:root {
  --bg: #f3ecdf;
  --ink: #1c1915;
  --muted: #6d655c;
  --card: #fffdf8;
  --line: #e4d9c8;
  --apricot: #f6e2b8;
  --apricot-line: #e2c48a;
  --seal: #c23b2e;
  --shadow: 0 16px 40px rgba(60, 42, 20, 0.08);
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  background-color: var(--bg);
  background-image: radial-gradient(#e3d5c0 1.1px, transparent 1.1px);
  background-size: 18px 18px;
}
a { color: inherit; }
button, a { font-family: inherit; }

.stage {
  width: min(480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.eyebrow { margin: 8px 0 12px; }
.sticker {
  display: inline-block;
  padding: 4px 8px;
  background: #1c1915;
  color: #fffdf8;
  font-size: 12px;
  letter-spacing: 0.08em;
  transform: rotate(-2deg);
}
.sticker-sm { transform: none; }

h1 {
  margin: 0 0 14px;
  font-size: 44px;
  line-height: 1.12;
  font-weight: 900;
  letter-spacing: -0.03em;
}
.lead { margin: 0 0 22px; font-size: 16px; line-height: 1.65; color: var(--muted); }
.fine { margin: 14px 0 0; font-size: 12px; line-height: 1.6; color: var(--muted); }
.tested { margin: 0 0 6px; font-size: 15px; }
.tested strong { font-size: 22px; font-weight: 700; }
.library { margin: 0 0 18px; font-size: 14px; color: var(--muted); }
.library strong, .library time { color: var(--ink); font-weight: 700; }
.basis { margin-top: 28px; }
.basis h2 { margin: 0 0 8px; font-size: 16px; font-weight: 800; }
.basis p, .basis li { margin: 0; font-size: 13px; line-height: 1.65; color: var(--muted); }
.basis ol { margin: 8px 0 0; padding-left: 1.2em; }
.basis li { margin-top: 6px; }
.basis cite { font-style: italic; }
.report .basis h2 { margin-top: 8px; font-size: 16px; }
.report .basis p, .report .basis li { font-size: 13px; color: var(--muted); }

.btn-primary {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fffdf8;
  text-align: center;
  text-decoration: none;
  font-size: 17px;
  font-weight: 700;
  padding: 16px 20px;
  cursor: pointer;
}
.btn-primary:active { transform: translateY(1px); }

.preview { margin-top: 36px; }
.preview-kicker {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.12em;
}

.shot {
  background: var(--card);
  border-radius: 28px;
  padding: 22px 20px 18px;
  box-shadow: var(--shadow);
}
.shot-top { display: flex; gap: 14px; align-items: flex-start; }
.seal {
  flex: 0 0 auto;
  width: 76px;
  height: 58px;
  border: 2px solid var(--seal);
  color: var(--seal);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  transform: rotate(-8deg);
}
.shot-kicker { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.shot-name { margin: 0; font-size: 40px; font-weight: 900; line-height: 1.1; letter-spacing: -0.03em; }
.shot-sub { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.quote {
  margin: 16px 0 0;
  padding: 10px 12px;
  border: 1px dashed #d9c7a4;
  border-radius: 12px;
  font-size: 16px;
}
.shot-line { margin: 12px 0 0; font-size: 15px; line-height: 1.65; }
.shot-foot { margin: 14px 0 0; font-size: 12px; color: var(--muted); }
.score { margin: 14px 0 8px; font-size: 14px; color: var(--muted); }
.score strong { color: var(--ink); font-size: 28px; font-weight: 900; margin-left: 4px; }

.bars { list-style: none; margin: 8px 0 0; padding: 0; }
.bars li { display: grid; grid-template-columns: 4.6em 1fr 2.8em; gap: 8px; align-items: center; margin-top: 8px; font-size: 13px; }
.bars em { font-style: normal; text-align: right; color: var(--muted); }
.bars i { display: block; height: 8px; background: #f3eadb; border-radius: 99px; overflow: hidden; }
.bars b { display: block; height: 100%; background: #1c1915; border-radius: 99px; }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.back, .text-btn, .text-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  padding: 8px 0;
}
.qcard {
  background: var(--card);
  border-radius: 28px;
  min-height: 420px;
  padding: 22px 18px 18px;
  box-shadow: var(--shadow);
}
.progress-num { margin: 0; font-size: 28px; font-weight: 900; }
.bar { height: 6px; background: #f0e6d6; border-radius: 99px; margin: 10px 0 18px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: #e2a23a; border-radius: 99px; }
.qcard h2 { margin: 0; font-size: 22px; line-height: 1.45; font-weight: 800; }
.role { min-height: 44px; margin: 8px 0 16px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: #f6f1e8;
  color: var(--ink);
  border-radius: 16px;
  padding: 14px 14px;
  font-size: 15px;
  line-height: 1.5;
  cursor: pointer;
}
.opt b { font-weight: 800; margin-right: 8px; }
.opt.picked {
  background: var(--apricot);
  border-color: var(--apricot-line);
}
.qnav { display: flex; justify-content: space-between; margin-top: 8px; }
.is-hidden { visibility: hidden; }
.again { margin-top: 10px; }
.neighbors em { flex: 0 0 auto; font-style: normal; margin-left: 0; font-weight: 700; font-size: 16px; color: var(--ink); }
.error { color: var(--seal); font-size: 14px; }

.mask {
  position: fixed;
  inset: 0;
  background: rgba(243, 236, 223, 0.92);
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
}
.mask[hidden] { display: none; }

.report h2 { margin: 28px 0 8px; font-size: 22px; }
.report h3 { margin: 22px 0 8px; font-size: 16px; }
.star { color: #c23b2e; }
.report p { margin: 0 0 8px; font-size: 15px; line-height: 1.7; }
.portrait { color: var(--ink); }
.ask { margin-top: 18px !important; font-weight: 800; }
.neighbors { list-style: none; margin: 0; padding: 0; }
.neighbors li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.neighbors .near-main { min-width: 0; }
.neighbors strong { display: block; font-size: 16px; }
.neighbors span { color: var(--muted); font-size: 13px; }
.report .btn-primary { margin-top: 18px; }
.report .fine { margin-top: 36px; }
.copied { color: #2f6b45; font-weight: 700; }
.text-link { display: inline-block; margin-top: 12px; }

@media (min-width: 960px) {
  body.page-home, body.page-quiz { background-color: #efe4d2; }
  body.page-result .stage {
    width: min(1040px, calc(100% - 64px));
  }
  .result-grid {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 28px;
    align-items: start;
  }
  .card-col { position: sticky; top: 24px; align-self: start; }
  .result-grid .shot { position: static; }
  .report { padding-top: 8px; }
  .report h2 { margin-top: 0; }
}

.code-input, .note, .num, .date, select, .code-box {
  width: 100%;
  border: 0;
  background: var(--card);
  color: var(--ink);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 16px;
  font-family: inherit;
  box-shadow: var(--shadow);
}
.code-input { letter-spacing: 0.04em; margin-bottom: 12px; }
.form-error { color: var(--seal); font-size: 14px; margin: 0 0 10px; }
body.page-admin .stage { width: min(880px, calc(100% - 32px)); }
body.page-admin h1 { font-size: 32px; }
.panel { margin: 0 0 16px; }
.code-box { min-height: 96px; resize: vertical; }
.create-row, .filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.create-row .note, .filter .note { width: min(280px, 100%); }
.num { width: 88px; }
.date { width: 168px; }
select { width: auto; }
.btn-inline { width: auto; padding-inline: 22px; }
.home-links { margin-top: 28px; }
.home-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 14px 16px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  text-decoration: none;
  font-weight: 700;
}
.home-link::after { content: "›"; color: var(--muted); font-weight: 400; }
.link-url { width: min(360px, 100%); }
.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.link-row .fine { display: block; word-break: break-all; }
.table-wrap { overflow-x: auto; background: var(--card); border-radius: 18px; box-shadow: var(--shadow); }
.cards { width: 100%; border-collapse: collapse; }
.cards th, .cards td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
.cards a { font-weight: 700; }
.answer-list { padding-left: 18px; }
.answer-list li { margin-bottom: 14px; }
.answer-list p { margin: 0 0 4px; }
.share-btn { margin-top: 14px; }
.copy-code { margin-left: 8px; }
.confirm {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 21, 0.46);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 20;
}
.confirm[hidden] { display: none; }
.confirm-card {
  width: min(420px, 100%);
  background: var(--card);
  border-radius: 24px;
  padding: 22px 20px 16px;
}
.confirm-card h2 { margin: 0 0 8px; font-size: 24px; }
.confirm-card p { margin: 0 0 16px; line-height: 1.6; color: var(--muted); }
.confirm-card .text-btn { display: block; width: 100%; margin-top: 6px; }
.confirm-card img { width: 100%; border-radius: 16px; display: block; margin-bottom: 12px; }
.confirm-card .btn-primary { margin-bottom: 4px; }
