:root {
  --night: #16222c; --ink: #2b2118; --ink-soft: #5d4e3d;
  --parch: #f3e9d2; --parch-2: #e9dcbd; --parch-edge: #c8a96a; --gold: #d8a93b; --gold-2: #f0c95a;
  --red: #c0392b; --red-2: #9e2a1f; --pine: #2f5d3a; --wood: #5b3a22; --wood-2: #7a5230;
  --good: #3f8a46; --bad: #c0392b;
  --display: "Fredoka", "Alegreya Sans", system-ui, sans-serif; --brand: "Cinzel", Georgia, serif;
  --body: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--night); font-family: var(--body); color: var(--ink); font-size: 17px; font-variant-numeric: lining-nums;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
#map { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; cursor: pointer; color: inherit; }
button:focus-visible { outline: 3px solid var(--gold-2); outline-offset: 2px; }
img { display: block; }
h2, h3, h4 { font-family: var(--display); font-weight: 600; margin: 0; letter-spacing: 0; }
.good { color: var(--good); } .bad { color: var(--bad); } .dim { color: var(--ink-soft); font-size: 15px; }

/* key caps: the same everywhere */
.kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 5px; font: 800 14px/1 var(--body);
  background: linear-gradient(#fffaf0, #e8dcc0); color: #3a2a18; border: 1px solid #8a6a3a; box-shadow: 0 2px 0 #8a6a3a; vertical-align: middle; white-space: nowrap; }

/* surfaces and buttons */
.parch { background: radial-gradient(ellipse at 30% 20%, #faf3e2 0%, var(--parch) 55%, var(--parch-2) 100%); border: 2px solid var(--parch-edge);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5), inset 0 0 24px rgba(160, 120, 60, 0.18), var(--shadow); border-radius: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 2px solid #7a2a1e; background: linear-gradient(#d04a3a, var(--red) 55%, var(--red-2)); color: #fff7e6;
  font-weight: 800; padding: 10px 18px; border-radius: 10px; min-height: 48px; font-size: 17px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 3px 0 #5a1a12, 0 6px 14px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); transition: transform 0.08s, filter 0.15s; }
.btn:hover:not([disabled]) { filter: brightness(1.1); transform: translateY(-1px); }
.btn:active:not([disabled]) { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 1px 0 #5a1a12; }
.btn[disabled] { filter: grayscale(0.7) brightness(0.85); cursor: default; opacity: 0.55; }
.btn.gold { border-color: #8a6414; background: linear-gradient(#f5d36a, var(--gold) 60%, #b8862a); color: #3a2408; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 3px 0 #6a4a10, 0 6px 14px rgba(0, 0, 0, 0.3); }
.btn.wood { border-color: #3a2412; background: linear-gradient(#8a6038, var(--wood-2) 55%, var(--wood)); color: #fbeedb; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 3px 0 #2a1a0c, 0 6px 14px rgba(0, 0, 0, 0.3); }
.btn.ghost { background: rgba(255, 248, 230, 0.1); border-color: rgba(255, 240, 210, 0.6); color: #fff4dc; box-shadow: none; }
.btn.small { padding: 6px 12px; min-height: 40px; font-size: 15px; }
.btn.big { padding: 12px 26px; font-size: 20px; font-family: var(--display); min-height: 56px; }
.btn .kbd { margin-left: 2px; }
.icon-btn { width: 46px; height: 46px; border-radius: 10px; border: 1px solid rgba(240, 210, 150, 0.45); background: rgba(255, 240, 210, 0.08); color: #f6e7c8; font-size: 22px; display: grid; place-items: center; }
.icon-btn:hover { background: rgba(255, 240, 210, 0.18); }
.icon-btn img { width: 28px; height: 28px; }
.icon-btn.off { opacity: 0.45; }
.cost { display: inline-flex; gap: 10px; flex-wrap: wrap; font-weight: 800; font-size: 19px; font-variant-numeric: lining-nums tabular-nums; align-items: center; }
.cost span { display: inline-flex; align-items: center; gap: 3px; }
.cost img { width: 26px; height: 26px; }
.cost .short { color: var(--bad); }
.cost.lock { color: var(--ink-soft); font-size: 14px; font-weight: 700; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 8px; border-radius: 5px; background: rgba(90, 60, 30, 0.12); color: var(--ink-soft); }

/* ---------- top bar ---------- */
#top { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: calc(6px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 6px max(12px, env(safe-area-inset-left, 0px));
  background: linear-gradient(#3b2716, #2a1b0f); border-bottom: 3px solid var(--gold); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45); color: #f6e7c8; }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand img { width: 38px; height: 44px; }
.brand b { font-family: var(--brand); font-size: 19px; letter-spacing: 0.12em; display: block; line-height: 1; color: #ffe9b0; }
.brand small { font-size: 14px; color: #d8c49a; }
.resbar { display: flex; gap: 6px; flex: 1; justify-content: safe center; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.chip { display: flex; align-items: center; gap: 6px; padding: 4px 12px 4px 6px; border-radius: 24px; background: rgba(255, 240, 210, 0.08); border: 1px solid rgba(240, 210, 150, 0.22); cursor: default; white-space: nowrap; transition: transform 0.15s; }
.chip:hover { background: rgba(255, 240, 210, 0.16); }
.chip img { width: 30px; height: 30px; }
.chip b { font-size: 20px; font-variant-numeric: lining-nums tabular-nums; color: #fff4dc; }
.chip b i { font-style: normal; font-size: 15px; color: #d8c49a; }
.chip small { font-size: 14px; font-weight: 800; font-variant-numeric: lining-nums tabular-nums; }
.chip small.up { color: #a8f08a; } .chip small.down { color: #ffb0a0; }
.chip.warn { border-color: #ff8a6a; background: rgba(192, 57, 43, 0.3); animation: pulse 1.2s infinite; }
.chip.bump { animation: bump 0.35s; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(255, 120, 90, 0.25); } }
@keyframes bump { 40% { transform: scale(1.18); background: rgba(255, 230, 140, 0.35); } }
.calendar { display: flex; align-items: center; gap: 10px; }
.calendar .yr { font-size: 14px; color: #d8c49a; font-weight: 700; }
.season-badge { font-family: var(--display); font-weight: 700; font-size: 17px; padding: 5px 14px; border-radius: 8px; color: #fff; border: 1px solid rgba(255, 255, 255, 0.35); text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4); }
.season-badge.spring { background: linear-gradient(#7cc062, #4f9a3e); } .season-badge.summer { background: linear-gradient(#e0b03a, #b8862a); }
.season-badge.autumn { background: linear-gradient(#d8702a, #a84a1e); } .season-badge.winter { background: linear-gradient(#6aa0c8, #3a6a94); }
.pips { display: flex; gap: 4px; margin-top: 3px; }
.pips i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(255, 240, 210, 0.5); }
.pips i.done { background: var(--gold); border-color: var(--gold-2); } .pips i.now { background: #fff4dc; box-shadow: 0 0 8px #fff4dc; } .pips i.boss { border-color: #ff8a7a; border-width: 2px; }
.gauges { display: flex; gap: 12px; }
.gauge { display: flex; align-items: center; gap: 6px; cursor: default; }
.gauge img { width: 28px; height: 28px; }
.gauge b { font-variant-numeric: lining-nums tabular-nums; font-size: 18px; color: #fff4dc; min-width: 28px; }
.meter { width: 86px; height: 11px; border-radius: 6px; background: rgba(0, 0, 0, 0.45); overflow: hidden; border: 1px solid rgba(255, 240, 210, 0.25); }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, #c0392b, #ff704a); transition: width 0.4s; }
.meter.morale i { background: linear-gradient(90deg, #d8a93b, #ffe080); }
.sys { display: flex; gap: 6px; }

/* ---------- dock (right) ---------- */
.dock { position: fixed; right: max(10px, env(safe-area-inset-right, 0px)); top: calc(80px + env(safe-area-inset-top, 0px)); z-index: 16; display: grid; gap: 8px; }
.dock-btn { position: relative; width: 58px; height: 58px; border-radius: 14px; border: 2px solid var(--gold); background: linear-gradient(#3b2716, #2a1b0f); display: grid; place-items: center; box-shadow: var(--shadow); transition: transform 0.1s; }
.dock-btn:hover { transform: translateX(-3px); }
.dock-btn.on { background: var(--parch); }
.dock-btn img { width: 34px; height: 34px; }
.dock-btn .badge { position: absolute; left: -10px; bottom: -6px; min-width: 24px; padding: 2px 6px; border-radius: 10px; background: var(--red); color: #fff; font-weight: 800; font-size: 14px; border: 2px solid #fff4dc; }
.dock-panel { position: fixed; right: calc(80px + env(safe-area-inset-right, 0px)); top: calc(80px + env(safe-area-inset-top, 0px)); z-index: 17; width: 360px; max-height: calc(100vh - 260px); overflow-y: auto; padding: 14px 16px; font-size: 17px; animation: slidein 0.18s; }
@keyframes slidein { from { transform: translateX(12px); opacity: 0; } }
.dock-panel h4 { display: flex; align-items: center; gap: 8px; font-size: 17px; color: var(--wood); margin: 4px 0 8px; }
.wave { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px dashed rgba(120, 90, 50, 0.3); }
.wave.gone { opacity: 0.45; }
.wave .num { font-family: var(--display); font-weight: 700; font-size: 18px; width: 20px; color: var(--red); }
.wave .gate { font-weight: 800; width: 104px; font-size: 15px; color: var(--ink-soft); }
.foes { display: flex; flex-wrap: wrap; gap: 2px 8px; }
.foe { display: inline-flex; align-items: center; font-weight: 800; font-size: 15px; }
.foe img { width: 34px; height: 34px; margin-right: -2px; }
.foe.boss { color: var(--red); }
.wline { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.wline img { width: 40px; height: 40px; flex: none; }
.wline div { flex: 1; }
.wline b { display: block; font-size: 17px; }
.wline small { color: var(--ink-soft); font-size: 15px; }
.progress { height: 12px; border-radius: 6px; background: rgba(90, 60, 30, 0.15); overflow: hidden; margin: 10px 0 6px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); }
.row.sp { justify-content: space-between; font-weight: 700; font-size: 15px; }
.mini-icons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.mini-icons span { display: inline-flex; align-items: center; gap: 5px; font-size: 15px; font-weight: 700; padding: 3px 10px 3px 4px; border-radius: 14px; background: rgba(90, 60, 30, 0.1); }
.mini-icons img { width: 22px; height: 22px; }
.close-x { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 26px; line-height: 1; color: var(--ink-soft); padding: 4px 8px; }

/* ---------- minimap ---------- */
.minimap { position: fixed; left: max(10px, env(safe-area-inset-left, 0px)); bottom: calc(var(--bar-h, 214px) + 8px); transition: bottom 0.25s; z-index: 15; padding: 6px; border-radius: 12px; background: linear-gradient(#3b2716, #2a1b0f); border: 2px solid var(--gold); box-shadow: var(--shadow); }
.minimap canvas { display: block; width: 240px; height: auto; border-radius: 5px; cursor: pointer; }
.minimap.closed canvas { display: none; }
.mini-tools { display: flex; gap: 4px; margin-top: 5px; }
.mini-btn { flex: 1; font-size: 14px; font-weight: 800; padding: 4px 4px; border-radius: 6px; border: 1px solid rgba(240, 210, 150, 0.35); background: rgba(255, 240, 210, 0.06); color: #e8d8b8; display: inline-flex; gap: 4px; align-items: center; justify-content: center; }
.mini-btn.on { background: rgba(240, 201, 90, 0.25); color: #fff4dc; }
#btn-mini { flex: 0 0 34px; }

/* ---------- info panel (left) ---------- */
.info { position: fixed; left: max(10px, env(safe-area-inset-left, 0px)); top: calc(78px + env(safe-area-inset-top, 0px)); width: 350px; z-index: 16; padding: 16px; max-height: calc(100vh - 460px); min-height: 120px; overflow-y: auto; font-size: 17px; animation: slidein 0.15s; }
.info .head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; padding-right: 20px; }
.info .head img { width: 72px; height: 72px; background: rgba(90, 60, 30, 0.08); border-radius: 10px; border: 1px solid rgba(120, 90, 50, 0.25); object-fit: contain; }
.info h3 { font-size: 22px; line-height: 1.1; color: var(--wood); }
.stars { color: var(--gold); letter-spacing: 2px; font-size: 17px; }
.stars .off { color: rgba(120, 90, 50, 0.3); }
.info .desc { margin: 6px 0; line-height: 1.35; }
.info .rows { display: grid; gap: 4px; margin: 8px 0; }
.info .rows div { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-bottom: 1px dotted rgba(120, 90, 50, 0.3); padding-bottom: 3px; }
.info .rows b { font-variant-numeric: lining-nums tabular-nums; display: inline-flex; align-items: center; gap: 4px; text-align: right; }
.yl { display: inline-flex; align-items: center; gap: 2px; }
.info .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.mk-gi { display: inline-flex; gap: 1px; vertical-align: middle; }
.mk-gi img { width: 18px; height: 18px; }
.mk-tt { display: grid; grid-template-columns: auto repeat(5, minmax(30px, auto)); gap: 3px 8px; align-items: center; justify-items: center; }
.mk-tt b { justify-self: start; font-weight: 600; opacity: 0.8; white-space: nowrap; }
.mk-tt span { font-variant-numeric: tabular-nums; }
.mk-tt i { opacity: 0.5; font-style: normal; padding: 0 1px; }
.mk-tt .now { color: #9be37d; opacity: 1; font-weight: 700; }
.refund { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.refund > span { display: inline-flex; align-items: center; gap: 1px; }
.refund img { width: 20px; height: 20px; }
.refund.none { font-weight: 600; font-size: 13px; opacity: 0.8; }
.info .why { color: var(--bad); font-weight: 700; margin-top: 6px; }
.info .ok { color: var(--good); font-weight: 800; margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.info .note { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.info .region { margin: 10px 0 4px; }
.info .region b { font-size: 18px; display: block; margin-bottom: 4px; }
.upgrade-box { margin-top: 10px; padding: 10px; border-radius: 10px; background: rgba(216, 169, 59, 0.14); border: 1px solid rgba(216, 169, 59, 0.5); }
.cost-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.spec { text-align: left; border-radius: 10px; padding: 10px 12px; border: 2px solid var(--parch-edge); background: linear-gradient(#fffaf0, #f3e6c8); box-shadow: 0 2px 0 #a8884a; }
.spec:hover:not([disabled]) { border-color: var(--red); }
.spec b { display: block; font-size: 16px; color: var(--wood); }
.spec small { font-size: 14px; line-height: 1.25; display: block; }
.spec[disabled] { opacity: 0.5; }

/* ---------- build bar ---------- */
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 18; display: flex; align-items: flex-end; gap: 12px;
  padding: 8px max(12px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  background: linear-gradient(rgba(42, 27, 15, 0), rgba(42, 27, 15, 0.94) 26%, #2a1b0f); pointer-events: none; }
.bar > * { pointer-events: auto; }
.bar-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px 0 6px; border-radius: 10px; border: 1px solid rgba(240, 210, 150, 0.35); background: rgba(255, 240, 210, 0.08); color: #f3e9d2; font-weight: 800; font-size: 15px; }
.tab img { width: 26px; height: 26px; }
.tab:hover { background: rgba(255, 240, 210, 0.16); }
.tab.on { background: var(--parch); color: var(--wood); border-color: var(--gold); box-shadow: 0 0 0 2px rgba(240, 201, 90, 0.4); }
.cards { display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px 4px; }
.bcard { flex: none; width: 132px; border-radius: 12px; padding: 6px 6px 8px; text-align: center; position: relative; background: linear-gradient(#fbf4e3, var(--parch)); border: 2px solid var(--parch-edge);
  box-shadow: 0 3px 0 #8a6a3a, 0 6px 12px rgba(0, 0, 0, 0.3); transition: transform 0.1s; }
.bcard:hover { transform: translateY(-4px); }
.bcard.sel { border-color: var(--red); box-shadow: 0 0 0 3px rgba(240, 201, 90, 0.8), 0 3px 0 #8a6a3a; transform: translateY(-6px); }
.bcard img.pic { width: 84px; height: 72px; margin: 0 auto; object-fit: contain; }
.bcard .nm { font-weight: 800; font-size: 15px; line-height: 1.1; min-height: 34px; display: flex; align-items: center; justify-content: center; color: var(--wood); }
.bcard .cost { justify-content: center; gap: 6px; font-size: 18px; }
.bcard .cost img { width: 24px; height: 24px; }
.bcard > .kbd { position: absolute; left: 5px; top: 5px; }
.bcard .wk { position: absolute; right: 6px; top: 5px; display: flex; align-items: center; gap: 1px; font-size: 14px; font-weight: 800; color: var(--ink-soft); }
.bcard .wk img { width: 16px; height: 16px; }
.bcard.poor { filter: saturate(0.5); opacity: 0.8; }
/* start of a run: the Woodcutter comes first (it is free), everything else waits */
.bcard.must { border-color: #e0a92e; box-shadow: 0 0 0 3px #f0c95a, 0 0 22px rgba(255, 196, 70, 0.75); animation: mustPulse 1.3s ease-in-out infinite; }
.bcard.wait { filter: saturate(0.35); opacity: 0.55; }
.bcard .must-tag { position: absolute; left: 50%; top: -12px; transform: translateX(-50%); white-space: nowrap; padding: 2px 10px; border-radius: 999px; background: linear-gradient(#ffe9a0, #e8b840); color: #4a2e08; font: 700 13px var(--display); box-shadow: 0 2px 0 #a87a20; z-index: 2; }
.bcard .cost.free { display: inline-block; padding: 1px 10px; border-radius: 999px; background: #dff2d6; color: #2f6b3d; font: 700 15px var(--display); }
@keyframes mustPulse { 50% { box-shadow: 0 0 0 3px #f0c95a, 0 0 32px rgba(255, 196, 70, 0.95); transform: translateY(-3px); } }
.bcard.locked { filter: grayscale(1); opacity: 0.5; }
.endbox { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 190px; }
.endbox .hint { color: #e8d8b8; font-size: 14px; text-align: center; }

/* ---------- winter bar ---------- */
.winterbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 18; display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; border-radius: 16px; background: linear-gradient(#24384a, #182633); border: 2px solid #8fc3e0; box-shadow: var(--shadow); color: #eaf6ff; max-width: calc(100vw - 20px); }
.wb-waves { min-width: 230px; }
.wb-waves .lbl { font-size: 15px; color: #cfe6f2; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.wb-waves .lbl span { display: inline-flex; gap: 4px; align-items: center; }
.wb-track { position: relative; height: 12px; border-radius: 6px; background: rgba(255, 255, 255, 0.14); margin-top: 6px; }
.wb-track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: linear-gradient(90deg, #8fc3e0, #e8f6ff); }
.wb-track .mark { position: absolute; top: -4px; width: 4px; height: 20px; background: #ff8a7a; border-radius: 2px; }
.wb-track .mark.av { background: #ffffff; }
.powers { display: flex; gap: 8px; }
.power { position: relative; width: 66px; height: 66px; border-radius: 12px; border: 2px solid #8fc3e0; background: linear-gradient(#35506a, #22384c); display: grid; place-items: center; transition: transform 0.1s; }
.power:hover { transform: translateY(-3px); }
.power img { width: 40px; height: 40px; }
.power > .kbd { position: absolute; left: -6px; top: -8px; }
.power .c { position: absolute; right: 3px; bottom: 2px; display: flex; align-items: center; font-size: 14px; font-weight: 800; }
.power .c img { width: 16px; height: 16px; }
.power .cd { position: absolute; inset: 0; border-radius: 10px; background: rgba(10, 20, 30, 0.68); display: grid; place-items: center; font-weight: 800; font-size: 20px; }
.power .cd.lock { font-size: 16px; color: #ffb0a0; background: rgba(10, 20, 30, 0.55); }
.power.ready { box-shadow: 0 0 0 3px rgba(143, 195, 224, 0.4), 0 0 18px rgba(143, 195, 224, 0.35); }
.power.arm { border-color: var(--gold-2); box-shadow: 0 0 0 4px rgba(240, 201, 90, 0.6); animation: pulse 0.8s infinite; }
.speed { display: flex; gap: 6px; }
.speed button { min-width: 54px; height: 46px; border-radius: 10px; border: 1px solid rgba(143, 195, 224, 0.5); background: rgba(255, 255, 255, 0.08); color: #eaf6ff; font-weight: 800; font-size: 16px; display: inline-flex; gap: 4px; align-items: center; justify-content: center; padding: 0 6px; }
.speed button.on { background: #eaf6ff; color: #182633; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(10, 14, 20, 0.45), rgba(10, 14, 20, 0.8));
  padding: max(14px, env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) max(14px, env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px)); animation: fade 0.2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: min(960px, 100%); max-height: 100%; overflow-y: auto; padding: 24px 28px; position: relative; animation: rise 0.28s cubic-bezier(.2, .9, .3, 1.2); }
.sheet.narrow { width: min(680px, 100%); }
.sheet.keep { animation: none; }
@keyframes rise { from { transform: translateY(20px) scale(0.98); opacity: 0; } }
.sheet .eyebrow { font-size: 14px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 800; color: var(--ink-soft); }
.sheet h2 { font-size: 34px; color: var(--wood); line-height: 1.05; margin: 4px 0 12px; display: flex; align-items: center; gap: 10px; }
.sheet h4 { font-size: 19px; color: var(--red); margin: 14px 0 8px; }
.sheet p.lead { font-size: 19px; line-height: 1.4; margin: 0 0 12px; }
.scene { width: 100%; height: auto; border-radius: 10px; border: 2px solid var(--parch-edge); display: block; margin-bottom: 14px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25); }
.choices { display: grid; gap: 10px; margin-top: 12px; }
.choice { text-align: left; border-radius: 12px; padding: 12px 16px; border: 2px solid var(--parch-edge); background: linear-gradient(#fffaf0, #f6ecd6); box-shadow: 0 3px 0 #a8884a; display: flex; align-items: center; gap: 12px; min-height: 60px; }
.choice:hover:not([disabled]) { border-color: var(--red); transform: translateX(3px); }
.choice b { font-size: 20px; flex: 1; font-family: var(--display); font-weight: 600; }
.choice small { color: var(--ink); font-size: 18px; font-weight: 700; line-height: 1.3; text-align: right; max-width: 60%; }
.choice[disabled] { opacity: 0.5; cursor: default; }
.draft { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 14px 0; }
.dcard { text-align: left; border-radius: 14px; padding: 14px 16px 16px; border: 2px solid var(--parch-edge); background: linear-gradient(#fffaf0, #f3e6c8); box-shadow: 0 4px 0 #a8884a, 0 8px 18px rgba(0, 0, 0, 0.18);
  display: grid; gap: 6px; align-content: start; transition: transform 0.12s, border-color 0.12s; position: relative; }
.dcard:hover { transform: translateY(-5px); border-color: var(--red); }
.dcard > .kbd { position: absolute; left: 10px; top: 10px; z-index: 1; }
.dcard .pic { width: 100%; height: 130px; object-fit: contain; background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.85), rgba(220, 200, 160, 0.25)); border-radius: 10px; }
.dcard .kind { font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 800; }
.dcard .kind.blueprint { color: #1f4f8a; } .dcard .kind.relic { color: #8a6414; } .dcard .kind.boon { color: var(--pine); }
.dcard .t { font-family: var(--display); font-size: 22px; font-weight: 600; color: var(--wood); line-height: 1.1; }
.dcard .d { font-size: 17px; line-height: 1.35; }
.dcard .pro { color: var(--good); font-weight: 800; } .dcard .con { color: var(--bad); font-weight: 800; }
.dcard .pro::before { content: "+ "; } .dcard .con::before { content: "− "; }
.law-seal { position: absolute; right: 12px; top: 12px; width: 40px; height: 40px; }
.spring-info { display: flex; flex-wrap: wrap; gap: 8px 14px; font-weight: 700; }
.spring-info span { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 16px; background: rgba(90, 60, 30, 0.1); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.row.end { justify-content: flex-end; }
.goals { display: grid; gap: 10px; margin: 6px 0 4px; }
.goals div { display: flex; gap: 12px; align-items: center; font-size: 17px; line-height: 1.35; }
.goals img { flex: none; }
.hint-line { color: var(--ink-soft); font-size: 15px; }
.upkeep { display: grid; gap: 8px; margin: 10px 0; }
.upkeep div { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.5); border: 1px solid rgba(120, 90, 50, 0.2); font-size: 17px; }
.upkeep div.warn { background: rgba(192, 57, 43, 0.1); border-color: rgba(192, 57, 43, 0.5); }
.upkeep div > span:last-child { font-weight: 800; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 12px 0; }
.stat { background: rgba(255, 255, 255, 0.55); border: 1px solid rgba(120, 90, 50, 0.25); border-radius: 10px; padding: 10px 12px; display: grid; justify-items: start; gap: 2px; }
.stat b { font-family: var(--display); font-weight: 700; font-size: 28px; color: var(--wood); font-variant-numeric: lining-nums tabular-nums; }
.stat span { font-size: 14px; color: var(--ink-soft); font-weight: 800; }
.chron { max-height: 200px; overflow-y: auto; border-left: 3px solid var(--parch-edge); padding-left: 12px; margin: 10px 0; font-size: 15px; line-height: 1.4; }
.chron p { margin: 3px 0; }
.chron .y { font-family: var(--display); font-weight: 700; color: var(--red); margin-right: 8px; }
.clans { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin: 12px 0; }
.clan { position: relative; text-align: center; border-radius: 14px; padding: 14px 12px; border: 2px solid var(--parch-edge); background: linear-gradient(#fffaf0, #f3e6c8); display: grid; gap: 6px; justify-items: center; }
.clan > .kbd { position: absolute; left: 8px; top: 8px; }
.clan > img { width: 64px; height: 74px; }
.clan.sel { border-color: var(--red); box-shadow: 0 0 0 3px rgba(240, 201, 90, 0.7); }
.clan.locked > :not(.unlock) { filter: grayscale(1); opacity: 0.55; }
.clan .tag.unlock { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px 6px; max-width: 100%; box-sizing: border-box; margin-top: 4px; padding: 6px 10px; border-radius: 10px; text-transform: none; letter-spacing: 0; background: #fff6d6; border: 1px solid #e0c070; color: #6a4a10; }
.clan .tag.unlock img { width: 20px; height: 20px; }
.clan .tag.unlock b { font: 700 20px var(--display); color: #4a3008; }
.clan .tag.unlock small { width: 100%; font-size: 13px; font-weight: 700; }
.clan b { font-family: var(--display); font-size: 17px; color: var(--wood); }
.clan ul { margin: 2px 0 0; padding-left: 18px; text-align: left; font-size: 15px; line-height: 1.35; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 8px; }
.mitem { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.5); border: 1px solid rgba(120, 90, 50, 0.25); }
.mitem.owned { background: rgba(63, 138, 70, 0.12); border-color: rgba(63, 138, 70, 0.4); }
.mitem b { color: var(--wood); font-size: 17px; }
.mitem small { display: block; color: var(--ink-soft); font-size: 15px; }
.mitem .lv { font-size: 14px; font-weight: 800; color: var(--good); }
.ew { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; }
.mini-icons.big span { font-size: 16px; }
.keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px 22px; margin-bottom: 10px; }
.krow { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px dotted rgba(120, 90, 50, 0.25); font-size: 16px; }
.krow span:last-child { margin-left: auto; text-align: right; color: var(--ink); }

/* ---------- toasts, tooltip, fly icons ---------- */
.toasts { position: fixed; top: calc(80px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 30; display: grid; gap: 6px; justify-items: center; pointer-events: none; }
.toast { padding: 10px 18px; border-radius: 12px; background: rgba(30, 22, 14, 0.94); color: #fff4dc; border: 1px solid var(--gold); font-weight: 800; font-size: 17px; box-shadow: var(--shadow); animation: toast 3.6s forwards; display: flex; gap: 10px; align-items: center; }
.toast.bad { border-color: #ff8a7a; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-8px); } 8% { opacity: 1; transform: none; } 85% { opacity: 1; } 100% { opacity: 0; } }
.tooltip { position: fixed; z-index: 50; max-width: 340px; padding: 12px 14px; border-radius: 12px; background: rgba(28, 20, 12, 0.96); color: #fbeedb; border: 2px solid var(--gold); font-size: 17px; line-height: 1.4; pointer-events: none; box-shadow: var(--shadow); }
.tt-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.tt-head b { font-size: 18px; color: #ffe9b0; font-family: var(--display); }
.tt-head img { width: 34px; height: 34px; object-fit: contain; }
.tt-lines div { margin: 2px 0; }
.tt-lines b { color: #ffe9b0; }
.tt-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; padding-top: 6px; border-top: 1px solid rgba(240, 210, 150, 0.25); font-weight: 800; }
.tt-stats span { display: inline-flex; gap: 4px; align-items: center; }
.tooltip .good { color: #a8f08a; } .tooltip .bad { color: #ffb0a0; } .tooltip .dim { color: #c8b898; font-size: 14px; }
.fly { position: fixed; z-index: 45; width: 28px; height: 28px; pointer-events: none; transition: transform 0.6s cubic-bezier(.4, 0, .6, 1), opacity 0.6s; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); }

/* ---------- title ---------- */
.title-screen { position: fixed; inset: 0; z-index: 35; display: grid; place-items: center; }
#title-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.title-inner { position: relative; text-align: center; display: grid; gap: 24px; justify-items: center; padding: 20px; }
.logo .pre { display: block; font-size: 14px; letter-spacing: 0.3em; text-transform: uppercase; color: #fff4dc; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6); }
.logo h1 { font-family: var(--brand); font-size: clamp(40px, 11vw, 124px); margin: 4px 0; letter-spacing: 0.14em; white-space: nowrap; color: #fff7e2; text-shadow: 0 3px 0 #8a5a2a, 0 6px 0 #5a3a1a, 0 12px 30px rgba(0, 0, 0, 0.55); }
.logo .sub2 { display: flex; align-items: center; justify-content: center; gap: 0.6em; margin: -2px 0 8px; font-family: var(--brand); font-size: clamp(20px, 4.2vw, 46px); letter-spacing: 0.3em; text-indent: 0.3em; color: #ffd98a; text-shadow: 0 2px 0 #6a4418, 0 4px 12px rgba(0, 0, 0, 0.6); white-space: nowrap; }
.logo .sub2::before, .logo .sub2::after { content: ""; width: clamp(24px, 6vw, 70px); height: 2px; background: linear-gradient(90deg, rgba(255, 217, 138, 0), #ffd98a); box-shadow: 0 1px 0 #6a4418; }
.logo .sub2::after { background: linear-gradient(90deg, #ffd98a, rgba(255, 217, 138, 0)); }
.logo .emblem { display: block; width: clamp(60px, 8vw, 96px); height: auto; margin: 0 auto 4px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45)); animation: emblemIn 0.7s cubic-bezier(.2, .9, .3, 1.3) both; }
@keyframes emblemIn { from { opacity: 0; transform: translateY(-10px) scale(0.85); } }
@media (max-height: 640px) { .logo .emblem { width: 48px; } }
.logo .sub { font-family: var(--display); font-weight: 600; font-size: clamp(17px, 2.6vw, 26px); color: #ffe9b0; letter-spacing: 0.08em; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7); }
.title-menu { display: grid; gap: 12px; min-width: 280px; }
.title-meta { color: #fff4dc; font-size: 16px; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); display: flex; gap: 16px; align-items: center; flex-wrap: wrap; justify-content: center; }

@media (max-width: 1600px) {
  .brand div { display: none; }
  .chip { padding: 3px 8px 3px 4px; } .chip img { width: 24px; height: 24px; } .chip b { font-size: 17px; }
  .meter { width: 60px; }
  .tab span { display: none; }
}
@media (max-width: 820px) {
  html, body { font-size: 15px; }
  #top { flex-wrap: wrap; gap: 4px 8px; padding-bottom: 4px; }
  .brand { order: 0; } .calendar { order: 1; flex: 1; min-width: 0; gap: 6px; } .sys { order: 2; gap: 4px; }
  .pips i { width: 9px; height: 9px; } .season-badge { font-size: 14px; padding: 4px 8px; }
  .gauges { order: 3; width: 100%; justify-content: space-between; } .gauge { flex: 1; } .meter { flex: 1; width: auto; }
  .resbar { order: 4; width: 100%; justify-content: flex-start; overflow-x: auto; flex: none; scrollbar-width: none; }
  .icon-btn { width: 34px; height: 34px; font-size: 17px; } .icon-btn img { width: 22px; height: 22px; }
  .dock { top: calc(124px + env(safe-area-inset-top, 0px)); right: 6px; gap: 6px; } .dock-btn { width: 46px; height: 46px; border-radius: 12px; } .dock-btn img { width: 28px; height: 28px; }
  .dock-panel { left: 8px; right: 62px; width: auto; top: calc(124px + env(safe-area-inset-top, 0px)); max-height: 45vh; }
  .minimap { display: none; }
  .info { top: auto; bottom: 214px; left: 8px; right: 8px; width: auto; max-height: 42vh; }
  .bar { flex-wrap: wrap; gap: 6px; align-items: center; }
  .bar-main { order: 2; flex: 1 1 100%; }
  .endbox { order: 1; margin-left: auto; min-width: 0; flex-direction: row; align-items: center; } .endbox .hint { display: none; }
  .bcard { width: 100px; } .bcard img.pic { width: 64px; height: 54px; } .bcard .nm { font-size: 14px; min-height: 28px; }
  .btn.big { font-size: 16px; padding: 8px 14px; min-height: 46px; }
  .winterbar { left: 6px; right: 6px; transform: none; flex-wrap: wrap; gap: 8px; justify-content: center; }
  .wb-waves { min-width: 0; flex: 1 1 100%; }
  .power { width: 54px; height: 54px; } .power img { width: 32px; height: 32px; }
  .sheet { padding: 16px; } .sheet h2 { font-size: 28px; }
  .kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- v4: modes, challenges ---------- */
.title-menu .btn.mode { display: flex; align-items: center; gap: 12px; text-align: left; padding: 8px 16px; min-height: 58px; }
.title-menu .btn.mode .mt { display: grid; }
.title-menu .btn.mode b { font-family: var(--display); font-size: 18px; }
.title-menu .btn.mode small { font-size: 14px; opacity: 0.85; font-weight: 600; }
.title-menu .btn.mode.locked { filter: grayscale(0.85) brightness(0.85); }
.title-menu .btn.mode.cont b { font-size: 22px; }
.title-menu .btn.mode.cont[hidden] { display: none; }
.replace-note { color: #8a3a20; }
.title-sub { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.title-menu .kbd { margin-right: 4px; }
.mut-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.mut-pick button { display: grid; grid-template-columns: 38px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; text-align: left; padding: 8px 10px; border-radius: 10px; border: 2px solid rgba(90, 60, 30, 0.35); background: rgba(255, 250, 235, 0.7); cursor: pointer; font: inherit; color: inherit; }
.mut-pick button img { grid-row: span 2; }
.mut-pick button small { font-size: 14px; opacity: 0.8; }
.mut-pick button.sel { border-color: #b8382a; background: rgba(255, 225, 200, 0.95); box-shadow: 0 0 0 2px rgba(184, 56, 42, 0.25); }
.mut-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.mut { display: inline-flex; align-items: center; gap: 6px; }
.mut.big { display: grid; grid-template-columns: 38px 1fr; column-gap: 8px; padding: 6px 10px; border-radius: 10px; background: rgba(255, 245, 225, 0.8); border: 1px solid rgba(90, 60, 30, 0.25); flex: 1 1 220px; }
.mut.big img { grid-row: span 2; }
.mut.big small { font-size: 14px; opacity: 0.8; }
.cal-mut { display: flex; gap: 2px; margin-left: 6px; }
.daily-row { display: flex; gap: 14px; align-items: center; margin: 8px 0; }
.daily-row div { display: grid; } .daily-row b { font-size: 20px; font-family: var(--display); } .daily-row small { opacity: 0.8; }
.endless-offer { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; margin: 12px 0; padding: 10px 14px; border-radius: 12px; background: linear-gradient(90deg, rgba(40, 70, 120, 0.12), rgba(255, 245, 220, 0.4)); border: 2px solid rgba(40, 70, 120, 0.35); }
.endless-offer div { display: grid; } .endless-offer small { opacity: 0.85; }
.dcard .law-seal { width: 72px; height: 72px; }
@media (max-width: 720px) { .title-menu .btn.mode { min-height: 50px; } .title-menu .btn.mode b { font-size: 16px; } .endless-offer { grid-template-columns: 40px 1fr; } .endless-offer .btn { grid-column: span 2; } }

.title-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.title-inner::before { content: ''; position: absolute; inset: -40px -140px; z-index: -1; background: radial-gradient(ellipse at 50% 45%, rgba(12, 22, 34, 0.5), rgba(12, 22, 34, 0.25) 45%, rgba(12, 22, 34, 0) 72%); pointer-events: none; }

.wk-change { display: grid; grid-template-columns: 26px 1fr; column-gap: 8px; align-items: center; margin-top: 8px; padding: 6px 10px; border-radius: 8px; background: rgba(60, 110, 60, 0.12); border: 1px solid rgba(60, 110, 60, 0.35); font-size: 16px; }
.wk-change img { grid-row: span 2; }
.wk-change i { font-style: normal; font-weight: 800; color: #2f6b3d; }
.wk-change small { font-size: 14px; opacity: 0.85; }
.wk-change.short { background: rgba(192, 57, 43, 0.12); border-color: rgba(192, 57, 43, 0.5); }
.wk-change.short i, .wk-change.short small { color: #a8321f; opacity: 1; font-weight: 700; }

.chip .stack { display: grid; line-height: 1.1; }
.chip .stack small { font-size: 14px; }
.endbox .hint.grow { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: 15px; }
.endbox .hint.grow.up { color: #a8f08a; } .endbox .hint.grow.down { color: #ffb0a0; }

/* scrollbars: wooden thumb in a parchment groove, the same on every panel */
::-webkit-scrollbar { width: 14px; height: 14px; }
::-webkit-scrollbar-track { background: rgba(120, 88, 48, 0.12); border-radius: 10px; box-shadow: inset 0 1px 3px rgba(90, 60, 30, 0.25); margin: 6px; }
::-webkit-scrollbar-thumb { background: linear-gradient(90deg, #b8874a, #8a5e32 55%, #6e4826); border: 3px solid transparent; background-clip: padding-box; border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 230, 180, 0.45); min-height: 40px; }
::-webkit-scrollbar-thumb:hover { background: linear-gradient(90deg, #f0c95a, #d8a93b 55%, #b07f22); background-clip: padding-box; border: 3px solid transparent; }
::-webkit-scrollbar-thumb:active { background: linear-gradient(90deg, #d8a93b, #a87a1e); background-clip: padding-box; border: 3px solid transparent; }
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; }
@supports not selector(::-webkit-scrollbar) { * { scrollbar-color: #8a5e32 rgba(120, 88, 48, 0.12); } }
.cards::-webkit-scrollbar { height: 10px; }

.upgrade-box .cost { font-size: 21px; } .upgrade-box .cost img { width: 30px; height: 30px; }

.gains { margin-top: 8px; padding: 8px 10px; border-radius: 9px; background: rgba(255, 250, 235, 0.7); border: 1px solid rgba(160, 120, 60, 0.3); }
.gains .g-head { font-family: var(--display); font-weight: 600; font-size: 15px; color: var(--ink-soft); margin-bottom: 4px; }
.g-row { display: grid; grid-template-columns: 26px 1fr auto auto auto; align-items: center; column-gap: 6px; font-size: 17px; padding: 2px 0; }
.g-row b { font-family: var(--display); font-weight: 600; font-variant-numeric: lining-nums tabular-nums; color: var(--ink-soft); }
.g-row b.up { color: var(--good); font-size: 19px; } .g-row b.down { color: var(--bad); font-size: 19px; }
.g-row i { font-style: normal; color: var(--gold); font-weight: 800; }
.spec { position: relative; } .spec > .kbd { position: absolute; right: 6px; top: 6px; }

/* the info panel may use the full height; the minimap steps aside while it is open */
.info { max-height: calc(100vh - var(--bar-h, 214px) - 100px); }
body.info-open .minimap { display: none; }

/* law cards: a big seal on top, then the gain and the cost in their own coloured boxes */
.lawcard { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 14px; border-radius: 16px; border: 2px solid var(--parch-edge);
  background: radial-gradient(ellipse at 50% 0%, #fffdf6, #f3e6c8 70%); box-shadow: 0 4px 0 #a8884a, 0 10px 20px rgba(0, 0, 0, 0.25); text-align: center; transition: transform 0.12s, border-color 0.12s; }
.lawcard:hover { transform: translateY(-6px); border-color: var(--red); }
.lawcard > .kbd { position: absolute; left: 12px; top: 12px; }
.lawcard .seal { width: 128px; height: 128px; filter: drop-shadow(0 6px 8px rgba(60, 30, 10, 0.3)); transition: transform 0.2s; }
.lawcard:hover .seal { transform: scale(1.06) rotate(-3deg); }
.lawcard .t { font-family: var(--display); font-weight: 600; font-size: 24px; color: var(--wood); line-height: 1.1; min-height: 2.2em; display: flex; align-items: center; justify-content: center; }
.lawcard .fx { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 12px; font-size: 17px; font-weight: 700; line-height: 1.3; }
.lawcard .fx .ico { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.7); }
.lawcard .fx .ico::after { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: #fff; font-weight: 800; }
.lawcard .fx.up { background: rgba(63, 138, 70, 0.14); border: 1px solid rgba(63, 138, 70, 0.45); color: #245a2a; }
.lawcard .fx.up .ico::after { content: '▲'; background: var(--good); }
.lawcard .fx.down { background: rgba(192, 57, 43, 0.1); border: 1px solid rgba(192, 57, 43, 0.4); color: #8a2418; }
.lawcard .fx.down .ico::after { content: '▼'; background: var(--bad); }

/* relic reveal reel */
.reel { position: relative; overflow: hidden; height: 150px; margin: 14px 0; border-radius: 14px; background: radial-gradient(ellipse at center, #fffaf0, #e9d8b0); border: 2px solid var(--parch-edge); box-shadow: inset 0 0 30px rgba(120, 80, 30, 0.35); }
.reel-strip { display: flex; height: 100%; align-items: center; transition: transform 3s cubic-bezier(0.12, 0.72, 0.18, 1); will-change: transform; }
.reel-cell { flex: none; width: 128px; height: 128px; display: grid; place-items: center; }
.reel-cell img { width: 112px; height: 112px; filter: saturate(0.85); transition: transform 0.35s cubic-bezier(0.2, 1.6, 0.4, 1), filter 0.3s; }
.reel-cell.win.pop img { transform: scale(1.25); filter: saturate(1.15) drop-shadow(0 0 14px rgba(255, 210, 90, 0.95)); }
.reel-mark { position: absolute; left: 50%; top: 6px; bottom: 6px; width: 132px; transform: translateX(-50%); border: 3px solid var(--gold); border-radius: 14px; box-shadow: 0 0 0 9999px rgba(40, 24, 8, 0.18), 0 0 18px rgba(255, 210, 90, 0.7); pointer-events: none; }
.reel-result { display: grid; gap: 4px; justify-items: center; text-align: center; animation: rise 0.35s cubic-bezier(.2, .9, .3, 1.2); }
.reel-result b { font-family: var(--display); font-weight: 600; font-size: 26px; color: var(--wood); }
.reel-result span { font-size: 18px; font-weight: 700; color: var(--good); }
.reel-result small { display: inline-flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 700; color: #1f4f8a; }
.rel-pool { display: inline-flex; gap: 2px; vertical-align: middle; margin-left: 4px; } .rel-pool img { width: 24px; height: 24px; }

.modal-actions { display: flex; justify-content: center; gap: 12px; margin-top: 14px; }

.multi-hint { font-size: 15px; color: var(--ink-soft); margin: 6px 0 2px; }
.info .ihead { display: flex; align-items: center; gap: 10px; } .info .ihead img { width: 56px; height: 56px; object-fit: contain; } .info .ihead small { font-size: 15px; color: var(--ink-soft); font-weight: 700; }

#mo-fx { font-size: 13px; font-weight: 800; color: #e8dcc0; white-space: nowrap; } #mo-fx.up { color: #a8f08a; } #mo-fx.down { color: #ffb0a0; }

/* altitude picker: a mountain with one stop per altitude, a flag on the pick, effects as tiles, terrain as a bar */
.alt-h { display: flex; align-items: center; gap: 10px; }
.alt-keys { margin-left: auto; display: inline-flex; gap: 4px; }
.alt-pick { --rh: 116px; --top: 28px; --dot: 24px; --dot-sel: 34px; }
.alt-track { position: relative; overflow: hidden; border-radius: 14px; border: 2px solid var(--parch-edge);
  background: linear-gradient(#bcd9e8, #e4eef0 calc(var(--top) + var(--rh) - 10px), #fffaf0 calc(var(--top) + var(--rh)), #f3e6c8); box-shadow: 0 3px 0 #a8884a, inset 0 0 16px rgba(120, 90, 50, 0.12); }
.alt-mtn, .alt-trail { position: absolute; left: 0; top: var(--top); width: 100%; height: var(--rh); pointer-events: none; overflow: visible; }
.alt-mtn .ridge { fill: none; stroke: rgba(58, 36, 18, 0.5); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.alt-mtn .trail { fill: none; stroke: rgba(255, 255, 255, 0.85); stroke-width: 2.5; stroke-dasharray: 2 6; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.alt-trail polyline { fill: none; stroke: var(--red); stroke-width: 3.5; stroke-dasharray: 8 6; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.alt-trail { clip-path: inset(-10px calc(100% - (var(--sel) + 0.5) / var(--n) * 100%) -10px 0); transition: clip-path 0.5s cubic-bezier(.3, 1.1, .5, 1); }
.alt-fog { position: absolute; top: 0; height: calc(var(--top) + var(--rh)); right: 0; left: calc((var(--open) + 1) / var(--n) * 100%); pointer-events: none; border-left: 2px dashed rgba(90, 60, 30, 0.35);
  background: repeating-linear-gradient(-45deg, rgba(243, 233, 210, 0.6) 0 7px, rgba(243, 233, 210, 0.3) 7px 14px); -webkit-backdrop-filter: grayscale(1); backdrop-filter: grayscale(1); }
.alt-stops { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); touch-action: pan-y; }
.alt-stop { position: relative; display: grid; grid-template-rows: calc(var(--top) + var(--rh)) auto; padding: 0 3px 8px; border: 0; background: none; text-align: center; min-width: 0; }
.alt-stop .peak { position: relative; }
.alt-stop .dot { position: absolute; left: 50%; bottom: calc(var(--rh) * var(--b) / 100); width: var(--dot); height: var(--dot); transform: translate(-50%, 50%); border-radius: 50%; background: var(--c); border: 3px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35); display: grid; place-items: center; color: #fff; transition: transform 0.2s cubic-bezier(.3, 1.6, .5, 1), width 0.2s, height 0.2s; }
.alt-stop:hover:not(.locked) .dot { transform: translate(-50%, 50%) scale(1.25); }
.alt-stop.sel .dot { width: var(--dot-sel); height: var(--dot-sel); animation: altGlow 1.8s ease-in-out infinite; }
.alt-stop.locked { cursor: not-allowed; }
.alt-stop.locked .dot { width: calc(var(--dot) + 4px); height: calc(var(--dot) + 4px); background: #8f897d; border-color: #e4ddcd; }
.alt-stop.nope .dot { animation: altNope 0.4s; }
.alt-stop .lbl { display: grid; padding: 5px 2px 4px; margin-top: 4px; border-radius: 10px; border: 2px solid transparent; line-height: 1.15; transition: background 0.2s, border-color 0.2s; }
.alt-stop .lbl b { font: 600 17px var(--display); color: var(--wood); white-space: nowrap; }
.alt-stop .lbl small { font-size: 14px; color: var(--ink-soft); }
.alt-stop:hover:not(.locked) .lbl { background: rgba(255, 255, 255, 0.6); }
.alt-stop.sel .lbl { background: #fff0e0; border-color: var(--red); }
.alt-stop.sel .lbl b { color: var(--red); } .alt-stop.sel .lbl small { color: var(--ink); font-weight: 800; }
.alt-stop.locked .lbl { opacity: 0.5; }
.alt-flags { position: absolute; left: 0; right: 0; top: 0; height: calc(var(--top) + var(--rh)); pointer-events: none; }
.alt-flag { position: absolute; left: calc((var(--sel) + 0.5) / var(--n) * 100%); bottom: calc(var(--rh) * var(--fb) / 100); width: 0; height: 0;
  transition: left 0.5s cubic-bezier(.3, 1.3, .5, 1), bottom 0.5s cubic-bezier(.3, 1.3, .5, 1); }
.alt-flag.plant { animation: altPlant 0.45s cubic-bezier(.3, 1.6, .5, 1); }
.alt-flag .pole { position: absolute; left: -1.5px; bottom: 6px; width: 3px; height: 36px; border-radius: 2px; background: linear-gradient(90deg, #9a6a3a, #4a2e18); }
.alt-flag .pole::before { content: ''; position: absolute; left: -1.5px; top: -4px; width: 6px; height: 6px; border-radius: 50%; background: var(--gold-2); box-shadow: 0 0 0 1px #8a6414; }
.alt-flag .cloth { position: absolute; left: 1.5px; bottom: 22px; width: 19px; height: 18px; border-radius: 1px 3px 3px 1px; transform-origin: left center; animation: altWave 1.4s ease-in-out infinite alternate;
  background: linear-gradient(#fff, #fff) center / 11px 3.6px no-repeat, linear-gradient(#fff, #fff) center / 3.6px 11px no-repeat, linear-gradient(135deg, #e8402f, #b3241a); box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.3); }
.alt-info { margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 250, 235, 0.75); border: 2px solid rgba(160, 120, 60, 0.3); transition: border-color 0.2s; }
.alt-pick.preview .alt-info { border-style: dashed; border-color: var(--gold); }
.alt-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.alt-m { font: 700 20px/1 var(--display); color: #fff; background: var(--c); padding: 5px 12px; border-radius: 999px; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2); font-variant-numeric: lining-nums tabular-nums; }
.alt-head b { font: 600 24px/1.1 var(--display); color: var(--wood); }
.alt-lock { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 6px; background: #8f897d; color: #fff; font-size: 14px; font-weight: 800; }
.alt-cmp { margin-left: auto; font: 600 15px var(--display); color: var(--ink-soft); }
.alt-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 10px 0 12px; }
@media (max-width: 740px) { .alt-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.alt-t { display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.6); border: 1px solid rgba(120, 90, 50, 0.25); }
.alt-t img { grid-row: span 2; }
.alt-t .v { display: grid; justify-items: start; font-family: var(--display); line-height: 1.1; }
.alt-t .v b { font-size: 24px; font-weight: 700; color: var(--ink-soft); font-variant-numeric: lining-nums tabular-nums; }
.alt-t .v b.n { font-size: 19px; font-weight: 600; }
.alt-t .v s { font-size: 15px; font-weight: 600; color: var(--ink-soft); text-decoration: none; white-space: nowrap; }
.alt-t .v i { font-style: normal; font-weight: 800; }
.alt-t small { font-size: 14px; font-weight: 700; color: var(--ink-soft); line-height: 1.2; }
.alt-t.con { background: rgba(192, 57, 43, 0.1); border-color: rgba(192, 57, 43, 0.4); } .alt-t.con .v b { color: #8a2418; }
.alt-t.pro { background: rgba(63, 138, 70, 0.14); border-color: rgba(63, 138, 70, 0.45); } .alt-t.pro .v b { color: #245a2a; }
.alt-t.chg { animation: altPop 0.4s cubic-bezier(.3, 1.6, .5, 1); }
.alt-land { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.ter-row { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 8px; align-items: center; }
.ter-row small { font: 600 14px/1 var(--display); color: var(--ink-soft); text-align: right; white-space: nowrap; }
.ter-row.was { margin-bottom: 4px; } .ter-row.was small { font-size: 12px; opacity: 0.8; } .ter-row.was .ter-bar { height: 10px; opacity: 0.55; border-radius: 5px; }
.ter-row.off { visibility: hidden; }
.ter-bar { display: flex; height: 26px; overflow: hidden; border-radius: 8px; border: 1px solid rgba(60, 40, 20, 0.35); background: #e8dcc0; }
.ter-bar i { display: flex; align-items: center; justify-content: center; min-width: 0; overflow: hidden; font-style: normal; transition: width 0.5s cubic-bezier(.3, 1.1, .5, 1); }
.ter-bar i + i { box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.55); }
.ter-bar span { font: 700 14px var(--display); color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5); white-space: nowrap; }
.ter-bar .t-i span { color: #2a4a5a; text-shadow: none; }
.t-m { background: #86b955; } .t-f { background: #4e7a3e; } .t-r { background: #9a958c; } .t-i { background: #d6ecf4; }
.ter-leg { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 0 66px; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.ter-leg span { display: inline-flex; align-items: center; gap: 5px; }
.ter-leg i { width: 13px; height: 13px; border-radius: 4px; border: 1px solid rgba(60, 40, 20, 0.35); }
@keyframes altGlow { 0%, 100% { box-shadow: 0 0 0 3px rgba(240, 201, 90, 0.9), 0 3px 6px rgba(0, 0, 0, 0.4); } 50% { box-shadow: 0 0 0 7px rgba(240, 201, 90, 0.4), 0 3px 6px rgba(0, 0, 0, 0.4); } }
@keyframes altNope { 20% { transform: translate(-70%, 50%); } 45% { transform: translate(-30%, 50%); } 70% { transform: translate(-62%, 50%); } }
@keyframes altPlant { 0% { transform: translateY(-18px) scale(0.6); opacity: 0.4; } 100% { transform: none; opacity: 1; } }
@keyframes altWave { from { transform: skewY(-4deg) scaleX(0.92); } to { transform: skewY(5deg) scaleX(1.03); } }
@keyframes altPop { 0% { transform: scale(0.92); } 60% { transform: scale(1.05); } 100% { transform: none; } }
@media (max-width: 600px) {
  .alt-pick { --rh: 80px; --top: 26px; --dot: 20px; --dot-sel: 28px; }
  .alt-flag { scale: 0.8; }
  .alt-stop { padding: 0 1px 6px; }
  .alt-stop .lbl small, .alt-stop .lbl .u { display: none; }
  .alt-stop .lbl b { font-size: 16px; }
  .alt-head b { font-size: 21px; } .alt-m { font-size: 17px; padding: 4px 10px; }
  .ter-leg { gap: 4px 10px; font-size: 13px; }
  .alt-tiles { grid-template-columns: 1fr 1fr; } .alt-t:last-child { grid-column: span 2; }
  .alt-t { padding: 6px 8px; } .alt-t .v b { font-size: 21px; }
  .ter-row { grid-template-columns: 48px minmax(0, 1fr); } .ter-leg { margin-left: 0; }
}

.title-sound { position: absolute; top: 16px; right: 16px; z-index: 2; display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px 8px 10px; border-radius: 999px; border: 1px solid rgba(255, 244, 220, 0.5); background: rgba(30, 24, 18, 0.55); color: #fff4dc; font: 600 16px var(--display); cursor: pointer; backdrop-filter: blur(4px); }
.title-sound img { width: 24px; height: 24px; }
.title-sound .kbd { margin-left: 2px; }
.title-sound:hover { background: rgba(30, 24, 18, 0.75); }
.title-sound.off { opacity: 0.75; }
.title-sound.off img { filter: grayscale(1); }
.title-sound.wait { animation: tsPulse 1.6s ease-in-out infinite; }
@keyframes tsPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 220, 140, 0.0); } 50% { box-shadow: 0 0 0 6px rgba(255, 220, 140, 0.35); } }

#r-retire.armed { background: linear-gradient(#c0392b, #8e2a20); color: #fff; animation: retirePulse 0.9s ease-in-out infinite; }
@keyframes retirePulse { 50% { transform: scale(1.04); } }

/* rare relics: legendary glows gold, mythic shimmers violet and ice blue */
.dcard.rare-legendary { border-color: #e0a92e; background: linear-gradient(#fff8df, #f7e1a0); box-shadow: 0 4px 0 #b8862a, 0 0 0 2px #f0c95a, 0 0 24px rgba(255, 196, 70, 0.65); }
.dcard.rare-mythic { border-color: #9a6ae8; background: linear-gradient(#f7f1ff, #e3d5fb); box-shadow: 0 4px 0 #6f4fb0, 0 0 0 2px #b48cff, 0 0 28px rgba(150, 110, 255, 0.7); animation: mythGlow 2.6s ease-in-out infinite; }
.dcard.rare-legendary .kind { color: #8a5a10; font-weight: 700; }
.dcard.rare-mythic .kind { color: #5a2fb0; font-weight: 700; }
@keyframes mythGlow { 50% { box-shadow: 0 4px 0 #6f4fb0, 0 0 0 2px #7fe3f5, 0 0 34px rgba(127, 227, 245, 0.75); } }
.reel-result .rar { display: block; font: 700 15px var(--display); letter-spacing: 0.08em; text-transform: uppercase; font-style: normal; }
.reel-result.rare-legendary .rar { color: #b8862a; }
.reel-result.rare-mythic .rar { color: #7a4fd0; }
.reel-result.rare-legendary b { color: #8a5a10; }
.reel-result.rare-mythic b { color: #5a2fb0; }

/* choice rows: up to 4 cards side by side; 5 and 6 as two centred rows of 3 */
.draft { display: flex; flex-wrap: wrap; justify-content: center; --cols: 3; }
.draft > * { flex: 0 0 calc((100% - (var(--cols) - 1) * 14px) / var(--cols)); min-width: 0; }
.draft[data-n="1"] { --cols: 1; } .draft[data-n="2"] { --cols: 2; } .draft[data-n="4"] { --cols: 4; }
.sheet.wide { width: min(1200px, 100%); }
.draft[data-n="5"] .dcard .pic, .draft[data-n="6"] .dcard .pic { height: 104px; }
.draft[data-n="5"] .lawcard .seal, .draft[data-n="6"] .lawcard .seal { width: 100px; height: 100px; }
@media (max-width: 900px) { .draft[data-n="4"] { --cols: 2; } }
@media (max-width: 640px) { .draft { --cols: 1 !important; } }

/* run intro: four painted seasons with the harvest between them, then the climb through seven winters */
.intro-head { display: flex; align-items: center; gap: 12px; }
.intro-head h2 { margin-bottom: 0; }
.intro-head .eyebrow img { display: inline-block; vertical-align: -5px; margin-right: 2px; }
.intro-crest { flex: none; width: 46px; height: 53px; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.3)); animation: yrIn 0.45s cubic-bezier(.2, .9, .3, 1.3) both; }
.yr-cycle { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 26px; margin: 10px 0 8px; }
.yr-col { position: relative; display: flex; flex-direction: column; border-radius: 14px; padding: 6px 6px 10px; color: #2a1c10; box-shadow: 0 3px 0 rgba(90, 60, 30, 0.35), 0 6px 14px rgba(0, 0, 0, 0.15);
  animation: yrIn 0.45s cubic-bezier(.2, .9, .3, 1.3) both; animation-delay: calc(var(--i) * 0.1s); }
.yr-col.spring { background: linear-gradient(#eef8e2, #bfe0a0); border: 2px solid #7fb060; }
.yr-col.summer { background: linear-gradient(#fff8d8, #f2d878); border: 2px solid #d0a838; }
.yr-col.autumn { background: linear-gradient(#ffecd6, #f0b07a); border: 2px solid #c87a3a; }
.yr-col.winter { background: linear-gradient(#eef6fc, #a9cbe6); border: 2px solid #5a8ab8; }
.yr-pic { position: relative; overflow: hidden; border-radius: 10px; aspect-ratio: 240 / 100; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }
.yr-pic img { display: block; width: 100%; height: 100%; }
.yr-pic b { position: absolute; left: 8px; bottom: 5px; font: 700 23px/1 var(--display); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35), 0 0 10px rgba(0, 0, 0, 0.5); }
.yr-col ul { list-style: none; margin: 7px 4px 0; padding: 0; display: grid; gap: 4px; align-content: start; flex: 1; }
.yr-col li { display: flex; gap: 8px; align-items: center; font-size: 16px; font-weight: 700; line-height: 1.15; }
.yr-col li img { flex: none; }
.yr-hv { display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3c4, #e8b840 70%, #c08a20); box-shadow: 0 2px 0 #8a6414, 0 3px 8px rgba(0, 0, 0, 0.2); }
.yr-col > .yr-hv { position: absolute; z-index: 2; right: -34px; top: 24px; width: 42px; height: 42px; animation: yrHv 0.5s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: calc(0.55s + var(--i) * 0.18s); }
.yr-attack { align-self: center; display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 4px 12px; border-radius: 999px; font: 700 15px var(--display); white-space: nowrap;
  background: linear-gradient(#ff8a7a, #c0392b); color: #fff; box-shadow: 0 2px 0 #7a1a10; animation: yrPulse 1.4s ease-in-out infinite; }
.yr-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 16px; line-height: 1.2; }
.yr-legend > b { font: 700 18px var(--display); color: #7a5410; }
.yr-legend span { display: inline-flex; align-items: center; gap: 4px; }
.yr-goods { gap: 2px !important; }
.yr-goal { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin: 10px 0 6px; }
.yr-goal > span:not(.alt-keys) { flex: 1 1 220px; }
.yr-goal small { display: inline-flex; align-items: center; gap: 4px; font: 600 15px var(--display); color: #2a3a5a; }
.yr-climb { --rh: 90px; --top: 80px; }
.yr-track { position: relative; overflow: hidden; height: calc(var(--top) + var(--rh)); border-radius: 14px; border: 2px solid var(--parch-edge);
  background: linear-gradient(#bcd9e8, #e4eef0 calc(var(--top) + var(--rh) - 10px)); box-shadow: 0 3px 0 #a8884a, inset 0 0 16px rgba(120, 90, 50, 0.12); }
.yr-mtn, .yr-trail { position: absolute; left: 0; bottom: 0; width: 100%; height: var(--rh); pointer-events: none; overflow: visible; }
.yr-mtn .ridge { fill: none; stroke: rgba(58, 36, 18, 0.5); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.yr-mtn .trail { fill: none; stroke: rgba(255, 255, 255, 0.85); stroke-width: 2.5; stroke-dasharray: 2 6; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.yr-trail polyline { fill: none; stroke: var(--red); stroke-width: 3.5; stroke-dasharray: 8 6; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.yr-trail { clip-path: inset(-10px 100% -10px 0); animation: yrTrail 1.6s 0.5s cubic-bezier(.4, 0, .3, 1) forwards; }
.yr-stops { position: absolute; inset: 0; }
.yr-stop { position: absolute; left: calc(var(--x) * 1%); bottom: calc(var(--rh) * var(--b) / 100 - 16px); translate: -50% 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 0; border: 0; background: none; cursor: pointer; animation: yrStop 0.45s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: calc(0.6s + var(--i) * 0.16s); }
.yr-n { position: relative; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #fffaf0; border: 3px solid #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
  font: 700 16px var(--display); color: var(--wood); transition: transform 0.2s cubic-bezier(.3, 1.6, .5, 1); }
.yr-stop.boss .yr-n { background: #2a3a5a; color: #fff; }
.yr-stop.now .yr-n { background: var(--red); color: #fff; }
.yr-stop:hover .yr-n, .yr-stop.sel .yr-n { transform: scale(1.2); }
.yr-stop.sel .yr-n { animation: altGlow 1.8s ease-in-out infinite; }
.yr-foes { display: flex; align-items: flex-end; justify-content: center; transition: transform 0.2s cubic-bezier(.3, 1.6, .5, 1); }
.yr-stop:hover .yr-foes, .yr-stop.sel .yr-foes { transform: translateY(-3px) scale(1.08); }
.yr-foes img { width: 34px; height: 34px; margin: 0 -5px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3)); }
.yr-foes img.yr-boss { width: 68px; height: 68px; margin: 0 0 -8px; }
.yr-stop small { position: absolute; left: 50%; top: 100%; translate: -50% 1px; white-space: nowrap; font: 700 13px var(--display); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.yr-flag { position: absolute; left: 22px; bottom: 6px; width: 0; height: 0; }
.yr-flag .pole { position: absolute; left: -1.5px; bottom: 0; width: 3px; height: 34px; border-radius: 2px; background: linear-gradient(90deg, #9a6a3a, #4a2e18); }
.yr-flag .pole::before { content: ''; position: absolute; left: -1.5px; top: -4px; width: 6px; height: 6px; border-radius: 50%; background: var(--gold-2); box-shadow: 0 0 0 1px #8a6414; }
.yr-flag .cloth { position: absolute; left: 1.5px; bottom: 16px; width: 19px; height: 18px; border-radius: 1px 3px 3px 1px; transform-origin: left center; animation: altWave 1.4s ease-in-out infinite alternate;
  background: linear-gradient(#fff, #fff) center / 11px 3.6px no-repeat, linear-gradient(#fff, #fff) center / 3.6px 11px no-repeat, linear-gradient(135deg, #e8402f, #b3241a); box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.3); }
.yr-info { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; min-height: 44px; margin-top: 8px; padding: 4px 14px; border-radius: 12px; background: rgba(255, 250, 235, 0.75); border: 2px solid rgba(160, 120, 60, 0.3); font-size: 16px; }
.yr-info.pop { animation: altPop 0.35s cubic-bezier(.3, 1.6, .5, 1); }
.yr-iy { font: 700 20px var(--display); color: var(--wood); }
.yr-iv { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; }
.yr-iv > b { font: 700 22px var(--display); color: var(--red); font-variant-numeric: lining-nums tabular-nums; }
.yr-iv.boss > img { width: 42px; height: 42px; margin: -10px 0; }
.yr-iv.boss > b { font-size: 18px; color: #2a3a5a; }
.yr-iv.new small { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); }
.yr-foe { display: inline-flex; align-items: center; gap: 2px; margin-right: 6px; }
.yr-foe img { width: 32px; height: 32px; margin: -6px 0; }
.intro-foot { margin-top: 10px; }
.intro-foot .hint-line { margin: 0 auto 0 0; }
@keyframes yrIn { from { opacity: 0; transform: translateY(12px) scale(0.96); } }
@keyframes yrPulse { 50% { transform: scale(1.06); } }
@keyframes yrHv { 0% { opacity: 0; transform: scale(0) rotate(-60deg); } 100% { opacity: 1; transform: none; } }
@keyframes yrStop { 0% { opacity: 0; transform: translateY(14px) scale(0.5); } 100% { opacity: 1; transform: none; } }
@keyframes yrTrail { to { clip-path: inset(-10px 0 -10px 0); } }
@media (max-width: 820px) { .intro-foot .hint-line, .yr-goal .alt-keys { display: none; } }
@media (max-width: 760px) {
  .yr-cycle { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .yr-col > .yr-hv { right: 6px; top: 6px; width: 30px; height: 30px; } .yr-col > .yr-hv img { width: 20px; height: 20px; }
  .yr-goal { font-size: 17px; } .yr-goal > img { width: 22px; height: 22px; }
  .yr-attack { gap: 4px; padding: 3px 9px; font-size: 13px; } .yr-attack img { width: 18px; height: 18px; }
  .yr-pic b { font-size: 19px; }
  .yr-col li { font-size: 14px; gap: 6px; } .yr-col li img { width: 24px; height: 24px; }
  .yr-legend { font-size: 14px; } .yr-legend img { width: 22px; height: 22px; }
  .yr-climb { --rh: 72px; --top: 46px; }
  .yr-foes img:not(.yr-boss) { display: none; } .yr-foes img.yr-boss { width: 46px; height: 46px; }
  .yr-stop { bottom: calc(var(--rh) * var(--b) / 100 - 13px); } .yr-stop small { display: none; }
  .yr-n { width: 26px; height: 26px; font-size: 14px; border-width: 2px; }
  .yr-flag { left: 16px; } .yr-flag .pole { height: 26px; } .yr-flag .cloth { bottom: 10px; scale: 0.8; }
  .yr-info { gap: 2px 10px; font-size: 14px; padding: 6px 10px; } .yr-iy { font-size: 17px; } .yr-iv > b { font-size: 19px; }
}

/* the guide: a short picture story in three pages, with numbered pins in the picture and the same numbers on the steps */
.guide .eyebrow { margin-bottom: 6px; }
.guide-nav { display: flex; align-items: center; margin: 0 0 8px; }
.gnav { display: inline-flex; align-items: center; gap: 8px; padding: 4px 14px 4px 4px; border-radius: 999px; border: 2px solid rgba(120, 90, 50, 0.3); background: rgba(255, 255, 255, 0.5);
  font: 600 17px var(--display); color: var(--ink-soft); cursor: pointer; transition: background 0.25s, border-color 0.25s, color 0.25s, transform 0.25s cubic-bezier(.3, 1.6, .5, 1); }
.gnav .gn-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(90, 60, 30, 0.12); transition: background 0.25s, box-shadow 0.25s; }
.gnav:hover { border-color: var(--red); }
.gnav.on { background: #fff0e0; border-color: var(--red); color: var(--red); transform: scale(1.06); }
.gnav.on .gn-ic { background: #fff; box-shadow: 0 0 0 3px var(--red); }
.gnav.done { color: #2f6b3d; border-color: rgba(63, 138, 70, 0.55); }
.gnav.done .gn-ic { background: rgba(63, 138, 70, 0.2); }
.gnav-bar { flex: 1; height: 6px; margin: 0 10px; border-radius: 3px; background: rgba(90, 60, 30, 0.15); overflow: hidden; }
.gnav-bar i { display: block; width: 0; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #3f8a46, #7fb060); transition: width 0.45s cubic-bezier(.4, 0, .3, 1); }
.gnav-bar.done i { width: 100%; }
.guide-page { touch-action: pan-y; }
.guide-page.from-right { animation: gIn 0.38s cubic-bezier(.2, .9, .3, 1) both; }
.guide-page.from-left { animation: gInL 0.38s cubic-bezier(.2, .9, .3, 1) both; }
.guide-page h2 { margin: 0 0 8px; }
.gsub { display: flex; align-items: center; gap: 8px; margin: -2px 0 10px; font-size: 16px; font-weight: 700; color: var(--ink-soft); }
.gpic { position: relative; overflow: hidden; border-radius: 14px; border: 2px solid var(--parch-edge); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22); animation: yrIn 0.45s cubic-bezier(.2, .9, .3, 1.2) both; }
.gpic-bg { display: block; width: 100%; height: auto; }
.gpic.winter { aspect-ratio: 880 / 210; } .gpic-in { position: absolute; left: 0; right: 0; bottom: 0; aspect-ratio: 880 / 240; }   /* the top of the night sky is cut off */
.gw-walk { position: absolute; width: 8.5%; translate: -50% -86%; scale: -1 1; pointer-events: none; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.35)); animation: gwalk 9s linear infinite, gFade 9s linear infinite; }
.gpin { position: absolute; z-index: 2; width: 30px; height: 30px; translate: -50% -50%; border-radius: 50%; display: grid; place-items: center; background: var(--red); color: #fff; font: 700 17px var(--display);
  border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45); transition: scale 0.2s cubic-bezier(.3, 1.6, .5, 1), background 0.2s; animation: gPin 0.4s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: calc(0.35s + var(--i) * 0.18s); }
.gpin.hot { scale: 1.4; background: var(--gold-2); color: #3a2408; }
.gfloat { position: absolute; translate: -50% 0; display: inline-flex; align-items: center; gap: 2px; padding: 2px 7px 2px 8px; border-radius: 999px; background: rgba(255, 250, 235, 0.94); color: #7a5410;
  font: 700 14px var(--display); white-space: nowrap; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); animation: gFloat 3s ease-in-out infinite both; }
.gfloat img { width: 18px; height: 18px; }
.gfloat.d2 { animation-delay: 1s; } .gfloat.d3 { animation-delay: 2s; }
.gfloat.bad { background: #c0392b; color: #fff; }
.gbeats { display: grid; gap: 10px; margin-top: 10px; }
.gbeats.five { grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.3fr) minmax(0, 1fr); }
.gbeats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gbeat { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 10px 10px 10px 12px; border-radius: 12px; background: rgba(255, 252, 240, 0.85); border: 2px solid rgba(160, 120, 60, 0.3);
  box-shadow: 0 3px 0 rgba(168, 136, 74, 0.55); font-size: 15px; line-height: 1.3; transition: border-color 0.2s, transform 0.2s;
  animation: yrIn 0.4s cubic-bezier(.2, .9, .3, 1.3) both; animation-delay: calc(0.3s + var(--i) * 0.18s); }
.gbeat:hover { border-color: var(--red); transform: translateY(-2px); }
.gb-n { position: absolute; left: -8px; top: -8px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--red); color: #fff; font: 700 14px var(--display); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }
.gb-ic { display: flex; gap: 2px; }
.gbeat > b { font: 700 18px/1.1 var(--display); color: var(--wood); }
.gb-t .red { color: var(--bad); } .gb-t .gold { color: #a87a1e; }
.grules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
.grule { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 12px; background: rgba(192, 57, 43, 0.07); border: 1px dashed rgba(192, 57, 43, 0.45); font-size: 14px; line-height: 1.25;
  animation: yrIn 0.4s cubic-bezier(.2, .9, .3, 1.3) both; animation-delay: 1.3s; }
.grule b { color: var(--wood); }
.grule > img { flex: none; width: 40px; height: 40px; object-fit: contain; }
.gr-line { flex: none; width: 40px; height: 0; border-top: 4px dashed #e0483a; }
.gr-faces { flex: none; display: flex; } .gr-faces img { width: 34px; height: 34px; margin-right: -8px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3)); }
.gr-faces img:last-child { margin-right: 0; }
.gkeys { display: flex; flex-wrap: wrap; gap: 5px 3px; margin-top: 4px; }
.gk { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.gk i, .gk-c { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px; font: 800 13px/1 var(--body); font-style: normal;
  background: linear-gradient(#fffaf0, #e8dcc0); color: #3a2a18; border: 1px solid #8a6a3a; box-shadow: 0 2px 0 #8a6a3a; }
.gk.sp b { display: grid; place-items: center; width: 34px; height: 28px; border-radius: 8px; background: #2a3a4a; color: #eaf6ff; font: 700 14px var(--display); }
.rs-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.rs-grid.later { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 12px; }
.rs-card { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; border-radius: 14px; background: linear-gradient(#fffaf0, #f3e6c8); border: 2px solid var(--parch-edge); box-shadow: 0 3px 0 #a8884a;
  animation: yrIn 0.4s cubic-bezier(.2, .9, .3, 1.3) both; animation-delay: calc(var(--i) * 0.08s); }
.rs-card.wood { background: linear-gradient(#fffaf0, #ecd6b8); } .rs-card.stone { background: linear-gradient(#fbfaf6, #dedad2); } .rs-card.food { background: linear-gradient(#fffbea, #f4e2a6); }
.rs-card.gold { background: linear-gradient(#fffaf0, #f3dc96); } .rs-card.iron { background: linear-gradient(#f8fafc, #d8dee6); } .rs-card.crystal { background: linear-gradient(#f6fcff, #cfeaf4); } .rs-card.folk { background: linear-gradient(#fffaf4, #f3dccc); }
.rs-top { display: flex; align-items: center; gap: 8px; } .rs-top b { font: 700 24px var(--display); color: var(--wood); }
.rs-make { display: flex; justify-content: center; gap: 14px; padding: 6px 4px 0; border-radius: 10px; background: radial-gradient(ellipse at 50% 60%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 70%); }
.rs-b { position: relative; display: flex; flex-direction: column; align-items: center; }
.rs-b > img { width: 72px; height: 72px; object-fit: contain; }
.rs-b em { position: absolute; top: -4px; right: -14px; display: inline-flex; align-items: center; gap: 1px; padding: 1px 6px 1px 8px; border-radius: 999px; font: 700 19px var(--display); font-style: normal;
  color: #245a2a; background: #eaf7dc; border: 2px solid #7fb060; box-shadow: 0 2px 0 rgba(47, 107, 61, 0.4); animation: rsPop 3s ease-in-out infinite; animation-delay: calc(0.6s + var(--i) * 0.4s); }
.rs-b em img { width: 20px; height: 20px; }
.rs-b small { font-size: 13px; font-weight: 800; color: var(--ink-soft); }
.rs-first { margin-top: 3px; white-space: nowrap; padding: 1px 9px; border-radius: 999px; font: 700 13px var(--display); color: #5a3a08; background: linear-gradient(#ffe9a0, #e8b840); box-shadow: 0 2px 0 #a87a20, 0 0 12px rgba(255, 196, 70, 0.7); animation: mustPulse 1.3s ease-in-out infinite; }
.rs-card p { margin: 0; font-size: 15px; line-height: 1.3; }
.rs-card.mini { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 4px 12px; padding: 8px 12px; }
.rs-card.mini .rs-top { flex-direction: column; gap: 0; } .rs-card.mini .rs-top b { font-size: 18px; }
.rs-card.mini .rs-make { padding: 6px 14px 0 4px; background: none; }
.rs-card.mini .rs-b > img { width: 56px; height: 56px; }
.rs-card.mini p { font-size: 14px; }
.gland { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.gl-hi { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; animation: glHi 1.6s ease-in-out infinite; }
.gl-feat { position: absolute; width: 9.5%; translate: -50% -62%; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3)); animation: gPin 0.4s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: calc(0.5s + var(--i) * 0.15s); }
.gl-tag { position: absolute; translate: -50% -50%; padding: 3px 12px; border-radius: 999px; font: 700 16px var(--display); white-space: nowrap; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); }
.gl-tag.own { background: rgba(42, 28, 16, 0.88); color: #ffe9b0; border: 2px solid #e8b840; }
.gl-tag.fog { background: rgba(90, 110, 125, 0.85); color: #fff; }
.gl-claim { position: absolute; translate: -50% -50%; }
.gl-claim .btn { pointer-events: none; min-height: 38px; padding: 5px 12px; animation: glBtn 1.6s ease-in-out infinite; }
.gl-tap { position: absolute; left: 72%; top: 68%; width: 26px; height: 26px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25); animation: glTap 1.6s ease-out infinite; pointer-events: none; }
.gl-ladder { display: flex; flex-direction: column; height: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 14px; background: rgba(255, 250, 235, 0.75); border: 2px solid rgba(160, 120, 60, 0.3); }
.gl-h { font: 700 18px var(--display); color: var(--wood); }
.gl-steps { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; align-items: end; min-height: 136px; margin: 6px 0; }
.gl-step { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.gl-cost { display: flex; flex-direction: column; align-items: center; }
.gl-cost span { display: inline-flex; align-items: center; gap: 2px; font: 700 20px var(--display); color: #7a5410; font-variant-numeric: lining-nums tabular-nums; }
.gl-cost span.g { color: #a87a1e; }
.gl-bar { display: block; width: 100%; height: calc(var(--h) * 64px + 8px); margin-top: 4px; border-radius: 8px 8px 3px 3px; background: linear-gradient(#f0c95a, #c8902a); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 2px 0 #8a6414;
  transform-origin: bottom; animation: glBar 0.5s cubic-bezier(.3, 1.4, .5, 1) both; animation-delay: calc(0.4s + var(--i) * 0.15s); }
.gl-step small { margin-top: 4px; font: 700 14px var(--display); color: var(--ink-soft); }
.gl-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.gl-se, .gl-gets { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; }
.gl-se i { padding: 2px 8px; border-radius: 999px; font: 700 13px var(--display); font-style: normal; color: #2a1c10; }
.gl-se .spring { background: #cfe8b4; } .gl-se .summer { background: #f6e08e; } .gl-se .autumn { background: #f4c08e; }
.gl-se .winter { background: #d6e4ef; color: #6a7a88; text-decoration: line-through; }
.guide-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.guide-count { font: 700 16px var(--display); color: var(--ink-soft); }
@keyframes gIn { from { opacity: 0; transform: translateX(40px); } }
@keyframes gInL { from { opacity: 0; transform: translateX(-40px); } }
@keyframes gFade { 0% { opacity: 0; } 5% { opacity: 1; } 92% { opacity: 1; } 100% { opacity: 0; } }
@keyframes gPin { from { opacity: 0; transform: scale(0); } }
@keyframes gFloat { 0% { opacity: 0; transform: translateY(8px); } 20%, 70% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-14px); } }
@keyframes rsPop { 0%, 60%, 100% { transform: none; } 70% { transform: translateY(-6px) scale(1.15); } 80% { transform: scale(0.96); } }
@keyframes glHi { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
@keyframes glTap { 0% { transform: scale(0.4); opacity: 1; } 100% { transform: scale(1.8); opacity: 0; } }
@keyframes glBtn { 50% { transform: scale(1.06); } }
@keyframes glBar { from { transform: scaleY(0); } }
@media (max-width: 760px) {
  .gnav { padding: 3px; } .gnav b { display: none; }
  .gbeats.five, .gbeats.three, .grules { grid-template-columns: 1fr; gap: 8px; }
  .gbeat { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; align-items: center; padding: 8px 10px 8px 14px; } .gb-ic { grid-row: span 2; }
  .rs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .rs-grid.later { grid-template-columns: minmax(0, 1fr); }
  .rs-card { padding: 8px 10px 10px; } .rs-top b { font-size: 20px; } .rs-top img { width: 36px; height: 36px; }
  .rs-make { gap: 10px; } .rs-b > img { width: 50px; height: 50px; } .rs-b em { font-size: 15px; right: -10px; padding: 0 5px 0 6px; } .rs-b em img { width: 16px; height: 16px; }
  .rs-card p { font-size: 14px; }
  .gpin { width: 18px; height: 18px; font-size: 11px; }
  .gland { grid-template-columns: 1fr; }
  .gpin { border-width: 2px; }
  .gfloat { padding: 1px 5px; font-size: 11px; } .gfloat img { width: 13px; height: 13px; }
  .gl-tag { padding: 2px 8px; font-size: 13px; } .gl-claim .btn { min-height: 30px; padding: 3px 8px; font-size: 14px; }
}

/* one building format everywhere (build bar tooltip, info panel, plan cards): role, number tiles, one sentence, where, cost */
.b-role { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; font-size: 14px; font-weight: 800; color: var(--ink-soft); line-height: 1.2; }
.b-role .stars { font-size: 14px; letter-spacing: 1px; }
.btiles { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 6px; }
.bt { display: grid; grid-template-columns: 24px auto; grid-template-rows: auto auto; column-gap: 6px; align-items: center; padding: 4px 10px 4px 6px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.6); border: 1px solid rgba(120, 90, 50, 0.25); line-height: 1.05; }
.bt img { grid-row: span 2; }
.bt b { font: 700 19px var(--display); color: var(--ink); font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.bt small { font-size: 12px; font-weight: 800; color: var(--ink-soft); white-space: nowrap; }
.bt.up { background: rgba(63, 138, 70, 0.13); border-color: rgba(63, 138, 70, 0.45); } .bt.up b { color: #245a2a; }
.bt.dn { background: rgba(192, 57, 43, 0.1); border-color: rgba(192, 57, 43, 0.4); } .bt.dn b { color: #8a2418; }
.b-where { display: flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.b-where img { flex: none; }
.cost.free { display: inline-block; padding: 1px 10px; border-radius: 999px; background: #dff2d6; color: #2f6b3d; font: 700 15px var(--display); }
/* the dark tooltip */
.tooltip .tt-head > div { display: grid; gap: 2px; }
.tooltip .b-role { color: #d8c8a8; font-size: 13px; }
.tooltip .b-role .stars .off { color: rgba(255, 240, 210, 0.25); }
.tooltip .btiles { margin: 8px 0 4px; }
.tooltip .bt { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 240, 210, 0.2); }
.tooltip .bt b { color: #fff4dc; } .tooltip .bt small { color: #d8c8a8; }
.tooltip .bt.up { background: rgba(110, 190, 100, 0.16); border-color: rgba(140, 210, 120, 0.45); } .tooltip .bt.up b { color: #b8f0a0; }
.tooltip .bt.dn { background: rgba(240, 110, 90, 0.16); border-color: rgba(255, 140, 120, 0.45); } .tooltip .bt.dn b { color: #ffb8a8; }
.tooltip .b-where { color: #d8c8a8; margin-top: 4px; }
.tooltip .b-cost { margin-top: 8px; padding-top: 6px; border-top: 1px solid rgba(240, 210, 150, 0.25); }
.tooltip .cost .short { color: #ff9a88; }
/* the info panel */
.info .head .b-role { margin-top: 2px; }
.info .btiles { margin: 4px 0 2px; }

/* plan cards: a coloured band says what you get (new building, permanent bonus, supplies), then the exact numbers */
.dcard.pc { display: flex; flex-direction: column; gap: 5px; overflow: hidden; }
.dcard.pc > .kbd { top: 8px; }
.pband { display: flex; align-items: center; gap: 6px; margin: -14px -16px 2px; padding: 6px 12px 6px 42px; white-space: nowrap; border-bottom: 1px solid rgba(0, 0, 0, 0.1); font-family: var(--display); }
.pband b { font-size: 16px; font-weight: 700; }
.pband small { margin-left: auto; font: 800 13px var(--body); opacity: 0.8; white-space: nowrap; }
.pband.blueprint { background: linear-gradient(#e8f1fb, #d0e1f5); color: #1f4f8a; }
.pband.relic { background: linear-gradient(#fdf3d8, #f4dca0); color: #7a5410; }
.pband.boon { background: linear-gradient(#eaf6e2, #cfe8bf); color: #2f6b3d; }
.dcard.pc .pic { height: 112px; }
.dcard.pc .t { margin-top: 2px; }
.dcard.pc .b-role { margin-top: -3px; }
.dcard.pc .b-role.rar { color: #8a6414; }
.dcard.rare-mythic .b-role.rar { color: #5a2fb0; }
.dcard.pc .btiles { margin: 2px 0; }
.dcard.pc .d { font-size: 15px; line-height: 1.3; }
.dcard.pc .b-where { font-size: 13px; }
.pcost { margin-top: auto; padding-top: 7px; border-top: 1px dashed rgba(120, 90, 50, 0.35); }
.pcost .cost { font-size: 21px; } .pcost .cost img { width: 28px; height: 28px; }
.pfx { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(63, 138, 70, 0.14); border: 1px solid rgba(63, 138, 70, 0.45); color: #245a2a; font-size: 16px; font-weight: 700; line-height: 1.3; }
.pfx img { flex: none; }
.pbp { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 800; color: #1f4f8a; }
.pgot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 2px 0; }
.pgot > span { display: grid; grid-template-columns: 40px auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 6px 14px 6px 8px; border-radius: 12px; background: rgba(63, 138, 70, 0.14); border: 1px solid rgba(63, 138, 70, 0.45); }
.pgot img { grid-row: span 2; }
.pgot b { font: 700 30px/1 var(--display); color: #245a2a; font-variant-numeric: lining-nums tabular-nums; }
.pgot small { font-size: 13px; font-weight: 800; color: var(--ink-soft); }
.dcard.pc .btiles { gap: 4px; }
.dcard.pc .bt { grid-template-columns: 22px auto; column-gap: 4px; padding: 3px 8px 3px 4px; }
.dcard.pc .bt img { width: 22px; height: 22px; } .dcard.pc .bt b { font-size: 17px; } .dcard.pc .bt small { font-size: 11px; }
/* four to six cards, and on phones: the picture moves next to the name to keep the cards short */
.draft.compact .dcard.pc { display: grid; grid-template-columns: 64px minmax(0, 1fr); column-gap: 10px; row-gap: 4px; align-content: start; }
.draft.compact .dcard.pc > * { grid-column: 1 / -1; }
.draft.compact .dcard.pc > .pic { grid-column: 1; grid-row: 2 / span 2; width: 64px; height: 64px; align-self: center; }
.draft.compact .dcard.pc > .t, .draft.compact .dcard.pc > .b-role { grid-column: 2; }
.draft.compact .dcard.pc > .t { align-self: end; margin: 0; font-size: 20px; }
.draft.compact .dcard.pc > .b-role { align-self: start; margin: 0; }
.draft.compact .pcost { margin-top: 2px; }
.draft.compact .pband { padding-left: 40px; } .draft.compact .pband img { display: none; } .draft.compact .pband b { font-size: 15px; } .draft.compact .pband small { font-size: 12px; }
@media (max-width: 820px) { .pband, .draft.compact .pband { padding-left: 12px; } .draft.compact .pband img { display: inline; } }
.law-hint { display: flex; align-items: center; gap: 8px; font-size: 17px; margin: 0 0 6px; } .law-hint img { flex: none; } .law-hint .good { color: var(--good); }
/* ---------- market: tiles on top, one row per good, every button says what you give → what you get ---------- */
.mk-hd { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 10px; }
.sheet .mk-hd h2 { margin-bottom: 0; }
.mk-top { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; flex: 1; }
.mk-t { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; align-items: center; padding: 6px 14px 6px 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.6); border: 1px solid rgba(120, 90, 50, 0.25); line-height: 1.15; }
.mk-t > img { grid-row: 1 / span 3; }
.mk-t b { font: 700 28px/1.05 var(--display); color: var(--wood); font-variant-numeric: lining-nums tabular-nums; }
.mk-t small { font-size: 14px; font-weight: 800; color: var(--ink-soft); }
.mk-t small em { font-style: normal; color: #245a2a; }
.mk-t small.nx { font-weight: 700; }
.mk-t.gold { min-width: 140px; }
.mk-t.tier { min-width: 0; }
.mk-t.tier b { font-size: 21px; display: flex; align-items: center; flex-wrap: wrap; gap: 0 8px; }
.mk-t.tier .stars { font-size: 15px; color: #b8862a; letter-spacing: 1px; } .mk-t.tier .stars .off { color: rgba(120, 90, 50, 0.3); }
.mk-t.pro { background: rgba(63, 138, 70, 0.12); border-color: rgba(63, 138, 70, 0.4); }
.mk-t.off > img { filter: grayscale(1); opacity: 0.55; }
.mk-t small.bad { color: var(--bad); }
.mk-grid { display: grid; gap: 6px; }
.mk-head, .mk-row, .mk-merc { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.mk-head { padding: 0 6px; }
.mk-head span { font-size: 13px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); }
.mk-head span + span { text-align: center; }
.mk-row, .mk-merc { padding: 4px 6px; border-radius: 12px; background: rgba(255, 255, 255, 0.45); border: 1px solid rgba(120, 90, 50, 0.2); }
.mk-good { display: grid; grid-template-columns: 40px auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 0 4px; cursor: default; }
.mk-good > img { grid-row: span 2; }
.mk-good b { font: 700 28px/1 var(--display); color: var(--wood); font-variant-numeric: lining-nums tabular-nums; }
.mk-good small { grid-column: 2; font-size: 13px; font-weight: 800; color: var(--ink-soft); }
.mk-need { grid-column: 3; grid-row: 1 / span 2; justify-self: end; display: inline-flex; align-items: center; gap: 2px; padding: 2px 7px 2px 3px; border-radius: 999px; font: 700 15px var(--display); font-variant-numeric: lining-nums tabular-nums; }
.mk-need i { font-style: normal; margin-left: 2px; }
.mk-need.ok { background: rgba(63, 138, 70, 0.13); color: #245a2a; } .mk-need.bad { background: rgba(192, 57, 43, 0.12); color: #8a2418; }
.mk-btn { position: relative; display: grid; justify-items: center; align-content: center; gap: 4px; min-height: 56px; padding: 4px 6px; border-radius: 12px; border: 2px solid var(--parch-edge);
  background: linear-gradient(#fffaf0, #f3e6c8); box-shadow: 0 3px 0 #a8884a; transition: transform 0.08s, border-color 0.12s, background 0.12s; }
.mk-btn.sell { background: linear-gradient(#fffbea, #f6e3b0); }
.mk-btn:hover:not(.no) { border-color: var(--red); transform: translateY(-2px); }
.mk-btn:active:not(.no) { transform: translateY(2px); box-shadow: 0 1px 0 #a8884a; }
.mk-f { display: inline-flex; align-items: center; gap: 6px; }
.mk-f .kbd { min-width: 20px; height: 20px; padding: 0 5px; font-size: 13px; }
.mk-x { display: inline-flex; align-items: center; gap: 6px; font: 700 21px/1 var(--display); font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.mk-x > span { display: inline-flex; align-items: center; gap: 2px; }
.mk-x .give { color: #8a2418; } .mk-x .get { color: #245a2a; }
.mk-x > i { font-style: normal; font-size: 17px; color: var(--ink-soft); }
.mk-x s { font-size: 15px; font-weight: 600; color: var(--ink-soft); margin-right: 4px; text-decoration-thickness: 2px; }
.mk-btn small { font-size: 13px; font-weight: 800; color: var(--ink-soft); line-height: 1.1; }
.mk-btn small.why { color: var(--bad); }
.mk-btn.no { cursor: default; background: rgba(255, 255, 255, 0.3); border-style: dashed; border-color: rgba(120, 90, 50, 0.35); box-shadow: none; }
.mk-btn.no .mk-x { opacity: 0.4; filter: grayscale(0.85); }
.mk-btn.no .kbd { opacity: 0.5; }
.mk-btn.nope { animation: mkNope 0.34s; } .mk-btn.nope small.why { animation: mkWhy 0.6s; }
.mk-btn.hit { animation: mkHit 0.32s cubic-bezier(.3, 1.6, .5, 1); }
.mk-row.hit .mk-good > img, .mk-merc.hit .mk-fig { animation: mkHop 0.45s cubic-bezier(.3, 1.6, .5, 1); }
.mk-good b.up, .mk-t b.up, .mk-tot b.up { animation: mkUp 0.6s; } .mk-good b.dn, .mk-t b.dn { animation: mkDn 0.6s; }
.mk-merc { margin-top: 8px; }
.mk-mw { grid-column: 1 / 3; display: flex; align-items: center; gap: 10px; min-width: 0; }
.mk-fig { width: 60px; height: 60px; flex: none; }
.mk-mi { display: grid; justify-items: start; min-width: 0; }
.mk-mi > b { font: 600 21px/1.1 var(--display); color: var(--wood); }
.mk-mi > small { font-size: 14px; font-weight: 800; color: var(--ink-soft); }
.mk-mi .btiles { margin: 4px 0 3px; gap: 4px; flex-wrap: nowrap; }
.mk-mi .bt { grid-template-columns: 20px auto; column-gap: 4px; padding: 2px 8px 2px 4px; } .mk-mi .bt img { width: 20px; height: 20px; } .mk-mi .bt b { font-size: 17px; } .mk-mi .bt small { font-size: 11px; }
.mk-co { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 5px; }
.mk-co > i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #b8862a; background: rgba(255, 255, 255, 0.6); }
.mk-co > i.on { background: radial-gradient(circle at 35% 30%, #fff2b8, var(--gold) 55%, #b8862a); }
.mk-co > i.new { animation: mkHop 0.45s cubic-bezier(.3, 1.6, .5, 1); }
.mk-co small { font-size: 13px; font-weight: 800; color: var(--ink-soft); margin-left: 2px; }
.mk-co .mk-tot { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; color: var(--ink); }
.mk-co .mk-tot b { font: 700 16px var(--display); }
.mk-merc .mk-btn { align-self: stretch; }
.row.mk-foot { margin-top: 10px; }
.mk-foot .hint-line { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; }
.mk-float { position: fixed; z-index: 60; pointer-events: none; display: inline-flex; align-items: center; gap: 2px; font: 700 24px/1 var(--display); white-space: nowrap;
  transform: translate(-50%, -60%); text-shadow: 0 1px 0 #fffaf0, 0 0 10px rgba(255, 250, 235, 0.95); animation: mkFloat 1s ease-out forwards; }
.mk-float.up { color: #23702c; } .mk-float.dn { color: #a42a1c; }
@keyframes mkFloat { 0% { opacity: 0; transform: translate(-50%, -30%) scale(0.6); } 15% { opacity: 1; transform: translate(-50%, -80%) scale(1.15); } 30% { transform: translate(-50%, -95%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -200%); } }
@keyframes mkHit { 0% { transform: scale(0.94); } 60% { transform: scale(1.04); } 100% { transform: none; } }
@keyframes mkHop { 0% { transform: none; } 40% { transform: translateY(-6px) scale(1.15); } 100% { transform: none; } }
@keyframes mkUp { 0% { transform: scale(1.3); color: #2f8a3a; } 70% { color: #2f8a3a; } }
@keyframes mkDn { 0% { transform: scale(0.85); color: #b8301f; } 70% { color: #b8301f; } }
@keyframes mkNope { 20% { transform: translateX(-5px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-3px); } }
@keyframes mkWhy { 30% { transform: scale(1.12); } }
@media (max-width: 560px) {
  .mk-hd { margin-bottom: 8px; gap: 6px 12px; } .mk-top { display: contents; }
  .mk-t { padding: 5px 10px 5px 6px; column-gap: 8px; } .mk-t > img { width: 34px; height: 34px; }
  .mk-t b { font-size: 24px; } .mk-t.tier b { font-size: 18px; } .mk-t small { font-size: 13px; }
  .mk-t.gold { min-width: 0; margin-left: auto; } .mk-t.tier { flex: 1 1 100%; }
  .mk-head, .mk-row, .mk-merc { grid-template-columns: 46px minmax(0, 1fr) minmax(0, 1fr); gap: 4px; }
  .mk-head { padding: 0 3px; } .mk-head span { font-size: 11px; letter-spacing: 0.02em; white-space: nowrap; }
  .mk-row, .mk-merc { padding: 3px; }
  .mk-good { grid-template-columns: 1fr; grid-template-rows: none; justify-items: center; row-gap: 2px; padding: 0; }
  .mk-good > img { grid-row: auto; width: 28px; height: 28px; }
  .mk-good b { font-size: 21px; } .mk-good small { display: none; }
  .mk-need { grid-column: auto; grid-row: auto; justify-self: center; font-size: 13px; padding: 1px 5px 1px 2px; } .mk-need img { width: 14px; height: 14px; }
  .mk-btn { min-height: 54px; padding: 4px 2px; gap: 3px; }
  .mk-x { font-size: 16px; gap: 2px; } .mk-x > span { gap: 1px; } .mk-x img { width: 19px; height: 19px; } .mk-x > i { font-size: 12px; } .mk-x s { display: none; }
  .mk-btn small { font-size: 12px; }
  .mk-mw { grid-column: 1 / -1; align-items: flex-start; gap: 8px; } .mk-fig { width: 46px; height: 46px; }
  .mk-merc .mk-btn { grid-column: 1 / -1; min-height: 50px; }
  .mk-mi .btiles { flex-wrap: wrap; }
  .mk-foot .hint-line { font-size: 13px; }
}
