/* The Siege of Giridurg: sandstone, parchment and ink. */
:root {
  --night: #23160d;
  --paper: #f4e7c9;
  --paper-2: #ead9b3;
  --ink: #36230f;
  --soft: #6d5438;
  --line: rgba(54, 35, 15, .28);
  --red: #a1301f;
  --gold: #b07d12;
  --indigo: #2e3a66;
  --good: #2f6b3a;
  --bad: #a1301f;
  --serif: Georgia, "Palatino Linotype", Palatino, "Book Antiqua", serif;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--night); color: var(--ink); font-family: var(--sans); }
[hidden] { display: none !important; }
p, h1, h2, ol, ul { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
.eyebrow { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--red); font-weight: 700; }
.muted { color: var(--soft); font-size: 14px; line-height: 1.5; margin-top: 6px; }
.fine { font-size: 12px; color: var(--soft); margin-top: 10px; line-height: 1.45; }
.error { margin-top: 10px; color: var(--bad); font-size: 14px; font-weight: 600; }

/* ---- the map and the orders ---- */
#play { position: fixed; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
#stage { position: relative; min-width: 0; min-height: 0; background: #1a120a; overflow: hidden; }
#board { position: absolute; inset: 0; }
#board canvas { display: block; }
#top { position: absolute; left: 10px; right: 10px; top: 8px; display: flex; gap: 8px; align-items: center; justify-content: space-between; pointer-events: none; }
#top p { padding: 6px 12px; border-radius: 8px; background: rgba(35, 22, 13, .82); color: #f4e7c9; font-size: 13px; border: 1px solid rgba(244, 231, 201, .2); }
#clock b { font-family: var(--mono); font-size: 20px; margin-left: 4px; color: #fff; }
#clock.low b { color: #ff8a70; }
#gold-line b { font-family: var(--mono); font-size: 20px; color: #ffd874; }
#gold-line.over b { color: #ff8a70; }
#say { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); max-width: min(92%, 640px); padding: 9px 14px; border-radius: 8px; background: rgba(35, 22, 13, .88); color: #f4e7c9; font-size: 15px; line-height: 1.4; text-align: center; border: 1px solid rgba(244, 231, 201, .25); opacity: 0; transition: opacity .25s; pointer-events: none; }
#say.on { opacity: 1; }
#orders { background: var(--paper); border-left: 3px solid #8a5a2b; padding: 16px 16px 14px; overflow: auto; display: flex; flex-direction: column; }
#orders h2 { font-family: var(--serif); font-size: 20px; line-height: 1.25; margin: 4px 0 2px; }
#order-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
#order-list li { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbf3de; cursor: pointer; }
#order-list li.sel { border-color: var(--red); box-shadow: 0 0 0 2px rgba(161, 48, 31, .18); background: #fff8e6; }
#order-list .head { display: flex; align-items: baseline; gap: 8px; font-weight: 700; }
#order-list .no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; font-size: 13px; flex: none; }
#order-list .facts { font-size: 14px; color: var(--soft); margin: 4px 0 8px; line-height: 1.4; }
#order-list .facts b { color: var(--ink); font-family: var(--mono); font-size: 15px; }
#order-list .entry { display: flex; align-items: center; gap: 8px; font-size: 14px; }
#order-list input { width: 84px; padding: 8px 10px; font: 700 18px var(--mono); color: var(--ink); background: #fff; border: 2px solid #8a5a2b; border-radius: 8px; text-align: center; }
#order-list input:focus-visible { outline: 3px solid rgba(46, 58, 102, .4); outline-offset: 1px; }
#order-list .cost { margin-left: auto; font-size: 13px; color: var(--gold); font-weight: 700; }
#order-list svg { display: block; margin: 2px 0 8px; }
#strip { margin-top: 12px; }
#strip-cells { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; margin-top: 5px; }
#strip-cells span { font: 11px var(--mono); text-align: center; padding: 3px 0; border-radius: 4px; background: var(--paper-2); color: var(--soft); white-space: nowrap; }
#strip-cells span b { display: block; color: var(--ink); font-size: 13px; }
#orders .actions { margin-top: 14px; }
#orders-rule { margin-top: auto; padding-top: 10px; }
@media (max-width: 860px), (orientation: portrait) {
  #play { grid-template-columns: 1fr; grid-template-rows: minmax(0, 46vh) minmax(0, 1fr); }
  #orders { border-left: 0; border-top: 3px solid #8a5a2b; }
  #clock-label, #gold-line span { display: none; }
}

