:root {
  color-scheme: light;
  --ink: #202b25;
  --muted: #4f5b52;
  --green: #214f40;
  --green-dark: #153d31;
  --sage: #eaf0e8;
  --paper: #f5f1e8;
  --card: #fffdf8;
  --border: #d9d4c7;
  --red: #9c432d;
  --serif: "Noto Serif CJK SC", "Songti SC", SimSun, serif;
  font-family: system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 18px;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.6; }
button, input, select { font: inherit; }
button, summary { cursor: pointer; }
a { color: var(--green-dark); text-underline-offset: .2em; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
p { margin: .45rem 0; }
h1, h2, h3 { line-height: 1.18; margin: 0; }
h1 { font: 800 clamp(2.65rem, 8vw, 4.5rem)/1 var(--serif); letter-spacing: .08em; }
h2 { font-size: clamp(1.48rem, 5vw, 2rem); }
h3 { font-size: 1.18rem; margin: .9rem 0 .4rem; }
.shell { width: min(880px, calc(100% - 2rem)); margin: auto; }
.masthead { border-top: .35rem solid var(--green); border-bottom: 1px solid var(--border); }
.masthead-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.5rem 0 1.35rem; }
.eyebrow { color: var(--green); font-size: .84rem; font-weight: 750; letter-spacing: .13em; margin: 0 0 .4rem; }
.eyebrow span { display: inline-block; width: .6rem; height: 2px; background: var(--red); vertical-align: middle; margin-right: .25rem; }
.intro { color: var(--muted); margin: .55rem 0 0; }
.seal { flex: none; color: var(--red); border: 3px double currentColor; padding: .43rem; font: 750 1.15rem/1.2 var(--serif); letter-spacing: .1em; border-radius: 5px; transform: rotate(4deg); }
.panel { padding: clamp(1rem, 4vw, 1.75rem); margin: 1rem 0; border: 1px solid var(--border); border-radius: 1rem; background: var(--card); }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.form-row { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: .85rem; }
.form-row label { flex: 1 1 12rem; min-width: 0; }
label { display: block; font-weight: 700; }
input, select { display: block; width: 100%; min-width: 0; min-height: 3rem; padding: .55rem .7rem; margin-top: .25rem; color: var(--ink); border: 1px solid #9eaa9f; border-radius: .55rem; background: #fff; }
input::placeholder { color: #656c64; opacity: 1; }
.heading-line { display: flex; justify-content: space-between; align-items: start; gap: .55rem; }
.name-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .62rem; max-width: 23rem; text-align: center; margin: .9rem 0; }
input.character {
  aspect-ratio: 1;
  padding: 0;
  text-align: center;
  font: 740 clamp(1.7rem, 8vw, 3.1rem)/1 var(--serif);
  border-color: #b69683;
  border-radius: .4rem;
  background:
    repeating-linear-gradient(90deg, #c6a696 0 4px, transparent 4px 8px) center / 100% 1px no-repeat,
    repeating-linear-gradient(0deg, #c6a696 0 4px, transparent 4px 8px) center / 1px 100% no-repeat,
    #fdf7ef;
}
.character-cell { position: relative; display: block; }
.character-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  display: none;
  transform: translate(-50%, -50%);
  pointer-events: none;
  color: #613e31;
  background: #f5e6d7;
  border-radius: .25rem;
  padding: .15rem .2rem;
  font-size: .72rem;
  font-weight: 750;
  line-height: 1.3;
  white-space: nowrap;
}
.character:placeholder-shown + .character-hint { display: block; }
details { border-top: 1px solid var(--border); padding: .2rem 0 .55rem; }
summary { min-height: 2.75rem; padding: .6rem 0; font-weight: 760; color: var(--green-dark); }
.preferences { margin-bottom: .55rem; }
.preferences .form-row { margin-top: 0; }
button { min-height: 2.8rem; padding: .48rem .85rem; border: 1px solid transparent; border-radius: .55rem; font-weight: 750; }
button:disabled { opacity: .57; cursor: default; }
.primary { background: var(--green); color: #fff; min-width: min(15rem, 100%); }
.primary:hover:not(:disabled) { background: var(--green-dark); }
.secondary { color: var(--green-dark); background: var(--sage); border-color: #abbeb2; }
.secondary:hover:not(:disabled) { background: #dce9dc; }
.text-button { color: var(--green-dark); background: transparent; text-decoration: underline; text-underline-offset: .2em; }
.actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .8rem; }
.feedback:empty { display: none; }
.feedback { color: var(--muted); margin: .6rem 0 0; }
.error { color: #8d2f20; }
.name-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); list-style: none; gap: .6rem; padding: 0; margin: .8rem 0 0; }
.name-list:empty { display: none; }
.candidate { width: 100%; min-height: 5rem; padding: .65rem .7rem; text-align: left; border: 1px solid var(--border); background: #fff; color: var(--ink); }
.candidate:hover { border-color: var(--green); background: var(--sage); }
.candidate-top { display: flex; justify-content: space-between; align-items: center; gap: .35rem; }
.candidate-name { font: 800 1.45rem/1.35 var(--serif); }
.candidate-source { display: block; color: var(--muted); font-weight: 500; font-size: .86rem; overflow-wrap: anywhere; }
.candidate-note { display: block; margin-top: .26rem; color: var(--green-dark); font-weight: 600; font-size: .92rem; overflow-wrap: anywhere; }
.score-tag { color: var(--green-dark); background: var(--sage); padding: .12rem .42rem; border-radius: .35rem; flex: none; }
.rank { margin-right: .4rem; color: var(--red); font: 750 .78rem system-ui, sans-serif; }
.report { scroll-margin-top: .7rem; }
.report-top { display: flex; justify-content: space-between; align-items: center; gap: .55rem; padding: 0 0 .8rem; }
.report-name { font: 800 clamp(1.9rem, 7vw, 3rem)/1.22 var(--serif); }
.score-large { flex: none; border-radius: .75rem; padding: .5rem .85rem; background: var(--sage); color: var(--green-dark); text-align: center; }
.score-large strong { display: block; font-size: 1.85rem; line-height: 1.1; }
.callout { background: var(--sage); color: var(--green-dark); border-radius: .55rem; padding: .65rem .8rem; margin: .65rem 0; overflow-wrap: anywhere; }
.preference-row { margin: .45rem 0; border-radius: .45rem; padding: .45rem .65rem; overflow-wrap: anywhere; }
.check-pass { background: #e9f3e9; color: #154633; border-left: 4px solid #438064; }
.check-violation { background: #fbece8; color: #7c2b1e; border-left: 4px solid #ab4e3c; }
.check-unknown { background: #f3f0e8; color: #4f514a; border-left: 4px solid #8a897d; }
.facts { list-style: none; padding: 0; margin: .3rem 0 .6rem; }
.facts > li { padding: .45rem 0; border-bottom: 1px solid #e8e3d9; overflow-wrap: anywhere; }
.facts > li:last-child { border: 0; }
.table-scroll { overflow-x: auto; margin: .4rem 0 .65rem; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .93rem; }
th, td { padding: .38rem .42rem; border-bottom: 1px solid var(--border); }
th { background: var(--sage); }
blockquote { margin: .55rem 0 .25rem; padding: .45rem .65rem; border-left: 3px solid #a26852; background: #faf3e8; white-space: pre-wrap; overflow-wrap: anywhere; }
mark { background: #f5dfc7; color: #722d21; font-weight: 800; }
footer { padding: .4rem 0 1rem; color: var(--muted); font-size: .85rem; }
@media (max-width: 580px) {
  .shell { width: calc(100% - 1.15rem); }
  .masthead-inner { padding: .9rem .35rem 1rem; }
  .form-row { gap: .5rem; }
  .form-row label { flex-basis: 10rem; }
  .primary { width: 100%; }
  .name-list { grid-template-columns: 1fr; }
  .seal { font-size: .92rem; }
}
@media print {
  body { background: #fff; color: #000; }
  .shell { width: 100%; }
  .masthead, #name-form, .recommendations, footer, #report button { display: none; }
  #report { margin: 0; border: none; padding: 0; }
  table, blockquote, .report-top { break-inside: avoid; }
}
