.regex-page{
  display:grid;
  gap:16px;
}

.regex-hero{
  border:1px solid var(--border);
  border-radius:16px;
  background:linear-gradient(130deg, rgba(11,95,255,.10), rgba(11,95,255,.04) 36%, transparent 70%), var(--surface);
  box-shadow:var(--shadow2);
  padding:18px;
}

.regex-hero h1{ margin:0; font-size:clamp(28px,3.2vw,40px); }
.regex-hero p{ margin:8px 0 0; color:var(--muted); max-width:74ch; }

.regex-top-grid{
  display:grid;
  grid-template-columns: 1.05fr .95fr;
  gap:12px;
}

.regex-card{
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--surface);
  box-shadow:var(--shadow2);
  padding:12px;
  display:grid;
  gap:10px;
}

.regex-field{ display:grid; gap:6px; }
.regex-field label{ font-size:12px; color:var(--muted); font-weight:700; }

.regex-field input[type="text"],
.regex-field textarea,
.regex-field select{
  width:100%;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--surface2);
  color:var(--text);
  padding:10px;
  font:inherit;
}

.regex-field textarea{ min-height:180px; resize:vertical; }

.regex-flag-row{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.regex-flag-chip{
  display:inline-flex;
  align-items:center;
  gap:6px;
  border:1px solid var(--border);
  border-radius:999px;
  background:var(--surface2);
  padding:6px 10px;
  font-size:12px;
  color:var(--muted);
}

.regex-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.regex-status{
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--surface2);
  color:var(--muted);
  font-size:13px;
  padding:10px;
}

.regex-status.error{
  border-color:rgba(185,28,28,.3);
  color:#b91c1c;
  background:rgba(185,28,28,.06);
}

.regex-status.ok{
  border-color:rgba(4,120,87,.35);
  color:#065f46;
  background:rgba(16,185,129,.08);
}

.regex-highlight{
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--surface2);
  min-height:220px;
  max-height:420px;
  overflow:auto;
  padding:10px;
  white-space:pre-wrap;
  word-break:break-word;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  line-height:1.5;
}

.regex-highlight mark{
  background:rgba(11,95,255,.14);
  border:1px solid rgba(11,95,255,.35);
  border-radius:4px;
  padding:0 1px;
}

.regex-highlight mark.is-active{
  background:rgba(245,158,11,.22);
  border-color:rgba(245,158,11,.6);
}

.regex-match-list{
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--surface2);
  max-height:220px;
  overflow:auto;
  padding:8px;
  display:grid;
  gap:6px;
}

.regex-match-item{
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--surface);
  padding:7px 8px;
  text-align:left;
  font:inherit;
  color:inherit;
  cursor:pointer;
}

.regex-match-item.is-active{
  border-color:rgba(11,95,255,.4);
  box-shadow:0 0 0 3px var(--focus);
}

.regex-mid-grid{
  display:grid;
  gap:12px;
  grid-template-columns:1fr 1fr;
}

.regex-group-table,
.regex-save-list{
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--surface2);
  padding:8px;
  max-height:240px;
  overflow:auto;
  display:grid;
  gap:6px;
}

.regex-row{
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--surface);
  padding:8px;
  font-size:13px;
  word-break:break-word;
}

.regex-replace-out{
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--surface2);
  min-height:140px;
  max-height:240px;
  overflow:auto;
  padding:10px;
  white-space:pre-wrap;
  word-break:break-word;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}

.regex-note{
  margin:0;
  color:var(--muted);
  font-size:12px;
}

.regex-token-list{
  display:grid;
  gap:6px;
}

.regex-token-item{
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--surface2);
  padding:8px;
  font-size:13px;
}

@media (max-width: 980px){
  .regex-top-grid,
  .regex-mid-grid{ grid-template-columns:1fr; }
}
