:root {
    color-scheme: light;
    --ink: #142734;
    --muted: #4f6670;
    --line: #dbe8e7;
    --dark: #102d35;
    --page: #f2f7f6;
    --surface: #fff;
    --teal: #085d50;
    --teal-light: #ebf7f3;
    --note: #80502a;
    --danger: #a12d33;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    line-height: 1.55;
    background: var(--page);
    color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 17.5rem; }
:focus-visible { outline: 3px solid #1183a4; outline-offset: 3px; }
button, input { font: inherit; min-width: 0; }
button { cursor: pointer; }
button:disabled, input:disabled { cursor: default; opacity: .6; }
h1, h2, h3, p, dl, ul { margin: 0; }
.frame { max-width: 69rem; width: calc(100% - clamp(2rem, 8vw, 6rem)); margin-inline: auto; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner, .brand, .panel-head, .result-head, .button-row, .entry, .new-entry {
    display: flex; align-items: center; gap: .75rem;
}
.topbar-inner { min-height: 4.25rem; justify-content: space-between; }
.brand strong { font-size: 1.25rem; letter-spacing: .04em; }
.brand-mark { width: 2.35rem; height: 2.35rem; border-radius: .65rem; display: grid; place-items: center; background: var(--teal); color: white; }
.separator { border-left: 1px solid var(--line); height: 1.3rem; }
.brand-label, .top-link { font-size: .875rem; color: var(--muted); }
.top-link { text-decoration: none; padding: .45rem .68rem; border: 1px solid var(--line); border-radius: .5rem; white-space: nowrap; }
.top-link:hover { background: var(--teal-light); color: var(--teal); }
main.frame { padding: clamp(2rem, 6vw, 4.75rem) 0 2.25rem; }
.page-title { margin-bottom: 1.75rem; }
.kicker { color: var(--teal); font-size: .875rem; font-weight: 750; letter-spacing: .15em; }
.page-title h1 { margin: .22rem 0 .65rem; font-size: clamp(2rem, 5.35vw, 3.3rem); line-height: 1.17; letter-spacing: -.04em; }
.page-title p { color: var(--muted); }
.workspace { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(16rem, 1fr); align-items: start; gap: 1.15rem; }
.card-panel, .help-panel { border-radius: 1rem; padding: clamp(1.1rem, 3.2vw, 2rem); }
.card-panel { background: var(--surface); border: 1px solid var(--line); box-shadow: 0 8px 24px #13372c08; }
.panel-head { gap: .85rem; margin-bottom: 1.4rem; }
.panel-head h2, .help-panel h2, dialog h2 { font-size: 1.35rem; line-height: 1.3; }
.panel-head p, .input-hint { font-size: .875rem; color: var(--muted); }
.panel-head p { margin-top: .25rem; }
.panel-icon { flex: 0 0 3rem; height: 3rem; border-radius: .7rem; background: var(--teal-light); color: var(--teal); display: grid; place-items: center; }
label { display: block; font-size: .9rem; font-weight: 690; margin-bottom: .42rem; }
.entry { gap: .5rem; }
.entry input, .new-entry input { flex: 1; padding: .7rem .85rem; min-height: 2.75rem; border: 1px solid #afc7c7; border-radius: .58rem; background: #fcfefe; color: var(--ink); }
.entry input[type=text], .new-entry input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.entry input::placeholder { font: .9rem ui-monospace, SFMono-Regular, Consolas, monospace; color: #556c76; }
.input-hint { margin-top: .45rem; }
.button-row { flex-wrap: wrap; margin-top: 1rem; }
.primary-button, .secondary-button, .quiet-button { border-radius: .58rem; padding: .55rem .9rem; min-height: 2.65rem; font-weight: 680; }
.primary-button { border: 1px solid var(--teal); background: var(--teal); color: #fff; }
.primary-button:hover:not(:disabled) { background: #064d42; }
.secondary-button { background: var(--teal-light); border: 1px solid #b2dace; color: var(--teal); }
.secondary-button:hover:not(:disabled) { background: #dcf1ea; }
.quiet-button { background: #fff; border: 1px solid #c9dddd; color: var(--muted); }
.quiet-button:hover:not(:disabled) { background: var(--page); color: var(--ink); }
.visibility, #copy { flex: 0 0 auto; white-space: nowrap; }
.feedback { margin-top: 1rem; color: var(--muted); font-size: .9rem; }
.feedback[data-kind=error] { color: var(--danger); }
.feedback[data-kind=success] { color: var(--teal); }
.challenge { display: grid; justify-items: start; gap: .6rem; margin-top: .85rem; }
.result { border-top: 1px solid var(--line); margin-top: 1.25rem; padding-top: 1.05rem; }
.result-head { justify-content: space-between; margin-bottom: .72rem; flex-wrap: wrap; }
.result-head h3 { font-size: 1.05rem; }
.status-badge { color: var(--teal); background: var(--teal-light); border: 1px solid #c5e3da; border-radius: 4rem; padding: .2rem .6rem; font-weight: 700; font-size: .875rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.2rem, 1fr)); gap: .58rem; }
.stats div { padding: .65rem .75rem; border-radius: .55rem; background: var(--page); min-width: 0; }
.stats dt { font-size: .875rem; color: var(--muted); }
.stats dd { font-weight: 750; margin: .15rem 0 0; }
.replacement-rule { display: flex; align-items: center; justify-content: space-between; gap: .7rem; flex-wrap: wrap; margin-top: 1rem; }
.replacement-rule p, .new-card p { font-size: .9rem; }
.replacement-rule p { color: var(--muted); }
.new-card { border: 1px solid #b2dace; background: var(--teal-light); border-radius: .6rem; margin-top: 1rem; padding: .85rem; }
.new-entry { margin-top: .65rem; gap: .45rem; flex-wrap: wrap; }
.new-entry input { min-width: 13.6rem; }
.copy-feedback { min-height: 1rem; }
.help-panel { position: relative; overflow: hidden; isolation: isolate; background: var(--dark); color: #e8f6f4; }
.help-decoration { position: absolute; inset: 0; z-index: -1; background: radial-gradient(ellipse at 114% -5%, #1b655b 0%, transparent 57%); pointer-events: none; }
.inverse { color: #6ce0bd; }
.help-panel h2 { margin-top: .4rem; color: #fff; }
.help-panel ul { list-style: none; padding-left: 0; margin-top: .82rem; }
.help-panel li { position: relative; padding-left: 1.45rem; margin-bottom: .55rem; font-size: .9375rem; }
.help-panel li::before { content: "✓"; color: #77dfc0; position: absolute; inset-inline-start: 0; font-weight: 800; }
.help-note { font-size: .875rem; padding-top: .9rem; margin-top: 1rem; border-top: 1px solid #42616a; color: #d2e4e4; }
.footer { border-top: 1px solid var(--line); padding: 1rem 0 1.4rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .4rem .8rem; color: var(--muted); font-size: .875rem; }
dialog { color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: .85rem; width: min(calc(100% - 2rem), 29rem); padding: 1.45rem; box-shadow: 0 16px 40px #102d3530; }
dialog p { margin-top: .52rem; color: var(--muted); }
dialog::backdrop { background: #102d3580; }
.confirm-actions { justify-content: flex-end; }
@media (max-width: 46rem) {
    .workspace { grid-template-columns: minmax(0, 1fr); }
    .topbar-inner { min-height: 3.75rem; }
    .brand, .topbar-inner { gap: .5rem; }
    .brand strong { font-size: 1.08rem; }
    .brand-mark { width: 2rem; height: 2rem; }
    .brand-mark svg { width: 1.18rem; height: 1.18rem; }
    .brand-label, .separator { display: none; }
}
