/* Scope Creep. Dark, glassy interface over illustrated scenes; paper cards with coloured frames. */
:root {
  --ink: #F4F7F2; --muted: #B4C9CD; --faint: rgba(244, 247, 242, 0.14); --glass: rgba(9, 30, 40, 0.72); --glass-2: rgba(12, 40, 52, 0.86);
  --duck: #FFD23F; --beak: #FF8A1F; --danger: #EF6A45; --good: #62CFA0; --sky: #6FD1E6; --plum: #B79BE8; --gold: #F2C14E;
  --paper: #F6F0E1; --paper-2: #EDE3CC; --paper-ink: #1F2A2E;
  --attack: #C9492F; --skill: #267F9E; --power: #7456B8; --status: #6E7A80; --curse: #58415E; --smoke: #7D6B58;
  --cw: 158px; --ch: 224px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #07202A; color: var(--ink); }
body { font-family: var(--sans); font-size: 16px; line-height: 1.35; -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
button { font: inherit; color: inherit; }
#app { position: relative; min-height: 100dvh; display: flex; flex-direction: column; }
b.kw { color: var(--duck); font-weight: 700; text-decoration: underline dotted rgba(255, 210, 63, 0.5); cursor: help; }
.card b.kw { color: #7A4600; text-decoration-color: rgba(122, 70, 0, 0.35); }

/* Scenery behind every screen of a run, dimmed except in combat. */
.app-bg { position: fixed; inset: 0; z-index: 0; }
.app-bg .backdrop { position: absolute; inset: 0; }
.app-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5, 20, 28, 0.55), rgba(5, 20, 28, 0.82)); backdrop-filter: blur(2px); }
.backdrop svg { display: block; width: 100%; height: 100%; }
.backdrop .smoke { animation: drift 9s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes drift { from { transform: translate(0, 0) scale(0.8); opacity: 0; } 20% { opacity: 1; } to { transform: translate(60px, -160px) scale(1.5); opacity: 0; } }

/* ---------- buttons ---------- */
.btn {
  padding: 10px 18px; border-radius: 12px; border: 1px solid var(--faint); background: rgba(255, 255, 255, 0.06);
  cursor: pointer; font-weight: 700; letter-spacing: 0.03em; transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.btn:hover:not(:disabled), .btn:focus-visible { border-color: var(--duck); outline: none; background: rgba(255, 210, 63, 0.1); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #FFE070, var(--duck)); color: #10323F; border-color: #FFE070; box-shadow: 0 4px 0 #B8900E, 0 8px 18px rgba(0, 0, 0, 0.3); }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #FFEA99, #FFD95A); }
.btn.primary:active:not(:disabled) { box-shadow: 0 2px 0 #B8900E; transform: translateY(2px); }
.btn.small { padding: 5px 11px; font-size: 14px; border-radius: 9px; }

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px;
  padding: 8px 18px; padding-top: calc(8px + env(safe-area-inset-top, 0px));
  background: linear-gradient(180deg, rgba(5, 22, 30, 0.95), rgba(5, 22, 30, 0.78)); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--faint); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}
.bar .where { margin-right: auto; white-space: nowrap; font-family: var(--serif); font-weight: 800; font-size: 19px; color: var(--duck); letter-spacing: 0.01em; }
.bar .where small { font-family: var(--sans); color: var(--muted); font-weight: 600; font-size: 13px; margin-left: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.stat { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; }
.stat .ico { font-size: 17px; }
.heat { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: help; font-weight: 700; }
.heat .meter { width: 96px; height: 10px; border-radius: 5px; background: rgba(255, 255, 255, 0.12); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4); }
.heat .meter i { display: block; height: 100%; background: linear-gradient(90deg, #F2B84B, var(--danger)); box-shadow: 0 0 8px rgba(239, 106, 69, 0.8); }
.heat .lvl { padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.heat.hot .lvl { background: rgba(239, 106, 69, 0.25); color: #FFC0A8; }
.tools { display: inline-flex; gap: 5px; }
.tool { width: 36px; height: 36px; border-radius: 50%; border: 1px dashed var(--faint); background: none; font-size: 18px; cursor: pointer; padding: 0; }
.tool.full { border: 1px solid rgba(111, 209, 230, 0.6); background: radial-gradient(circle at 35% 30%, rgba(111, 209, 230, 0.35), rgba(111, 209, 230, 0.08)); }
.tool.full:hover, .tool.full:focus-visible { border-color: var(--duck); outline: none; }
.relics { position: relative; z-index: 29; display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 18px; background: rgba(5, 22, 30, 0.55); border-bottom: 1px solid var(--faint); backdrop-filter: blur(6px); }
.relic { font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)); border: 1px solid var(--faint); cursor: help; }
.relic.boss { border-color: var(--plum); color: #E3D6FF; }

/* ---------- title ---------- */
.title { position: relative; flex: 1; display: grid; place-items: center; padding: 24px 16px 60px; overflow: hidden; }
.title .backdrop { position: absolute; inset: 0; }
.title::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, rgba(5, 20, 28, 0.15), rgba(5, 20, 28, 0.75)); }
.title .hero-card { position: relative; z-index: 1; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px 36px; max-width: 900px; }
.title .duckart { width: min(280px, 34vw); filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.45)); animation: bob 3.2s ease-in-out infinite; }
.title h1 { margin: 0; font-family: var(--serif); font-weight: 800; font-size: clamp(52px, 9vw, 104px); line-height: 0.92; color: var(--duck); text-shadow: 0 4px 0 #9A6E00, 0 12px 30px rgba(0, 0, 0, 0.5); letter-spacing: -0.01em; }
.title .tag { font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; color: var(--sky); font-size: 13px; margin: 0 0 10px; }
.title .lede { color: #DCE8E6; max-width: 520px; margin: 16px 0 24px; font-size: 18px; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); }
.title .actions { display: flex; flex-wrap: wrap; gap: 12px; }
.title .note { color: var(--duck); font-weight: 700; }
.home { color: var(--muted); text-decoration: none; font-weight: 700; }
.home:hover { color: var(--duck); }

/* ---------- panels (events, rest, results, rewards) ---------- */
.screen { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; padding: 28px 16px 40px; gap: 18px; }
.panel {
  position: relative; width: min(660px, 100%); padding: 26px 26px 24px; border-radius: 20px;
  background: linear-gradient(180deg, var(--glass-2), var(--glass)); border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08); backdrop-filter: blur(12px);
}
.panel.with-art { padding-top: 64px; margin-top: 46px; }
.medallion {
  position: absolute; top: -46px; left: 50%; transform: translateX(-50%); width: 92px; height: 92px; border-radius: 50%;
  display: grid; place-items: center; font-size: 46px; background: radial-gradient(circle at 35% 30%, #1E5A6C, #0B2A36);
  border: 3px solid var(--duck); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), 0 0 0 6px rgba(255, 210, 63, 0.15);
}
.panel h2 { margin: 0 0 10px; font-family: var(--serif); font-weight: 800; font-size: 30px; color: var(--duck); text-align: center; }
.panel > p { margin: 0 0 18px; color: #D5E3E4; text-align: center; font-size: 17px; }
.options { display: flex; flex-direction: column; gap: 10px; }
.option { text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 13px 16px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); }
.option:hover:not(:disabled) { transform: translateX(4px); }
.option span { color: var(--muted); font-weight: 500; font-size: 14px; }
.how { width: min(760px, 100%); text-align: left; }
.how h2 { text-align: left; }
.how h3 { font-family: var(--serif); color: var(--duck); margin: 20px 0 6px; font-size: 21px; }
.how p, .how li { color: #D0DFE0; }
.how > p { text-align: left; }

/* ---------- cards ---------- */
.cards { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }
.card {
  --frame: var(--status);
  position: relative; width: var(--cw); height: var(--ch); padding: 0; border-radius: 14px; border: 0; cursor: pointer; text-align: left;
  background: linear-gradient(180deg, var(--paper), var(--paper-2)); color: var(--paper-ink);
  box-shadow: 0 0 0 3px var(--frame), 0 0 0 5px rgba(0, 0, 0, 0.45), 0 10px 22px rgba(0, 0, 0, 0.4);
  display: flex; flex-direction: column; transition: translate 0.18s ease, rotate 0.18s ease, scale 0.18s ease, box-shadow 0.18s, opacity 0.18s;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.card.attack { --frame: var(--attack); } .card.skill { --frame: var(--skill); } .card.power { --frame: var(--power); }
.card.status { --frame: var(--status); background: linear-gradient(180deg, #E1E1DA, #CFCFC6); }
.card.curse { --frame: var(--curse); background: linear-gradient(180deg, #DCD1DE, #C7B8CB); }
.card.r-rare { box-shadow: 0 0 0 3px var(--frame), 0 0 0 5px var(--gold), 0 0 18px rgba(242, 193, 78, 0.45), 0 10px 22px rgba(0, 0, 0, 0.4); }
.card.r-uncommon { box-shadow: 0 0 0 3px var(--frame), 0 0 0 5px #6FB7CF, 0 10px 22px rgba(0, 0, 0, 0.4); }
.card .gem {
  position: absolute; z-index: 2; top: -12px; left: -12px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--serif); font-weight: 800; font-size: 21px; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  background: radial-gradient(circle at 35% 30%, #FFE680, #E3A40C); border: 3px solid #10323F; box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}
.card .gem.cheaper { background: radial-gradient(circle at 35% 30%, #9BF0C9, #2F9E6E); }
.card .banner { margin: 8px 8px 0 18px; padding: 4px 8px; border-radius: 6px; background: var(--frame); color: #fff; text-align: center; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2); }
.card .name { font-family: var(--serif); font-weight: 800; font-size: 14.5px; line-height: 1.1; display: block; }
.card.up .banner { background: linear-gradient(90deg, var(--frame), #2F8F5B); }
.card .window {
  position: relative; margin: 6px 9px 0; height: 34%; border-radius: 8px; overflow: hidden; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.55), transparent 60%), linear-gradient(160deg, color-mix(in srgb, var(--frame) 30%, #D9E9EC), color-mix(in srgb, var(--frame) 55%, #0F3B4C));
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.12), inset 0 -10px 18px rgba(0, 0, 0, 0.15);
}
.card.fossil .window { background: radial-gradient(circle at 50% 40%, rgba(255, 220, 170, 0.45), transparent 60%), linear-gradient(160deg, #8E7A64, #3A2E26); }
.card .art { font-size: 46px; line-height: 1; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.35)); }
.card .stamp { position: absolute; right: 5px; bottom: 5px; font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #FFE7C2; background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 231, 194, 0.5); padding: 1px 6px; border-radius: 4px; }
.card .ribbon { align-self: center; margin-top: -9px; z-index: 1; padding: 1px 12px; font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: #fff; background: #1F3036; border-radius: 999px; }
.card .text { flex: 1; padding: 6px 11px 10px; font-size: 13px; line-height: 1.28; text-align: center; display: grid; place-items: center; }
.card .preview { position: absolute; left: 50%; bottom: -13px; transform: translateX(-50%); white-space: nowrap; font-weight: 700; font-size: 13px; padding: 2px 10px; border-radius: 999px; color: #10323F; background: var(--duck); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35); }
.card .price { position: absolute; bottom: -14px; left: 50%; transform: translateX(-50%); background: #0B2A36; color: var(--duck); border: 1px solid var(--duck); padding: 2px 12px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.cards .card:hover:not(.disabled), .cards .card:focus-visible, .shoprow .card:hover:not(.disabled) { translate: 0 -6px; outline: none; }
.card.selected { box-shadow: 0 0 0 3px var(--frame), 0 0 0 6px var(--duck), 0 0 24px rgba(255, 210, 63, 0.6), 0 12px 26px rgba(0, 0, 0, 0.45); }
.card.disabled { filter: saturate(0.55) brightness(0.82); cursor: not-allowed; }
.card.sold { opacity: 0.25; pointer-events: none; }

/* ---------- combat stage ---------- */
.stage { position: relative; flex: 1; min-height: 520px; height: calc(100dvh - 96px); display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
.stage .backdrop { position: absolute; inset: 0; z-index: 0; }
.banner-line { position: relative; z-index: 2; justify-self: center; margin-top: 12px; min-height: 30px; max-width: min(760px, 92%); padding: 5px 16px; border-radius: 999px; background: rgba(5, 20, 28, 0.55); backdrop-filter: blur(6px); font-weight: 700; color: var(--duck); text-align: center; font-size: 15px; }
.banner-line:empty { visibility: hidden; }
/* Characters stand on the scene's ground line, above the hand. */
.arena { position: relative; z-index: 2; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 0 5vw calc(var(--ch) * 0.86); min-height: 0; }

.hero, .foe { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.figure { position: relative; display: grid; place-items: end center; }
.figure::after { content: ""; position: absolute; bottom: -6px; left: 50%; width: 70%; height: 16px; transform: translateX(-50%); background: radial-gradient(ellipse, rgba(0, 0, 0, 0.45), transparent 70%); z-index: -1; }
.hero .figure.duck { width: clamp(130px, 16vw, 210px); animation: bob 3.4s ease-in-out infinite; }
.hero .figure.duck svg { width: 100%; height: auto; display: block; }
.hero .figure.duck::after { display: none; }
.hero-body { position: relative; display: flex; align-items: flex-end; }
.flock { display: flex; align-items: flex-end; margin-left: -10px; max-width: 240px; flex-wrap: wrap-reverse; }
.flock svg { width: 34px; height: 30px; margin-left: -6px; animation: bob 1.9s ease-in-out infinite; }
.flock svg:nth-child(2n) { animation-delay: -0.7s; } .flock svg:nth-child(3n) { animation-delay: -1.3s; }
@keyframes bob { 50% { translate: 0 -5px; } }

.foes { display: flex; align-items: flex-end; justify-content: flex-end; gap: clamp(8px, 2vw, 28px); flex-wrap: wrap; }
.foe { padding: 6px 8px 8px; border-radius: 18px; border: 2px solid transparent; background: none; cursor: default; }
.foe .figure span { font-size: clamp(64px, 8vw, 104px); line-height: 1; filter: drop-shadow(0 12px 10px rgba(0, 0, 0, 0.45)); display: block; animation: sway 3s ease-in-out infinite; }
.foe:nth-child(2) .figure span { animation-delay: -1s; } .foe:nth-child(3) .figure span { animation-delay: -2s; }
.foe.elite .figure span { font-size: clamp(76px, 9.5vw, 124px); filter: drop-shadow(0 0 16px rgba(239, 106, 69, 0.55)) drop-shadow(0 12px 10px rgba(0, 0, 0, 0.45)); }
.foe.boss .figure span { font-size: clamp(92px, 12vw, 158px); filter: drop-shadow(0 0 24px rgba(183, 155, 232, 0.6)) drop-shadow(0 14px 12px rgba(0, 0, 0, 0.5)); }
.foe.minion .figure span { font-size: clamp(44px, 5.5vw, 70px); }
@keyframes sway { 50% { translate: 0 -4px; rotate: -1.5deg; } }
.foe.dead { opacity: 0; transform: scale(0.8); transition: opacity 0.5s, transform 0.5s; pointer-events: none; }
.foe.targetable { cursor: pointer; border-color: rgba(255, 210, 63, 0.5); background: rgba(255, 210, 63, 0.06); }
.foe.targetable:hover, .foe.targetable:focus-visible, .foe.aimed { border-color: var(--danger); background: rgba(239, 106, 69, 0.12); outline: none; }
.foe.aimed .figure span { scale: 1.06; }

.plate { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 150px; }
.fname { font-weight: 700; font-size: 14px; letter-spacing: 0.04em; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8); white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.fname .num { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--duck); color: #10323F; font-size: 12px; }
.fname .info { color: var(--muted); font-size: 13px; cursor: help; }
.bars { display: flex; align-items: center; gap: 4px; }
.hpbar { position: relative; width: clamp(120px, 12vw, 160px); height: 16px; border-radius: 9px; background: rgba(0, 0, 0, 0.55); overflow: hidden; font-size: 12px; font-weight: 700; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4), 0 3px 8px rgba(0, 0, 0, 0.35); }
.hpbar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(180deg, #F07A5C, #B83A28); transition: width 0.35s ease; }
.hpbar.me i { background: linear-gradient(180deg, #7FE0B5, #2E9A6E); }
.hpbar span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; line-height: 1; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); }
.shield { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 5px; font-weight: 800; font-family: var(--serif); color: #0B2A36; background: linear-gradient(180deg, #BDEBF6, #5EB8D0); clip-path: polygon(50% 0, 100% 18%, 92% 72%, 50% 100%, 8% 72%, 0 18%); cursor: help; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; max-width: 240px; }
.chip { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(5, 20, 28, 0.7); border: 1px solid var(--faint); cursor: help; backdrop-filter: blur(4px); }
.chip.bad { border-color: rgba(239, 106, 69, 0.6); color: #FFC7B6; }
.chip.good { border-color: rgba(98, 207, 160, 0.6); color: #CFF5E3; }
.intent { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; min-height: 32px; align-items: center; cursor: help; }
.intent .i { display: inline-flex; align-items: center; gap: 4px; padding: 4px 11px; border-radius: 999px; font-weight: 800; font-size: 15px; background: rgba(5, 20, 28, 0.78); border: 1px solid var(--faint); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35); animation: intent 1.6s ease-in-out infinite; }
@keyframes intent { 50% { translate: 0 -2px; } }
.intent .attack { color: #FFB39C; border-color: rgba(239, 106, 69, 0.7); }
.intent .emit { color: #EBDDC7; border-color: rgba(200, 170, 130, 0.6); }
.intent .block { color: #C4EEF8; border-color: rgba(111, 209, 230, 0.6); }
.intent .buff, .intent .summon { color: #E1D3FF; border-color: rgba(183, 155, 232, 0.6); }
.intent .debuff, .intent .escape { color: #C9F3DF; border-color: rgba(98, 207, 160, 0.6); }
.preview-hit { position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%); z-index: 3; padding: 4px 12px; border-radius: 999px; background: var(--danger); color: #fff; font-weight: 800; font-size: 18px; pointer-events: none; white-space: nowrap; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45); }
.preview-hit.lethal { background: var(--duck); color: #10323F; }

/* ---------- hud: energy, piles, the fanned hand ---------- */
.hud { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; display: grid; grid-template-columns: 150px 1fr 170px; align-items: end; padding: 0 16px calc(10px + env(safe-area-inset-bottom, 0px)); pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud .left, .hud .right { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-bottom: 8px; }
.orb {
  position: relative; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; align-content: center;
  background: radial-gradient(circle at 35% 30%, #FFF3B0, var(--duck) 45%, #C98A00); color: #3A2800; border: 3px solid #10323F;
  box-shadow: 0 0 0 3px rgba(255, 210, 63, 0.35), 0 0 28px rgba(255, 210, 63, 0.55), 0 8px 18px rgba(0, 0, 0, 0.45); cursor: help;
}
.orb b { font-family: var(--serif); font-size: 34px; line-height: 1; }
.orb small { font-weight: 700; font-size: 12px; opacity: 0.75; }
.orb.empty { background: radial-gradient(circle at 35% 30%, #9AA9AE, #56707A); box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.3), 0 8px 18px rgba(0, 0, 0, 0.45); color: #1B2A30; }
.pile {
  position: relative; width: 64px; height: 84px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; align-content: center;
  background: repeating-linear-gradient(45deg, #1C5566 0 6px, #184B5A 6px 12px); border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 3px 3px 0 #0E2E38, 6px 6px 0 #0B2530, 0 10px 18px rgba(0, 0, 0, 0.4);
}
.pile span { font-family: var(--serif); font-size: 24px; font-weight: 800; }
.pile small { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.pile:hover, .pile:focus-visible { border-color: var(--duck); outline: none; }
.pile.discard { background: repeating-linear-gradient(45deg, #5A3A2E 0 6px, #4E3228 6px 12px); }
.pile.retired { width: 52px; height: 66px; background: repeating-linear-gradient(45deg, #3C3552 0 6px, #342E48 6px 12px); }
.hud .piles { display: flex; gap: 12px; align-items: flex-end; }
.endturn {
  padding: 14px 26px; border-radius: 999px; border: 0; cursor: pointer; font-family: var(--serif); font-weight: 800; font-size: 19px;
  color: #10323F; background: linear-gradient(180deg, #FFE889, var(--duck)); box-shadow: 0 5px 0 #B8900E, 0 10px 22px rgba(0, 0, 0, 0.4);
  transition: transform 0.12s, box-shadow 0.12s;
}
.endturn:hover, .endturn:focus-visible { outline: none; box-shadow: 0 5px 0 #B8900E, 0 0 0 4px rgba(255, 255, 255, 0.35), 0 10px 22px rgba(0, 0, 0, 0.4); }
.endturn:active { transform: translateY(3px); box-shadow: 0 2px 0 #B8900E; }

.hand {
  position: relative; container-type: inline-size; height: calc(var(--ch) * 0.8); align-self: end;
  --spread: min(calc(var(--cw) * 0.8), calc((100cqw - var(--cw)) / max(1, calc(var(--n) - 1))));
  --tilt: calc(22deg / max(4, var(--n)));
}
.hand .card {
  position: absolute; left: 50%; bottom: calc(var(--ch) * -0.18); margin-left: calc(var(--cw) / -2); transform-origin: 50% 110%;
  translate: calc(var(--k) * var(--spread)) calc(var(--k2) * 2.4px); rotate: calc(var(--k) * var(--tilt)); z-index: calc(10 + var(--i));
}
.hand .card:hover:not(.lifted):not(.disabled), .hand .card:focus-visible, .hand .card.selected {
  translate: calc(var(--k) * var(--spread)) calc(var(--ch) * -0.28); rotate: 0deg; scale: 1.14; z-index: 40; outline: none;
}
.hand .card.disabled:hover { translate: calc(var(--k) * var(--spread)) calc(var(--ch) * -0.08); rotate: 0deg; z-index: 40; }
.hand .card.lifted { opacity: 0; }
.hand.deal .card { animation: deal 0.42s cubic-bezier(0.2, 0.8, 0.3, 1.1) both; animation-delay: calc(var(--i) * 55ms); }
@keyframes deal { from { translate: -45cqw 40px; rotate: -40deg; opacity: 0; } }
.card.held { position: fixed; left: 0; top: 0; z-index: 80; pointer-events: none; transition: none; box-shadow: 0 0 0 3px var(--frame), 0 0 0 6px var(--duck), 0 22px 40px rgba(0, 0, 0, 0.55); }
.card.held.ready { box-shadow: 0 0 0 3px var(--frame), 0 0 0 6px var(--good), 0 0 30px rgba(98, 207, 160, 0.7), 0 22px 40px rgba(0, 0, 0, 0.55); }
.card.held.returning { transition: transform 0.18s ease-in; }
.card.ghost { position: fixed; z-index: 80; margin: 0; pointer-events: none; transition: transform 0.38s ease-in, opacity 0.38s ease-in; }
.card.ghost.go { transform: translateY(-150px) scale(0.7) rotate(6deg); opacity: 0; }
.aim { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 79; pointer-events: none; overflow: visible; }
.aim .chev { fill: none; stroke: var(--duck); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); }
.aim .head { fill: var(--duck); filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); }
.aim .locked.chev { stroke: var(--danger); } .aim .locked.head { fill: var(--danger); }

/* ---------- hits and pops ---------- */
.pop { position: absolute; top: 20%; left: 50%; z-index: 5; font-family: var(--serif); font-weight: 800; font-size: 30px; color: #FFD0C0; pointer-events: none; animation: rise 1s ease-out forwards; text-shadow: 0 3px 0 #7A1F10, 0 6px 14px rgba(0, 0, 0, 0.6); }
.pop.green { color: var(--good); text-shadow: 0 3px 0 #145A3C; } .pop.smoke { color: #EDE2CF; font-size: 20px; text-shadow: 0 2px 0 #4A3A2A; }
@keyframes rise { from { transform: translate(-50%, 0) scale(1.3); opacity: 1; } to { transform: translate(-50%, -60px) scale(1); opacity: 0; } }
.shake { animation: shake 0.34s ease-out; }
@keyframes shake { 20% { translate: -8px 0; } 45% { translate: 7px 0; } 70% { translate: -4px 0; } }
.ouch .figure.duck { animation: ouch 0.45s ease-out; }
@keyframes ouch { 20% { translate: -14px 0; filter: brightness(1.6) sepia(1) hue-rotate(-40deg) saturate(4); } }
.hero.strike .figure.duck { animation: strike 0.32s ease-out; }
@keyframes strike { 40% { translate: 36px -6px; rotate: 6deg; } }

/* ---------- map ---------- */
.mapwrap {
  position: relative; width: min(600px, 100%); overflow-y: auto; max-height: calc(100dvh - 190px); border-radius: 18px;
  background-color: #0D3346; border: 1px solid rgba(160, 210, 230, 0.25); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  background-image: linear-gradient(rgba(160, 210, 230, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(160, 210, 230, 0.07) 1px, transparent 1px), linear-gradient(rgba(160, 210, 230, 0.12) 1px, transparent 1px), linear-gradient(90deg, rgba(160, 210, 230, 0.12) 1px, transparent 1px);
  background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px;
}
.map svg { display: block; width: 100%; height: auto; }
.map .edge { fill: none; stroke: rgba(200, 230, 240, 0.35); stroke-width: 2.5; stroke-dasharray: 2 7; stroke-linecap: round; }
.map .edge.walked { stroke: var(--duck); stroke-dasharray: none; stroke-width: 3.5; stroke-opacity: 0.85; }
.map .node circle { fill: #0B2A36; stroke: rgba(200, 230, 240, 0.45); stroke-width: 2; }
.map .node text { font-size: 21px; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.map .node.visited circle { fill: #1E5A6C; stroke: var(--duck); }
.map .node.here circle { stroke: var(--duck); stroke-width: 4; }
.map .node.open { cursor: pointer; }
.map .node.open circle { stroke: var(--duck); stroke-width: 3; fill: #164557; }
.map .rings .ring { fill: none; pointer-events: none; stroke: var(--duck); stroke-width: 2; animation: ring 1.6s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes ring { from { transform: scale(1); opacity: 0.9; } to { transform: scale(1.7); opacity: 0; } }
.map .node.open:hover circle, .map .node.open:focus-visible circle { fill: #22627A; }
.map .node:focus { outline: none; }
.map .actname { font-family: var(--serif); font-weight: 800; fill: var(--duck); font-size: 26px; text-anchor: middle; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; color: #D0DFE0; font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: 999px; background: rgba(5, 20, 28, 0.6); backdrop-filter: blur(6px); }

/* ---------- rewards, shop ---------- */
.rewards { display: flex; flex-direction: column; gap: 10px; }
.reward { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--faint); }
.reward small { color: var(--muted); }
.shopgrid { width: min(1000px, 100%); display: flex; flex-direction: column; gap: 24px; }
.shopgrid h3 { margin: 0 0 16px; font-family: var(--serif); color: var(--duck); font-size: 22px; }
.shoprow { display: flex; flex-wrap: wrap; gap: 26px 16px; }
.ware { display: flex; flex-direction: column; gap: 6px; padding: 14px; width: 230px; border-radius: 16px; background: linear-gradient(180deg, var(--glass-2), var(--glass)); border: 1px solid var(--faint); text-align: left; cursor: pointer; backdrop-filter: blur(8px); transition: border-color 0.15s, transform 0.15s; }
.ware:hover:not(:disabled), .ware:focus-visible { border-color: var(--duck); outline: none; transform: translateY(-3px); }
.ware:disabled { opacity: 0.45; cursor: not-allowed; }
.ware .p { color: var(--duck); font-weight: 800; font-family: var(--serif); font-size: 18px; }
.ware small { color: var(--muted); }

/* ---------- overlays and tooltips ---------- */
.overlay { position: fixed; inset: 0; z-index: 90; background: rgba(3, 14, 20, 0.86); backdrop-filter: blur(6px); display: flex; flex-direction: column; align-items: center; padding: 22px 16px; overflow-y: auto; }
.overlay h2 { font-family: var(--serif); color: var(--duck); margin: 8px 0 22px; font-size: 28px; }
.overlay .close { position: sticky; top: 0; align-self: flex-end; z-index: 2; }
.overlay .cards { gap: 22px 16px; }
#tip { position: fixed; z-index: 100; max-width: 280px; padding: 9px 12px; border-radius: 10px; background: rgba(4, 22, 30, 0.97); border: 1px solid var(--duck); color: var(--ink); font-size: 14px; pointer-events: none; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5); }

.score { font-variant-numeric: tabular-nums; width: 100%; border-collapse: collapse; margin: 6px 0 18px; }
.score td { padding: 6px 0; border-bottom: 1px solid var(--faint); }
.score td:last-child { text-align: right; font-weight: 700; }
.score tr.total td { color: var(--duck); font-family: var(--serif); font-size: 24px; border-bottom: 0; padding-top: 10px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  .card, .card.ghost { transition: none !important; }
}

@media (max-width: 720px) {
  :root { --cw: 112px; --ch: 160px; }
  .bar { gap: 6px 12px; font-size: 14px; padding: 6px 10px; }
  .bar .where { font-size: 16px; width: 100%; }
  .heat .meter { width: 56px; }
  .card .name { font-size: 12px; }
  .card .text { font-size: 11px; padding: 4px 7px 8px; }
  .card .art { font-size: 32px; }
  .card .gem { width: 30px; height: 30px; font-size: 16px; top: -9px; left: -9px; }
  .arena { padding: 0 6px calc(var(--ch) * 0.92); gap: 4px; }
  .foes { flex-wrap: nowrap; gap: 2px; }
  .foe { padding: 4px 2px; }
  .plate { min-width: 0; }
  .fname { font-size: 12px; white-space: normal; text-align: center; justify-content: center; max-width: 96px; }
  .hpbar { width: 84px; height: 14px; }
  .shield { min-width: 24px; height: 24px; font-size: 13px; }
  .chips { max-width: 110px; }
  .hero .figure.duck { width: 104px; }
  .flock svg { width: 24px; height: 22px; }
  .intent .i { padding: 2px 7px; font-size: 13px; }
  .foe .figure span { font-size: 46px; } .foe.boss .figure span { font-size: 64px; } .foe.elite .figure span { font-size: 54px; } .foe.minion .figure span { font-size: 34px; }
  .hud { grid-template-columns: 76px 1fr 90px; padding: 0 6px 8px; }
  .orb { width: 60px; height: 60px; } .orb b { font-size: 24px; }
  .pile { width: 46px; height: 60px; } .pile span { font-size: 18px; }
  .endturn { padding: 10px 14px; font-size: 15px; }
  .title .hero-card { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .title .actions { justify-content: center; }
}

/* ---------- playback of enemy turns and the end of a fight ---------- */
.pop.block { color: #CFF3FB; text-shadow: 0 3px 0 #1D5E72, 0 6px 14px rgba(0, 0, 0, 0.6); font-size: 30px; }
.pop.block.small { font-size: 20px; top: 34%; }
.pop.buff { color: #E1D3FF; text-shadow: 0 3px 0 #4A2F80; }
.pop.debuff { color: #C9F3DF; text-shadow: 0 3px 0 #1E6B4A; font-size: 24px; }
.foe.lunge .figure span { animation: lunge 0.34s ease-in-out; }
@keyframes lunge { 45% { translate: -70px 6px; rotate: -8deg; scale: 1.08; } }
.hero.parry .figure.duck { animation: parry 0.36s ease-out; }
@keyframes parry { 30% { translate: -6px 0; filter: drop-shadow(0 0 18px #7FD9EE) brightness(1.15); } }
.hero.parry .shield, .shield.flash { animation: flash-shield 0.45s ease-out; }
@keyframes flash-shield { 30% { scale: 1.45; filter: drop-shadow(0 0 10px #BDEBF6); } }
.flock.hop svg { animation: hop 0.3s ease-out; }
@keyframes hop { 50% { translate: 8px -10px; } }
.foe.dying { opacity: 0; scale: 0.6; filter: blur(4px) grayscale(1); transition: opacity 0.45s, scale 0.45s, filter 0.45s; }
.foe.escaping { translate: 60vw -40vh; rotate: -12deg; opacity: 0; transition: translate 0.5s ease-in, opacity 0.5s, rotate 0.5s; }
.puff { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px; border-radius: 50%; background: radial-gradient(circle, rgba(220, 210, 195, 0.8), rgba(220, 210, 195, 0)); pointer-events: none; animation: puff 1.2s ease-out forwards; }
@keyframes puff { from { scale: 0.4; opacity: 0.9; } to { translate: 20px -120px; scale: 2.6; opacity: 0; } }
.banner-line.flash { animation: flash-banner 0.35s ease-out; }
@keyframes flash-banner { from { scale: 1.12; background: rgba(255, 210, 63, 0.3); } }
.finale { position: absolute; inset: 0; z-index: 70; display: grid; place-items: center; pointer-events: none; background: radial-gradient(ellipse at center, rgba(5, 20, 28, 0.55), rgba(5, 20, 28, 0) 70%); animation: fade-in 0.3s ease-out; }
.finale span { font-family: var(--serif); font-weight: 800; font-size: clamp(48px, 9vw, 110px); color: var(--duck); text-shadow: 0 5px 0 #9A6E00, 0 16px 40px rgba(0, 0, 0, 0.6); animation: stamp 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.finale.lose span { color: #FFB3A0; text-shadow: 0 5px 0 #7A1F10, 0 16px 40px rgba(0, 0, 0, 0.6); }
@keyframes stamp { from { scale: 2.2; opacity: 0; rotate: -6deg; } }
@keyframes fade-in { from { opacity: 0; } }
.foe .pop { top: 58%; } .hero .pop { top: 48%; }
.pop.small { font-size: 22px; }
.stage.resolving .hand .card { translate: calc(var(--k) * var(--spread)) calc(var(--ch) * 0.9); opacity: 0; transition: translate 0.3s ease-in, opacity 0.3s; }

/* ---------- drawing cards ---------- */
.hand .card.incoming { opacity: 0; }
.card.flying { position: fixed; z-index: 85; margin: 0; pointer-events: none; transition: none; box-shadow: 0 0 0 3px var(--frame), 0 0 0 6px rgba(111, 209, 230, 0.8), 0 16px 30px rgba(0, 0, 0, 0.5); }
.hand .card.landed { animation: landed 0.35s ease-out; }
@keyframes landed { 0% { filter: brightness(1.35) drop-shadow(0 0 14px rgba(111, 209, 230, 0.9)); } }
.pile.give { animation: give 0.22s ease-out; }
@keyframes give { 40% { scale: 1.12; border-color: var(--sky); box-shadow: 3px 3px 0 #0E2E38, 6px 6px 0 #0B2530, 0 0 20px rgba(111, 209, 230, 0.8); } }
