:root {
  font-family: "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #181818;
  background: #fff;
  font-synthesis: none;
  --ink: #181818;
  --muted: #727272;
  --line: #e6e6e6;
  --soft: #f7f7f7;
  --accent: #2759d8;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.app-shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: #fff; }
.topbar { background: #fff; }
.topbar-inner { max-width: 1180px; min-height: 68px; margin: auto; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font: 700 12px var(--mono); letter-spacing: .04em; }
.brand-mark { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 3px; background: var(--ink); color: #fff; font: 700 13px var(--mono); letter-spacing: -.06em; }
.brand-word strong { font-weight: 400; color: var(--muted); }
.privacy-note { color: var(--muted); font-size: 12px; }
.privacy-note i { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: #38a172; vertical-align: 2px; }
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 28px 80px; }
.intro { padding: 22px 0 16px; }
.eyebrow, .panel small, .reverse-panel small, .playground small { color: var(--muted); font: 600 10px var(--mono); letter-spacing: .1em; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 21px; }
.eyebrow-line { width: 15px; height: 1px; background: var(--accent); }
.eyebrow-index { color: #a7a7a7; }
h1 { margin: 0; font-size: 24px; line-height: 1.25; letter-spacing: -.035em; font-weight: 650; }
.mode-tabs { display: inline-flex; max-width: 100%; gap: 3px; margin: 0 0 25px; padding: 4px; border-radius: 7px; background: #f3f3f3; }
.mode-tabs button { min-height: 36px; padding: 0 16px; border: 0; border-radius: 5px; background: transparent; color: #666; font-size: 12px; font-weight: 600; white-space: nowrap; }
.mode-tabs button:hover { color: var(--ink); }
.mode-tabs button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px #00000012; }
.title-arrow { color: var(--accent); font-weight: 400; }
.mobile-break { display: none; }
.intro-description { max-width: 620px; margin: 19px 0 0; color: #666; font-size: 14px; line-height: 1.8; }
.steps { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.steps li { display: grid; grid-template-columns: 25px 1fr; align-items: baseline; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.steps span { color: var(--accent); font: 600 10px var(--mono); }
.steps strong { font-size: 12px; font-weight: 600; }
.steps small { grid-column: 2; color: #8a8a8a; font-size: 11px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 42px; margin: 0 0 25px; }
.panel { min-width: 0; padding: 0; background: #fff; }
.panel + .panel { border: 0; }
.panel-heading { min-height: 38px; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-heading strong { font-size: 14px; font-weight: 650; }
.heading-main, .reverse-intro { display: flex; align-items: center; gap: 12px; min-width: 0; }
.panel-number { flex: 0 0 auto; color: var(--accent); font: 600 11px var(--mono); }
.panel h2, .reverse-panel h2, .playground h2 { margin: 3px 0 0; color: var(--ink); font-size: 19px; line-height: 1.3; letter-spacing: -.035em; font-weight: 650; }
.count-pill { flex: 0 0 auto; padding: 5px 8px; border-radius: 3px; color: #666; background: var(--soft); font: 600 11px var(--mono); }
.hint { min-height: 19px; margin: 14px 0 15px; color: #777; font-size: 12px; line-height: 1.6; }
.panel textarea, .reverse-content textarea, .playground-editor textarea { display: block; width: 100%; resize: vertical; border: 1px solid #d9d9d9; border-radius: 4px; background: #fff; color: var(--ink); font: 12px/1.75 var(--mono); tab-size: 2; }
.panel textarea { height: 240px; padding: 16px; }
textarea::placeholder, input::placeholder { color: #aaa; }
.panel textarea:hover, .test-row input:hover, .reverse-content textarea:hover, .playground-editor textarea:hover, .pattern-field:hover { border-color: #999; }
.actions, .reverse-actions, .playground-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.primary, .secondary, .ghost, .copy { min-height: 37px; border-radius: 4px; padding: 0 13px; font-size: 12px; font-weight: 600; transition: background .15s ease, border-color .15s ease; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: 20px; border: 1px solid var(--ink); background: var(--ink); color: #fff; }
.primary:hover { background: #333; border-color: #333; }
.primary span { color: #fff; font-size: 15px; }
.secondary, .copy { border: 1px solid #d5d5d5; background: #fff; color: var(--ink); white-space: nowrap; }
.secondary:hover, .copy:hover:not(:disabled) { border-color: #777; background: var(--soft); }
.ghost { border: 1px solid transparent; background: transparent; color: #666; }
.ghost:hover { color: var(--ink); background: var(--soft); }
.copy:disabled { opacity: .42; cursor: not-allowed; }
.summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 30px; margin-top: 9px; color: #888; font-size: 11px; }
.summary-item { padding: 4px 7px; border-radius: 3px; background: var(--soft); color: #555; }
.summary-item.valid { color: #246a44; background: #e8f5ed; }
.summary-item.duplicate { color: #925600; background: #fff1d6; }
.summary-item.invalid { color: #a93434; background: #fde9e9; }
.invalid-detail { flex-basis: 100%; padding: 6px 8px; border-radius: 3px; color: #a93434; background: #fff2f2; overflow-wrap: anywhere; }
.code-window { height: 240px; display: flex; flex-direction: column; border-radius: 4px; background: var(--soft); overflow: hidden; }
.code-bar { flex: 0 0 34px; display: flex; align-items: center; padding: 0 15px; border-bottom: 1px solid var(--line); color: #888; font: 600 10px var(--mono); letter-spacing: .08em; }
.code-dots { display: none; }
.regex-output { flex: 1; min-height: 0; margin: 0; padding: 16px; overflow: auto; color: #222; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.8 var(--mono); }
.test-box { margin-top: 20px; }
.test-title { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; font-weight: 600; }
.test-state { color: #888; font-weight: 500; }
.test-state.good { color: #28784f; }
.test-state.bad { color: #b44747; }
.test-row { display: flex; gap: 8px; margin-top: 10px; }
.test-row input { flex: 1; min-width: 0; min-height: 37px; padding: 0 11px; border: 1px solid #d9d9d9; border-radius: 4px; background: #fff; color: var(--ink); font: 12px var(--mono); }
.test-message { min-height: 15px; margin: 7px 0 0; color: #b44747; font-size: 11px; }
.reverse-panel { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 0; padding: 15px 18px; border-radius: 4px; background: var(--soft); }
.reverse-panel strong { font-size: 13px; font-weight: 650; }
.reverse-intro { align-items: flex-start; }
.reverse-panel p, .playground-heading p { margin: 6px 0 0; color: #777; font-size: 12px; line-height: 1.6; }
.reverse-content { padding: 0 0 16px; }
.reverse-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 42px; }
.reverse-result-head label, .reverse-content label, .playground-editor > label { display: block; margin-bottom: 10px; color: #333; font-size: 12px; font-weight: 600; }
.panel-heading label, .reverse-content .panel-heading label { margin: 0; color: var(--ink); font-size: 14px; font-weight: 650; }
.reverse-content textarea { height: 240px; padding: 16px; }
.manual-reverse { margin-top: 18px; }
.manual-reverse summary { width: fit-content; color: #666; font-size: 12px; cursor: pointer; }
.manual-reverse-body { padding-top: 18px; }
.reverse-actions select { min-height: 37px; padding: 0 8px; border: 1px solid #d9d9d9; border-radius: 4px; background: #fff; color: #555; font-size: 12px; }
.reverse-result-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.reverse-message { margin: 10px 0 0; color: #777; font-size: 11px; }
.reverse-message.good { color: #246a44; }
.reverse-message.bad { color: #a93434; }
.playground { margin: 0; padding-top: 0; }
.playground-heading { display: flex; justify-content: flex-end; align-items: center; gap: 20px; padding: 0 0 18px; }
.playground-heading h2 { margin: 0; }
.playground-heading p { max-width: 700px; }
.playground-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 42px; padding-top: 0; }
.playground-editor, .playground-results { min-width: 0; }
.pattern-field { display: flex; align-items: center; gap: 6px; height: 41px; padding: 0 11px; border: 1px solid #d9d9d9; border-radius: 4px; color: #888; font: 15px var(--mono); }
.pattern-field:focus-within { border-color: var(--accent); }
.pattern-field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font: 12px var(--mono); }
.pattern-field input:focus-visible { outline: 0; }
.playground-options { display: flex; flex-wrap: wrap; gap: 9px 17px; margin: 15px 0 22px; }
.playground-options label { display: inline-flex; align-items: center; gap: 5px; color: #555; font-size: 11px; cursor: pointer; }
.playground-options input { margin: 0; accent-color: var(--accent); }
.playground-options code { color: #888; font: 11px var(--mono); }
.playground-editor textarea { height: 255px; padding: 13px; }
.playground-actions span { margin-left: auto; color: #999; font-size: 10px; }
.playground-result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 31px; margin-bottom: 16px; }
.playground-result-head strong { font-size: 13px; font-weight: 650; }
.count-pill.error { max-width: 70%; color: #b44747; border-color: #edc9c9; white-space: normal; overflow-wrap: anywhere; line-height: 1.4; }
.count-pill.miss { color: #925600; background: #fff1d6; }
.highlight-preview { min-height: 255px; max-height: 350px; padding: 13px; overflow: auto; border-radius: 4px; background: var(--soft); color: #555; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.75 var(--mono); }
.highlight-preview mark { padding: 1px 0; background: #dce8ff; color: #153c9c; }
.match-results { margin-top: 20px; }
.match-results-head { display: flex; justify-content: space-between; color: #333; font-size: 12px; }
.match-results-head span { color: #888; }
.match-results ol { display: flex; flex-direction: column; gap: 6px; max-height: 200px; margin: 9px 0 0; padding: 0; overflow: auto; list-style: none; }
.match-results li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; padding: 9px 10px; border-radius: 4px; background: var(--soft); font-size: 11px; }
.match-results li > span { flex: 0 0 94px; color: #888; font-family: var(--mono); }
.match-results li code { min-width: 0; color: var(--ink); overflow-wrap: anywhere; font: 12px var(--mono); }
.match-results li small { flex: 1 0 100%; color: #777; letter-spacing: 0; font-weight: 400; overflow-wrap: anywhere; }
.match-results .empty-match { color: #999; }
.regex-reference { margin-top: 28px; padding: 0 14px; border-radius: 4px; background: var(--soft); }
.regex-reference summary { display: flex; align-items: center; gap: 10px; padding: 19px 0; color: #333; font-size: 12px; font-weight: 600; cursor: pointer; }
.regex-reference summary::before { content: '+'; color: var(--accent); font: 17px var(--mono); }
.regex-reference[open] summary::before { content: '−'; }
.regex-reference summary span { color: #999; font-size: 11px; font-weight: 400; }
.reference-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 20px; }
.reference-grid div { display: flex; align-items: center; gap: 10px; padding: 10px 0; color: #666; font-size: 11px; }
.reference-grid code { flex: 0 0 52px; color: #333; font: 600 12px var(--mono); }
footer { width: 100%; max-width: 1180px; margin: 0 auto; padding: 20px 28px 28px; display: flex; justify-content: space-between; gap: 14px; color: #999; font-size: 11px; }
footer span:first-child { color: #666; font-family: var(--mono); }
@media (max-width: 950px) {
  .intro { padding: 20px 0 16px; }
  .steps { display: grid; grid-template-columns: repeat(3, 1fr); }
  .steps li { padding-right: 12px; margin-right: 12px; }
  .workspace, .reverse-grid, .playground-grid { grid-template-columns: 1fr; }
  .workspace { gap: 30px; }
  .reverse-grid { gap: 30px; }
  .playground-grid { gap: 35px; }
}
@media (max-width: 640px) {
  .topbar-inner { min-height: 58px; padding: 0 17px; }
  .brand-mark { width: 28px; height: 28px; }
  .brand-word { font-size: 10px; }
  .privacy-note { font-size: 0; }
  .privacy-note i { width: 7px; height: 7px; margin: 0; }
  main { padding: 0 17px 55px; }
  .intro { padding: 20px 0 15px; }
  h1 { font-size: 22px; }
  .mode-tabs { display: flex; width: 100%; gap: 2px; margin-bottom: 22px; }
  .mode-tabs button { flex: 1; min-width: 0; padding: 0 6px; font-size: 11px; }
  .mobile-break { display: block; }
  .intro-description { font-size: 12px; }
  .steps li { grid-template-columns: 1fr; gap: 4px; }
  .steps small { display: none; }
  .workspace { margin-top: 0; }
  .panel { padding: 0; }
  .panel h2, .reverse-panel h2, .playground h2 { font-size: 18px; }
  .panel textarea, .code-window { height: 230px; }
  .actions .primary { flex: 1 0 100%; }
  .playground-heading { align-items: flex-end; }
  .reverse-grid, .reference-grid { grid-template-columns: 1fr; }
  .reverse-content textarea { height: 210px; }
  .playground { margin-top: 0; }
  .playground-grid { padding-top: 0; }
  .playground-actions span { margin-left: 0; flex: 1 0 100%; }
  footer { padding: 20px 17px; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .primary, .secondary, .ghost, .copy { transition: none; }
}
