:root {
  --paper: #efe2cc;
  --card: #fffaf2;
  --ink: #241c16;
  --muted: #65584c;
  --cinnabar: #b4332a;
  --pine: #1d463f;
  --gold: #8d6840;
  --line: rgba(36, 28, 22, 0.14);
  --desk: #261e19;
  --cream: #f6efe4;
  --shadow: 0 16px 40px rgba(70, 42, 22, 0.08);
  --serif: "PMingLiU", "Songti TC", "MingLiU", "Source Han Serif TC", serif;
  --sans: "Segoe UI", "Microsoft JhengHei", "PingFang HK", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(circle at 8% -8%, rgba(180, 51, 42, 0.16), transparent 28%),
    linear-gradient(180deg, #f7f0e4 0%, var(--paper) 42%, #e7d4b6 100%);
  min-height: 100vh;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(36, 28, 22, 0.03) 1px, transparent 1px);
  background-size: 100% 28px;
  mask-image: linear-gradient(180deg, #000, transparent 80%);
}

.mast, .notice, .layout { position: relative; }
.mast {
  display: flex;
  gap: 22px;
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 22px 10px;
}
.seal {
  flex: 0 0 78px;
  width: 78px;
  height: 78px;
  border: 3px solid var(--cinnabar);
  border-radius: 50%;
  color: var(--cinnabar);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0.12em;
  transform: rotate(-8deg);
  box-shadow: inset 0 0 0 2px rgba(180, 51, 42, 0.35);
  background: rgba(255, 250, 242, 0.72);
}
.eyebrow {
  margin: 0 0 6px;
  color: var(--cinnabar);
  font-size: 13px;
  letter-spacing: 0.04em;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; }
h1 { margin: 0; font-size: clamp(34px, 4vw, 52px); letter-spacing: 0.04em; }
.lede { margin: 8px 0 0; max-width: 68ch; color: var(--muted); line-height: 1.7; }

.notice {
  max-width: 1180px;
  margin: 14px auto 0;
  padding: 12px 16px;
  border-left: 4px solid var(--cinnabar);
  background: rgba(255, 250, 242, 0.8);
  line-height: 1.65;
  color: #4a2a22;
}

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 22px 72px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.85fr);
  gap: 22px;
  align-items: start;
}

.panel {
  background: rgba(255, 250, 242, 0.86);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}
.step-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.step-head h2 { margin: 0; font-size: 26px; }
.step-head p { margin: 4px 0 0; color: var(--muted); line-height: 1.6; }
.step-no {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  background: var(--cinnabar);
  color: #fffaf2;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 18px;
}

.stack { display: grid; gap: 10px; }
.pick, .choice, .chip, .tab, .btn, .text-btn {
  font-family: inherit;
  cursor: pointer;
}
.pick {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  padding: 12px 14px;
  color: inherit;
}
.pick:hover, .choice:hover, .chip:hover { border-color: rgba(180, 51, 42, 0.45); }
.pick.is-on, .choice.is-on, .chip.is-on {
  border-color: var(--cinnabar);
  background: #fff4ee;
  box-shadow: inset 4px 0 0 var(--cinnabar);
}
.pick:focus-visible, .choice:focus-visible, .chip:focus-visible, .btn:focus-visible, .tab:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(180, 51, 42, 0.35);
  outline-offset: 2px;
}
.tag {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--cinnabar);
  font-size: 12px;
  letter-spacing: 0.08em;
}
.quote { margin: 0; font-family: var(--serif); font-size: 22px; line-height: 1.45; }
.quote.long { font-size: 18px; }
.meaning { margin: 6px 0 0; color: var(--muted); line-height: 1.55; }