/* ---- panels ---- */
#screens { position: fixed; inset: 0; pointer-events: none; }
.screen { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; pointer-events: auto; overflow: auto; background: rgba(35, 22, 13, .72); }
.screen.title { place-items: end start; padding: clamp(18px, 6vw, 80px); background: linear-gradient(180deg, rgba(35, 22, 13, .1), rgba(35, 22, 13, .9) 78%), var(--night) center / cover no-repeat; }
#s-load { background: var(--night); }
.loading { color: #c9b48a; font-family: var(--serif); font-style: italic; }
.title-card { max-width: 640px; color: #f4e7c9; }
.title-card .eyebrow { color: #ffcf7a; }
.title-card h1 { font-family: var(--serif); font-size: clamp(38px, 7.5vw, 86px); line-height: 1; margin: 8px 0 16px; font-weight: 700; color: #fff4dc; text-shadow: 0 3px 24px rgba(0, 0, 0, .6); }
.lead { font-size: clamp(15px, 1.8vw, 19px); line-height: 1.55; color: #f1e2c2; max-width: 56ch; }
.title-card .fine { color: #c9b48a; }
.panel { width: min(100%, 720px); max-height: 100%; overflow: auto; padding: clamp(18px, 3vw, 30px); background: var(--paper); border: 1px solid #8a5a2b; border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, .55), inset 0 0 0 4px rgba(138, 90, 43, .12); }
.panel.narrow { width: min(100%, 560px); }
.panel.wide { width: min(100%, 900px); }
.panel h2 { font-family: var(--serif); font-size: clamp(22px, 3.2vw, 34px); line-height: 1.15; margin: 6px 0 12px; }
.say { font-size: clamp(15px, 1.7vw, 18px); line-height: 1.55; }
.rule { margin-top: 12px; padding: 9px 12px; font-size: 14px; line-height: 1.5; border-left: 3px solid var(--gold); background: rgba(176, 125, 18, .1); border-radius: 0 8px 8px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; align-items: center; }
.actions .right { margin-left: auto; }
.btn { padding: 11px 20px; min-height: 44px; border-radius: 9px; border: 1px solid #8a5a2b; background: transparent; font-weight: 700; transition: transform .12s ease-out, background .15s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff7e6; box-shadow: 0 6px 18px rgba(161, 48, 31, .3); }
.btn.primary:hover { background: #b83a27; }
.btn.primary:disabled { background: #b9a88a; border-color: #b9a88a; box-shadow: none; cursor: not-allowed; }
.btn.ghost:hover { background: rgba(138, 90, 43, .12); }
.title-card .btn.ghost { color: #f4e7c9; border-color: rgba(244, 231, 201, .5); }
.btn:focus-visible, .panel input:focus-visible { outline: 3px solid rgba(46, 58, 102, .5); outline-offset: 2px; }
label { display: block; margin-top: 14px; font-size: 13px; color: var(--soft); }
.panel input { display: block; width: 100%; margin-top: 6px; padding: 11px 12px; font: inherit; color: var(--ink); background: #fffaf0; border: 1px solid #8a5a2b; border-radius: 8px; }

.missions { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.missions li { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fbf3de; }
.missions li.open { cursor: pointer; }
.missions li.open:hover { border-color: var(--red); background: #fff8e6; }
.missions li.locked { opacity: .5; }
.missions .no { font-family: var(--serif); font-size: 24px; color: var(--red); }
.missions .t { font-family: var(--serif); font-weight: 700; font-size: 18px; }
.missions .d { font-size: 13px; color: var(--soft); margin-top: 2px; }
.missions .s { font-size: 14px; color: var(--gold); white-space: nowrap; font-weight: 700; }

.panel.brief { width: min(100%, 980px); display: grid; grid-template-columns: 170px 1fr; gap: clamp(14px, 3vw, 30px); }
.chief { text-align: center; }
.portrait { width: 100%; aspect-ratio: 1 / 1; border-radius: 10px; border: 2px solid #8a5a2b; background: #c9a56a center / cover no-repeat; }
.chief .name { margin-top: 8px; font-family: var(--serif); font-weight: 700; }
.brief-body { min-width: 0; display: flex; flex-direction: column; }
.show { margin-top: 16px; min-height: 170px; display: grid; place-items: center; padding: 14px; border-radius: 10px; border: 1px dashed #8a5a2b; background: #fbf3de; font-family: var(--mono); }
.brief-body .actions { margin-top: auto; padding-top: 18px; }
@media (max-width: 640px) { .panel.brief { grid-template-columns: 1fr; } .chief { display: flex; align-items: center; gap: 12px; text-align: left; } .portrait { width: 64px; } }

/* pictures inside a briefing */
.v-scene { text-align: center; font-family: var(--serif); }
.v-scene .place { font-size: clamp(22px, 3.4vw, 34px); font-weight: 700; color: var(--red); }
.v-scene .sec { margin-top: 6px; font: 12px var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--soft); }
.v-chain { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; font-size: clamp(17px, 2.4vw, 24px); font-weight: 700; }
.v-chain .by { font: 600 12px var(--sans); color: var(--red); display: flex; flex-direction: column; align-items: center; max-width: 110px; text-align: center; }
.v-chain .by::after { content: "→"; font-size: 20px; color: var(--indigo); line-height: 1; }
.v-compare { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.v-compare .side { text-align: center; }
.v-compare .big { font-size: clamp(20px, 3vw, 30px); font-weight: 700; }
.v-compare .sub { font: 12px var(--sans); color: var(--soft); margin-top: 4px; }
.v-compare .v { font: 600 13px var(--sans); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--indigo); color: var(--indigo); background: rgba(46, 58, 102, .08); }
.v-table { border-collapse: collapse; font-size: 17px; }
.v-table th, .v-table td { padding: 6px 18px; border-bottom: 1px solid var(--line); text-align: center; }
.v-table th { font: 600 12px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--red); }
.v-table td:first-child { color: var(--soft); }
.v-squares { display: grid; grid-template-columns: repeat(auto-fit, minmax(54px, 1fr)); gap: 5px; width: 100%; }
.v-squares span { text-align: center; padding: 5px 0; border-radius: 6px; background: var(--paper-2); font-size: 12px; color: var(--soft); }
.v-squares span b { display: block; font-size: 16px; color: var(--ink); }
.show svg { max-width: 100%; height: auto; }
.practice { display: grid; gap: 12px; justify-items: center; width: 100%; font-family: var(--sans); }
.practice .ask { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; font-size: 15px; }
.practice input { width: 90px; padding: 9px 10px; font: 700 20px var(--mono); text-align: center; border: 2px solid #8a5a2b; border-radius: 8px; background: #fff; color: var(--ink); }
.practice .result { font-size: 15px; line-height: 1.5; text-align: center; max-width: 60ch; }
.practice .result.good { color: var(--good); } .practice .result.bad { color: var(--bad); }

/* debrief */
.people { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.people li { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fbf3de; }
.people li.good { border-color: rgba(47, 107, 58, .6); }
.people li.bad { border-color: rgba(161, 48, 31, .7); background: #fbe9e2; }
.people .badge { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
.people li.good .badge { color: var(--good); } .people li.bad .badge { color: var(--bad); }
.people .data { font-family: var(--mono); font-weight: 700; font-size: 15px; }
.people .why { font-size: 14px; line-height: 1.5; margin-top: 3px; color: #4a3520; }
@media (max-width: 560px) { .people li { grid-template-columns: 1fr; } }
.stars { font-size: 40px; letter-spacing: .1em; color: var(--gold); margin: 6px 0 10px; }
.stars i { font-style: normal; opacity: .25; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
