:root {
  --ink: #211d18;
  --muted: #6f6252;
  --paper: #f5efe4;
  --card: #fffdf8;
  --line: #ded1bc;
  --brass: #a97e3f;
  --a: #a44a3f;
  --b: #b07a2a;
  --c: #4f7357;
  --danger: #9e3f35;
  --shadow: 0 18px 54px rgba(83, 61, 31, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% -10%, rgba(255,255,255,.95), transparent 34%),
    radial-gradient(circle at 96% 4%, rgba(232,216,190,.55), transparent 28%),
    var(--paper);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  line-height: 1.6;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, .serif { font-family: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif; }
a { color: var(--brass); }

body.landing-open { overflow: hidden; }

.landing {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,.98), transparent 42%),
    radial-gradient(circle at 84% 8%, rgba(239,226,205,.7), transparent 30%),
    var(--paper);
  transition: opacity .45s ease, visibility .45s ease;
}
.landing.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.landing-card {
  width: min(560px, 100%);
  text-align: center;
  animation: landing-rise .7s cubic-bezier(.2,.8,.2,1) both;
}
.landing-logo {
  display: block;
  width: min(300px, 60vw);
  height: auto;
  margin: 0 auto 8px;
  filter: drop-shadow(0 22px 32px rgba(68, 48, 26, .16));
}
.landing .eyebrow { margin-top: 4px; }
.landing h1 {
  margin: 8px 0 8px;
  font-size: clamp(38px, 6vw, 56px);
  line-height: 1.1;
  letter-spacing: .04em;
}
.landing-lede {
  margin: 0 auto 24px;
  max-width: 30ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
}
.start-button {
  min-width: 210px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fffaf0;
  padding: 14px 34px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .12em;
  box-shadow: 0 14px 34px rgba(34,31,26,.2);
  transition: background .15s, transform .15s, box-shadow .15s;
}
.start-button:hover {
  background: #3a3025;
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(34,31,26,.24);
}
.start-button:focus-visible {
  outline: 3px solid rgba(169,126,63,.4);
  outline-offset: 4px;
}
@keyframes landing-rise {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.page { width: min(1280px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 36px; }

.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 30px 34px;
  background: linear-gradient(135deg, rgba(255,253,248,.98), rgba(247,238,222,.9));
  box-shadow: var(--shadow);
}
.hero::after {
  content: "";
  position: absolute;
  width: 330px; height: 330px;
  border: 1px solid rgba(169,126,63,.18);
  border-radius: 50%;
  right: -110px; top: -170px;
}
.eyebrow { color: var(--brass); font-size: 10px; letter-spacing: .28em; text-transform: uppercase; font-weight: 700; }
.hero h1 { font-size: clamp(32px, 4vw, 44px); line-height: 1.22; margin: 12px 0 10px; letter-spacing: .01em; }
.lede { max-width: 720px; margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.9; }
.hero-side { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 130px; flex: 0 0 auto; }
.hero-logo {
  width: 128px;
  height: 128px;
  object-fit: contain;
  filter: drop-shadow(0 12px 20px rgba(68, 48, 26, .14));
}
.stamp {
  width: 104px; height: 104px; border-radius: 50%;
  border: 1px solid #baa27c;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #6d4e1f; background: rgba(255,250,240,.55);
  font-size: 9px; letter-spacing: .22em;
}
.stamp strong { font-family: Georgia, serif; font-size: 32px; line-height: 1; letter-spacing: 0; margin-top: 3px; }
.keys { display: flex; align-items: flex-start; height: 46px; }
.key { width: 15px; height: 45px; border: 1px solid #c9b99f; border-radius: 0 0 4px 4px; background: #fffdf8; }
.key.black { width: 10px; height: 29px; margin: 0 -5px; background: #2a251f; border-color: #2a251f; z-index: 2; }

.layout { display: grid; grid-template-columns: minmax(360px, 5.2fr) minmax(0, 6.8fr); gap: 42px; align-items: start; margin-top: 28px; }
.input-panel, .report-panel { min-width: 0; }
.section-label { margin: 8px 0 10px; color: var(--brass); font-size: 10px; letter-spacing: .22em; font-weight: 700; text-transform: uppercase; }
.section-label span { color: var(--ink); font-family: "Songti SC", "Noto Serif SC", Georgia, serif; font-size: 21px; letter-spacing: .02em; text-transform: none; margin-left: 8px; }
.section-note { color: var(--muted); font-size: 11px; line-height: 1.7; margin: -2px 0 14px; }

.form-card {
  background: rgba(255,253,248,.72);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 17px 18px;
  margin-bottom: 14px;
}
.form-card h2 { font-size: 18px; margin: 0 0 10px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.block-head h2 { margin: 0; }
.hint { color: #9a8a72; font-size: 10px; }
.text-button { border: 0; background: transparent; color: var(--brass); font-size: 12px; padding: 2px 0; }
.text-button:hover { color: #6d4e1f; text-decoration: underline; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.field > span, fieldset legend { color: #5f5344; font-size: 12px; font-weight: 600; }
.field.compact { margin-top: 12px; }
input[type="text"], input[type="date"], input[type="time"], input[type="number"], select, textarea {
  width: 100%;
  border: 1px solid #d8cab5;
  border-radius: 9px;
  background: #fffdf8;
  padding: 9px 11px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(169,126,63,.12); }
textarea { resize: vertical; line-height: 1.7; }
fieldset { border: 0; margin: 10px 0; padding: 0; }
.pain-fieldset { margin-top: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 7px; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span {
  display: inline-block;
  border: 1px solid #d8cab5;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11px;
  color: #6f6252;
  background: #fffdf8;
  transition: all .15s;
}
.chip-check input:checked + span { background: var(--ink); color: #fffaf0; border-color: var(--ink); }
.chip-check input:focus-visible + span { box-shadow: 0 0 0 3px rgba(169,126,63,.2); }

.table-wrap { overflow-x: auto; border: 1px solid #e2d6c2; border-radius: 10px; background: #fffdf8; }
.edit-table { width: 100%; border-collapse: collapse; min-width: 360px; }
.edit-table th, .edit-table td { padding: 6px 8px; border-bottom: 1px solid #eee2d1; text-align: left; vertical-align: middle; }
.edit-table th { background: #f7efe2; color: #7a6a54; font-size: 10px; font-weight: 600; letter-spacing: .04em; }
.edit-table tr:last-child td { border-bottom: 0; }
.edit-table input, .edit-table select { border: 0; background: transparent; padding: 5px 3px; border-radius: 5px; }
.edit-table input:focus, .edit-table select:focus { background: #f8f1e5; box-shadow: none; }
.pieces-table th:nth-child(1) { width: 54%; }
.pieces-table th:nth-child(2) { width: 30%; }
.pieces-table th:nth-child(3) { width: 34px; }
.energy-table th:nth-child(1) { width: 22%; }
.energy-table th:nth-child(2) { width: 26%; }
.energy-table th:nth-child(3) { width: 26%; }
.energy-table th:nth-child(4) { width: 26%; }
.energy-table td:first-child { color: #5f5344; font-size: 12px; white-space: nowrap; }
.icon-button { border: 0; background: transparent; color: #a89a86; font-size: 18px; line-height: 1; padding: 2px 4px; }
.icon-button:hover { color: var(--danger); }

.status { display: none; border-radius: 10px; padding: 9px 12px; margin: 10px 0; font-size: 12px; line-height: 1.7; }
.status.show { display: block; }
.status.error { background: #fbeae6; border: 1px solid #e4b9b0; color: #7f2f25; }
.status.info { background: #f4ead8; border: 1px solid #dcc7a4; color: #6d4e1f; }
.status ul { margin: 4px 0 0 17px; padding: 0; }

.primary-button {
  position: relative;
  width: 100%;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fffaf0;
  padding: 13px 20px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .04em;
  transition: background .15s, transform .15s;
}
.primary-button:hover { background: #3a3025; }
.primary-button:active { transform: translateY(1px); }
.primary-button:disabled { opacity: .72; cursor: wait; }
.spinner { display: none; width: 14px; height: 14px; border: 2px solid rgba(255,250,240,.35); border-top-color: #fffaf0; border-radius: 50%; margin-left: 9px; vertical-align: -2px; animation: spin .8s linear infinite; }
.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.fine-print { color: #9a8a72; font-size: 10.5px; line-height: 1.7; margin: 9px 2px 0; }

.empty-state {
  border: 1px dashed #cdbb9f;
  border-radius: 18px;
  background: rgba(255,253,248,.62);
  padding: 42px 26px;
  text-align: center;
}
.empty-big { font-family: "Songti SC", "Noto Serif SC", Georgia, serif; font-size: 27px; margin-bottom: 9px; }
.empty-state p { color: var(--muted); font-size: 12px; line-height: 1.9; max-width: 540px; margin: 0 auto; }
.steps { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.steps span { border: 1px solid var(--line); background: #fffaf0; border-radius: 999px; padding: 6px 11px; font-size: 10px; color: #74552b; }

.report-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  background: #221f1a;
  color: #f7f1e6;
  border-radius: 18px;
  padding: 20px 22px;
  margin-bottom: 4px;
  box-shadow: 0 12px 30px rgba(34,31,26,.15);
}
.report-head .eyebrow { color: #c7a66f; }
.report-head h2 { color: #fffaf0; font-size: 25px; line-height: 1.35; margin: 7px 0 6px; }
.report-head .meta { color: #c9bda9; font-size: 11px; line-height: 1.7; }
.badge { flex: 0 0 auto; border: 1px solid #7c6747; background: #b08d57; color: #1f1b16; border-radius: 999px; padding: 6px 11px; font-size: 10px; font-weight: 700; letter-spacing: .06em; }
.warning-box { border: 1px solid #d9b98a; background: #fbf0dd; color: #6d4e1f; border-radius: 10px; padding: 9px 12px; font-size: 11px; line-height: 1.7; margin: 10px 0; }

.module-head { display: flex; align-items: baseline; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin: 28px 0 13px; }
.module-head .num { color: var(--brass); font-family: Georgia, serif; font-size: 12px; letter-spacing: .18em; white-space: nowrap; }
.module-head .title { font-family: "Songti SC", "Noto Serif SC", Georgia, serif; font-size: 22px; }
.module-head .hint { margin-left: auto; color: #8a7b66; font-size: 10px; text-align: right; }

.diagnosis { background: linear-gradient(135deg, #fffdf8, #f6eddc); border: 1px solid var(--line); border-left: 4px solid var(--a); border-radius: 14px; padding: 22px 24px; }
.diagnosis .quote { font-family: "Songti SC", "Noto Serif SC", Georgia, serif; font-size: 21px; line-height: 1.7; margin: 0 0 13px; color: #1f1b16; }
.diag-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 13px; }
.diag-tag { background: #f1e4cc; color: #74552b; border-radius: 999px; padding: 4px 10px; font-size: 10px; letter-spacing: .05em; }
.evidence { color: #5f5344; font-size: 12.5px; line-height: 1.8; }
.evidence ul { margin: 5px 0 0 17px; padding: 0; }
.evidence li { margin: 2px 0; }
.success-line { margin-top: 11px; padding-top: 11px; border-top: 1px dashed #d8c9b1; font-size: 12.5px; color: #3b3329; }

.abc-card { --tone: var(--a); background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--tone); border-radius: 14px; padding: 15px 16px; box-shadow: 0 8px 22px rgba(83,61,31,.045); margin-bottom: 12px; }
.abc-card.a { --tone: var(--a); }
.abc-card.b { --tone: var(--b); }
.abc-card.c { --tone: var(--c); }
.abc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.abc-level { font-family: Georgia, serif; font-size: 29px; color: var(--tone); line-height: 1; }
.abc-label { color: #8a7b66; font-size: 9px; letter-spacing: .1em; text-align: right; }
.abc-goal { color: #5f5344; font-size: 11.5px; line-height: 1.7; margin: 7px 0 10px; }
.task { border-top: 1px dashed #e2d6c2; padding-top: 11px; margin-top: 11px; }
.task-line { display: flex; align-items: baseline; gap: 7px; }
.task-id { background: var(--tone); color: white; border-radius: 4px; padding: 2px 5px; font-size: 9px; font-weight: 700; }
.task-title { font-weight: 700; font-size: 12.5px; color: var(--ink); line-height: 1.45; }
.task-loc { color: #9a8a72; font-size: 9.5px; margin: 3px 0 5px; line-height: 1.5; }
.task-action { color: #3b3329; font-size: 11.5px; line-height: 1.72; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.task-meta span { background: #f5ebda; color: #74552b; border-radius: 4px; padding: 2px 6px; font-size: 9.5px; }
.task-success { color: #5f5344; font-size: 10.5px; line-height: 1.6; margin-top: 6px; }

.sched { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.golden { background: #f4ead8; border-left: 3px solid var(--brass); border-radius: 8px; padding: 10px 12px; color: #5f5344; font-size: 11.5px; line-height: 1.75; margin-bottom: 8px; }
.sched-day { display: grid; grid-template-columns: 102px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px dashed #e2d6c2; }
.sched-day:last-child { border-bottom: 0; }
.sched-day-name { font-family: "Songti SC", "Noto Serif SC", Georgia, serif; font-size: 18px; color: var(--ink); }
.sched-date { color: #9a8a72; font-size: 10px; margin-top: 2px; }
.sched-meta { color: #8a7b66; font-size: 10px; margin-top: 4px; }
.bar { display: flex; gap: 2px; height: 30px; border-radius: 7px; overflow: hidden; background: #f1e8d8; }
.seg { display: flex; align-items: center; justify-content: center; min-width: 30px; color: white; font-size: 9.5px; font-weight: 700; white-space: nowrap; overflow: hidden; }
.seg.A { background: var(--a); } .seg.B { background: var(--b); } .seg.C { background: var(--c); }
.sched-detail { color: #5f5344; font-size: 10.5px; line-height: 1.65; margin-top: 5px; }
.alloc { display: flex; flex-wrap: wrap; gap: 10px; border-top: 1px solid #e2d6c2; margin-top: 12px; padding-top: 12px; }
.alloc .item { color: #5f5344; font-size: 11px; }
.alloc .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.dot.a { background: var(--a); } .dot.b { background: var(--b); } .dot.c { background: var(--c); }
.rest-line { color: #8a7b66; font-size: 11px; margin-top: 9px; }

.pitfall { display: flex; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 9px; }
.pitfall .n { font-family: Georgia, serif; color: var(--a); font-size: 27px; line-height: 1; min-width: 25px; }
.pitfall .t { font-weight: 700; font-size: 13px; color: var(--ink); margin-bottom: 4px; }
.pitfall .d { color: #5f5344; font-size: 11.5px; line-height: 1.7; }
.pitfall .r { color: #9a8a72; font-size: 9.5px; margin-top: 5px; }

.report-actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 18px 0 4px; }
.action-button { border: 1px solid #cdbb9f; background: #fffaf0; border-radius: 999px; padding: 8px 14px; font-size: 11.5px; color: var(--ink); text-decoration: none; }
.action-button:hover { border-color: var(--brass); color: #6d4e1f; }
.saved-note { color: #9a8a72; font-size: 10px; margin-top: 5px; }
details.raw { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,253,248,.6); padding: 0 12px; }
details.raw summary { cursor: pointer; color: #74552b; font-size: 11px; padding: 10px 0; }
details.raw pre { max-height: 380px; overflow: auto; background: #f7efe2; border-radius: 8px; padding: 10px; font-size: 10px; }

.footer { display: flex; justify-content: space-between; gap: 14px; border-top: 1px solid var(--line); margin-top: 34px; padding-top: 14px; color: #9a8a72; font-size: 10px; }

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; gap: 26px; }
  .hero { align-items: flex-start; }
  .hero-side { display: none; }
}
@media (max-width: 640px) {
  .page { width: min(100% - 24px, 1280px); padding-top: 14px; }
  .landing { padding: 18px; }
  .landing-logo { width: min(230px, 62vw); }
  .landing h1 { font-size: 38px; }
  .landing-lede { font-size: 12.5px; }
  .start-button { min-width: 190px; padding: 13px 28px; }
  .hero { padding: 24px 20px; border-radius: 18px; }
  .hero h1 { font-size: 31px; }
  .lede { font-size: 12px; }
  .form-card { padding: 14px; }
  .report-head { flex-direction: column; }
  .module-head { align-items: flex-start; flex-direction: column; gap: 2px; }
  .module-head .hint { margin-left: 0; text-align: left; }
  .sched-day { grid-template-columns: 1fr; gap: 6px; }
  .diagnosis { padding: 18px; }
  .diagnosis .quote { font-size: 19px; }
}