.relic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.relic {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  overflow: hidden;
}
.relic.is-on { outline: 2px solid var(--cinnabar); }
.relic .pick {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding: 0 0 10px;
}
.relic .pick.is-on { background: #fff4ee; }
.thumb {
  height: 148px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(36, 28, 22, 0.04), rgba(36, 28, 22, 0.02)),
    #f3ecdf;
  border-bottom: 1px solid var(--line);
}
.thumb img { max-width: 92%; max-height: 132px; object-fit: contain; }
.relic-copy { padding: 10px 12px 0; }
.relic h3 { margin: 0; font-size: 18px; line-height: 1.4; }
.meta { margin: 4px 0 0; color: var(--gold); font-size: 13px; }
details { padding: 0 12px 12px; color: var(--muted); }
summary { cursor: pointer; color: var(--pine); }
details ul { margin: 8px 0 0; padding-left: 1.1em; line-height: 1.6; }

.field { display: grid; gap: 8px; margin-bottom: 16px; }
.field > span, .file-box legend { font-weight: 650; }
.field em, .hint, .filename, .copy-note { font-style: normal; color: var(--muted); font-weight: 400; }
textarea, input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: inherit;
}
textarea.invalid { border-color: var(--cinnabar); background: #fff8f6; }
.chips, .choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .choice {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  color: inherit;
}
.choice { border-radius: 12px; text-align: left; }
.choice small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }

.file-box {
  border: 1px dashed rgba(36, 28, 22, 0.25);
  border-radius: 14px;
  padding: 12px;
}
.file-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.file-box label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.check-line { display: flex; align-items: center; gap: 8px; margin: 10px 0; color: var(--ink); }
.filename {
  margin: 0;
  padding: 8px 10px;
  background: #fff;
  border-radius: 8px;
  font-family: var(--serif);
  color: var(--ink);
}

.desk {
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 28px);
  overflow: auto;
  background: var(--desk);
  color: var(--cream);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 18px 50px rgba(30, 18, 10, 0.28);
}
.desk-kicker { margin: 0; letter-spacing: 0.14em; color: #e7b08a; font-size: 12px; }
.desk h2 { margin: 2px 0 8px; font-size: 30px; }
.status {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 248, 240, 0.08);
  line-height: 1.55;
}
.status.ready { background: rgba(120, 168, 132, 0.18); }
.status.wait { background: rgba(180, 51, 42, 0.2); }
.map {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 4px 8px;
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 248, 240, 0.06);
  font-size: 14px;
  line-height: 1.5;
}
.map b { color: #e7b08a; font-weight: 600; }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab {
  border: 0;
  background: transparent;
  color: rgba(246, 239, 228, 0.72);
  border-bottom: 2px solid transparent;
  padding: 8px 8px 6px;
}
.tab.is-on { color: var(--cream); border-color: #e7b08a; }
.tab-panel { display: none; }
.tab-panel.is-on { display: block; }
.prompt-box {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid rgba(246, 239, 228, 0.16);
  background: #1b1512;
  color: #f6efe4;
  padding: 12px;
  line-height: 1.65;
  font-family: var(--sans);
  font-size: 14.5px;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn {
  border: 0;
  background: #f0d7bf;
  color: #2a1c14;
  border-radius: 999px;
  padding: 9px 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn.ghost { background: transparent; color: var(--cream); border: 1px solid rgba(246, 239, 228, 0.35); }
.hint { line-height: 1.6; font-size: 13px; }
.desk a { color: #f0d7bf; }
.steps { margin: 0 0 12px; padding-left: 1.2em; line-height: 1.65; }
.checks { list-style: none; padding: 0; margin: 12px 0 0; }
.checks li { margin: 6px 0; }
.checks label { display: flex; gap: 8px; align-items: flex-start; line-height: 1.45; }
.text-btn {
  justify-self: start;
  border: 0;
  background: transparent;
  color: var(--pine);
  padding: 0;
  text-decoration: underline;
}
.copy-note { min-height: 1.2em; margin: 10px 0 0; }
.to-desk { display: none; margin: 4px 0 0; text-align: right; }
.to-desk a {
  color: #fffaf2;
  background: var(--cinnabar);
  text-decoration: none;
  border-radius: 999px;
  padding: 8px 14px;
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .desk { position: static; max-height: none; }
  .relic-grid, .file-grid { grid-template-columns: 1fr; }
  .mast { align-items: flex-start; }
  .to-desk { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
