/* Build 5, first version (11/18). One file, split into sections. Each agent writes only inside its own section.
   Palette and window look follow notes/mockups/build5-ui/ui.css. Order of sections is the cascade order. */

/* === base (T0) === */
:root {
  --ink: #3b2f6b; --ink-soft: #6a5f9a; --cream: #fff7ec; --lav: #ece7ff; --lav-line: #cfc5f3;
  --yellow: #ffd56a; --yellow-line: #e2a93f; --pink: #f7a6b4; --teal: #2fb8a6;
  --ok: #ddf7e4; --warn: #ffe1c7; --bad: #e8505b; --night: #2b2450;
  --gap: 22px; --win-w: 340px; --info-w: 330px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--night); }
body { font-family: "Zen Kaku Gothic New", sans-serif; color: var(--ink); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.stage { position: relative; width: 100vw; height: 100vh; overflow: hidden; }
.map-area { position: absolute; inset: 0; }
.map-area > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* the floating window look */
.win {
  position: absolute; z-index: 10; background: var(--cream); border: 3px solid var(--ink); border-radius: 22px;
  box-shadow: 0 5px 0 rgba(43, 32, 90, .35), 0 14px 32px rgba(30, 18, 70, .28);
}
/* the frame positions (mockup 01, 1440×900). Top left info, top right picture story, bottom right choices. */
.win.info { left: var(--gap); top: var(--gap); width: var(--info-w); min-height: 120px; padding: 12px 14px; }
.win.story { right: var(--gap); top: var(--gap); width: var(--win-w); min-height: 120px; padding: 10px; }
.win.choices { right: var(--gap); bottom: var(--gap); width: var(--win-w); min-height: 120px; padding: 14px; }
/* the place window (mockup 10) sits left of the right-hand windows */
.win.place { right: calc(var(--gap) * 2 + var(--win-w)); top: var(--gap); width: var(--win-w); max-height: calc(100% - var(--gap) * 2); overflow: auto; padding: 14px; }
/* full-screen layers over everything, in this stacking order */
.layer { position: absolute; inset: 0; z-index: 20; }
#layer-opening { z-index: 40; }
#layer-zukan, #layer-owned { z-index: 30; }

.placeholder { font-size: 15px; font-weight: 700; color: var(--ink-soft); }

/* === opening (B1) === */
#layer-opening.op { overflow: hidden; background: var(--night); }
.op-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.op-screen { position: absolute; inset: 0; overflow: auto; }
.op .win { position: absolute; }
.op button { font-family: "Zen Kaku Gothic New", sans-serif; }
.op button:focus-visible, .op .op-input:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
.op .op-q:focus { outline: none; }
.op .op-step { display: flex; gap: 6px; align-items: center; font-size: 16px; font-weight: 700; color: var(--ink-soft); }
.op .op-step b { width: 26px; height: 8px; border-radius: 4px; background: var(--lav-line); }
.op .op-step b.on { background: var(--ink); }
.op .op-foot { display: flex; align-items: center; gap: 18px; margin-top: auto; padding-top: 16px; }
/* the confirm row stays pinned to the bottom of whatever scrolls (the window on desktop, the screen on phones) */
.op .op-foot { position: sticky; bottom: 0; z-index: 3; background: var(--cream); padding-bottom: 2px; }
.op .op-keys { font-size: 14px; font-weight: 700; color: var(--ink-soft); line-height: 1.5; margin-top: 4px; }
/* buttons sit in the middle, under what the player just touched (designer, eyes stay near the centre) */
.op .op-footrow { display: flex; align-items: center; justify-content: center; gap: 18px; }
.op .op-footc { flex-direction: column; justify-content: center; gap: 10px; }
.op-q .op-foot, .op-dish .op-foot { margin-top: 20px; }
.op .op-pickline { font-size: 16px; font-weight: 700; color: var(--ink-soft); text-align: center; line-height: 1.5; min-height: 1.5em; }
.op .op-pickline.msg { color: var(--ink); }
.op-namefoot { margin-top: 18px; justify-content: flex-start; }
.op .op-go { margin-left: 0; height: 58px; padding: 0 34px; border-radius: 29px; font-size: 22px; font-weight: 900; white-space: nowrap;
  background: var(--yellow); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--yellow-line); }
