/* Alley Cards: a green felt table at night, cream cards, warm gold for money, blue for chips and red for Mult. */
:root, #mm, .sg-sheet {
  --felt: #1f4a3f; --felt2: #163a31; --felt3: #0f2924; --ink: #2a2440; --paper: #fbf4e4; --gold: #f2c33a;
  --chips: #3f8de0; --mult: #e5484d; --cream: #f6ecd4; --line: rgba(255, 255, 255, .14);
  --sg-bg: radial-gradient(ellipse at 50% 30%, #2b6152, #12302a 75%); --sg-ink: #fbf4e4; --sg-ink-soft: #cfe3d8;
  --sg-title: #ffe9a8; --sg-title-shadow: #0b201b; --sg-accent: #f2c33a; --sg-accent-ink: #2a2014; --sg-card: rgba(255, 255, 255, .1);
  --sg-card-ink: #fbf4e4; --sg-line: rgba(255, 255, 255, .18); --sg-sheet-bg: #fbf4e4; --sg-sheet-ink: #2a2440;
  --sg-font: 'Baloo 2', system-ui, sans-serif;
}
* { box-sizing: border-box; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--felt3); overflow: hidden; }
body { font-family: 'Baloo 2', system-ui, sans-serif; color: var(--paper); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button { font: inherit; color: inherit; }
.app {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  padding: 0 calc(8px + env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) calc(8px + env(safe-area-inset-left));
  background: radial-gradient(ellipse at 50% 45%, #2b6152 0%, var(--felt) 40%, var(--felt3) 100%);
}
.app.away { visibility: hidden; }

/* the top bar: the menu button, where you are, your money */
.bar { display: flex; align-items: center; gap: 10px; padding-top: var(--sg-corner-top); padding-left: calc(var(--sg-corner-left) - 8px - env(safe-area-inset-left)); min-height: 52px; }
.where { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.05; }
.where b { font-size: 19px; font-weight: 800; color: #ffe9a8; }
.where small { font-size: 13.5px; color: #cfe3d8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.money { font-size: 24px; font-weight: 800; color: var(--gold); background: rgba(0, 0, 0, .28); border-radius: 12px; padding: 2px 12px; min-width: 64px; text-align: center; }

/* companions: five slots across */
.comps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 6px; }
.comps:has(> :nth-child(6)) { grid-template-columns: repeat(6, 1fr); }
.slot { position: relative; aspect-ratio: 5 / 7; border-radius: 9px; padding: 0; border: 0; background: none; }
.slot.empty { border: 2px dashed var(--line); }
.slot svg, .cslot svg, .pc svg, .wcard svg, .big-card svg, .cart svg { display: block; width: 100%; height: 100%; }
.slot.comp { filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .35)); }
.slot.napping { opacity: .45; }
.slot .cnt { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 11.5px; font-weight: 800; border-radius: 8px; padding: 0 6px; }

/* the round: target, score, hands, throw-aways, the two slots */
.status { display: flex; align-items: stretch; gap: 6px; margin-top: 10px; }
.goal, .counts { display: flex; gap: 4px; background: rgba(0, 0, 0, .25); border-radius: 12px; padding: 4px 8px; }
.goal { flex: 1.3; }
.goal span, .counts span { flex: 1; display: flex; flex-direction: column; align-items: center; line-height: 1.05; min-width: 0; }
.status small { font-size: 11.5px; color: #cfe3d8; }
.status b { font-size: 19px; font-weight: 800; white-space: nowrap; }
#target { color: #ffd0a8; }
.counts .hd b { color: #8fc1ff; } .counts .th b { color: #ff9a9d; }
.cons { display: flex; gap: 4px; }
.cslot { width: 38px; aspect-ratio: 5 / 7; border-radius: 6px; padding: 0; border: 0; background: none; }
.cslot.empty { border: 2px dashed var(--line); }
.bossline { margin: 6px 0 0; font-size: 13.5px; line-height: 1.2; color: #ffd6d6; background: rgba(150, 30, 40, .35); border-radius: 10px; padding: 4px 10px; }

.lower { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; margin-top: 6px; }
/* what the picked hand is, and its chips x Mult as it counts up */
.tally { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hname { flex: 1; min-width: 0; min-height: 44px; text-align: left; background: none; border: 0; padding: 0; font-size: 16px; font-weight: 700; color: #fbf4e4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hname.big { font-size: 26px; font-weight: 800; color: #ffe9a8; }
.cm { display: flex; align-items: center; gap: 4px; }
.cm b { min-width: 64px; text-align: center; font-size: 22px; font-weight: 800; border-radius: 10px; padding: 2px 8px; color: #fff; }
.cm .chips { background: var(--chips); } .cm .mult { background: var(--mult); }
.cm i { font-style: normal; font-weight: 800; font-size: 18px; }
.bump { animation: bump .16s ease-out; } .bumpx { animation: bumpx .28s ease-out; }
@keyframes bump { 50% { transform: scale(1.18); } }
@keyframes bumpx { 40% { transform: scale(1.4) rotate(-4deg); } }

/* cards */
.table, .hand { position: relative; }
.table { flex: 1; min-height: 70px; }
.hand { height: 118px; margin-top: 4px; }
.pc { position: absolute; top: 18px; aspect-ratio: 5 / 7; border-radius: 9px; transition: transform .14s ease-out, left .2s ease-out; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .35)); }
.table .pc { top: 50%; transform: translateY(-50%); }
.table .pc.scoring { transform: translateY(-62%); }
.table .pc.dim { opacity: .55; }
.hand .pc.up { transform: translateY(-18px); }
.pc.hit, .slot.hit { animation: hit .22s ease-out; }
.table .pc.scoring.hit { animation: hitup .22s ease-out; }
@keyframes hit { 50% { transform: scale(1.12) rotate(3deg); } }
@keyframes hitup { 50% { transform: translateY(-62%) scale(1.12) rotate(3deg); } }
.pops { position: absolute; inset: 0; pointer-events: none; z-index: 30; }
.pop { position: absolute; transform: translate(-50%, -60%); font-weight: 800; font-size: 19px; padding: 0 7px; border-radius: 8px; color: #fff; animation: popup .9s ease-out forwards; white-space: nowrap; }
.pop.chips, .pop.chips0 { background: var(--chips); } .pop.mult { background: var(--mult); } .pop.x { background: #b01f3c; font-size: 22px; }
.pop.money { background: #c99a22; } .pop.again, .pop.grow, .pop.level { background: #8b4fd0; } .pop.off { background: #555; }
@keyframes popup { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); } 20% { opacity: 1; transform: translate(-50%, -80%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -170%); } }

.actions { display: flex; gap: 6px; align-items: stretch; margin-top: 6px; }
.actions[hidden] { display: none; }
.act { flex: 1.3; min-height: 50px; border: 0; border-radius: 14px; font-size: 17px; font-weight: 800; color: #fff; box-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
.act.play { background: #2f7ad6; } .act.throw { background: #d23a4f; }
.act:disabled { opacity: .45; }
.act:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.sorts { flex: 1.2; display: flex; flex-direction: row; gap: 3px; }
.sorts button { flex: 1; min-width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 9px; background: rgba(255, 255, 255, .14); font-size: 13.5px; font-weight: 700; }
.foot { display: flex; justify-content: space-between; align-items: center; height: 26px; font-size: 13px; color: #cfe3d8; }
.deckinfo { background: rgba(0, 0, 0, .25); border: 0; border-radius: 8px; padding: 0 10px; min-height: 26px; font-weight: 700; }

/* the panels between hands: choosing a round, the cash out, the shop, a pack, the end */
.panel { position: absolute; inset: 0; z-index: 12; display: flex; flex-direction: column; overflow-y: auto; }
.panel[hidden] { display: none; }
.pnl { margin: auto 0; background: rgba(10, 30, 26, .92); border: 1.5px solid var(--line); border-radius: 18px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.pnl h2 { margin: 0; font-size: 20px; text-align: center; color: #ffe9a8; }
.pnl .note { margin: 0; text-align: center; font-size: 14px; color: #cfe3d8; }
.blind { display: flex; gap: 10px; align-items: center; background: rgba(255, 255, 255, .07); border-radius: 12px; padding: 7px 10px; }
.blind.done { opacity: .5; } .blind.next { outline: 2px solid var(--gold); background: rgba(242, 195, 58, .12); }
.blind.boss .bw b { color: #ffb4b4; }
.bossart { width: 44px; height: 44px; border-radius: 50%; background: #5a1f2a; flex: none; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.bossart img { width: 52px; height: 52px; }
.bossart.plain { background: #2f7ad6; font-weight: 800; font-size: 20px; }
.bw { flex: 1; display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.bw b { font-size: 16px; } .bw small { font-size: 13px; color: #cfe3d8; } .bt { font-size: 13px; color: var(--gold); font-weight: 700; }
.blind em { font-style: normal; font-size: 12.5px; color: var(--gold); font-weight: 700; }
.pbtns { display: flex; gap: 8px; }
.pbtns.two > *, .pbtns.three > * { flex: 1; }
.pill { min-height: 46px; border: 0; border-radius: 13px; padding: 0 14px; background: rgba(255, 255, 255, .16); color: #fff; font-size: 16px; font-weight: 800; flex: 1; box-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
.pill.primary { background: #f2a33a; color: #2a1606; }
.pill.big { min-height: 54px; font-size: 18px; }
.pill.buy { background: #2f9a62; min-height: 40px; font-size: 15px; padding: 0 8px; }
.pill.poor { opacity: .5; }
.pill.sell { background: #c99a22; color: #2a1606; }
.pill:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .3); }
.cash { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cash li { display: flex; justify-content: space-between; font-size: 16px; padding: 2px 6px; border-bottom: 1px solid var(--line); }
.cash li b { color: var(--gold); }
.wares { display: flex; gap: 10px; justify-content: center; }
.ware { width: 30%; max-width: 104px; display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.wares.n4 .ware, .wares.n5 .ware { width: 19%; }
.wares.n5 { gap: 5px; }
.ware.sold .wcard { opacity: .3; }
.wcard { aspect-ratio: 5 / 7; padding: 0; border: 0; background: none; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .4)); }
.ware .price { text-align: center; font-size: 14px; color: #cfe3d8; min-height: 40px; line-height: 40px; }
.ware .pk { text-align: center; font-size: 12px; line-height: 1.1; color: #cfe3d8; min-height: 26px; }
.pnl.pack.withhand { margin: 0; }
.panel:has(.withhand) { bottom: 128px; }
.win .winart { display: flex; justify-content: center; }
.win .winart img { width: 72px; height: 72px; margin: 0 -8px; }
.unl .pb { margin-top: 4px; }

/* sheets */
.info { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.info .big-card { width: 120px; aspect-ratio: 5 / 7; margin: 0 auto; }
.info small { text-align: center; color: #6b6380; font-size: 14px; }
.info p { margin: 0; font-size: 16px; line-height: 1.3; text-align: center; }
.info .note { color: #6b6380; font-size: 14px; }
.info .pill { color: #fff; background: #5b5676; }
.info .pill.primary { background: #f2a33a; color: #2a1606; }
.info .pill.sell { background: #c99a22; color: #2a1606; }
.hands { list-style: none; margin: 0; padding: 0; }
.hands li { display: flex; gap: 8px; align-items: baseline; padding: 4px 2px; border-bottom: 1px solid rgba(0, 0, 0, .1); }
.hands li span { flex: 1; font-weight: 700; } .hands li small { color: #6b6380; font-size: 13px; }
.deckview { display: flex; flex-direction: column; gap: 6px; }
.drow { display: flex; flex-wrap: wrap; gap: 3px; }
.pc.mini { position: relative; top: 0; width: 34px; filter: none; }
.pc.mini.used { opacity: .3; }
.coll { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.coll .unl { grid-column: 1 / -1; }
.coll .unl .note { text-align: center; color: #6b6380; margin: 0; }
.cc { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.cc .cart { width: 70%; aspect-ratio: 5 / 7; }
.cc b { font-size: 14px; line-height: 1.1; } .cc small { font-size: 12px; line-height: 1.15; color: #6b6380; }
.cc.locked .cart { opacity: .35; filter: grayscale(1); }

.toast { position: absolute; left: 50%; bottom: calc(190px + env(safe-area-inset-bottom)); transform: translate(-50%, 10px); max-width: 92%; margin: 0; background: #2a2440; color: #fff; border-radius: 12px; padding: 8px 14px; font-size: 15px; text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 40; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* the title picture: a fan of five cards */
.pk-title-art { display: flex; justify-content: center; align-items: center; height: 100%; min-height: 170px; }
.fan { position: relative; width: 240px; height: 170px; }
.fan .pc { position: absolute; left: 50%; top: 10px; width: 96px; margin-left: -48px; transform-origin: 50% 120%; transform: rotate(calc(var(--i) * 11deg)) translateY(calc(var(--i) * var(--i) * 3px)); }

@media (max-height: 700px) {
  .hand { height: 104px; }
  .status b { font-size: 17px; }
  .cm b { font-size: 19px; min-width: 56px; }
  .comps { margin-top: 2px; }
  .bar { min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .pc, .slot { transition: none; }
  .bump, .bumpx, .pc.hit, .slot.hit { animation-duration: .01s; }
  .pop { animation-duration: .6s; }
}

/* stage 2: gifts, perks, dreams, decks and collars */
.blind.skipped { opacity: .45; }
.blind .gift { flex: none; width: 44px; height: 44px; padding: 4px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .12); }
.blind .gift svg { display: block; width: 100%; height: 100%; }
.cons.many { gap: 3px; }
.cons.many .cslot { width: 32px; }
.cslot.ghost { filter: drop-shadow(0 0 3px #b9a6ff); }
.wares.n3 .ware { width: 29%; }
.wares.perks { margin-top: 2px; }
.wares.perks .ware { width: 26%; }
.giftart { display: flex; justify-content: center; }
.decks h3 { margin: 12px 0 6px; font-size: 16px; }
.decks .unl .note { text-align: center; color: #6b6380; margin: 0 0 4px; }
.dgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dk { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 6px 4px; border: 2px solid transparent; border-radius: 12px; background: rgba(0, 0, 0, .04); font: inherit; color: inherit; min-height: 44px; }
.dk.on { border-color: var(--gold, #f2c33a); background: rgba(242, 195, 58, .14); }
.dk .dart { width: 62%; aspect-ratio: 5 / 7; }
.dk .dart svg { display: block; width: 100%; height: 100%; }
.dk b { font-size: 13px; line-height: 1.1; } .dk small { font-size: 11.5px; line-height: 1.15; color: #6b6380; }
.dk em { font-style: normal; font-size: 11px; color: #a07a12; font-weight: 700; }
.dk.locked .dart { opacity: .35; filter: grayscale(1); }
.cgrid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.cl { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 4px 0; min-height: 44px; border: 2px solid transparent; border-radius: 10px; background: rgba(0, 0, 0, .04); font: inherit; color: inherit; }
.cl.on { border-color: var(--gold, #f2c33a); }
.cl.locked { opacity: .35; }
.cl b { font-size: 12px; }

/* sheets are cream: their quiet text must be dark (the title screen keeps the light one) */
.sg-sheet { --sg-ink-soft: #4d5a52; }
