/* The Wool Road. Parlor paper, pasture subject. Cozy Alpaca Studio. */
:root {
  --cream: #f7f1e8;
  --cream-deep: #efe4d4;
  --ink: #3d3429;
  --soft: #6e5a45;
  --faint: #a89886;
  --accent: #c4785a;
  --accent-ink: #fffaf3;
  --panel: #fffaf3;
  --line: #e4d5c4;
  --shadow: rgba(61, 52, 41, 0.12);
  --moss: #3f6b48;
  --focus: #c4785a;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 50% -10%, #fffaf3 0%, transparent 55%),
    linear-gradient(165deg, #f3eadf 0%, #e7d9c8 48%, #ddd0c0 100%);
}

html, body { overflow-x: hidden; }

.app {
  width: min(44rem, calc(100% - 1.5rem));
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 1.25rem 0 2.5rem;
}

.top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.coin {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 8px var(--shadow);
}

.titles h1 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.tagline {
  margin: 0.12rem 0 0;
  color: var(--soft);
  font-size: 0.86rem;
}

.top-actions { display: flex; gap: 0.4rem; }

.btn {
  appearance: none;
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  box-shadow: 0 1px 3px var(--shadow);
}

.btn:hover { filter: brightness(1.02); }

.btn:focus-visible,
.choice:focus-visible,
.offer:focus-visible,
.icon-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn-quiet { font-size: 0.82rem; font-weight: 650; }

.btn-fill {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
  border-color: transparent;
}

.btn-fill:hover { filter: brightness(1.05); }

.btn-text {
  background: transparent;
  box-shadow: none;
  color: var(--soft);
  padding-left: 0;
  padding-right: 0;
  font-size: 0.86rem;
}

.foot {
  margin: 1.25rem 0 0;
  text-align: center;
  color: var(--faint);
  font-size: 0.78rem;
}

.loading { color: var(--soft); }

.lede {
  font-size: 1.08rem;
  margin: 0 0 1rem;
}

.paper {
  background: var(--panel);
  border-radius: 16px;
  box-shadow: 0 10px 28px var(--shadow);
  padding: 1.05rem 1.15rem 1.15rem;
  border-top: 4px solid #c4a574;
  position: relative;
}

.paper::before {
  content: "";
  position: absolute;
  top: 0.55rem;
  right: 0.7rem;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #8d3b3b;
  box-shadow: inset 0 0 0 1px rgba(61, 52, 41, 0.25);
}

.kicker {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.paper h2 {
  margin: 0 0 0.55rem;
  padding-right: 1rem;
  font-size: 1.35rem;
  font-weight: 650;
  line-height: 1.2;
}

#scene-title:focus { outline: none; }

.paper p { margin: 0 0 0.75rem; }

.paper p:last-child { margin-bottom: 0; }

.roster {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin: 0.25rem 0 1rem;
}

.who, .member {
  background: var(--panel);
  border-radius: 14px;
  padding: 0.55rem 0.4rem 0.7rem;
  text-align: center;
  box-shadow: 0 4px 14px var(--shadow);
}

.who h2, .member h3 {
  margin: 0.2rem 0 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.role, .status {
  display: block;
  color: var(--soft);
  font-size: 0.75rem;
}

.who p {
  margin: 0.35rem 0.15rem 0;
  color: var(--soft);
  font-size: 0.75rem;
  line-height: 1.35;
}

.portrait {
  width: 4.6rem;
  height: 5.1rem;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  background: radial-gradient(circle at 50% 42%, #fff 0%, #f3ebe0 72%);
  border-radius: 2.2rem;
}

.ribbon {
  display: block;
  width: 1.8rem;
  height: 0.38rem;
  margin: -0.15rem auto 0.15rem;
  border-radius: 99px;
}

.actions, .choices, .offers { display: grid; gap: 0.55rem; margin-top: 0.85rem; }

.choice, .offer {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: #fffdf9;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.72rem 0.85rem 0.68rem;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(61, 52, 41, 0.03);
}

.choice:hover, .offer:hover { border-color: var(--accent); background: #fff7f2; }

.choice[disabled], .offer[disabled] {
  cursor: not-allowed;
  opacity: 0.62;
  background: #f7f1e8;
}

.choice[disabled]:hover, .offer[disabled]:hover { border-color: var(--line); }

.choice-label, .offer-name {
  display: block;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.choice-prose, .offer-note { display: block; color: var(--soft); font-size: 0.92rem; }

.choice-math, .offer-pay {
  display: block;
  margin-top: 0.28rem;
  color: var(--ink);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.map {
  display: flex;
  gap: 0.15rem;
  overflow-x: auto;
  max-width: 100%;
  padding: 0.15rem 0 0.55rem;
  margin-bottom: 0.7rem;
  position: relative;
}

.stop {
  position: relative;
  flex: 1 0 2.7rem;
  min-width: 0;
  text-align: center;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 650;
}

.stop::before {
  content: "";
  display: block;
  width: 0.55rem;
  height: 0.55rem;
  margin: 0 auto 0.28rem;
  border-radius: 50%;
  background: #e4d5c4;
  box-shadow: 0 0 0 3px #f3eadf;
  position: relative;
  z-index: 1;
}

.stop.done { color: var(--ink); }
.stop.done::before { background: var(--ink); }
.stop.now { color: var(--accent); }
.stop.now::before { background: var(--accent); transform: scale(1.15); }

.party {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}

.member { padding: 0.4rem 0.25rem 0.5rem; }

.member .portrait { width: 3.5rem; height: 3.9rem; }

.pips { display: flex; gap: 0.18rem; justify-content: center; margin-top: 0.28rem; }

.pip {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: #e4d5c4;
}

.pip.on { background: var(--accent); }

.member.sitting { outline: 1px dashed var(--accent); }
.member.stayed { opacity: 0.72; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.chip {
  background: var(--panel);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  box-shadow: 0 1px 3px var(--shadow);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

.chip b { font-weight: 700; }

.fleece {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.bar {
  width: 4.2rem;
  height: 0.42rem;
  border-radius: 99px;
  background:
    linear-gradient(90deg, transparent 69%, var(--accent) 69%, var(--accent) 71%, transparent 71%),
    #efe4d6;
  overflow: hidden;
  position: relative;
}

.bar > span {
  display: block;
  height: 100%;
  background: var(--moss);
  border-radius: 99px;
}

.bar.low > span { background: var(--accent); }
.bar.mid > span { background: #b0893e; }

.log {
  margin-top: 0.85rem;
  color: var(--soft);
  font-size: 0.88rem;
}

.log summary { cursor: pointer; font-weight: 650; color: var(--ink); }
.log ol { margin: 0.4rem 0 0; padding-left: 1.15rem; }
.log li { margin: 0.15rem 0; }

.ending-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.3rem 0 0.8rem;
}

.fairings { display: grid; gap: 0.4rem; margin-top: 0.8rem; }

.fairing {
  background: #fffdf9;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
}

.fairing strong { display: block; font-size: 0.92rem; }
.fairing span { color: var(--soft); font-size: 0.8rem; }
.fairing.earned { border-color: #e7c3b6; background: #fff7f2; }
.fairing .new {
  display: inline-block;
  margin-left: 0.35rem;
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

dialog {
  width: min(34rem, calc(100% - 1.5rem));
  border: none;
  border-radius: 16px;
  padding: 1.2rem 1.3rem 1.15rem;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 18px 50px rgba(61, 52, 41, 0.28);
}

dialog::backdrop { background: rgba(61, 52, 41, 0.38); }

dialog h2 { margin: 0 0 0.5rem; font-size: 1.25rem; }
dialog p, dialog li { font-size: 0.95rem; }
dialog ul { margin: 0.4rem 0 0.7rem; padding-left: 1.15rem; }
dialog li { margin: 0.2rem 0; }
.how-keys { color: var(--soft); font-size: 0.85rem; }
dialog form { margin: 0.8rem 0 0; }

@container book (max-width: 36rem) {
  .roster, .party { grid-template-columns: repeat(2, 1fr); }
  .titles h1 { font-size: 1.3rem; }
  .top {
    grid-template-columns: auto 1fr;
    grid-template-areas: "coin titles" "actions actions";
  }
  .coin { grid-area: coin; }
  .titles { grid-area: titles; }
  .top-actions { grid-area: actions; justify-content: flex-start; }
  .portrait { width: 4.2rem; height: 4.6rem; }
  .stop { flex-basis: 0; font-size: 0.58rem; letter-spacing: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .stop.now::before { transform: none; }
}
