:root {
  --wood-d: #1b110a; --wood: #2d1b0e; --wood-l: #4a2f18; --wood-hl: #6a4526;
  --gold: #f4c542; --gold-d: #b9831b; --cream: #f3e4c6; --muted: #b59e7a;
  --good: #7fe08a; --bad: #ff7b6b; --chalk: #e9efe9; --purple: #1c0f2e; --purple-l: #3a2160;
  --ui: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --serif: Georgia, "Palatino Linotype", "Book Antiqua", serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--wood-d); color: var(--cream); font-family: var(--ui); overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.hidden { display: none !important; }
.ic { width: 100%; height: 100%; display: block; }
.icw { display: inline-block; width: 100%; height: 100%; color: var(--gold); }
.round { width: 44px; height: 44px; border-radius: 50%; padding: 9px; color: var(--cream); background: radial-gradient(circle at 35% 30%, #6a4526, #2d1b0e); border: 2px solid var(--gold-d); box-shadow: 0 2px 6px #0008; }
.round:hover { filter: brightness(1.2); }
.round .icw { color: var(--cream); }

/* ---------------------------------------------------------------- start */
.screen { position: fixed; inset: 0; z-index: 20; }
#start { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 20px;
  background: radial-gradient(ellipse at 50% 30%, #4a2f18 0%, #1b110a 70%), #1b110a; }
#start::before { content: ""; position: absolute; inset: 14px; border: 10px solid; border-image: linear-gradient(135deg, #6a4526, #2d1b0e 40%, #6a4526) 1; box-shadow: inset 0 0 40px #000a; pointer-events: none; }
.logo { font-family: var(--serif); font-weight: 900; line-height: .9; font-size: clamp(54px, 12vw, 120px); letter-spacing: 2px; text-transform: uppercase; }
.logo-a { color: var(--cream); text-shadow: 0 4px 0 #6a4526, 0 8px 18px #000; margin-right: .18em; }
.logo-b { color: var(--gold); text-shadow: 0 4px 0 #8a5a12, 0 8px 18px #000, 0 0 30px #f4c54255; }
.tagline { color: var(--muted); letter-spacing: .08em; text-transform: uppercase; font-size: 13px; }
.ask { font-family: var(--serif); font-size: clamp(26px, 5vw, 44px); margin: 18px 0 0; color: var(--cream); }
.choices { display: flex; gap: clamp(20px, 6vw, 70px); margin-top: 6px; }
.choice { width: clamp(110px, 24vw, 190px); height: clamp(110px, 24vw, 190px); border-radius: 50%; transition: transform .2s, filter .2s; filter: drop-shadow(0 10px 14px #000a); }
.choice:hover, .choice:focus-visible { transform: translateY(-8px) rotate(-6deg) scale(1.06); filter: drop-shadow(0 16px 20px #000a) brightness(1.1); }
.choice svg { width: 100%; height: 100%; }
.hintline { color: var(--muted); font-size: 14px; }
.start-btns { position: absolute; top: 24px; right: 24px; display: flex; gap: 10px; z-index: 2; }

/* ---------------------------------------------------------------- app layout */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
#topbar { height: 58px; flex: none; display: flex; align-items: center; gap: 12px; padding: 6px 12px; z-index: 5;
  background: linear-gradient(#3a2412, #1b110a); border-bottom: 3px solid var(--gold-d); box-shadow: 0 4px 12px #000a; }
.inflate { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px 0 8px; border-radius: 22px; border: 2px solid var(--gold-d);
  background: linear-gradient(#5a3a77, #2c1745); box-shadow: 0 2px 6px #0008; }
.inflate:hover { filter: brightness(1.2); }
.inflate-ic { width: 28px; height: 28px; }
.inflate-ic .icw { color: #d9b8ff; }
.inflate-txt { display: flex; flex-direction: column; line-height: 1.05; text-align: left; }
.inflate-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #cdb2ee; }
.inflate-n { font-weight: 700; font-size: 16px; color: #fff; }
.inflate-gain { font-size: 11px; color: var(--gold); font-weight: 700; }
.inflate-gain:empty { display: none; }
.inflate.ready { animation: pulse 1.6s infinite; border-color: #fff3b0; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 #c58cf0aa; } 50% { box-shadow: 0 0 0 8px #c58cf000; } }
#goal { flex: 1; min-width: 0; max-width: 460px; margin: 0 auto; }
.goal-bar { height: 10px; border-radius: 6px; background: #0009; border: 1px solid #6a4526; overflow: hidden; }
.goal-fill { height: 100%; width: 0; background: linear-gradient(90deg, #b9831b, #f4c542, #fff3b0); transition: width .4s; }
.goal-lbl { display: flex; justify-content: center; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: .08em; }
.goal-lbl #goal-sym { width: 18px; height: 12px; display: inline-block; }
.goal-lbl #goal-sym .icw { color: var(--gold); }
.topbtns { display: flex; gap: 8px; margin-left: auto; }
#main { flex: 1; min-height: 0; display: flex; flex-direction: row-reverse; }
#version { position: fixed; right: 10px; bottom: 6px; font-size: 12px; color: #fff9; text-shadow: 0 1px 2px #000; pointer-events: none; z-index: 6; }

/* ---------------------------------------------------------------- board (chalkboard) */
#board { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; padding: 14px 16px 22px; gap: 12px;
  background: radial-gradient(ellipse at 50% 40%, #3f4f47 0%, #28332e 60%, #1c2421 100%);
  box-shadow: inset 0 0 0 10px #3a2412, inset 0 0 0 13px #6a4526, inset 0 0 40px 14px #000a; }
#board::before { content: ""; position: absolute; inset: 13px; opacity: .22; pointer-events: none; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .55 0'/></filter><rect width='220' height='220' filter='url(%23n)'/></svg>"); }
.flipmore { position: relative; z-index: 2; align-self: center; width: min(560px, 92%); padding: 10px 18px 12px; border-radius: 12px; text-align: center;
  background: linear-gradient(#7a4f2a, #4a2f18); border: 3px solid var(--gold-d); box-shadow: 0 4px 0 #2d1b0e, 0 8px 16px #000a; transition: transform .1s; margin-top: 10px; }
.flipmore:hover { filter: brightness(1.15); }
.flipmore:active { transform: translateY(3px); box-shadow: 0 1px 0 #2d1b0e; }
.fm-title { display: block; font-family: var(--serif); font-weight: 900; font-size: clamp(22px, 3.4vw, 34px); color: var(--cream); letter-spacing: .02em; text-shadow: 0 2px 0 #000a; }
.fm-cost { display: block; font-weight: 700; font-size: 16px; margin-top: 2px; }
.fm-cost.afford, .cost.afford { color: var(--good); }
.fm-cost.poor, .cost.poor { color: var(--bad); }
.fm-cost.max { color: var(--gold); }
#play { position: relative; flex: 1; min-height: 0; z-index: 1; }
#hands { position: absolute; inset: 0; display: grid; align-content: center; justify-content: center; justify-items: center; gap: 16px 4px; padding: 8px; }
.cell { position: relative; width: var(--cell); height: var(--cell); cursor: pointer; }
.cell .hand { position: absolute; left: 11%; bottom: 0; width: 78%; transform-origin: 30% 90%; }
.cell.tossing .hand { animation: recoil var(--dur, .85s) ease-out; }
@keyframes recoil { 0% { transform: none; } 7% { transform: translateY(-3%) rotate(-3deg); } 22% { transform: translateY(1%); } 88% { transform: translateY(0); } 94% { transform: translateY(3%); } 100% { transform: none; } }
.handsvg { width: 100%; display: block; filter: drop-shadow(0 4px 4px #0008); overflow: visible; }
.thumb-fl { transform-origin: 54px 46px; transition: transform .18s cubic-bezier(.3, 1.4, .5, 1); }
.cell.tossing .thumb-fl { animation: flick .4s ease-out; }
@keyframes flick { 0% { transform: rotate(0); } 12% { transform: rotate(-34deg); } 38% { transform: rotate(-4deg); } 55% { transform: rotate(2deg); } 100% { transform: rotate(0); } }
.cell.win .thumb-fl { transform: rotate(-86deg); }
.hand.silver .skin { fill: #cfd6de; } .hand.gold .skin { fill: #f2c94c; stroke: #7a5410; }
.cell .coinbox { position: absolute; left: 53.4%; bottom: 28.8%; width: 36%; aspect-ratio: 1; margin-left: -18%; perspective: 520px; pointer-events: none; z-index: 3; }
.cell.tossing .coinbox { animation: arc var(--dur, .85s) linear; }
@keyframes arc {
  0%, 7% { transform: translateY(0); animation-timing-function: cubic-bezier(.2, .7, .35, 1); }
  47% { transform: translateY(calc(var(--cell) * -.82)); animation-timing-function: cubic-bezier(.55, 0, .85, .4); }
  91% { transform: translateY(2%); animation-timing-function: ease-out; }
  96% { transform: translateY(-5%); animation-timing-function: ease-in; }
  100% { transform: translateY(0); }
}
.coin { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateX(var(--rest, 78deg)); transition: transform .2s ease-out; }
.coin .f { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.coin .f svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 3px #0009); }
.coin .back { transform: rotateX(180deg); }
.coin.go { animation: spin var(--dur, .85s) linear forwards; }
@keyframes spin { 0%, 7% { transform: rotateX(78deg); } 91%, 100% { transform: rotateX(1518deg); } }
.cell .coinbox { transition: transform .2s ease-out; }
.cell.reveal .coinbox { transform: translateY(-46%) scale(1.12); }

#floaters { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.floater { position: absolute; transform: translate(-50%, 0); white-space: nowrap; font-weight: 800; font-size: clamp(13px, 1.9vw, 19px); color: var(--gold); text-shadow: 0 2px 0 #000, 0 0 8px #000; animation: floatup 1.4s ease-out forwards; }
.floater.lose { color: #aab6b0; font-weight: 600; }
.floater.crit { color: #fff3b0; font-size: clamp(16px, 2.4vw, 24px); }
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, 6px) scale(.8); } 12% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, -54px); } }
#hint { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; color: #cfe0d6aa; font-size: 14px; pointer-events: none; }
.badge { position: absolute; right: 26px; bottom: 30px; padding: 6px 12px; border-radius: 16px; background: #000a; border: 2px solid var(--gold-d); color: var(--gold); font-weight: 800; z-index: 3; }

/* ---------------------------------------------------------------- left panel (wood) */
#panel { width: 30%; min-width: 330px; max-width: 480px; display: flex; flex-direction: column; min-height: 0; position: relative; z-index: 2;
  background: repeating-linear-gradient(90deg, #3a2412 0 7px, #33200f 7px 14px, #3d2713 14px 19px), #33200f;
  border-right: 6px solid #1b110a; box-shadow: inset -2px 0 0 var(--gold-d), 6px 0 18px #000a; }
#p-head { padding: 12px 14px 8px; text-align: center; background: linear-gradient(#0003, #0000); }
.coins-line { font-family: var(--serif); font-weight: 900; font-size: clamp(22px, 2.6vw, 32px); color: var(--gold); text-shadow: 0 2px 0 #000a; word-break: break-word; }
.coins-line .lbl { color: var(--cream); }
.sub { display: flex; justify-content: center; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; margin-top: 2px; flex-wrap: wrap; }
.sub .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); }
#tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 6px 10px; }
.tab { height: 46px; border-radius: 10px 10px 4px 4px; background: linear-gradient(#5a3a1f, #3a2412); border: 2px solid #1b110a; padding: 7px; position: relative; }
.tab .icw { color: var(--muted); }
.tab.active { background: linear-gradient(#8a5a2c, #5a3a1f); border-color: var(--gold-d); }
.tab.active .icw { color: var(--gold); }
.tab.locked { opacity: .45; cursor: not-allowed; }
.tab .dotnew { position: absolute; top: 3px; right: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); border: 1px solid #000; }
#buybar { display: flex; gap: 6px; align-items: center; padding: 2px 12px 6px; color: var(--muted); font-size: 13px; }
#buybar button { min-width: 44px; padding: 5px 8px; border-radius: 8px; background: #1b110a; border: 1px solid #6a4526; font-weight: 700; }
#buybar button.on { background: var(--gold-d); color: #000; border-color: var(--gold); }
#list { flex: 1; overflow-y: auto; padding: 4px 10px 40px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; scrollbar-color: var(--gold-d) #1b110a; scrollbar-width: thin; }
.card { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 10px; min-height: 64px;
  background: linear-gradient(#2a1a0d, #1f1309); border: 2px solid #5a3a1f; box-shadow: 0 2px 0 #000a; transition: transform .08s, border-color .15s; }
.card:hover:not(.mystery):not(.maxed) { border-color: var(--gold-d); }
.card:active:not(.mystery):not(.maxed) { transform: scale(.985); }
.card .cicon { flex: none; width: 44px; height: 44px; border-radius: 10px; padding: 6px; background: radial-gradient(circle at 35% 30%, #4a2f18, #1b110a); border: 1px solid #6a4526; }
.card .cinfo { flex: 1; min-width: 0; }
.card .cname { font-weight: 800; font-size: 15px; color: var(--cream); line-height: 1.15; }
.card .cname small { font-weight: 600; font-size: 11px; color: var(--muted); margin-left: 4px; }
.card .cdesc { font-size: 12px; color: var(--muted); line-height: 1.25; margin-top: 2px; }
.card .cost { flex: none; font-weight: 800; font-size: 14px; text-align: right; max-width: 40%; }
.card.mystery { opacity: .7; cursor: default; }
.card.mystery .cname { letter-spacing: .12em; }
.card.maxed { opacity: .75; cursor: default; border-color: #3a5a2a; }
.card.maxed .cost { color: var(--gold); }
.card.flash { animation: cardflash .35s; }
@keyframes cardflash { 0% { background: #5a4a1f; } 100% { background: #1f1309; } }
.card.q-done { border-color: var(--good); }
.card.q-claimed { opacity: .6; }
.bar { height: 7px; border-radius: 4px; background: #000a; overflow: hidden; margin-top: 5px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #b9831b, #f4c542); }
.claimbtn { padding: 8px 12px; border-radius: 8px; background: linear-gradient(#4f9a4a, #2f6a2c); border: 2px solid #9be08a; font-weight: 800; color: #fff; }
.maxbanner { text-align: center; padding: 18px 10px; border: 2px dashed var(--gold-d); border-radius: 12px; color: var(--gold); font-family: var(--serif); font-weight: 900; font-size: 22px; line-height: 1.2; }
.maxbanner small { display: block; font-family: var(--ui); font-weight: 600; font-size: 13px; color: var(--muted); }
.section-title { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; padding: 6px 2px 0; }
.agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.trophy { text-align: center; padding: 8px 4px; border-radius: 10px; background: #1f1309; border: 2px solid #5a3a1f; min-height: 108px; }
.trophy .tic { width: 38px; height: 38px; margin: 0 auto 4px; }
.trophy .tic .icw { color: var(--gold); }
.trophy.locked { opacity: .5; } .trophy.locked .tic .icw { color: #7a6a52; }
.trophy .tn { font-weight: 800; font-size: 12px; line-height: 1.15; }
.trophy .td { font-size: 10.5px; color: var(--muted); margin-top: 3px; line-height: 1.2; }
.abonus { text-align: center; color: var(--gold); font-weight: 700; padding: 4px 0 8px; }

/* ---------------------------------------------------------------- tree */
#tree-screen { display: flex; flex-direction: column; background: radial-gradient(ellipse at 50% 50%, #3a2160 0%, #1c0f2e 60%, #0d0618 100%); z-index: 15; }
.tree-top { flex: none; display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: linear-gradient(#2c1745, #1c0f2e); border-bottom: 3px solid var(--gold-d); z-index: 2; flex-wrap: wrap; }
.backbtn { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 8px; border-radius: 22px; border: 2px solid var(--gold-d); background: linear-gradient(#7a4f2a, #4a2f18); font-weight: 800; }
.backbtn #back-ic { width: 26px; height: 26px; } .backbtn .icw { color: var(--gold); }
.tree-ic { margin-left: auto; text-align: right; line-height: 1.1; }
.tree-ic .lbl { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #cdb2ee; }
#tree-ic { font-weight: 800; font-size: 22px; color: #fff; }
.tree-ic .bonus { display: block; font-size: 11px; color: #cdb2ee; margin-top: 2px; }
.inflatebtn { height: 44px; padding: 0 18px; border-radius: 22px; border: 2px solid #fff3b0; background: linear-gradient(#8a54c8, #4a2a80); font-weight: 800; color: #fff; }
.inflatebtn:disabled { opacity: .4; cursor: not-allowed; border-color: #6a4a98; }
#tree-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; cursor: grab; }
#tree-wrap.drag { cursor: grabbing; }
#tree-svg { width: 100%; height: 100%; display: block; }
.edge { stroke: #7a5a1a; stroke-width: 5; stroke-linecap: round; opacity: .55; }
.edge.on { stroke: var(--gold); opacity: 1; filter: drop-shadow(0 0 4px #f4c54299); }
.edge.open { stroke: #c9a44a; opacity: .85; }
.node { cursor: pointer; }
.node .body { fill: #2a1946; stroke: #6a4a98; stroke-width: 4; }
.node.open .body { fill: #3b2362; stroke: #d8b8ff; }
.node.afford .body { stroke: var(--good); }
.node.owned .body { fill: #b9831b; stroke: #fff3b0; }
.node.sel .body { stroke: #fff; stroke-width: 6; }
.node .glyph { color: #8f78b8; }
.node.open .glyph { color: #e6d4ff; }
.node.owned .glyph { color: #3a2410; }
.node.locked .glyph { color: #5b4a78; }
.node text { fill: #fff; font-size: 17px; font-weight: 800; text-anchor: middle; paint-order: stroke; stroke: #0d0618; stroke-width: 4px; pointer-events: none; }
.node text.lbl { font-size: 14px; font-weight: 600; fill: #cdb2ee; }
.node.afford text.cost { fill: var(--good); } .node.open:not(.afford) text.cost { fill: var(--bad); }
.zoombtns { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.zoombtns button { width: 40px; height: 40px; border-radius: 10px; background: #2c1745cc; border: 2px solid var(--gold-d); font-size: 22px; font-weight: 800; }
#tree-info { flex: none; min-height: 84px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(#1c0f2e, #2c1745); border-top: 3px solid var(--gold-d); display: flex; align-items: center; gap: 14px; flex-wrap: wrap; z-index: 2; }
.ti-empty { color: #cdb2ee; font-size: 14px; }
.ti-main { flex: 1; min-width: 200px; }
.ti-name { font-family: var(--serif); font-weight: 900; font-size: 19px; color: var(--gold); }
.ti-fx { font-size: 14px; color: var(--cream); line-height: 1.35; }
.ti-state { font-size: 12px; color: #cdb2ee; margin-top: 2px; }
.ti-buy { height: 46px; padding: 0 20px; border-radius: 23px; font-weight: 800; border: 2px solid #9be08a; background: linear-gradient(#4f9a4a, #2f6a2c); color: #fff; }
.ti-buy:disabled { background: #3a2c50; border-color: #6a4a98; color: #cdb2ee; cursor: not-allowed; }

/* ---------------------------------------------------------------- modal / toasts */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: #000b; padding: 14px; }
.modal-box { width: min(560px, 100%); max-height: 92vh; overflow-y: auto; border-radius: 14px; padding: 20px; background: linear-gradient(#3a2412, #24160b); border: 3px solid var(--gold-d); box-shadow: 0 10px 40px #000; }
.modal h2 { font-family: var(--serif); margin: 0 0 10px; color: var(--gold); font-size: 26px; }
.modal p { color: var(--cream); line-height: 1.45; margin: 8px 0; }
.modal .row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.modal .row.end { justify-content: flex-end; }
.btn { padding: 11px 18px; border-radius: 10px; font-weight: 800; border: 2px solid var(--gold-d); background: linear-gradient(#7a4f2a, #4a2f18); color: var(--cream); min-height: 44px; }
.btn:hover { filter: brightness(1.15); }
.btn.primary { background: linear-gradient(#d9a62e, #a8741a); color: #1b110a; border-color: #fff3b0; }
.btn.danger { background: linear-gradient(#a8402f, #6a2418); border-color: #ff9a8a; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid #5a3a1f; }
.setrow select, .modal textarea { background: #1b110a; color: var(--cream); border: 2px solid #6a4526; border-radius: 8px; padding: 8px; font: inherit; }
.modal textarea { width: 100%; height: 90px; font-family: monospace; font-size: 12px; user-select: text; -webkit-user-select: text; }
.stat { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; padding: 2px 0; }
.stat b { color: var(--cream); }
.inf-sym { width: 180px; height: 100px; margin: 0 auto; } .inf-sym .icw { color: var(--gold); filter: drop-shadow(0 0 16px #f4c542aa); }
.center { text-align: center; }
.gstake { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.gstake button { flex: 1; min-width: 70px; }
.gresult { min-height: 52px; text-align: center; font-weight: 800; font-size: 18px; }
.gresult.win { color: var(--good); } .gresult.lose { color: var(--bad); }
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 420px); }
.toast { padding: 10px 14px; border-radius: 10px; background: #24160bf2; border: 2px solid var(--gold-d); color: var(--cream); font-weight: 700; font-size: 14px; box-shadow: 0 6px 18px #000a; animation: toastin .25s, toastout .4s 3.2s forwards; text-align: center; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } }
@keyframes toastout { to { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 860px) {
  #main { flex-direction: column; }
  #board { flex: none; height: 38vh; min-height: 220px; padding: 8px 10px 14px; gap: 6px; box-shadow: inset 0 0 0 7px #3a2412, inset 0 0 0 9px #6a4526, inset 0 0 24px 10px #000a; }
  .flipmore { padding: 6px 12px 8px; margin-top: 4px; width: 94%; }
  .fm-title { font-size: 20px; } .fm-cost { font-size: 14px; }
  #panel { width: 100%; max-width: none; min-width: 0; flex: 1; border-right: 0; border-top: 4px solid #1b110a; }
  #topbar { height: 54px; gap: 8px; padding: 5px 8px; }
  .inflate { padding: 0 10px 0 6px; } .inflate-lbl { font-size: 10px; }
  .round { width: 40px; height: 40px; padding: 8px; }
  #goal { max-width: none; }
  #p-head { padding: 6px 10px 4px; }
  .coins-line { font-size: 22px; }
  #tabs { padding: 4px 8px; } .tab { height: 40px; }
  #version { bottom: 2px; font-size: 10px; }
  .card { min-height: 58px; padding: 6px 8px; } .card .cicon { width: 38px; height: 38px; }
  #hint { font-size: 12px; }
  .ti-buy { width: 100%; }
}
@media (max-width: 420px) {
  .goal-lbl { font-size: 10px; }
  .inflate-lbl { display: none; }
}
@media (prefers-reduced-motion: reduce) { .coin.go, .cell.tossing .coinbox, .cell.tossing .hand, .cell.tossing .thumb-fl { animation-duration: .01s !important; } .floater { animation-duration: .8s; } .inflate.ready { animation: none; } }
