:root {
  --bg: #0a1820; --bg2: #102530; --panel: #15303c; --panel2: #1b3b49; --line: #2b5263;
  --ink: #eef3ee; --muted: #9fb7bd; --gold: #e9c46a; --gold2: #f4dc9b; --red: #e0583f; --blue: #4aa3df; --green: #6cc070;
  --fear: #b48ce6; --blight: #6a3b57;
  --serif: "Iowan Old Style", "Palatino", "Georgia", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px); --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  --speed: 1;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 14px; overscroll-behavior: none; }
body { overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input, select { font: inherit; }
#app { position: fixed; inset: 0; padding: var(--st) var(--sr) var(--sb) var(--sl); display: flex; flex-direction: column; }
.noanim * { animation: none !important; transition: none !important; }

/* ---------- generic ---------- */
.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; font-weight: 600; transition: transform .1s, background .2s; }
.btn:active { transform: scale(.96); }
.btn.primary { background: linear-gradient(180deg, #f0cf78, #d9ab45); color: #2a1d05; border-color: #f4dc9b; }
.btn.danger { background: #5a2626; border-color: #8a3b3b; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .4; pointer-events: none; }
.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 2px 8px; font-size: 12px; background: var(--panel2); border: 1px solid var(--line); white-space: nowrap; }
.muted { color: var(--muted); }
.serif { font-family: var(--serif); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; }
.row { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; }
.scroll { overflow: auto; -webkit-overflow-scrolling: touch; }
.el { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; font-size: 10.5px; color: #111; font-weight: 700; line-height: 1; flex: none; box-shadow: inset 0 -1px 0 rgba(0,0,0,.25); }
.el.big { width: 22px; height: 22px; font-size: 13px; }
.el.dim { opacity: .3; }
.elcount { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 700; }
.energy { color: var(--gold); font-weight: 700; }
kbd { font-family: var(--sans); }

/* ---------- home & setup screens ---------- */
.screen { flex: 1; overflow: auto; padding: 14px 18px; background: radial-gradient(ellipse at 30% 0%, #1b4252 0%, var(--bg) 60%); }
.home { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; align-items: center; height: 100%; }
.home .title { font-size: 40px; color: var(--gold2); letter-spacing: .5px; text-shadow: 0 2px 18px rgba(233,196,106,.25); }
.home .sub { color: var(--muted); margin-top: 6px; line-height: 1.4; max-width: 420px; }
.home .menu { display: flex; flex-direction: column; gap: 9px; max-width: 320px; width: 100%; justify-self: center; }
.home .menu .btn { padding: 12px 16px; text-align: left; display: flex; gap: 10px; align-items: center; }
.home .menu .btn small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
.home .menu .btn.primary small { color: #5a4310; }
.home .art { width: 100%; max-width: 440px; }
.setup { display: grid; grid-template-columns: 1fr 1fr 0.9fr; gap: 12px; }
.setup .col b.serif { white-space: nowrap; }
.setup .col { background: rgba(21,48,60,.8); border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.setup input[type=text] { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); padding: 7px 9px; width: 100%; }
.spirit-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.spirit-pick button { border: 1px solid var(--line); border-radius: 9px; padding: 6px 4px; background: var(--bg2); font-size: 11.5px; line-height: 1.15; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.spirit-pick button .g { font-size: 18px; }
.spirit-pick button.sel { border-color: var(--gold); background: #2a3f2b; box-shadow: 0 0 0 1px var(--gold) inset; }
.spirit-pick button.taken { opacity: .3; pointer-events: none; }
.spirit-info { font-size: 12px; line-height: 1.35; color: #dbe6e0; }
.spirit-info .cx { font-size: 11px; }
.bars { display: grid; grid-template-columns: auto 1fr; gap: 2px 6px; font-size: 10.5px; color: var(--muted); align-items: center; }
.bar { height: 5px; border-radius: 3px; background: #0c1d25; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); border-radius: 3px; }
.opt { display: flex; gap: 6px; flex-wrap: wrap; }
.opt button { border: 1px solid var(--line); background: var(--bg2); border-radius: 8px; padding: 6px 9px; font-size: 12.5px; }
.opt button.sel { border-color: var(--gold); color: var(--gold2); background: #2a3a28; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 13px; }
.switch { width: 42px; height: 24px; border-radius: 12px; background: #34505b; position: relative; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(18px); }

/* ---------- game layout ---------- */
.game { flex: 1; display: grid; grid-template-rows: 42px 1fr; grid-template-columns: 54px 1fr; min-height: 0; }
.topbar { grid-column: 1 / 3; display: flex; align-items: center; gap: 7px; padding: 0 6px; background: linear-gradient(180deg, #12303d, #0d2530); border-bottom: 1px solid var(--line); min-width: 0; overflow: hidden; }
.topbar .phase { display: flex; flex-direction: column; line-height: 1.05; min-width: 92px; }
.topbar .phase b { font-family: var(--serif); font-size: 15px; color: var(--gold2); }
.topbar .phase span { font-size: 10.5px; color: var(--muted); }
.track { display: flex; gap: 2px; }
.track i { width: 9px; height: 9px; border-radius: 2px; background: #22404c; display: block; }
.track i.on { background: var(--fear); box-shadow: 0 0 6px var(--fear); }
.tb-block { display: flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 9px; background: rgba(0,0,0,.2); border: 1px solid #224653; font-size: 12px; white-space: nowrap; }
.tb-block .lbl { font-size: 9.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.tb-block.pulse { animation: pulse calc(.8s * var(--speed)) ease 2; }
.invcard { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 40px; height: 30px; border-radius: 5px; padding: 0 4px; font-size: 9.5px; font-weight: 700; line-height: 1.05; color: #111; border: 1px solid rgba(0,0,0,.35); }
.invcard small { font-weight: 600; font-size: 8.5px; opacity: .75; text-transform: uppercase; }
.invcard.back { background: repeating-linear-gradient(45deg, #5a2f2a, #5a2f2a 4px, #6b3832 4px, #6b3832 8px); color: #f3d6c8; }
.invcard.empty { background: transparent; border: 1px dashed #3b5c69; color: var(--muted); }
.tb-btn { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 17px; background: var(--panel); border: 1px solid var(--line); flex: none; }
.tb-btn:disabled { opacity: .3; }
.tb-btn.on { background: #3b3a1d; border-color: var(--gold); }

.rail { display: flex; flex-direction: column; gap: 6px; padding: 6px 5px; background: #0c222b; border-right: 1px solid var(--line); }
.rail button { height: 50px; border-radius: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 9.5px; color: var(--muted); position: relative; border: 1px solid transparent; }
.rail button .ic { font-size: 19px; line-height: 1.1; }
.rail button.sel { background: var(--panel2); color: var(--ink); border-color: var(--line); }
.rail button .dot { position: absolute; top: 4px; right: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.rail button .done { position: absolute; top: 3px; right: 4px; font-size: 10px; color: var(--green); }

.main { position: relative; min-width: 0; min-height: 0; overflow: hidden; }

/* ---------- map ---------- */
.mapwrap { position: absolute; inset: 0; touch-action: none; background: radial-gradient(ellipse at 50% 50%, #12384a 0%, #0a1c26 75%); }
.mapwrap svg { width: 100%; height: 100%; display: block; }
.land { stroke: #0e1b1f; stroke-width: 2.2; stroke-linejoin: round; transition: filter .2s, opacity .2s; }
.land.sel { stroke: var(--gold); stroke-width: 4; filter: brightness(1.15); animation: glow calc(1.2s * var(--speed)) ease-in-out infinite alternate; }
.land.dim { filter: brightness(.5) saturate(.6); }
.land.flash-ravage { animation: fr calc(.5s * var(--speed)) ease 3; }
.land.flash-build { animation: fb calc(.5s * var(--speed)) ease 2; }
.land.flash-explore { animation: fe calc(.5s * var(--speed)) ease 2; }
.land.flash-power { animation: fp calc(.5s * var(--speed)) ease 2; }
.land.picked { stroke: #fff; stroke-width: 4; }
.lbl-land { font: 700 13px var(--sans); fill: rgba(255,255,255,.85); paint-order: stroke; stroke: rgba(0,0,0,.55); stroke-width: 3px; pointer-events: none; }
.lbl-terr { font: 600 9.5px var(--sans); fill: rgba(255,255,255,.6); pointer-events: none; text-transform: uppercase; letter-spacing: .6px; }
.piece { pointer-events: none; }
.piece.pop { animation: pop calc(.45s * var(--speed)) cubic-bezier(.3,1.6,.5,1); transform-box: fill-box; transform-origin: center; }
.cnt { font: 800 11px var(--sans); fill: #fff; paint-order: stroke; stroke: #000; stroke-width: 3px; }
.floattext { font: 800 18px var(--sans); paint-order: stroke; stroke: rgba(0,0,0,.7); stroke-width: 4px; pointer-events: none; animation: floatup calc(1.1s * var(--speed)) ease-out forwards; }
.badge-threat { pointer-events: none; }
.ocean-label { font: italic 600 13px var(--serif); fill: rgba(170,220,240,.45); letter-spacing: 3px; }

.prompt { position: absolute; left: 50%; top: 6px; transform: translateX(-50%); max-width: calc(100% - 16px); background: rgba(14,36,46,.95); border: 1px solid var(--gold); border-radius: 12px; padding: 7px 10px; display: flex; gap: 8px; align-items: center; z-index: 5; box-shadow: 0 6px 24px rgba(0,0,0,.45); flex-wrap: wrap; justify-content: center; }
.prompt .txt { font-size: 13px; max-width: 460px; }
.prompt .txt b { color: var(--gold2); }

.tray { position: absolute; left: 6px; right: 6px; bottom: 6px; display: flex; gap: 6px; align-items: flex-end; z-index: 4; pointer-events: none; }
.tray > * { pointer-events: auto; }
.tray .chips { flex: 1; display: flex; gap: 6px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.chip { flex: none; display: flex; align-items: center; gap: 6px; text-align: left; padding: 5px 9px 5px 6px; border-radius: 11px; background: rgba(21,48,60,.95); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; box-shadow: 0 3px 10px rgba(0,0,0,.35); max-width: 190px; line-height: 1.2; }
.chip .sw { width: 10px; height: 26px; border-radius: 4px; flex: none; }
.chip small { display: block; font-weight: 400; color: var(--muted); font-size: 10.5px; }
.chip.suggest { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 3px 10px rgba(0,0,0,.35); }
.chip.done { opacity: .5; }
.speed-tag { font-size: 9px; font-weight: 800; letter-spacing: .5px; padding: 1px 5px; border-radius: 4px; }
.speed-tag.fast { background: #e8743b; color: #2b1205; }
.speed-tag.slow { background: #5c8fd6; color: #0d1a2e; }

.legend-btn { position: absolute; right: 8px; top: 8px; z-index: 3; }
.zoom-btns { position: absolute; right: 8px; top: 48px; display: flex; flex-direction: column; gap: 5px; z-index: 3; }
.zoom-btns button { width: 32px; height: 32px; border-radius: 8px; background: rgba(21,48,60,.9); border: 1px solid var(--line); font-size: 16px; }

.invbanner { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); z-index: 6; background: rgba(40,16,12,.94); border: 1px solid #b4533c; border-radius: 12px; padding: 7px 12px; display: flex; gap: 10px; align-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.invbanner .steps { display: flex; gap: 4px; }
.invbanner .steps span { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: rgba(255,255,255,.07); color: #d9b5a8; }
.invbanner .steps span.on { background: #c3533b; color: #fff; font-weight: 700; }

/* ---------- spirit panel ---------- */
.spanel { position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr; }
.sp-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(255,255,255,.04), transparent); min-width: 0; overflow-x: auto; scrollbar-width: none; }
.sp-head .nm { font-family: var(--serif); font-size: 16px; font-weight: 600; white-space: nowrap; }
.sp-head .who { font-size: 11px; color: var(--muted); }
.sp-head .stat { display: flex; flex-direction: column; align-items: center; line-height: 1.05; padding: 2px 8px; border-left: 1px solid var(--line); }
.sp-head .stat b { font-size: 16px; }
.sp-head .stat span { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.sp-body { display: grid; grid-template-columns: minmax(210px, 36%) 1fr; min-height: 0; }
.sp-left { border-right: 1px solid var(--line); padding: 8px; overflow: auto; display: flex; flex-direction: column; gap: 7px; }
.sp-right { display: grid; grid-template-rows: auto 1fr; min-height: 0; min-width: 0; }
.subtabs { display: flex; gap: 4px; padding: 6px 8px 0; overflow-x: auto; scrollbar-width: none; }
.subtabs button { font-size: 12px; padding: 5px 10px; border-radius: 8px 8px 0 0; color: var(--muted); border: 1px solid transparent; border-bottom: 0; white-space: nowrap; }
.subtabs button.sel { background: var(--panel); color: var(--ink); border-color: var(--line); }
.sp-pane { background: var(--panel); border-top: 1px solid var(--line); overflow: auto; padding: 8px; min-height: 0; }
.hand { display: flex; gap: 8px; height: 100%; align-items: flex-start; overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
.hand.wrap { flex-wrap: wrap; overflow-y: auto; height: auto; }
.empty-note { color: var(--muted); font-size: 12.5px; padding: 10px; }

.growth-opt { border: 1px solid var(--line); background: var(--bg2); border-radius: 11px; padding: 7px 9px; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.growth-opt .gn { font-weight: 700; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.growth-opt .ga { display: flex; gap: 5px; flex-wrap: wrap; }
.growth-opt .ga span { font-size: 11.5px; background: rgba(255,255,255,.06); padding: 2px 7px; border-radius: 6px; }
.growth-opt.suggest { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.growth-opt:active { transform: scale(.98); }
.star { color: var(--gold); font-size: 11px; font-weight: 700; }
.section-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 700; }
.power-row { display: flex; align-items: center; gap: 7px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.power-row.done { opacity: .45; }
.power-row .pn { font-weight: 600; font-size: 12.5px; flex: 1; line-height: 1.2; }
.power-row .pn small { display: block; color: var(--muted); font-weight: 400; font-size: 10.5px; }

/* cards */
.card { flex: none; width: 122px; height: 172px; border-radius: 10px; background: linear-gradient(180deg, #f6efdd, #e7dcc0); color: #2a2418; position: relative; display: flex; flex-direction: column; overflow: hidden; border: 2px solid #b9a77c; box-shadow: 0 3px 10px rgba(0,0,0,.35); transition: transform .15s; text-align: left; }
.card:active { transform: scale(.97); }
.card.minor { border-color: #9aa3a8; }
.card.major { border-color: #d4a531; background: linear-gradient(180deg, #fbf1d4, #ecd9a6); }
.card .stripe { height: 5px; flex: none; }
.card .top { display: flex; align-items: flex-start; gap: 4px; padding: 4px 5px 2px; }
.card .cost { flex: none; width: 21px; height: 21px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe9a6, #d29d2a); display: grid; place-items: center; font-weight: 800; font-size: 12.5px; color: #3a2700; border: 1px solid #8a6514; }
.card .name { font-family: var(--serif); font-weight: 700; font-size: 11.5px; line-height: 1.1; flex: 1; }
.card .meta { display: flex; align-items: center; gap: 3px; padding: 0 5px; flex-wrap: wrap; }
.card .rng { font-size: 9px; color: #5b4f3a; padding: 1px 5px; line-height: 1.2; }
.card .txt { font-size: 10.3px; line-height: 1.25; padding: 3px 6px; flex: 1; overflow: hidden; }
.card .bonus { font-size: 9.5px; line-height: 1.2; margin: 0 4px 4px; padding: 3px 4px; background: rgba(160,110,20,.15); border-radius: 5px; }
.card .kind { position: absolute; bottom: 3px; right: 6px; font-size: 8px; text-transform: uppercase; letter-spacing: .5px; color: #8b7a55; }
.card.cant { filter: grayscale(.7) brightness(.8); }
.card.suggest { box-shadow: 0 0 0 3px var(--gold), 0 0 16px rgba(233,196,106,.7); }
.card.played-anim { animation: cardup calc(.4s * var(--speed)) ease; }
.card.big { width: 200px; height: 262px; border-radius: 14px; }
.card.big .name { font-size: 16px; }
.card.big .cost { width: 32px; height: 32px; font-size: 18px; }
.card.big .txt { font-size: 14px; padding: 6px 10px; }
.card.big .rng { font-size: 12px; padding: 3px 10px; }
.card.big .bonus { font-size: 13px; padding: 6px 8px; margin: 0 8px 8px; }
.card.big .meta { padding: 0 10px; }
.card.big .el { width: 22px; height: 22px; font-size: 13px; }
.card.big .kind { font-size: 11px; }
.card .resolved-tag { position: absolute; inset: auto 0 22px 0; text-align: center; font-size: 10px; font-weight: 800; color: #fff; background: rgba(60,90,60,.85); padding: 2px; }

.innate { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; margin-bottom: 7px; }
.innate .ih { display: flex; align-items: center; gap: 6px; font-weight: 700; font-family: var(--serif); font-size: 14px; }
.innate .lv { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; padding: 3px 0; border-top: 1px dashed #2c4b58; opacity: .55; }
.innate .lv.met { opacity: 1; }
.innate .lv .req { display: flex; gap: 2px; flex: none; min-width: 92px; flex-wrap: wrap; }
.tracks { display: flex; flex-direction: column; gap: 8px; }
.trk { display: flex; gap: 4px; align-items: center; }
.trk .tl { width: 76px; font-size: 11px; color: var(--muted); }
.slot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: #0d2029; border: 1px solid #2b4a57; position: relative; }
.slot.rev { background: #f3ecd8; color: #2a2418; border-color: #c8b78a; }
.slot { color: #8fb0ba; }
.slot .pres { position: absolute; right: -4px; top: -4px; width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5); }
.slot:not(.rev) .el { opacity: .55; }
.slot.next { box-shadow: 0 0 0 2px var(--gold); }
.special { background: rgba(233,196,106,.07); border: 1px solid #5d5532; border-radius: 10px; padding: 7px 9px; font-size: 12px; line-height: 1.35; margin-bottom: 6px; }
.special b { color: var(--gold2); }

/* ---------- log ---------- */
.logview { position: absolute; inset: 0; overflow: auto; padding: 8px 12px; font-size: 12.5px; line-height: 1.45; }
.logview .ln { padding: 1px 0; }
.logview .ln.turn { color: var(--gold2); font-family: var(--serif); font-weight: 700; margin-top: 6px; font-size: 14px; }
.logview .ln.phase { color: var(--muted); font-style: italic; }
.logview .ln.bad, .logview .ln.ravage { color: #f0957f; }
.logview .ln.good { color: #9ddc9f; }
.logview .ln.dread { color: #cfb2f5; }
.logview .ln.power { color: #cfe6f2; }
.logview .ln.build { color: #f1c48f; }
.logview .ln.explore { color: #9cc8ea; }
.logview .ln.win { color: var(--gold); font-weight: 700; }
.logview .ln.lose { color: var(--red); font-weight: 700; }

/* ---------- modal / sheet ---------- */
.overlay { position: fixed; inset: 0; background: rgba(3,10,14,.62); z-index: 50; display: grid; place-items: center; padding: calc(var(--st) + 8px) calc(var(--sr) + 8px) calc(var(--sb) + 8px) calc(var(--sl) + 8px); animation: fadein .18s; }
.sheet { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; max-width: 760px; width: 100%; max-height: calc(100vh - 16px - var(--st) - var(--sb)); max-height: calc(100dvh - 16px - var(--st) - var(--sb)); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.6); animation: rise .22s ease; }
.sheet .sh { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.sheet .sh h2 { font-size: 18px; flex: 1; }
.sheet .sb { padding: 10px 14px; overflow: auto; }
.sheet .sf { flex: none; padding: 8px 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.sheet.narrow { max-width: 460px; }
.choice-list { display: flex; flex-direction: column; gap: 7px; }
.choice-list .btn { text-align: left; }
.cards-pick { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px; }
.cards-pick .card { width: 150px; height: 210px; }
.cards-pick .card .txt { font-size: 11.5px; }
.cards-pick .card.picked { box-shadow: 0 0 0 3px var(--gold); transform: translateY(-4px); }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 24px; }
.settings-grid h3 { grid-column: 1 / -1; font-size: 14px; color: var(--gold2); margin-top: 6px; }
.rules { font-size: 13px; line-height: 1.5; }
.rules h3 { color: var(--gold2); margin: 12px 0 4px; font-size: 16px; }
.rules p, .rules li { margin: 3px 0; }
.rules ul { padding-left: 18px; margin: 4px 0; }
.legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 12px; font-size: 12px; }
.legend div { display: flex; align-items: center; gap: 6px; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.stats-table td, .stats-table th { padding: 4px 6px; border-bottom: 1px solid #234452; text-align: left; }
.stats-table th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; }
.win-t { color: var(--green); font-weight: 700; } .lose-t { color: var(--red); font-weight: 700; }
.result-hero { text-align: center; padding: 6px 0 10px; }
.result-hero .big { font-family: var(--serif); font-size: 32px; }

/* toast & coach */
.toast { position: fixed; left: 50%; bottom: calc(var(--sb) + 64px); transform: translateX(-50%); background: rgba(14,36,46,.97); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; z-index: 40; pointer-events: none; font-size: 13px; max-width: 80vw; box-shadow: 0 8px 24px rgba(0,0,0,.5); animation: rise .25s; }
.coach { position: fixed; z-index: 90; max-width: 360px; background: #fdf6e3; color: #2a2418; border-radius: 14px; padding: 12px 14px; box-shadow: 0 10px 40px rgba(0,0,0,.6); font-size: 13.5px; line-height: 1.42; animation: rise .25s; }
.coach h3 { font-size: 16px; margin-bottom: 4px; color: #6a4a10; }
.coach .cf { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; align-items: center; }
.coach .cf .btn { background: #e9dfc2; border-color: #c9b98d; color: #2a2418; }
.coach .cf .btn.primary { background: linear-gradient(180deg, #f0cf78, #d9ab45); }
.coach .step { font-size: 11px; color: #8b7a55; margin-right: auto; }
.coach-dim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 89; }
.coach-ring { position: fixed; z-index: 89; border: 3px solid var(--gold); border-radius: 12px; box-shadow: 0 0 0 4000px rgba(0,0,0,.35), 0 0 18px var(--gold); pointer-events: none; transition: all .25s; }

.rotate { position: fixed; inset: 0; z-index: 200; background: var(--bg); display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 30px; }
@media (orientation: portrait) and (max-width: 700px) { .rotate.show { display: flex; } }
.rotate .ph { font-size: 54px; animation: rot 2s ease-in-out infinite; }

@keyframes pulse { 50% { transform: scale(1.08); box-shadow: 0 0 14px var(--fear); } }
@keyframes glow { from { filter: brightness(1.05) drop-shadow(0 0 2px var(--gold)); } to { filter: brightness(1.3) drop-shadow(0 0 7px var(--gold)); } }
@keyframes fr { 50% { fill: #c4402b; } }
@keyframes fb { 50% { fill: #d88a3a; } }
@keyframes fe { 50% { fill: #5aa5d8; } }
@keyframes fp { 50% { fill: #f2e6b0; } }
@keyframes pop { 0% { transform: scale(0); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes floatup { 0% { opacity: 0; transform: translateY(6px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(-34px); } }
@keyframes fadein { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes cardup { 0% { transform: translateY(0); } 50% { transform: translateY(-16px) scale(1.04); } 100% { transform: none; } }
@keyframes rot { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }

@media (max-height: 360px) {
  .game { grid-template-rows: 38px 1fr; }
  .card { width: 112px; height: 158px; }
  .card .txt { font-size: 9.8px; }
}
