:root {
  color-scheme: light;
  font-family: "DM Sans", "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  color: #152b36;
  background: #f2f6f7;
  --ink: #152b36;
  --muted: #455e6b;
  --line: #d5e0e4;
  --paper: #fff;
  --action: #075d58;
  --teal: #61d5bf;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.shell { width: min(100% - 2rem, 65rem); margin-inline: auto; }
.masthead { background: #102630; color: #eff9fa; }
.masthead-inner { min-height: 4.5rem; display: flex; align-items: center; gap: .7rem; }
.mark { width: 2.35rem; height: 2.35rem; flex: none; display: flex; align-items: end; justify-content: center; gap: .17rem; padding-bottom: .65rem; border: 1px solid #496b73; border-radius: .65rem; }
.mark span { width: .23rem; height: .5rem; border-radius: .15rem; background: var(--teal); }
.mark span:nth-child(2) { height: .75rem; }
.mark span:nth-child(3) { height: 1rem; }
.identity { display: grid; gap: .04rem; flex: 1; }
.identity strong { letter-spacing: .025em; }
.identity > span { color: #bdd1d8; font-size: .8rem; }
.offline { font-size: .78rem; color: #d1e4eb; text-align: end; }
.offline[data-ready] { color: var(--teal); }
.intro { padding-block: clamp(1.6rem, 5vw, 3.1rem) 1.3rem; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -.05em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.06rem; }
.intro p { color: var(--muted); margin-top: .45rem; line-height: 1.6; }
.database { display: flex; gap: .7rem; align-items: flex-start; padding: .8rem 1rem; margin-bottom: 1rem; background: #e7f3f1; border: 1px solid #c7e2dd; border-left: 4px solid #177c6c; border-radius: .75rem; overflow-wrap: anywhere; }
.database[data-review] { background: #fff5e4; border-color: #ecd3a3; border-left-color: #a46a1c; }
.database p { color: var(--muted); font-size: .88rem; line-height: 1.6; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 1rem; }
.input-panel { padding: clamp(1rem, 3vw, 1.45rem); }
.panel-top, .results-top, .view-tools { display: flex; gap: .65rem 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.panel-top { margin-bottom: .65rem; }
.tools, .input-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
button, select { background: white; color: var(--ink); min-height: 2.75rem; padding: .5rem .78rem; border: 1px solid #c2d2d8; border-radius: .6rem; font: inherit; font-size: .9rem; font-weight: 650; cursor: pointer; }
button:hover, select:hover { background: #eaf2f3; }
button:disabled { opacity: .65; cursor: wait; }
.primary { background: var(--action); border-color: var(--action); color: white; padding-inline: 1.15rem; }
.primary:hover { background: #064a46; }
.quiet { border-color: transparent; color: var(--action); }
.install { background: transparent; color: white; border-color: #6b8b91; }
.install:hover { background: #24434e; }
:focus-visible { outline: 3px solid #177c6c; outline-offset: 3px; }
.masthead :focus-visible { outline-color: var(--teal); }
textarea { resize: vertical; display: block; width: 100%; min-height: 9.5rem; margin-bottom: .8rem; padding: .8rem; background: #f8fafb; border: 1px solid #c2d2d8; border-radius: .65rem; color: var(--ink); line-height: 1.53; font-family: "IBM Plex Mono", Consolas, monospace; font-size: 1rem; }
.remember { display: inline-flex; gap: .35rem; align-items: center; min-height: 2.75rem; padding: .2rem .3rem; color: var(--muted); font-size: .9rem; cursor: pointer; }
.remember input { width: 1.05rem; height: 1.05rem; accent-color: var(--action); }
.input-note, .history-body, #summary, #result-note { color: var(--muted); font-size: .88rem; line-height: 1.5; }
.input-note { margin-top: .45rem; overflow-wrap: anywhere; }
.history { margin-top: .75rem; }
.history > summary { cursor: pointer; min-height: 2.75rem; padding: .65rem 1rem; font-weight: 650; }
.count { margin-left: .35rem; color: var(--muted); font-size: .8rem; }
.history-body { padding: 0 1rem .8rem; }
.history-row { display: flex; gap: .5rem; margin-bottom: .4rem; }
#results { margin-top: 1.85rem; }
.results-top { margin-bottom: .75rem; align-items: flex-start; }
.results-top h2 { font-size: 1.55rem; margin-bottom: .25rem; }
.view-tools { justify-content: flex-start; gap: .45rem .65rem; margin: .7rem 0 1rem; }
.view-tools label { font-size: .9rem; font-weight: 650; }
select { appearance: none; padding-right: 2rem; background-image: linear-gradient(45deg, transparent 50%, #325863 50%), linear-gradient(135deg, #325863 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.report-result { margin-bottom: 1rem; overflow: hidden; }
.report-head { padding: .8rem 1rem; background: #e7eef1; }
.report-head p, .empty, .diagnostics { font-size: .86rem; color: var(--muted); margin-top: .3rem; line-height: 1.5; }
.diagnostics { padding: 0 1rem 0 2rem; color: #634215; }
.empty { padding: 1rem; }
.word { display: grid; gap: .55rem; padding: .75rem 1rem 1rem; }
.word + .word { border-top: 1px solid var(--line); }
.word > h4 { font-family: "IBM Plex Mono", Consolas, monospace; letter-spacing: .04em; }
.engine-grid { display: grid; gap: .6rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.engine { min-width: 0; padding: .75rem; border-radius: .65rem; border: 1px solid var(--line); background: #f9fbfb; }
.engine-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .35rem; margin-bottom: .55rem; }
.tag { color: var(--muted); font-size: .8rem; }
.state { padding: .18rem .42rem; border-radius: .28rem; font-size: .8rem; font-weight: 650; background: #eaf0f2; color: #36515b; }
.state[data-state="review"], .state[data-state="partial"] { background: #fff0d3; color: #68420b; }
.state[data-state="matched"] { background: #dcedea; color: #06554c; }
.engine p, .engine ul, .engine dl { line-height: 1.5; overflow-wrap: anywhere; }
.engine p, .engine ul, .origin { font-size: .88rem; }
.this-data { display: grid; gap: .12rem; }
.engine code { font-family: "IBM Plex Mono", Consolas, monospace; font-size: .92rem; }
.engine ul { padding-left: 1.2rem; margin: .45rem 0 .2rem; color: #694615; }
.engine .origin { color: var(--muted); margin-top: .45rem; }
.fault { border-top: 1px solid var(--line); margin-top: .65rem; padding-top: .5rem; }
.fault summary { cursor: pointer; padding: .3rem 0; font-size: .96rem; font-weight: 700; overflow-wrap: anywhere; white-space: pre-wrap; }
.fault dl { display: grid; grid-template-columns: minmax(4.5rem, 1fr) minmax(0, 1.5fr); gap: .28rem .65rem; font-size: .86rem; margin: .5rem 0 0; }
.fault dt { color: var(--muted); white-space: pre-wrap; }
.fault dd { margin: 0; white-space: pre-wrap; }
footer { padding: 1.25rem 0 2.4rem; font-size: .8rem; color: var(--muted); }
footer span { margin-inline: .13rem; }
#print-output { display: none; }
@media (max-width: 38rem) {
  .engine-grid { grid-template-columns: 1fr; }
}
@media (max-width: 25rem) {
  .shell { width: calc(100% - 1.3rem); }
  .word { padding-inline: .7rem; }
}
@media print {
  :root { background: white; color: black; }
  body > header, main > :not(#print-output) { display: none !important; }
  .shell { width: 100%; margin: 0; }
  #print-output { display: block; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 10pt/1.45 "Segoe UI", sans-serif; }
}