.op .op-go:disabled { opacity: .45; cursor: default; }
.op .op-back { height: 46px; padding: 0 20px; border-radius: 23px; font-size: 17px; font-weight: 700; white-space: nowrap;
  background: #fff; border: 2px solid var(--lav-line); color: var(--ink-soft); }

/* title (mockup 00) */
.op-veil { position: absolute; left: 0; top: 0; width: 100%; height: 40%; background: linear-gradient(rgba(60, 34, 100, .55), rgba(60, 34, 100, 0)); pointer-events: none; }
.op-ttl { position: absolute; left: 0; right: 0; top: 6vh; text-align: center; color: #fff;
  text-shadow: 0 4px 0 rgba(60, 34, 100, .55), 0 10px 30px rgba(40, 20, 80, .45); }
.op-ttl h1 { font-size: min(132px, 13vh, 17vw); font-weight: 900; letter-spacing: .08em; padding-left: .08em; line-height: 1.1; white-space: nowrap; }
.op-ttl .op-en { font-size: min(30px, 3.4vh, 4.6vw); font-weight: 700; letter-spacing: .32em; padding-left: .32em; margin-top: 4px; white-space: nowrap; }
.op-ttl .op-sub { display: inline-block; font-size: 18px; font-weight: 700; margin-top: 18px; color: var(--ink); background: var(--cream);
  border: 3px solid var(--ink); border-radius: 18px; padding: 3px 18px 5px; text-shadow: none; letter-spacing: .06em; }
.op-titlebtns { position: absolute; left: 0; right: 0; bottom: 7vh; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.op-start { height: 84px; padding: 0 74px; border-radius: 42px; font-size: 38px; font-weight: 900; letter-spacing: .18em; white-space: nowrap;
  background: var(--yellow); border: 4px solid var(--ink); box-shadow: 0 7px 0 var(--yellow-line), 0 18px 34px rgba(30, 18, 70, .35); }
.op-start::after { content: "▶"; font-size: 24px; margin-left: 16px; letter-spacing: 0; }
.op-cont { height: 50px; padding: 0 36px; border-radius: 25px; font-size: 20px; font-weight: 900; letter-spacing: .1em;
  background: var(--cream); border: 3px solid var(--ink); box-shadow: 0 4px 0 rgba(43, 32, 90, .35); }
.op-corner { position: absolute; right: 26px; bottom: 22px; font-size: 14px; font-weight: 700; color: #fff; opacity: .85; text-shadow: 0 2px 6px rgba(40, 20, 80, .6); }

/* the questions (mockup 09). Left the question, right the alien */
.op-q { left: 50%; transform: translateX(-50%); width: min(920px, calc(100% - 88px)); top: 44px; max-height: calc(100% - 88px); padding: 30px 36px 28px; display: flex; flex-direction: column; overflow: auto; }
.op-q .op-open { font-size: 30px; font-weight: 900; margin-top: 16px; }
.op-q .op-qtext { font-size: 24px; font-weight: 700; color: var(--ink-soft); margin-top: 6px; line-height: 1.4; }
.op-opts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 24px; }
.op-opts.n8 { grid-template-columns: repeat(4, 1fr); }
.op-opt { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 110px; padding: 14px 10px;
  background: #fff; border: 3px solid var(--lav-line); border-radius: 22px; text-align: center; }
.op-opts.n8 .op-opt { min-height: 150px; }
.op-opt:hover { border-color: var(--ink-soft); }
.op-opt .op-ic { font-size: 44px; line-height: 1; }
.op-opts.n8 .op-opt .op-ic { font-size: 56px; }
.op-opt .op-tx { font-size: 21px; font-weight: 900; line-height: 1.3; }
.op-opt .op-num { position: absolute; left: 10px; top: 8px; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.op-opt.on, .op-card.on { border-color: var(--ink); border-width: 4px; background: #fff7d6; box-shadow: 0 5px 0 var(--yellow-line); }
.op-opt.on::after, .op-card.on::after { content: "✓"; position: absolute; right: -12px; top: -12px; width: 38px; height: 38px; border-radius: 50%;
  background: var(--yellow); border: 3px solid var(--ink); font-size: 22px; font-weight: 900; display: flex; align-items: center; justify-content: center; }

/* the result card */
.op-res { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(1100px, calc(100% - 88px)); max-height: calc(100% - 88px); overflow: auto;
  padding: 30px 36px 28px; display: flex; gap: 36px; }
.op-resL { flex: 0 0 300px; display: flex; align-items: center; justify-content: center; background: linear-gradient(#f39cb8, #ffd2a0 58%, #8b83c1 58%); border: 3px solid var(--ink); border-radius: 24px; padding: 30px 20px 20px; }
.op-resfig svg, .op-namefig svg { width: 220px; height: 275px; display: block; }
.op-resR { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.op-reshead { font-size: 34px; font-weight: 900; margin-top: 4px; }
.op-res.op-ask { flex-direction: column; align-items: center; gap: 18px; width: min(560px, calc(100% - 88px)); text-align: center; }
.op-ask .op-resL { flex: none; width: 100%; padding: 26px 20px 18px; }
.op-ask .op-resfig svg { width: 240px; height: 300px; }
.op-ask .op-reshead { font-size: 32px; margin: 0; }
.op-ask .op-foot { width: 100%; justify-content: center; margin-top: 0; }
.op-ask .op-go { margin-left: 0; min-width: 160px; }
.op-pairshead { font-size: 17px; font-weight: 900; color: var(--ink-soft); margin-top: 18px; }
.op-pairs { list-style: none; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.op-pairs li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 18px; font-weight: 700; background: var(--lav); border-radius: 14px; padding: 7px 14px; }
.op-pairs .op-arrow { color: var(--ink-soft); }
.op-pairs .op-pb { font-weight: 900; }

/* the name */
.op-name { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(900px, calc(100% - 88px)); max-height: calc(100% - 88px); overflow: auto;
  padding: 30px 36px 28px; display: flex; gap: 36px; }
.op-nameL { flex: 0 0 280px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: linear-gradient(#f39cb8, #ffd2a0 62%, #8b83c1 62%); border: 3px solid var(--ink); border-radius: 24px; padding: 24px 16px; }
.op-nametag { max-width: 100%; font-size: 20px; font-weight: 900; background: #fffaf0; border: 2px solid var(--ink); border-radius: 18px; padding: 4px 16px 6px;
  overflow-wrap: anywhere; text-align: center; }
.op-nameR { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.op-namehead { font-size: 34px; font-weight: 900; margin-top: 12px; }
.op-namesub { font-size: 17px; font-weight: 700; color: var(--ink-soft); margin-top: 6px; line-height: 1.6; }
.op-label { font-size: 16px; font-weight: 900; color: var(--ink-soft); margin-top: 24px; }
.op-inrow { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.op-input { flex: 1; min-width: 0; height: 64px; padding: 0 20px; font: 900 28px "Zen Kaku Gothic New", sans-serif; color: var(--ink);
  background: #fff; border: 3px solid var(--ink); border-radius: 18px; }
.op-count { font-size: 16px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
.op-max { font-size: 14px; font-weight: 700; color: var(--ink-soft); margin-top: 6px; }

/* the first dish (mockup 09b) */
.op-dish { left: 30px; right: 30px; top: 30px; max-height: calc(100% - 60px); padding: 24px 34px 18px; display: flex; flex-direction: column; overflow: auto; }
.op-dishhead { font-size: 32px; font-weight: 900; margin: 8px 0 4px; }
.op-dishsub { font-size: 18px; font-weight: 700; color: var(--ink-soft); line-height: 1.6; }
.op-group { margin-top: 14px; }
.op-grouphead { display: flex; align-items: baseline; gap: 12px; font-size: 17px; font-weight: 900; color: var(--ink); }
.op-grouphead small { font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.op-group.combo .op-grouphead { color: var(--ink-soft); }
.op-cards { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; margin-top: 6px; }
.op-card { position: relative; min-height: 0; padding: 28px 6px 10px; display: flex; flex-direction: column; align-items: center;
  background: #fff; border: 3px solid var(--lav-line); border-radius: 22px; text-align: center; }
.op-card .op-pic { width: 100%; max-width: 160px; aspect-ratio: 240 / 128; }
.op-card .op-pic svg { width: 100%; height: 100%; display: block; }
.op-card .op-cname { font-size: 16px; font-weight: 900; margin-top: 2px; line-height: 1.25; white-space: nowrap; max-width: 100%; letter-spacing: -.02em; }
.op-card .op-mat { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }
.op-card .op-mat { gap: 2px; margin-top: 4px; }
.op-card .op-mat span { font-size: 12px; font-weight: 700; background: #eef8e6; border: 1.5px solid #bfe3b0; border-radius: 10px; padding: 0 5px 1px; white-space: nowrap; }
.op-card .op-mat i { font-size: 11px; }
.op-card .op-mat i { font-style: normal; font-weight: 900; color: var(--ink-soft); align-self: center; }
.op-card .op-goes { font-size: 14px; font-weight: 700; color: var(--ink-soft); margin-top: 6px; }
.op-badge { position: absolute; left: 8px; top: 7px; font-size: 12px; font-weight: 900; border-radius: 11px; padding: 2px 10px 3px; }
.op-badge.ok { background: var(--teal); color: #fff; }
.op-badge.soon { background: #fff; color: var(--ink-soft); border: 2px dashed var(--lav-line); padding: 0 9px 1px; }
.op-card.soon { background: #faf7ff; cursor: default; }
.op-card.soon .op-pic { opacity: .78; }
.op-card.nudge { animation: op-nudge .35s; }
@keyframes op-nudge { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.op-hint { font-size: 15px; font-weight: 700; color: var(--ink-soft); line-height: 1.6; margin-top: 4px; }
.op-hint .op-soonmsg { color: var(--ink); }

/* shorter laptop screens */
@media (max-height: 820px) and (min-width: 701px) {
  .op-opts.n8 .op-opt { min-height: 118px; }
  .op-opts.n8 .op-opt .op-ic { font-size: 44px; }
  .op-card .op-pic { max-width: 104px; }
  .op-dish .op-step { display: none; }
  .op-dishhead { font-size: 26px; margin-top: 0; }
  .op-dishsub { font-size: 14px; line-height: 1.5; }
  .op-hint { font-size: 13px; margin-top: 0; }
  .op-group { margin-top: 8px; }
  .op-card { padding-top: 24px; padding-bottom: 7px; }
  .op .op-pickline { font-size: 14px; }
  .op-dish .op-go { height: 50px; }
}
@media (max-width: 1100px) { .op-cards { grid-template-columns: repeat(4, 1fr); } }
/* phones and narrow windows: one column, the layer scrolls */
@media (max-width: 700px) {
  .op .op-screen > .win { position: relative; left: auto; right: auto; top: auto; bottom: auto; transform: none; width: auto; max-height: none; min-height: 0; margin: 12px; overflow: visible; }
  .op-ttl { top: 9vh; }
  .op-start { height: 70px; padding: 0 48px; font-size: 30px; }
  .op-corner { left: 16px; right: 16px; bottom: 12px; text-align: center; font-size: 12px; }
  .op-titlebtns { bottom: 9vh; }
  .op-q { padding: 18px 16px 16px; }
  .op-q .op-open { font-size: 22px; margin-top: 10px; }
  .op-q .op-qtext { font-size: 18px; }
  .op-opts, .op-opts.n8 { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
  .op-opt, .op-opts.n8 .op-opt { min-height: 86px; padding: 10px 6px; gap: 4px; }
  .op-opt .op-ic, .op-opts.n8 .op-opt .op-ic { font-size: 34px; }
  .op-opt .op-tx { font-size: 17px; }
  .op .op-foot { gap: 10px; flex-wrap: wrap; margin-top: 14px; margin-inline: -14px; padding: 10px 14px 12px; box-shadow: 0 -8px 14px -10px rgba(43, 32, 90, .35); border-radius: 0 0 18px 18px; }
  .op .op-keys { display: none; }
  .op .op-go { height: 52px; padding: 0 24px; font-size: 19px; }
  .op-res, .op-name { flex-direction: column; gap: 14px; padding: 18px 16px; }
  .op-resL, .op-nameL { flex: none; padding: 14px; }
  .op-resfig svg, .op-namefig svg { width: 120px; height: 150px; }
  .op-pairs li { font-size: 15px; padding: 6px 10px; gap: 6px; }
  .op-namehead { font-size: 26px; }
  .op-input { font-size: 21px; height: 56px; padding: 0 12px; }
  .op-dish { padding: 18px 14px; }
  .op-dishhead { font-size: 24px; }
  .op-dishsub { font-size: 15px; }
  .op-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
  .op-card { padding: 26px 4px 8px; }
  .op-cards { grid-template-columns: repeat(2, 1fr); }
  .op-card .op-cname { font-size: 18px; }
  .op-card .op-mat span { font-size: 13px; padding: 0 7px 2px; }
  .op-card .op-goes { font-size: 12px; }
  .op-badge { left: 8px; top: 8px; font-size: 12px; }
  .op-hint { font-size: 14px; flex-basis: 100%; }
}

/* the next-dish overlay on the map (the 'dish' message). The map stays visible behind a dim backdrop */
#layer-opening.op.op-over { background: rgba(36, 26, 74, .48); }
.op.op-over .op-bg { display: none; }
.op.op-over .op-screen { cursor: pointer; }
.op.op-over .op-screen > .win { cursor: auto; }
.op-dish.op-next { left: 30px; right: 30px; top: 30px; }
.op-close { position: absolute; right: 26px; top: 22px; height: 44px; padding: 0 22px; border-radius: 22px; font-size: 17px; font-weight: 900;
  background: #fff; border: 2px solid var(--ink); color: var(--ink); box-shadow: 0 3px 0 rgba(43, 32, 90, .25); }
.op-badge.made { background: var(--ink); color: #fff; }
.op-badge.now { background: var(--yellow); color: var(--ink); border: 2px solid var(--yellow-line); padding: 0 9px 1px; }
.op-card.is-made, .op-card.is-now { background: #f6f3ff; cursor: default; }
.op-card.is-made .op-pic { opacity: .62; }
.op-card.is-made .op-cname, .op-card.is-made .op-mat { opacity: .7; }
@media (max-height: 820px) and (min-width: 701px) {
}
@media (max-width: 700px) {
  .op-close { right: 12px; top: 12px; height: 40px; padding: 0 16px; font-size: 15px; }
  .op-dish.op-next .op-dishhead { padding-right: 70px; font-size: 22px; }
  .op-dish.op-next .op-step { padding-right: 76px; }
}

/* the prologue (name → prologue → dish cards). The picture large, who and the line under it */
.op-pro { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(920px, calc(100% - 88px)); max-height: calc(100% - 60px); overflow: auto;
  padding: 22px 28px 20px; display: flex; flex-direction: column; }
.op-propic { width: min(100%, calc((100vh - 330px) * 1.688)); aspect-ratio: 314 / 186; margin: 0 auto; border-radius: 16px; overflow: hidden; border: 3px solid var(--ink); background: #fff; flex: none; }
.op-propic svg { width: 100%; height: 100%; display: block; }
.op-who { align-self: flex-start; margin-top: 16px; font-size: 15px; font-weight: 900; color: #fff; background: var(--bad); border-radius: 11px; padding: 2px 12px 4px; max-width: 100%; overflow-wrap: anywhere; }
.op-who.me { background: var(--teal); }
.op-proline { font-size: 24px; font-weight: 700; line-height: 1.6; margin-top: 6px; min-height: 3.2em; }
.op-skip { background: none; border: none; font-size: 15px; font-weight: 700; color: var(--ink-soft); text-decoration: underline; padding: 8px 4px; }
.op-prodots { display: flex; gap: 6px; flex: 1; justify-content: center; }
.op-prodots b { width: 9px; height: 9px; border-radius: 50%; background: var(--lav-line); }
.op-prodots b.on { background: var(--ink); }
@media (max-width: 700px) {
  .op-ask .op-reshead { font-size: 24px; }
  .op-ask .op-foot { flex-wrap: nowrap; }
  .op-ask .op-go { min-width: 130px; }
  .op-ask .op-resfig svg { width: 200px; height: 250px; }
  .op-pro { padding: 14px 14px 0; }
  .op-propic { width: 100%; }
  .op-proline { font-size: 19px; min-height: 0; }
}

/* the language switch on the title, and room for longer English text */
.op-langs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: calc(100vw - 24px); }
.op-lang { min-height: 36px; padding: 0 16px; border-radius: 18px; font-size: 15px; font-weight: 700; line-height: 1.7; color: #fff; background: rgba(43, 32, 90, .45); border: 2px solid rgba(255, 255, 255, .7); }
.op-lang.on { background: var(--cream); color: var(--ink); border-color: var(--ink); }
/* scripts that need more line height. Devanagari about 1.6, Tibetan stacks about 1.9 */
[data-lang="hi"] .op-screen { line-height: 1.6; }
[data-lang="dz"] .op-screen { line-height: 1.9; }
[data-lang="hi"] .op-screen *, [data-lang="dz"] .op-screen * { line-height: inherit; }
[data-lang="hi"] .op-ttl h1, [data-lang="dz"] .op-ttl h1 { font-size: min(84px, 10vh, 10vw); white-space: normal; letter-spacing: 0; padding: 0 16px; }
[data-lang="dz"] .op-ttl h1 { line-height: 1.5; }
[data-lang="hi"] .op-ttl h1 { line-height: 1.35; }
[data-lang="hi"] .op-start, [data-lang="dz"] .op-start { letter-spacing: 0; }
[data-lang="hi"] .op-card .op-cname, [data-lang="dz"] .op-card .op-cname, [data-lang="hi"] .op-card .op-mat span, [data-lang="dz"] .op-card .op-mat span { white-space: normal; overflow-wrap: break-word; letter-spacing: 0; }
[data-lang="hi"] .op-opt .op-tx, [data-lang="dz"] .op-opt .op-tx { font-size: 18px; overflow-wrap: break-word; }
/* Tibetan script draws small in these fonts, so Dzongkha text is set a size up */
[data-lang="dz"] .op-opt .op-tx { font-size: 24px; }
[data-lang="dz"] .op-proline { font-size: 26px; }
[data-lang="dz"] .op-q .op-open { font-size: 34px; }
[data-lang="dz"] .op-q .op-qtext { font-size: 28px; }
[data-lang="dz"] .op .op-keys, [data-lang="dz"] .op-step, [data-lang="dz"] .op-hint, [data-lang="dz"] .op-dishsub { font-size: 18px; }
[data-lang="dz"] .op .op-go { font-size: 26px; }
[data-lang="dz"] .op .op-back, [data-lang="dz"] .op-skip, [data-lang="dz"] .op-lang { font-size: 19px; }
[data-lang="dz"] .op-card .op-cname { font-size: 20px; }
[data-lang="dz"] .op-corner { font-size: 17px; }
@media (max-width: 700px) {
  [data-lang="dz"] .op-opt .op-tx { font-size: 20px; }
  [data-lang="dz"] .op-q .op-open { font-size: 26px; }
  [data-lang="dz"] .op-q .op-qtext { font-size: 22px; }
  [data-lang="dz"] .op-proline { font-size: 22px; }
}
[data-lang="en"] .op-card .op-cname { white-space: normal; overflow-wrap: break-word; letter-spacing: 0; }
[data-lang="en"] .op-card .op-mat span { white-space: normal; }
[data-lang="en"] .op-opt .op-tx { overflow-wrap: break-word; font-size: 18px; }
[data-lang="en"] .op-ttl h1 { font-size: min(92px, 11vh, 11vw); letter-spacing: .01em; white-space: normal; line-height: 1.05; padding: 0 16px; }
[data-lang="en"] .op-ttl .op-en { letter-spacing: .2em; }
[data-lang="en"] .op-start { letter-spacing: .06em; }
[data-lang="en"] .op-reshead, [data-lang="en"] .op-namehead, [data-lang="en"] .op-dishhead { overflow-wrap: anywhere; }

/* the first dish, only onigiri or toast as two large cards (decision 95) */
.op-first { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(880px, calc(100% - 60px)); max-height: calc(100% - 60px); overflow: auto;
  padding: 26px 34px 20px; display: flex; flex-direction: column; }
.op-firstrow { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 20px; }
.op-card.big { padding: 34px 18px 18px; border-radius: 26px; }
.op-card.big .op-pic { max-width: 300px; }
.op-card.big .op-cname { font-size: 30px; margin-top: 4px; }
.op-card.big .op-mat { gap: 6px; margin-top: 8px; }
.op-card.big .op-mat span { font-size: 16px; padding: 1px 12px 3px; border-width: 2px; border-radius: 14px; }
.op-card.big .op-mat i { font-size: 15px; }
.op-card.big .op-badge { display: none; }
.op-path { font-size: 16px; font-weight: 700; color: var(--ink-soft); line-height: 1.6; margin-top: 10px; max-width: 30em; }
.op-more { font-size: 15px; font-weight: 700; color: var(--ink-soft); text-align: center; }
.op-first .op-foot { margin-top: 18px; }

/* the next dish, grouped by stage. Open stages as cards, the next stage as silhouettes, later stages as one quiet row */
.op-tiers { display: flex; flex-wrap: wrap; column-gap: 30px; align-items: flex-start; }
.op-tiers > .op-group { flex: 1 1 260px; min-width: 0; }
.op-tiers .op-cards { grid-template-columns: repeat(var(--n, 4), minmax(0, 156px)); }
.op-tiers .op-card .op-cname { white-space: normal; font-size: 15px; }
.op-dish.op-next { padding-bottom: 0; }
.op-dish.op-next .op-foot { padding-bottom: 16px; }

@media (max-width: 700px) { .op-tiers > .op-group { flex-basis: 100% !important; } .op-tiers .op-cards { grid-template-columns: repeat(2, 1fr); } .op-dish.op-next .op-foot { padding-bottom: 12px; } }
.op-new { font-size: 13px; font-weight: 900; color: #fff; background: #e8505b; border-radius: 10px; padding: 1px 10px 2px; align-self: center; }
.op-tier.later { margin-top: 6px; }
.op-tier.later .op-grouphead { font-size: 15px; color: var(--ink-soft); }
.op-tier.locked .op-grouphead { color: var(--ink-soft); }
.op-card.is-locked { background: #f3f0fb; border-style: dashed; cursor: default; }
.op-card.is-locked .op-pic svg { filter: brightness(0); opacity: .16; }
.op-card.is-locked .op-cname { opacity: .4; }
@media (max-width: 700px) {
  .op-firstrow { gap: 10px; margin-top: 12px; }
  .op-card.big { padding: 16px 8px 12px; }
  .op-card.big .op-cname { font-size: 22px; }
  .op-card.big .op-mat span { font-size: 13px; padding: 0 7px 2px; }
  .op-path { font-size: 13px; line-height: 1.5; }
  .op-first { padding: 18px 14px 0; }
}

/* === map (B2) === */
.map-area > svg.b2-layer { position: absolute; inset: 0; width: 100%; height: 100%; display: block; will-change: transform; }
.b2-world { z-index: 1; }
.b2-glass { z-index: 2; pointer-events: none; }
/* walkers above the glass layer, so no glass sheen or rib crosses a character */
.b2-walk { z-index: 3; pointer-events: none; }
.b2-place { z-index: 4; pointer-events: none; }
.map-area > svg.b2-place:not(.on) { display: none; } /* empty unless placing: no full-screen layer to blend */
.b2-place.on { pointer-events: auto; }
.b2-unit, .b2-walker { cursor: pointer; }
.b2-walk .b2-walker { pointer-events: visiblePainted; }
.b2-layer text { font-family: "Zen Kaku Gothic New", sans-serif; }
.b2-pill { pointer-events: none; }
/* while a full-screen layer covers the map, the map's looping animations rest (ui/walkers.js sets this) */
.map-area.b2-paused * { animation-play-state: paused !important; }
.b2d-green { opacity: 0; animation: b2green 4s ease-in forwards; }
@keyframes b2green { to { opacity: .55; } }
.b2-brew { animation: b2rise 2.4s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.b2d-cell { fill: rgba(255, 243, 160, .35); stroke: #fff3a0; stroke-width: 3.5; animation: b2pop-in .3s ease-out both; transform-box: fill-box; transform-origin: center; }
.b2d-puff circle { animation: b2puff 1s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.b2d-drop > * { animation: b2drop 1s ease-in infinite; }
.b2d-ff ellipse { opacity: 0; animation: b2ffring 1.8s ease-out 2 both; transform-box: fill-box; transform-origin: center; }
.b2d-up { animation: b2rise 1.8s ease-out 2 both; transform-box: fill-box; }
@keyframes b2puff { 0% { opacity: 0; transform: scale(.4); } 40% { opacity: .9; } 100% { opacity: 0; transform: translateY(-14px) scale(1.4); } }
@keyframes b2drop { 0% { opacity: 0; transform: translateY(-6px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(24px); } }
@keyframes b2ffring { 0% { opacity: .9; transform: scale(.5); } 100% { opacity: 0; transform: scale(1.8); } }
.b2-links { opacity: 0; transition: opacity .6s; pointer-events: none; }
.b2-links.on { opacity: 1; }
.b2-links.out { opacity: 0; }
.b2-wcore { stroke-dasharray: 100; stroke-dashoffset: 100; animation: b2draw 1.1s ease-out forwards; }
.b2-wflow { animation: b2flow 2.2s linear infinite; }
.b2-wline { animation: b2fadein .8s ease-out both; }
.b2-wline.dim { opacity: .35; }
.b2-shimmer > * { animation: b2rise 2.8s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.b2-shimmer.down > * { animation-direction: reverse; }
@keyframes b2rise { 0% { opacity: 0; transform: translateY(14px) scale(.8); } 30% { opacity: .9; } 100% { opacity: 0; transform: translateY(-34px) scale(1.15); } }
@keyframes b2draw { to { stroke-dashoffset: 0; } }
@keyframes b2flow { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -10; } }
@keyframes b2fadein { from { opacity: 0; } }
@keyframes b2shim { 0%, 100% { opacity: 0; transform: translateY(8px); } 50% { opacity: .7; transform: none; } }
.b2-bubble { position: absolute; z-index: 6; max-width: min(280px, calc(100% - 16px)); padding: 7px 12px 8px; border-radius: 16px; background: var(--cream); border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 rgba(43, 32, 90, .3); font-size: 14px; font-weight: 700; line-height: 1.4; color: var(--ink); pointer-events: none;
  animation: b2pop-in .25s ease-out both; }
.b2-bubble span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.b2-bubble::after { content: ""; position: absolute; left: calc(var(--tail, 50%) - 7px); bottom: -9px; width: 12px; height: 12px; background: var(--cream);
  border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: rotate(45deg); }
.b2-bubble.below::after { bottom: auto; top: -9px; transform: rotate(225deg); }
.b2-bubble.far::after { display: none; }
.b2-bubble.out { opacity: 0; transition: opacity .35s; }
@keyframes b2pop-in { from { opacity: 0; transform: translateY(6px) scale(.92); } to { opacity: 1; transform: none; } }
.b2-ring { animation: b2ring 1.4s ease-in-out 3 both; transform-box: fill-box; transform-origin: center; }
@keyframes b2ring { 0% { opacity: 0; transform: scale(.7); } 40% { opacity: 1; transform: scale(1.05); } 100% { opacity: 0; transform: scale(1.25); } }
.b2-pop { transform-box: fill-box; transform-origin: center; animation: b2pop 1.4s ease-out both; }
@keyframes b2pop { 0% { opacity: 0; transform: scale(.4); } 60% { opacity: 1; transform: scale(1.08); } 100% { opacity: 1; transform: scale(1); } }
.b2-bub { fill: #e8fff0; opacity: 0; transform-box: fill-box; animation: b2bub 3s ease-in infinite; }
@keyframes b2bub { 0% { opacity: 0; transform: translateY(0); } 20% { opacity: .85; } 100% { opacity: 0; transform: translateY(-16px); } }
.b2-cell { cursor: pointer; }
.b2-cell.no { cursor: not-allowed; }
/* the place panel, one compact card that floats on the map next to the picks (place.js sets left and top) */
.win.place { position: fixed; right: auto; left: 0; top: 0; width: 262px; max-height: none; overflow: visible; padding: 10px 12px 12px; border-radius: 20px; z-index: 30; transition: left .3s ease, top .3s ease; }
.win.place.jump { transition: none; }
.win.place.moving:not(.full), .win.place.pop:not(.full) { pointer-events: none; }
.win.place.pop { animation: b2pop .34s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes b2pop { from { transform: scale(.55); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.win.place .b2p-head { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 900; color: var(--ink); white-space: nowrap; }
.win.place .b2p-head .ic { font-size: 20px; }
.win.place .b2p-touch { margin-top: 4px; font-size: 14px; font-weight: 800; color: var(--ink); }
.win.place .b2p-why { margin-top: 6px; padding: 4px 10px 5px; border-radius: 12px; background: #ffe3e6; border: 2px solid var(--bad); font-size: 13px; font-weight: 800; color: #8a1f2b; }
.win.place .b2p-dots { display: flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 16px; font-weight: 900; }
.win.place .b2p-dots i { width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--ink); background: transparent; display: inline-block; }
.win.place .b2p-dots i.on { background: var(--yellow); }
.win.place .b2p-dots span { margin-left: 6px; }
.win.place .b2p-btns { margin-top: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.win.place .b2p-btns button { padding: 8px 10px; border-radius: 14px; border: 3px solid var(--lav-line); background: var(--lav); font-size: 14px; font-weight: 900; text-align: center; }
.win.place .b2p-btns button.ok { grid-column: 1 / -1; height: 50px; font-size: 20px; background: var(--yellow); border-color: var(--yellow-line); box-shadow: 0 3px 0 var(--yellow-line); }
.win.place .b2p-btns button.cancel { background: transparent; border-style: dashed; }
.win.place .b2p-btns button:disabled { opacity: .45; cursor: default; box-shadow: none; }
@media (max-width: 700px) {
  /* while placing, the map takes the whole screen so the cells can be as big as a finger, the panel floats on it */
  .map-area.b2-placing { position: fixed; inset: 0; z-index: 24; }
  .win.place { width: 232px; padding: 8px 10px 10px; }
}


/* the つながり view (ui/web.js) */
.b2w-layer { background: rgba(30, 22, 64, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.b2w-panel { position: relative; inset: auto; width: min(860px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; }
.b2w-bar { display: flex; align-items: center; gap: 10px; }
.b2w-bar h2 { flex: 1; font-size: 20px; font-weight: 900; color: var(--ink); line-height: 1.3; }
.b2w-x { padding: 8px 16px; border-radius: 999px; border: 3px solid var(--yellow-line); background: var(--yellow); font-weight: 900; font-size: 15px; box-shadow: 0 3px 0 var(--yellow-line); }
.b2w-pic { border: 3px solid var(--ink); border-radius: 16px; overflow: hidden; background: #2f2566; min-height: 0; }
.b2w-svg { width: 100%; height: auto; max-height: calc(100vh - 220px); display: block; }
.b2w-cap { min-height: 2.8em; padding: 8px 14px; border-radius: 14px; background: var(--lav); font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.4; }
.b2w-cap.flash { animation: b2fadein .4s ease-out; }
.b2w-tok { cursor: pointer; animation: b2tok .7s ease-out both; transform-box: fill-box; transform-origin: center; }
.b2w-tok .b2w-halo { opacity: .55; }
.b2w-tok.missing .b2w-halo { opacity: 0; }
.b2w-tok.missing .b2w-ic { opacity: .4; filter: grayscale(1) brightness(1.4); }
.b2w-tok.dish.missing .b2w-ic { opacity: .55; }
.b2w-tok.growing .b2w-halo { animation: b2pulse 2.4s ease-in-out infinite; }
.b2w-tok.dish .b2w-halo { opacity: .9; }
.b2w-link { cursor: pointer; }
.b2w-hit { pointer-events: stroke; }
@keyframes b2tok { from { opacity: 0; transform: scale(.6); } }
@keyframes b2pulse { 0%, 100% { opacity: .25; } 50% { opacity: .85; } }
@media (max-width: 700px) {
  .b2w-layer { padding: 8px; align-items: flex-start; }
  .b2w-bar h2 { font-size: 16px; }
  .b2w-svg { max-height: 60dvh; }
  .b2w-cap { font-size: 14px; }
}

/* === frame (B3) === */
.info .date { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 900; padding: 0 16px 0 10px; height: 38px; background: var(--ink); color: #fff; border-radius: 20px; width: fit-content; white-space: nowrap; }
.info .date .sea { font-size: 18px; }
.info .now { display: flex; align-items: center; gap: 8px; margin: 10px 2px 0; font-size: 17px; font-weight: 700; line-height: 1.25; }
.info .now .lab { flex: none; font-size: 12px; font-weight: 900; color: #fff; background: var(--teal); border-radius: 9px; padding: 2px 8px 3px; }
.info .air { display: flex; align-items: center; gap: 8px; margin: 10px 2px 0; }
.info .air .lab { flex: none; font-size: 13px; font-weight: 900; width: 34px; }
.info .air .bar { flex: 1; height: 16px; border-radius: 8px; background: var(--lav); border: 2px solid var(--lav-line); overflow: hidden; }
.info .air .bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(#7fe0c8, #2fb8a6); transition: width .4s; }
.info .air .word { flex: none; width: 76px; text-align: center; font-size: 14px; font-weight: 700; padding: 2px 0 3px; border-radius: 12px; background: var(--ok); }
.info .air.low .bar i { background: linear-gradient(#ffc98a, #f08a4a); }
.info .air.low .word { background: var(--warn); }
.info .crew { margin-top: 10px; border-top: 2px dashed var(--lav-line); padding-top: 8px; }
.info .mem { display: flex; align-items: center; gap: 10px; height: 46px; }
.info .mem .face { width: 40px; height: 40px; border-radius: 50%; border: 2.5px solid var(--ink); background: #8b83c1; overflow: hidden; display: flex; align-items: flex-end; justify-content: center; flex: none; }
.info .mem .face svg { width: 34px; height: 42px; margin-bottom: -6px; }
.info .mem .nm { font-size: 17px; font-weight: 900; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info .mem .mood { flex: none; font-size: 15px; font-weight: 700; padding: 3px 12px 4px; border-radius: 14px; white-space: nowrap; }
.info .inv { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 8px; border-top: 2px dashed var(--lav-line); padding-top: 8px; min-height: 8px; }
.info .inv:empty { display: none; }
.info .inv .it { display: flex; align-items: center; gap: 3px; font-size: 16px; font-weight: 700; padding: 0 8px; height: 34px; border-radius: 17px; background: var(--lav); }
.info .inv .it .e { font-size: 18px; }
.info .links { display: flex; gap: 6px; margin-top: 8px; border-top: 2px dashed var(--lav-line); padding-top: 8px; }
.info .link { flex: 1; height: 36px; font-size: 14px; font-weight: 700; white-space: nowrap; background: var(--lav); border: 2px solid var(--lav-line); border-radius: 18px; }
.info .link:hover, .choices button:hover { filter: brightness(.97); }

.story .pic { width: 100%; aspect-ratio: 314 / 186; border-radius: 14px; overflow: hidden; background: #fff; border: 2px solid var(--ink); }
.story .pic svg { width: 100%; height: 100%; display: block; }
.story .line { font-size: 21px; font-weight: 700; margin: 10px 6px 4px; line-height: 1.4; }
.story .who { display: inline-block; font-size: 13px; font-weight: 700; color: #fff; background: var(--bad); border-radius: 10px; padding: 2px 9px 3px; margin: 8px 6px 0; }
.story .who + .line { margin-top: 4px; }
.story .dots { position: absolute; right: 20px; top: 20px; display: flex; gap: 5px; background: rgba(255, 247, 236, .92); border-radius: 9px; padding: 5px 7px; }
.story .dots b { width: 7px; height: 7px; border-radius: 50%; background: var(--lav-line); }
.story .dots b.on { background: var(--ink); }
.story .turn { display: block; margin: 6px 6px 2px auto; font-size: 14px; font-weight: 700; color: var(--ink-soft); background: transparent; border: 0; padding: 4px 8px; }
.story.turnable { cursor: pointer; }
/* large for milestones, the map stays visible behind and around it */
.win.story.big { right: auto; left: 50%; transform: translateX(-50%); top: var(--gap); width: min(700px, calc(100% - 2 * var(--info-w) - 8 * var(--gap))); padding: 14px; }
.story.big .line { font-size: 27px; }
.story.big .who { font-size: 15px; }
.story.big .pic { border-width: 3px; }

.choices .head { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--ink-soft); margin: 0 4px 10px; }
.choices .head i { width: 22px; height: 16px; display: inline-block; background: linear-gradient(var(--ink-soft) 0 3px, transparent 3px 6.5px, var(--ink-soft) 6.5px 9.5px, transparent 9.5px 13px, var(--ink-soft) 13px 16px); border-radius: 2px; }
.choices button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; margin-top: 8px; padding: 6px 14px; font-size: 18px; font-weight: 700; line-height: 1.2; text-align: left; background: var(--lav); border: 2px solid var(--lav-line); border-radius: 23px; }
.choices .head + button { margin-top: 0; }
.choices button .ic { flex: none; width: 26px; text-align: center; font-size: 19px; }
.choices button .tx { flex: 1; min-width: 0; }
.choices button .key { flex: none; font-size: 12px; font-weight: 900; color: var(--ink-soft); width: 20px; height: 20px; line-height: 18px; text-align: center; border: 1.5px solid var(--lav-line); border-radius: 6px; background: #fff; }
.choices button.on { background: var(--yellow); border-color: var(--yellow-line); box-shadow: 0 3px 0 var(--yellow-line); }
.choices button.ff { background: #fff; border-style: dashed; color: var(--ink-soft); }
.choices button:focus-visible, .info .link:focus-visible, .story .turn:focus-visible, .sheet .x:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.story .who.fact { background: var(--teal); }
.story.factcard { border-color: var(--teal); }
.story .who.fact { }
.story.issuecard { border-color: #e2813f; background: #fff3e6; }
.story.issuecard .who.fact { background: #e2813f; }
.story .ititle { font-size: 18px; font-weight: 900; margin: 6px 6px 0; color: #8a3f10; }
.story .isrc { font-size: 11px; font-weight: 700; color: var(--ink-soft); margin: 2px 6px 4px; }
.story .line.factline { font-size: 16px; font-weight: 700; line-height: 1.5; }
.story.big .line.factline { font-size: 20px; }
.choices.dim { opacity: .45; pointer-events: none; filter: saturate(.6); }
/* buttons the player must press sit near the centre (designer, 11/18). Info stays top left, the story top right. */
@media (min-width: 701px) {
  .win.choices { right: auto; left: 50%; transform: translateX(-50%); bottom: var(--gap); width: fit-content; min-width: 340px; max-width: min(720px, calc(100vw - 4 * var(--gap))); padding: 10px 12px 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; align-content: start; }
  .win.choices .head { grid-column: 1 / -1; margin: 0 4px 2px; }
  .win.choices button { margin-top: 0; min-height: 42px; font-size: 16px; padding: 4px 12px; }
  .win.choices button.ff, .win.choices .head + button:last-child { grid-column: 1 / -1; }
  .win.choices button.ff { min-height: 38px; }
  .win.choices.dim { display: none; }
}
.story .who.again { background: var(--lav); color: var(--ink-soft); border: 1.5px dashed var(--lav-line); }
.story.wrongreply { border-style: dashed; border-color: var(--ink-soft); }
/* overlays, owned, zukan, party */
.sheet { display: flex; align-items: center; justify-content: center; background: rgba(43, 36, 80, .55); padding: 24px; }
.sheet .panel { position: relative; width: min(860px, 100%); max-height: 100%; display: flex; flex-direction: column; padding: 16px 18px 18px; }
.sheet .bar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.sheet .bar h2 { font-size: 24px; font-weight: 900; flex: 1; }
.sheet .count { font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.sheet .x { height: 38px; padding: 0 18px; font-size: 15px; font-weight: 700; background: var(--yellow); border: 2px solid var(--yellow-line); border-radius: 19px; box-shadow: 0 3px 0 var(--yellow-line); }
.sheet .body { overflow: auto; }
.sheet .grp { margin-bottom: 14px; }
.sheet .grp h3 { font-size: 15px; font-weight: 900; color: var(--ink-soft); margin: 0 4px 8px; }
.sheet .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.sheet .card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px 10px; text-align: center; background: var(--lav); border: 2px solid var(--lav-line); border-radius: 18px; }
.sheet .card .ic { font-size: 34px; line-height: 1.2; }
.sheet .card .nm { font-size: 16px; font-weight: 900; }
.sheet .card .sub { font-size: 13px; font-weight: 700; color: var(--ink-soft); min-height: 1.2em; }
.sheet .card.dark { background: #e7e3f2; border-style: dashed; }
.sheet .card.dark .ic { filter: brightness(0); opacity: .28; }
.sheet .card.dark .nm { color: var(--ink-soft); }
.sheet .empty { font-size: 15px; font-weight: 700; color: var(--ink-soft); margin: 0 4px; }
.sheet .panel.party { width: min(760px, 100%); }
.sheet .partypic { width: 100%; border: 3px solid var(--ink); border-radius: 16px; overflow: hidden; aspect-ratio: 640 / 400; max-height: calc(100vh - 220px); margin: 0 auto; }
.sheet .partypic svg { width: 100%; height: 100%; display: block; }
.sheet .cap { font-size: 21px; font-weight: 700; text-align: center; margin-top: 10px; }
.sheet .lines { display: grid; gap: 6px; margin-top: 8px; }
.sheet .lines p { font-size: 15px; font-weight: 700; padding: 6px 12px 7px; border-radius: 14px; background: var(--lav); line-height: 1.4; }
.sheet .lines .taste { background: var(--yellow); }
.sheet .lines p { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.sheet .lines p.pop { animation: linepop .3s ease-out; }
@keyframes linepop { from { transform: translateY(6px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet .lines .gtag { flex: none; font-size: 12px; font-weight: 900; padding: 2px 9px 3px; border-radius: 10px; color: var(--ink); border: 2px solid rgba(59, 47, 107, .35); white-space: nowrap; }
.sheet .lines .tx { min-width: 0; }
.sheet .row { display: flex; justify-content: center; gap: 10px; }
.sheet .share { margin-top: 8px; height: 46px; padding: 0 26px; font-size: 17px; font-weight: 900; background: var(--yellow); border: 3px solid var(--yellow-line); border-radius: 23px; box-shadow: 0 3px 0 var(--yellow-line); }

/* compact info window so the place window fits under it at 1440x900 */
@media (min-width: 701px) {
  .info .now { margin-top: 6px; }
  .info .air { margin-top: 6px; }
  .info .crew { margin-top: 6px; padding-top: 4px; }
  .info .mem { height: 38px; gap: 8px; }
  .info .mem .face { width: 34px; height: 34px; }
  .info .mem .face svg { width: 29px; height: 36px; }
  .info .mem .nm { font-size: 16px; }
  .info .mem .mood { font-size: 14px; padding: 2px 10px 3px; }
  .info .inv { margin-top: 4px; padding-top: 6px; gap: 2px; }
  .info .inv .it { height: 28px; font-size: 14px; padding: 0 5px; gap: 2px; }
  .info .inv .it .e { font-size: 15px; }
  .info .links { margin-top: 6px; padding-top: 6px; }
  .info .link { height: 32px; }
}

/* zukan detail card */
.sheet button.card { cursor: pointer; font: inherit; color: inherit; }
.sheet .detail { display: flex; flex-direction: column; gap: 10px; }
.sheet .detail > * { flex: none; }
.sheet .dpic { width: min(100%, 460px); margin: 0 auto; aspect-ratio: 314 / 186; border: 3px solid var(--ink); border-radius: 16px; overflow: hidden; background: #fff; }
.sheet .dpic svg { width: 100%; height: 100%; display: block; }
.sheet .dname { font-size: 24px; font-weight: 900; text-align: center; margin-top: 4px; }
.sheet .dsub { text-align: center; font-size: 14px; font-weight: 700; color: var(--ink-soft); margin-top: -6px; }
.sheet .dsec h4 { font-size: 14px; font-weight: 900; color: var(--ink-soft); margin-bottom: 6px; }
.sheet .dchips { display: flex; flex-wrap: wrap; gap: 6px; }
.sheet .dchip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 14px; background: var(--lav); border: 2px solid var(--lav-line); font-size: 14px; font-weight: 700; }
.sheet .dfact p { font-size: 15px; font-weight: 700; line-height: 1.5; padding: 8px 12px; border-radius: 14px; background: var(--ok); }
.sheet .icard { padding: 8px 12px; border-radius: 14px; background: #fff3e6; border: 2px solid #e2813f; margin-bottom: 6px; }
.sheet .icard b { font-size: 15px; color: #8a3f10; } .sheet .icard p { font-size: 14px; font-weight: 700; line-height: 1.5; margin: 2px 0; } .sheet .icard small { font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.sheet .x.back { background: var(--lav); border-color: var(--lav-line); box-shadow: none; }

/* while an event plays, the story and the choices are one card, low centre (desktop). No event, no story window. */
@media (min-width: 701px) {
  .win.choices.joined { width: min(720px, calc(100vw - 4 * var(--gap))); border-top-left-radius: 0; border-top-right-radius: 0; border-top-width: 0; box-shadow: 0 14px 32px rgba(30, 18, 70, .28); }
  .win.story.joined { right: auto; left: 50%; top: auto; transform: translateX(-50%); width: min(720px, calc(100vw - 4 * var(--gap))); border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-width: 0; box-shadow: none; display: grid; grid-template-columns: 38% 1fr; gap: 0 14px; align-items: center; padding: 12px 14px; max-height: calc(100vh - 220px); overflow: auto; }
  .story.joined .pic { grid-column: 1; grid-row: 1 / span 5; }
  .story.joined .line, .story.joined .who, .story.joined .ititle, .story.joined .isrc, .story.joined .dots, .story.joined .turn { grid-column: 2; margin-left: 0; margin-right: 0; }
  .story.joined .dots { position: static; justify-self: end; background: transparent; }
  .story.joined .turn { justify-self: end; }
  .story.joined .who { justify-self: start; }
}

/* the road to the finished dish, slim, top centre (decision 92) */
.road { position: fixed; z-index: 11; top: 14px; left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 4 * var(--gap) - 2 * var(--info-w))); min-width: 320px; height: 58px; padding: 6px 14px 4px; display: grid; grid-template-columns: 1fr auto; grid-template-rows: 26px 18px; column-gap: 12px; align-items: center; background: rgba(255, 247, 236, .94); border: 3px solid var(--ink); border-radius: 29px; box-shadow: 0 4px 0 rgba(43, 32, 90, .3), 0 10px 22px rgba(30, 18, 70, .22); }
.road[hidden] { display: none; }
.road .rtrack { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 6px; height: 26px; }
.road .rtrack::before { content: ""; position: absolute; left: 8px; right: 14px; top: 50%; height: 3px; margin-top: -1.5px; background: var(--lav-line); border-radius: 2px; }
.road .node { position: relative; flex: none; width: 14px; height: 14px; padding: 0; border-radius: 50%; border: 2.5px solid var(--lav-line); background: #fff; }
.road .dense .node { width: 10px; height: 10px; border-width: 2px; }
.road .dense .node.now { width: 18px; height: 18px; }
.road .dense { gap: 3px; }
.road .node.done { background: var(--teal); border-color: var(--teal); }
.road .node.now { width: 20px; height: 20px; background: var(--yellow); border-color: var(--yellow-line); box-shadow: 0 0 0 4px rgba(255, 213, 106, .5), 0 0 14px 4px rgba(255, 213, 106, .8); animation: roadglow 1.6s ease-in-out infinite; }
.road .node.todo { opacity: .55; }
.road .node.sel { outline: 3px solid var(--ink); outline-offset: 2px; }
.road .goal { position: relative; flex: none; font-size: 22px; line-height: 26px; padding: 0 2px; background: var(--cream); }
.road .rcount { grid-column: 2; grid-row: 1; font-size: 15px; font-weight: 900; color: #fff; background: var(--ink); border-radius: 14px; padding: 2px 12px 3px; white-space: nowrap; }
.road .rlabel { grid-column: 1 / -1; grid-row: 2; font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
@keyframes roadglow { 50% { box-shadow: 0 0 0 5px rgba(255, 213, 106, .35), 0 0 20px 7px rgba(255, 213, 106, .9); } }
@media (prefers-reduced-motion: reduce) { .road .node.now { animation: none; } }
/* next step */
.info .nextstep { display: flex; align-items: flex-start; gap: 8px; margin: 8px 2px 0; font-size: 14px; font-weight: 700; line-height: 1.4; }
.info .nextstep .lab { flex: none; font-size: 12px; font-weight: 900; color: var(--ink); background: var(--yellow); border-radius: 9px; padding: 2px 8px 3px; }
.choices .nextq { grid-column: 1 / -1; margin: 0 4px 2px; font-size: 14px; font-weight: 700; color: var(--ink-soft); line-height: 1.4; }
/* fast-forward with nothing to grow, a small friendly card at the centre */
.win.ffconfirm { position: fixed; z-index: 40; left: 50%; top: 42%; transform: translate(-50%, -50%); width: min(380px, calc(100vw - 32px)); padding: 16px 18px 16px; text-align: center; }
.win.ffconfirm .fft { font-size: 19px; font-weight: 900; }
.win.ffconfirm .ffd { margin-top: 8px; font-size: 15px; font-weight: 700; line-height: 1.5; color: var(--ink-soft); }
.win.ffconfirm .ok { margin-top: 12px; height: 46px; padding: 0 30px; font-size: 17px; font-weight: 900; background: var(--yellow); border: 3px solid var(--yellow-line); border-radius: 23px; box-shadow: 0 3px 0 var(--yellow-line); }
@media (min-width: 701px) { .win.story.big { top: 90px; } }

/* Papa's demonstration choice */
.choices button.demo { background: var(--yellow); }
.choices button .pface { width: 34px; height: 34px; border-radius: 50%; border: 2.5px solid var(--ink); background: #8b83c1; overflow: hidden; display: flex; align-items: flex-end; justify-content: center; }
.choices button .pface svg { width: 30px; height: 36px; margin-bottom: -5px; }
.road .rdemo { position: absolute; right: 14px; top: -12px; font-size: 12px; font-weight: 900; color: var(--ink); background: var(--yellow); border: 2px solid var(--yellow-line); border-radius: 10px; padding: 0 9px 1px; }
/* medium widths, the road strip starts right of the info window so they never overlap */
@media (min-width: 701px) and (max-width: 1100px) { .road { left: calc(var(--gap) + var(--info-w) + 14px); right: 240px; transform: none; width: auto; min-width: 0; } }
/* large screens keep the 1440 proportions, --k is set by frame.js */
@media (min-width: 1600px) {
  .win.info { transform: scale(var(--k, 1)); transform-origin: top left; }
  .win.story:not(.joined):not(.big) { transform: scale(var(--k, 1)); transform-origin: top right; }
  .win.story.big { transform: translateX(-50%) scale(var(--k, 1)); transform-origin: top center; }
  .win.choices { transform: translateX(-50%) scale(var(--k, 1)); transform-origin: bottom center; }
  .win.story.joined { transform: translateX(-50%) scale(var(--k, 1)); transform-origin: bottom center; }
  .road { transform: translateX(-50%) scale(var(--k, 1)); transform-origin: top center; }
  .win.ffconfirm { transform: translate(-50%, -50%) scale(var(--k, 1)); }
}

/* Dzongkha (Tibetan script) has tall stacked letters, so lines need room and nothing may clip */
html[lang="dz"] .win, html[lang="dz"] .sheet { line-height: 1.9; }
html[lang="dz"] .win button, html[lang="dz"] .sheet button { line-height: 1.9; }
html[lang="dz"] .choices button { min-height: 50px; padding-top: 2px; padding-bottom: 2px; }
html[lang="dz"] .info .date, html[lang="dz"] .info .now .lab, html[lang="dz"] .story .who, html[lang="dz"] .sheet .lines .gtag { line-height: 1.9; height: auto; padding-top: 2px; padding-bottom: 2px; }
html[lang="dz"] .info .mem .mood, html[lang="dz"] .info .air .word { height: auto; line-height: 1.9; white-space: normal; }
html[lang="dz"] .info .mem .nm { overflow: visible; }

/* === phone (B3) === */
@media (max-width: 700px) {
  html, body { overflow: hidden; }
  .stage { display: flex; flex-direction: column; height: 100dvh; overflow-y: auto; overflow-x: hidden; }
  .map-area { position: relative; inset: auto; flex: 1 1 0; min-height: 200px; order: 1; }
  .win.info, .win.story, .win.choices { position: relative; inset: auto; width: auto; margin: 8px 10px 0; flex: none; }
  .win.info { order: 4; margin-bottom: 10px; min-height: 0; padding: 8px 10px; display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; margin-top: 8px; }
  .win.story { order: 2; padding: 6px; display: grid; grid-template-columns: 38% 1fr; gap: 0 8px; align-items: center; min-height: 0; }
  .win.choices { order: 3; padding: 8px; margin-top: 8px; min-height: 0; display: block; }
  .layer { position: fixed; }
  /* info as a slim strip */
  .info .date { grid-column: 1; height: 28px; font-size: 14px; padding: 0 10px 0 6px; }
  .info .air { grid-column: 2; margin: 0; }
  .info .air .lab { width: auto; font-size: 12px; }
  .info .air .bar { height: 12px; }
  .info .air .word { width: 64px; font-size: 12px; padding: 1px 0 2px; }
  .info .now { grid-column: 1 / -1; margin: 0 2px; font-size: 14px; }
  .info .crew { grid-column: 1 / -1; display: flex; gap: 6px; margin: 0; padding: 4px 0 0; }
  .info .mem { flex: 1; min-width: 0; height: auto; flex-direction: column; align-items: center; gap: 1px; }
  .info .mem .face { width: 28px; height: 28px; border-width: 2px; }
  .info .mem .face svg { width: 24px; height: 30px; margin-bottom: -4px; }
  .info .mem .nm { flex: none; max-width: 100%; font-size: 12px; text-align: center; }
  .info .mem .mood { font-size: 12px; padding: 1px 8px 2px; }
  .info .inv { grid-column: 1 / -1; margin: 0; padding-top: 4px; gap: 2px; }
  .info .inv .it { height: 26px; font-size: 13px; padding: 0 6px; }
  .info .links { grid-column: 1 / -1; margin: 0; padding-top: 4px; }
  .info .link { height: 36px; }
  /* picture story, picture left and words right */
  .story .pic { grid-column: 1; grid-row: 1 / span 4; border-width: 2px; }
  .story .line { grid-column: 2; font-size: 16px; margin: 0; }
  .story .line.factline { font-size: 13px; line-height: 1.4; }
  .story .ititle, .story .isrc { grid-column: 2; margin-left: 0; margin-right: 0; }
  .story .ititle { font-size: 15px; }
  .sheet .body-scroll { overflow: auto; }
  .sheet .panel.party { overflow: auto; }
  .story .who { grid-column: 2; justify-self: start; margin: 0 0 2px; }
  .story .who + .line { margin: 0; }
  .story .turn { grid-column: 2; justify-self: end; min-height: 36px; margin: 2px 0 0; }
  .story .dots { position: static; grid-column: 2; justify-self: end; margin-top: 2px; padding: 3px 6px; }
  .win.story.big { position: relative; left: auto; transform: none; width: auto; top: auto; padding: 6px; }
  .story.big .line { font-size: 17px; }
  .choices .head { display: none; }
  .choices button { min-height: 44px; margin-top: 6px; font-size: 16px; padding: 4px 12px; }
  .choices button .key { display: none; }
  .sheet { padding: 10px; align-items: center; background: rgb(43, 36, 80); }
  .sheet .bar h2 { font-size: 17px; word-break: keep-all; line-height: 1.3; }
  .sheet .panel { padding: 12px; }
  .sheet .cards { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .sheet .partypic { max-height: 40dvh; }
}

@media (max-width: 700px) {
  .road { top: 8px; left: 8px; right: 190px; transform: none; width: auto; min-width: 0; height: 52px; padding: 4px 10px 3px; grid-template-rows: 24px 16px; column-gap: 8px; z-index: 20; }
  .road .rtrack { justify-content: flex-start; gap: 10px; }
  .road .rtrack::before { display: none; }
  .road .rlabel { font-size: 12px; text-align: left; }
  .road .rcount { font-size: 13px; padding: 1px 9px 2px; }
  .info .nextstep { font-size: 13px; margin-top: 4px; grid-column: 1 / -1; }
}
