@font-face {
  font-family: 'Fredoka';
  src: url('./fonts/fredoka.woff2') format('woff2');
  font-weight: 300 700;
  font-stretch: 75% 125%;
  font-display: swap;
}

:root {
  --ink: #4a3a5c;
  --ink-soft: #7a6a8c;
  --cream: #fff8f2;
  --pink: #ff8fc0;
  --pink-deep: #ff5fa2;
  --mint: #4fd1a0;
  --mint-deep: #2fb084;
  --lilac: #b58cff;
  --lilac-deep: #8f62f0;
  --peach: #ffad6b;
  --peach-deep: #f08a3c;
  --sky: #6fbfff;
  --gold: #ffcf4a;
  --gold-deep: #e8a821;
  --red: #ff6f7d;
  --shadow: 0 4px 0 rgba(74, 58, 92, 0.16), 0 10px 26px rgba(74, 58, 92, 0.14);
  --card-w: 138px;
  --card-h: 192px;
  --hand-h: 230px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(#8ec9ff, #ffd6e8 60%, #ffe9d0);
  font-family: 'Fredoka', ui-rounded, 'SF Pro Rounded', 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
#vignette {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(74, 40, 90, 0.18) 100%);
}
#overlay { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }

/* ---------- pills, buttons ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 42px; padding: 0 14px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border: 3px solid #fff;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-weight: 600; font-size: 17px;
  white-space: nowrap;
}
.pill .ico { font-size: 18px; }
.pill small { font-weight: 500; color: var(--ink-soft); font-size: 13px; }
.pill.icon { width: 42px; padding: 0; justify-content: center; font-size: 18px; }
.pill.icon.off { opacity: 0.45; filter: grayscale(1); }
button.pill:hover { transform: translateY(-1px); }
button.pill:active { transform: translateY(2px); }

.coin {
  display: inline-block; width: 1.05em; height: 1.05em; border-radius: 50%; vertical-align: -0.15em;
  background: radial-gradient(circle at 35% 30%, #fff6c2 0 18%, #ffd34d 19% 62%, #e8a821 63%);
  box-shadow: inset 0 -2px 0 rgba(160, 100, 0, 0.35);
  flex: none;
}

.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px;
  border: none; border-radius: 18px;
  background: linear-gradient(#fff, #f6eefc);
  color: var(--ink);
  font-weight: 600; font-size: 18px;
  box-shadow: 0 5px 0 #d9cbe8, 0 10px 20px rgba(74, 58, 92, 0.18);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 #d9cbe8, 0 14px 24px rgba(74, 58, 92, 0.2); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #d9cbe8, 0 4px 10px rgba(74, 58, 92, 0.2); }
.btn.primary { background: linear-gradient(#ff9fcb, var(--pink-deep)); color: #fff; box-shadow: 0 5px 0 #d8407f, 0 10px 22px rgba(255, 95, 162, 0.4); text-shadow: 0 2px 0 rgba(180, 30, 90, 0.35); }
.btn.primary:hover { box-shadow: 0 7px 0 #d8407f, 0 14px 26px rgba(255, 95, 162, 0.45); }
.btn.primary:active { box-shadow: 0 1px 0 #d8407f; }
.btn.mint { background: linear-gradient(#7fe8c2, var(--mint-deep)); color: #fff; box-shadow: 0 5px 0 #23906b, 0 10px 20px rgba(47, 176, 132, 0.35); text-shadow: 0 2px 0 rgba(20, 100, 70, 0.35); }
.btn.gold { background: linear-gradient(#ffe48a, var(--gold-deep)); color: #6a4a00; box-shadow: 0 5px 0 #c08510, 0 10px 20px rgba(232, 168, 33, 0.35); }
.btn.big { min-height: 58px; font-size: 22px; padding: 0 30px; border-radius: 22px; }
.btn.small { min-height: 34px; font-size: 15px; padding: 0 14px; border-radius: 12px; box-shadow: 0 3px 0 #d9cbe8; }
.btn small { font-size: 0.6em; opacity: 0.8; font-weight: 500; }
.btn:disabled { filter: grayscale(0.8) opacity(0.6); pointer-events: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.75); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px;
  border: 2px solid #fff;
}

/* ---------- HUD ---------- */
#hud {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 0;
  pointer-events: none; z-index: 10;
}
#hud > div { display: flex; gap: 8px; flex-wrap: wrap; pointer-events: auto; }
.hud-left { max-width: calc(100% - 200px); }
.coins b { font-size: 21px; min-width: 2.2ch; }
#coins-delta { font-size: 15px; font-weight: 700; color: var(--mint-deep); opacity: 0; transition: opacity 0.3s; }
#coins-delta.show { opacity: 1; }
#coins-delta.neg { color: var(--red); }
.coins.bump { animation: bump 0.35s; }
@keyframes bump { 30% { transform: scale(1.14); } 100% { transform: scale(1); } }
.day-dots { display: inline-flex; gap: 4px; }
.day-dots i { width: 10px; height: 10px; border-radius: 50%; background: #eadff2; border: 2px solid #d6c6e6; }
.day-dots i.done { background: var(--mint); border-color: var(--mint-deep); }
.day-dots i.now { background: var(--gold); border-color: var(--gold-deep); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.25); } }
.rent b { color: var(--pink-deep); }
.rent.danger { animation: wiggle 1.4s infinite; border-color: #ffd0d8; }
.rent.danger b { color: var(--red); }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 5% { transform: rotate(-3deg); } 10% { transform: rotate(3deg); } 15% { transform: rotate(0); } }
.buzz-bar { position: relative; width: 74px; height: 12px; border-radius: 99px; background: #f6e3ee; overflow: hidden; box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.06); }
.buzz-bar i { position: absolute; inset: 0 auto 0 0; width: 20%; border-radius: 99px; background: linear-gradient(90deg, #ffb3d1, var(--pink-deep)); transition: width 0.6s cubic-bezier(.3, 1.6, .5, 1); }
.twist { background: linear-gradient(90deg, #fff, #f3eaff); }
.btn-speed { font-size: 15px; }

/* ---------- clock ---------- */
#clock {
  position: fixed; top: calc(66px + env(safe-area-inset-top)); left: 16px; z-index: 9;
  display: flex; align-items: center; gap: 10px; pointer-events: none;
}
.clock-ring {
  --p: 1;
  width: 74px; height: 74px; border-radius: 50%; padding: 6px;
  background: conic-gradient(var(--gold) calc(var(--p) * 360deg), #f3e8f8 0);
  box-shadow: var(--shadow); border: 3px solid #fff;
}
.clock-ring.late { background: conic-gradient(var(--red) calc(var(--p) * 360deg), #f3e8f8 0); }
.clock-face { width: 100%; height: 100%; border-radius: 50%; background: #fff; display: grid; place-items: center; align-content: center; line-height: 1; }
.clock-face b { font-size: 22px; }
.clock-face small { font-size: 11px; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.clock-info { background: rgba(255, 255, 255, 0.9); border: 3px solid #fff; border-radius: 16px; padding: 6px 12px; box-shadow: var(--shadow); font-weight: 600; }
.clock-earn { font-size: 20px; display: flex; gap: 6px; align-items: center; }
.clock-served { font-size: 13px; color: var(--ink-soft); }

/* ---------- hand ---------- */
#hand-area {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--hand-h);
  display: grid; grid-template-columns: 170px 1fr 220px; align-items: end; gap: 10px;
  padding: 0 16px calc(14px + env(safe-area-inset-bottom));
  pointer-events: none; z-index: 8;
}
#hand-area > * { pointer-events: auto; }
#deck-side, #open-side { display: flex; flex-direction: column; gap: 10px; align-items: stretch; padding-bottom: 6px; }
#open-side { align-items: flex-end; }
#stock-note { font-weight: 600; font-size: 14px; background: rgba(255, 255, 255, 0.85); border-radius: 12px; padding: 6px 10px; border: 2px solid #fff; box-shadow: var(--shadow); text-align: right; }
#stock-note:empty { display: none; }
.pile {
  position: relative; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.9); border: 3px solid #fff; box-shadow: var(--shadow); font-weight: 600;
}
.pile b { font-size: 22px; }
.pile small { color: var(--ink-soft); }
.pile-cards { position: relative; width: 34px; height: 44px; }
.pile-cards i { position: absolute; inset: 0; border-radius: 6px; background: linear-gradient(135deg, #ffb3d1, #b58cff); border: 2px solid #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15); }
.pile-cards i:nth-child(1) { transform: rotate(-8deg); }
.pile-cards i:nth-child(2) { transform: rotate(4deg); }
.call {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 12px; border-radius: 16px; border: none;
  background: linear-gradient(#fff6d6, #ffe48a); box-shadow: 0 4px 0 #e0b84a, 0 8px 18px rgba(232, 168, 33, 0.25); font-weight: 600; font-size: 15px; text-align: left;
}
.call b { display: inline-flex; gap: 4px; align-items: center; }
.call:active { transform: translateY(3px); box-shadow: 0 1px 0 #e0b84a; }
.call:disabled { filter: grayscale(0.7) opacity(0.6); }

#hand { position: relative; height: 100%; min-width: 0; display: flex; justify-content: center; align-items: flex-end; padding-bottom: 4px; }
#hand .card { margin: 0 -10px; transition: transform 0.25s cubic-bezier(.3, 1.5, .5, 1), filter 0.2s; transform-origin: 50% 120%; }
#hand .card:hover, #hand .card.selected { z-index: 5; }
/* Only the visuals lift on hover; the card's hit box stays put so clicks never miss. */
.card-lift { position: absolute; inset: 0; transition: transform 0.22s cubic-bezier(.3, 1.5, .5, 1); transform-origin: 50% 100%; }
#hand .card:hover .card-lift, #hand .card.selected .card-lift { transform: translateY(-34px) scale(1.12); }
#hand .card.selected .card-lift { filter: drop-shadow(0 0 12px rgba(255, 223, 90, 0.95)); }
#hand .card.enter { animation: deal 0.5s cubic-bezier(.3, 1.4, .5, 1) backwards; }
@keyframes deal { from { transform: translate(-40vw, 60px) rotate(-30deg) scale(0.5); opacity: 0; } }
#hand .card.played { animation: play 0.45s ease-in forwards; pointer-events: none; }
@keyframes play { to { transform: translateY(-50vh) scale(0.4) rotate(12deg); opacity: 0; } }

/* ---------- cards ---------- */
.card {
  --k1: #ffd2b0; --k2: var(--peach); --k3: var(--peach-deep);
  position: relative; width: var(--card-w); height: var(--card-h); flex: none;
  border-radius: 16px; cursor: pointer;
  perspective: 600px;
}
.card.kind-build { --k1: #c6f5e0; --k2: var(--mint); --k3: var(--mint-deep); }
.card.kind-upgrade { --k1: #e6dbff; --k2: var(--lilac); --k3: var(--lilac-deep); }
.card.kind-promo { --k1: #ffd3e6; --k2: var(--pink); --k3: var(--pink-deep); }
.card-inner {
  position: absolute; inset: 0; border-radius: 16px; overflow: hidden;
  background: linear-gradient(170deg, #fff 0%, #fff 55%, var(--k1) 100%);
  border: 4px solid #fff;
  box-shadow: 0 0 0 2.5px var(--k2), 0 6px 0 var(--k3), 0 12px 24px rgba(74, 58, 92, 0.25);
  transform-style: preserve-3d; transition: transform 0.12s;
  display: flex; flex-direction: column;
}
.card-art {
  position: relative; height: 47%; margin: 5px 5px 0; border-radius: 11px; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #fff 0%, var(--k1) 70%, var(--k2) 140%);
  display: grid; place-items: center;
}
.card-art::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.18) 0 6px, transparent 6px 14px); pointer-events: none; }
.card-art img { width: 92%; height: 92%; object-fit: contain; filter: drop-shadow(0 4px 4px rgba(74, 58, 92, 0.25)); position: relative; z-index: 1; }
.card-art .multi { display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 100%; position: relative; z-index: 1; }
.card-art .multi img { width: 46%; height: auto; margin: 0 -9%; }
.card-art .emoji { font-size: 54px; position: relative; z-index: 1; filter: drop-shadow(0 4px 3px rgba(74, 58, 92, 0.3)); }
.card-art .badge { position: absolute; z-index: 2; right: 6px; bottom: 5px; background: #fff; border-radius: 99px; padding: 1px 7px; font-weight: 700; font-size: 13px; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12); }
.card-name { margin: 6px 8px 0; font-weight: 700; font-size: 15px; line-height: 1.1; text-align: center; color: var(--ink); }
.card-desc { margin: 3px 9px 0; font-size: 11.5px; line-height: 1.22; text-align: center; color: var(--ink-soft); font-weight: 500; }
.card-cost {
  position: absolute; top: -9px; left: -9px; z-index: 3;
  min-width: 40px; height: 40px; padding: 0 6px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center; gap: 2px;
  background: radial-gradient(circle at 35% 30%, #fff6c2 0 14%, #ffd34d 15% 70%, #e8a821 71%);
  border: 3px solid #fff; box-shadow: 0 3px 0 rgba(160, 100, 0, 0.35);
  font-weight: 700; font-size: 18px; color: #6a4a00;
}
.card-cost.free { font-size: 13px; }
.card-kind {
  position: absolute; top: 9px; right: 9px; z-index: 3; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--k2); color: #fff; padding: 2px 7px; border-radius: 99px; box-shadow: 0 2px 0 var(--k3);
}
.card-gem { position: absolute; bottom: 7px; left: 50%; transform: translateX(-50%); display: flex; gap: 3px; }
.card-gem i { width: 8px; height: 8px; border-radius: 2px; transform: rotate(45deg); background: #e6dcef; }
.card.rarity-uncommon .card-gem i:nth-child(-n+2), .card.rarity-common .card-gem i:nth-child(1) { background: var(--k2); }
.card.rarity-rare .card-gem i { background: linear-gradient(135deg, #ffe48a, #ff8fc0); }
.card.rarity-rare .card-inner { box-shadow: 0 0 0 2.5px var(--k2), 0 6px 0 var(--k3), 0 0 22px rgba(255, 207, 74, 0.7), 0 12px 24px rgba(74, 58, 92, 0.25); }
.card.rarity-rare .card-inner::before {
  content: ''; position: absolute; inset: -50%; z-index: 4; pointer-events: none;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.55) 50%, transparent 60%);
  animation: shine 3.2s infinite;
}
@keyframes shine { from { transform: translateX(-60%); } to { transform: translateX(60%); } }
.card-lv { position: absolute; top: 34px; right: 8px; z-index: 3; color: var(--gold-deep); font-size: 15px; text-shadow: 0 1px 0 #fff; }
.card.disabled .card-inner { filter: grayscale(0.55) brightness(0.96); }
.card.disabled .card-cost { filter: grayscale(0.6); }
.card .why {
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); z-index: 9;
  background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 600; padding: 5px 10px; border-radius: 10px; white-space: nowrap;
  opacity: 0; transition: opacity 0.15s; pointer-events: none;
}
.card.disabled:hover .why { opacity: 1; }
.card.big { --card-w: 176px; --card-h: 244px; }
.card.big .card-name { font-size: 18px; }
.card.big .card-desc { font-size: 13.5px; }

/* ---------- overlay (bubbles, floaters) ---------- */
.bubble {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -100%);
  min-width: 40px; height: 40px; padding: 3px 8px; border-radius: 20px;
  background: #fff; border: 3px solid #fff; box-shadow: 0 3px 0 rgba(74, 58, 92, 0.18), 0 6px 14px rgba(74, 58, 92, 0.18);
  display: flex; align-items: center; justify-content: center; gap: 3px;
  font-weight: 700; font-size: 14px; white-space: nowrap;
  transition: opacity 0.25s;
  will-change: transform;
}
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -9px; width: 12px; height: 12px; background: #fff; transform: translateX(-50%) rotate(45deg); border-radius: 0 0 4px 0; box-shadow: 2px 2px 0 rgba(74, 58, 92, 0.1); }
.bubble img { width: 32px; height: 32px; object-fit: contain; }
.bubble .fam { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; }
.bubble.vip { background: linear-gradient(#fff, #fff4c8); border-color: #ffe48a; }
.bubble.got { background: #ffe9f3; border-color: #ffc6dd; }
.bubble.sad { background: #e8f1ff; border-color: #cfe0ff; }
.bubble.small { transform: translate(-50%, -100%) scale(0.82); }
.bubble.pop { animation: bubblePop 0.35s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes bubblePop { from { transform: translate(-50%, -100%) scale(0.2); } }
.size-tag { font-size: 12px; font-weight: 700; background: var(--lilac); color: #fff; border-radius: 99px; padding: 1px 7px; }
.floater {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  font-weight: 700; font-size: 22px; color: #fff; white-space: nowrap;
  -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill;
  text-shadow: 0 3px 0 rgba(74, 58, 92, 0.35);
  pointer-events: none;
}
.floater.gold { color: #ffd84a; }
.floater.pink { color: #ff8fc0; }
.floater.mint { color: #7fe8c2; }
.floater.big { font-size: 30px; }
.floater.huge { font-size: 40px; }
.floater.small { font-size: 16px; -webkit-text-stroke-width: 4px; }

/* ---------- tooltip, popover, coach ---------- */
#tooltip {
  position: fixed; z-index: 30; pointer-events: none; max-width: 260px;
  background: rgba(255, 255, 255, 0.97); border: 3px solid #fff; border-radius: 16px; padding: 10px 12px;
  box-shadow: var(--shadow); font-size: 14px; line-height: 1.3;
}
#tooltip h4 { margin: 0 0 4px; font-size: 16px; display: flex; gap: 6px; align-items: center; }
#tooltip .row { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-soft); font-weight: 500; }
#tooltip .row b { color: var(--ink); }
#tooltip .tip-note { margin-top: 6px; color: var(--ink-soft); font-size: 12.5px; }
.tier-tag { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: #f1e8fb; color: var(--lilac-deep); }
#popover {
  position: fixed; z-index: 25; transform: translate(-50%, -100%);
  background: #fff; border-radius: 18px; padding: 10px; box-shadow: var(--shadow); border: 3px solid #fff;
  display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-width: 180px;
}
#popover h4 { margin: 0 4px; font-size: 16px; }
#popover p { margin: 0 4px; font-size: 13px; color: var(--ink-soft); max-width: 220px; }
#popover .row { display: flex; gap: 8px; }
#place-bar {
  position: fixed; left: 50%; bottom: calc(var(--hand-h) + 6px); transform: translateX(-50%); z-index: 12;
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px;
  background: rgba(255, 255, 255, 0.95); border-radius: 18px; box-shadow: var(--shadow); font-weight: 600; font-size: 17px;
}
#coach {
  position: fixed; left: 50%; top: calc(70px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: 12px; max-width: min(620px, calc(100vw - 24px));
  background: #fff; border: 3px solid #fff; border-radius: 22px; padding: 12px 14px; box-shadow: 0 6px 0 rgba(74, 58, 92, 0.16), 0 16px 34px rgba(74, 58, 92, 0.25);
  animation: coachIn 0.45s cubic-bezier(.3, 1.6, .5, 1);
}
@keyframes coachIn { from { transform: translate(-50%, -30px) scale(0.8); opacity: 0; } }
.coach-face { font-size: 34px; width: 54px; height: 54px; border-radius: 50%; background: #fff1d6; display: grid; place-items: center; flex: none; animation: bob 2s infinite; }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-4deg); } }
.coach-text { font-weight: 500; font-size: 16px; line-height: 1.35; }
.coach-text b { color: var(--pink-deep); }
#coach-ok { white-space: nowrap; flex: none; }
#btn-open { white-space: nowrap; }

#banner {
  position: fixed; left: 50%; top: 32%; transform: translate(-50%, -50%); z-index: 20; pointer-events: none;
  font-size: 54px; font-weight: 700; color: #fff; white-space: nowrap;
  -webkit-text-stroke: 9px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 rgba(74, 58, 92, 0.3);
  opacity: 0;
}
#banner.show { animation: banner 2.2s cubic-bezier(.3, 1.4, .5, 1) forwards; }
#banner small { display: block; text-align: center; font-size: 22px; -webkit-text-stroke-width: 5px; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(-6deg); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.06) rotate(2deg); } 25% { transform: translate(-50%, -50%) scale(1) rotate(0); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(0.95); } }

#toasts { position: fixed; right: 16px; top: calc(70px + env(safe-area-inset-top)); z-index: 26; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 16px;
  background: #fff; box-shadow: var(--shadow); font-weight: 600; font-size: 15px; max-width: 320px;
  animation: toastIn 0.4s cubic-bezier(.3, 1.6, .5, 1), toastOut 0.4s ease-in 3.4s forwards;
}
.toast img { width: 40px; height: 40px; object-fit: contain; }
.toast .t-ico { font-size: 26px; width: 40px; text-align: center; }
.toast small { display: block; font-weight: 500; color: var(--ink-soft); font-size: 12.5px; }
@keyframes toastIn { from { transform: translateX(120%); } }
@keyframes toastOut { to { transform: translateX(130%); opacity: 0; } }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; overflow: auto; }
#screen-loading { background: linear-gradient(#ffd6e8, #ffe9d0); z-index: 60; transition: opacity 0.6s; }
#screen-loading.gone { opacity: 0; pointer-events: none; }
.loader { text-align: center; font-weight: 600; font-size: 20px; }
.loader-blob { width: 90px; height: 70px; margin: 0 auto 16px; border-radius: 50% 50% 46% 46%; background: #ffc2d4; position: relative; animation: squish 0.9s infinite ease-in-out; box-shadow: inset 0 -8px 0 rgba(255, 120, 160, 0.3); }
.loader-blob::before, .loader-blob::after { content: ''; position: absolute; top: 28px; width: 9px; height: 11px; border-radius: 50%; background: #1d1a24; }
.loader-blob::before { left: 26px; }
.loader-blob::after { right: 26px; }
@keyframes squish { 0%, 100% { transform: scale(1, 1); } 40% { transform: scale(1.18, 0.82) translateY(8px); } 60% { transform: scale(0.92, 1.1) translateY(-10px); } }

#screen-title { background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.0) 30%, rgba(255, 214, 232, 0.35) 100%); }
.title-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; transform: translateY(-4vh); }
.logo { margin: 0; font-size: clamp(64px, 12vw, 150px); line-height: 0.95; font-weight: 700; letter-spacing: -0.01em; display: flex; }
.logo span {
  display: inline-block; color: #ff8fc0;
  -webkit-text-stroke: 0.09em #fff; paint-order: stroke fill;
  text-shadow: 0 0.06em 0 #e8508a, 0 0.12em 0 rgba(74, 58, 92, 0.25), 0 0.2em 0.3em rgba(74, 58, 92, 0.2);
  animation: letter 2.4s infinite ease-in-out;
}
.logo span:nth-child(3n+2) { color: #ffd45c; text-shadow: 0 0.06em 0 #e8a821, 0 0.12em 0 rgba(74, 58, 92, 0.25), 0 0.2em 0.3em rgba(74, 58, 92, 0.2); }
.logo span:nth-child(3n) { color: #7cd8ff; text-shadow: 0 0.06em 0 #3ea6e0, 0 0.12em 0 rgba(74, 58, 92, 0.25), 0 0.2em 0.3em rgba(74, 58, 92, 0.2); }
.logo span:nth-child(1) { animation-delay: 0s; } .logo span:nth-child(2) { animation-delay: 0.1s; } .logo span:nth-child(3) { animation-delay: 0.2s; }
.logo span:nth-child(4) { animation-delay: 0.3s; } .logo span:nth-child(5) { animation-delay: 0.4s; } .logo span:nth-child(6) { animation-delay: 0.5s; }
.logo span:nth-child(7) { animation-delay: 0.6s; } .logo span:nth-child(8) { animation-delay: 0.7s; } .logo span:nth-child(9) { animation-delay: 0.8s; }
@keyframes letter { 0%, 100% { transform: translateY(0) scale(1, 1); } 15% { transform: translateY(0.04em) scale(1.12, 0.86); } 30% { transform: translateY(-0.12em) scale(0.94, 1.08); } 45% { transform: translateY(0) scale(1.04, 0.97); } }
.tagline { margin: 0 0 10px; font-size: 22px; font-weight: 600; color: #fff; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.title-buttons { display: flex; flex-direction: column; gap: 12px; min-width: 280px; }
.pill-mini { font-size: 13px; background: #f1e8fb; border-radius: 99px; padding: 2px 8px; }
.title-best { font-weight: 600; color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; min-height: 1em; margin: 6px 0 0; }
.title-foot { margin-top: 6px; }

#screen-modal { background: rgba(74, 40, 90, 0.28); backdrop-filter: blur(3px); }
#screen-modal.clear { background: transparent; backdrop-filter: none; pointer-events: none; }
#screen-modal.clear .panel { pointer-events: auto; }
#screen-modal.bottom { align-items: end; }
.panel {
  position: relative; width: min(860px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--cream); border: 4px solid #fff; border-radius: 28px; padding: 22px 24px;
  box-shadow: 0 8px 0 rgba(74, 58, 92, 0.18), 0 26px 60px rgba(74, 40, 90, 0.35);
  animation: panelIn 0.45s cubic-bezier(.3, 1.5, .5, 1);
  text-align: center;
}
.panel.narrow { width: min(520px, 100%); }
@keyframes panelIn { from { transform: translateY(40px) scale(0.92); opacity: 0; } }
.panel h2 { margin: 0 0 4px; font-size: 34px; line-height: 1.05; }
.panel h3 { margin: 18px 0 8px; font-size: 20px; color: var(--ink-soft); }
.panel p { margin: 6px auto; max-width: 560px; font-size: 16px; line-height: 1.4; color: var(--ink-soft); font-weight: 500; }
.panel .lead { font-size: 18px; color: var(--ink); }
.panel .row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.panel .x { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 50%; border: none; background: #f1e8fb; font-size: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 14px 0 6px; }
.stat { background: #fff; border-radius: 18px; padding: 10px 8px; box-shadow: 0 3px 0 rgba(74, 58, 92, 0.1); }
.stat b { display: block; font-size: 26px; }
.stat small { color: var(--ink-soft); font-weight: 600; font-size: 13px; }
.stat.good b { color: var(--mint-deep); }
.stat.bad b { color: var(--red); }
.choices { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; margin: 16px 0 6px; padding-top: 10px; }
.choices .card { transition: transform 0.2s cubic-bezier(.3, 1.5, .5, 1); animation: choiceIn 0.5s cubic-bezier(.3, 1.4, .5, 1) backwards; }
.choices .card:nth-child(2) { animation-delay: 0.08s; } .choices .card:nth-child(3) { animation-delay: 0.16s; }
.choices .card:nth-child(4) { animation-delay: 0.24s; } .choices .card:nth-child(5) { animation-delay: 0.32s; }
@keyframes choiceIn { from { transform: translateY(60px) rotateY(90deg); opacity: 0; } }
.choices .card:hover { transform: translateY(-10px) scale(1.04); }
.choices .card.sold { opacity: 0.35; pointer-events: none; transform: scale(0.94); }
.price-tag { margin-top: 12px; display: inline-flex; gap: 4px; align-items: center; font-weight: 700; font-size: 18px; background: #fff; border-radius: 99px; padding: 3px 12px; box-shadow: 0 3px 0 rgba(74, 58, 92, 0.12); }
.offer { display: flex; flex-direction: column; align-items: center; }
.services { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.service { background: #fff; border-radius: 20px; padding: 12px 14px; width: 230px; box-shadow: 0 3px 0 rgba(74, 58, 92, 0.1); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.service b { font-size: 17px; }
.service span { font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.deck-grid { display: flex; flex-wrap: wrap; gap: 14px 6px; justify-content: center; margin-top: 12px; }
.deck-grid .card { --card-w: 118px; --card-h: 164px; }
.deck-grid .card .card-desc { font-size: 10.5px; }
.deck-grid .card .card-name { font-size: 13px; }
.deck-grid .tag { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); z-index: 5; background: var(--ink); color: #fff; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 99px; white-space: nowrap; }
.landlord-says { display: inline-block; position: relative; background: #fff; border-radius: 20px; padding: 12px 18px; font-size: 19px; font-weight: 600; margin: 6px 0 4px; box-shadow: 0 3px 0 rgba(74, 58, 92, 0.12); }
.big-num { font-size: 52px; font-weight: 700; display: inline-flex; gap: 8px; align-items: center; }
.twist-card { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; background: #fff; border-radius: 24px; padding: 16px 26px; box-shadow: 0 4px 0 rgba(74, 58, 92, 0.12); margin-top: 8px; }
.twist-card .t-ico { font-size: 56px; animation: bob 2s infinite; }
.twist-card b { font-size: 24px; }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 14px; }
.dex-item { background: #fff; border-radius: 16px; padding: 6px; box-shadow: 0 3px 0 rgba(74, 58, 92, 0.1); font-size: 12px; font-weight: 600; }
.dex-item img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.dex-item.locked img { filter: brightness(0) opacity(0.15); }
.dex-item.locked span { color: var(--ink-soft); }
.dex-tiers { display: flex; justify-content: center; gap: 3px; margin-top: 2px; }
.dex-tiers i { width: 9px; height: 9px; border-radius: 50%; background: #eadff2; }
.dex-tiers i.on { background: var(--pink-deep); }
.help-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; text-align: left; margin-top: 12px; }
.help-steps div { background: #fff; border-radius: 18px; padding: 12px 14px; box-shadow: 0 3px 0 rgba(74, 58, 92, 0.1); font-size: 14.5px; line-height: 1.4; color: var(--ink-soft); font-weight: 500; }
.help-steps b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }
.menu-list { display: flex; flex-direction: column; gap: 10px; max-width: 320px; margin: 14px auto 0; }
.seg { display: inline-flex; background: #f1e8fb; border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { border: none; background: transparent; border-radius: 10px; padding: 6px 12px; font-weight: 600; }
.seg button.on { background: #fff; box-shadow: 0 2px 0 rgba(74, 58, 92, 0.12); }

.confetti { position: fixed; top: -20px; width: 10px; height: 16px; z-index: 70; pointer-events: none; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

.noscript { position: fixed; inset: 0; display: grid; place-items: center; font-size: 20px; }

/* ---------- smaller screens ---------- */
@media (max-width: 900px) {
  :root { --card-w: 112px; --card-h: 158px; --hand-h: 196px; }
  #hand-area { grid-template-columns: 120px 1fr 150px; padding: 0 8px calc(8px + env(safe-area-inset-bottom)); gap: 6px; }
  .card-desc { font-size: 10px; }
  .card-name { font-size: 13px; }
  .btn.big { font-size: 18px; padding: 0 16px; min-height: 52px; }
  .pill { height: 36px; font-size: 15px; padding: 0 10px; }
  .pill.icon { width: 36px; }
  .hud-left { max-width: calc(100% - 140px); }
  .buzz-bar { width: 50px; }
  #banner { font-size: 38px; }
}
@media (max-width: 640px) {
  :root { --card-w: 96px; --card-h: 136px; --hand-h: 250px; }
  #hand-area { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; height: auto; }
  #hand { grid-column: 1 / 3; grid-row: 1; height: calc(var(--card-h) + 26px); }
  #deck-side { grid-row: 2; flex-direction: row; }
  #open-side { grid-row: 2; }
  #hand .card { margin: 0 -14px; }
  .card-desc { display: none; }
  .card-art { height: 58%; }
  .rent span:not(.ico), .buzz small, #day-label { display: none; }
  .pill { height: 34px; font-size: 14px; }
  .call span { font-size: 12px; }
  .panel { padding: 18px 12px; border-radius: 22px; }
  .panel h2 { font-size: 26px; }
  .card.big { --card-w: 132px; --card-h: 186px; }
  .choices { gap: 10px; }
  #clock { top: auto; bottom: 16px; }
}
@media (max-width: 640px) {
  .bubble { transform: translate(-50%, -100%) scale(0.7); }
  .bubble.small { transform: translate(-50%, -100%) scale(0.6); }
  .floater { font-size: 17px; }
  .floater.big { font-size: 22px; }
  .floater.huge { font-size: 28px; }
  #coach { top: calc(100px + env(safe-area-inset-top)); }
  .coach-text { font-size: 14px; }
  #toasts { top: calc(104px + env(safe-area-inset-top)); }
}
/* Short screens (phones held sideways): a slimmer HUD and hand. */
@media (max-height: 520px) {
  :root { --card-w: 88px; --card-h: 124px; --hand-h: 138px; }
  #hand-area { grid-template-columns: 120px 1fr 150px; grid-template-rows: auto; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  #hand { grid-column: auto; grid-row: auto; }
  #deck-side, #open-side { grid-row: auto; flex-direction: column; gap: 6px; }
  .card-desc { display: none; }
  .card-art { height: 58%; }
  .card-name { font-size: 12px; }
  .card-cost { min-width: 30px; height: 30px; font-size: 14px; top: -6px; left: -6px; }
  .card-kind { font-size: 9px; top: 6px; right: 6px; }
  #hand .card:hover .card-lift, #hand .card.selected .card-lift { transform: translateY(-18px) scale(1.08); }
  .pill { height: 32px; font-size: 14px; padding: 0 9px; }
  .pill.icon { width: 32px; }
  .pile { padding: 4px 8px; }
  .pile b { font-size: 17px; }
  .pile-cards { width: 24px; height: 32px; }
  .call { padding: 5px 9px; font-size: 13px; }
  .btn.big { min-height: 44px; font-size: 17px; }
  #stock-note { display: none; }
  .bubble { transform: translate(-50%, -100%) scale(0.62); }
  .bubble.small { transform: translate(-50%, -100%) scale(0.55); }
  #clock { top: calc(52px + env(safe-area-inset-top)); }
  .clock-ring { width: 56px; height: 56px; }
  .clock-face b { font-size: 17px; }
  .panel { padding: 14px 16px; }
  .panel h2 { font-size: 24px; }
  .card.big { --card-w: 120px; --card-h: 168px; }
  .stats { margin: 8px 0 4px; }
  .stat b { font-size: 19px; }
}
