/* Bottle Swap — Play mode. Palette + header/footer come from ../bottle-swap.css. */

[hidden] { display: none !important; }
.btn { font: 600 16px 'Inter', sans-serif; min-height: 48px; padding: 0 22px; border-radius: 6px; border: 1px solid var(--primary-dark); background: var(--primary); color: var(--on-primary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; transition: background .15s ease, transform .1s ease; }
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: translateY(1px); }
.btn.big { min-height: 56px; font-size: 18px; padding: 0 34px; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--rule); }
.btn.ghost:hover { background: var(--rule-soft); }
.linkbtn { background: none; border: 0; color: var(--primary); font: 500 14px 'Inter', sans-serif; cursor: pointer; padding: 10px 4px; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.game { max-width: 1100px; margin: 0 auto; padding: 8px 10px 24px; }

/* ---------- intro ---------- */
.intro { text-align: center; padding: 44px 8px 36px; }
.intro .eyebrow { margin-bottom: 18px; }
.intro h1 { font-family: 'Fraunces', serif; font-size: clamp(46px, 13vw, 104px); line-height: .98; font-weight: 700; letter-spacing: -.03em; color: var(--text); margin-bottom: 20px; }
.lede { font-size: 18px; color: var(--text-soft); max-width: 30ch; margin: 0 auto 28px; }
.intro-actions { margin-bottom: 18px; }
.intro-links { color: var(--gray); font-size: 14px; }
.intro-links a { color: var(--primary); }

/* ---------- table ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.topbar .back { color: var(--text-soft); text-decoration: none; font-size: 14px; padding: 10px 4px; }
.pile-wrap { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 10px 8px 8px; margin: 4px 0 10px; }
.pile { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; min-height: 64px; }
.pile-label { text-align: center; font-size: 12px; color: var(--gray); margin-top: 4px; letter-spacing: .04em; }
.gift { flex: 0 0 auto; width: min(calc((100% - 24px) / 5), 72px); aspect-ratio: 1; background: none; border: 0; padding: 0; cursor: default; transform: rotate(var(--tilt, 0deg)); animation: giftIn .5s var(--d, 0ms) both cubic-bezier(.3,1.6,.5,1); position: relative; -webkit-tap-highlight-color: transparent; }
.gift-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.gift .glid { transform-box: fill-box; transform-origin: 50% 100%; transition: transform .45s cubic-bezier(.3,1.4,.5,1), opacity .45s; }
.gift.opening .glid { transform: translateY(-40px) rotate(-14deg); opacity: 0; }
.gift.opening .gbox { transform-box: fill-box; transform-origin: 50% 100%; animation: boxOpen .5s forwards; }
.gift.can { cursor: pointer; animation: giftIn .5s var(--d, 0ms) both cubic-bezier(.3,1.6,.5,1), nudge 1.4s 0.6s infinite ease-in-out; filter: drop-shadow(0 0 5px var(--accent)); }
.gift.can:active { transform: scale(.94) rotate(var(--tilt, 0deg)); }
body.your-move .gift:not(.can) { opacity: .55; }
@keyframes giftIn { from { transform: scale(.2) rotate(var(--tilt,0deg)); opacity: 0; } to { transform: scale(1) rotate(var(--tilt,0deg)); opacity: 1; } }
@keyframes nudge { 0%,100% { translate: 0 0; } 50% { translate: 0 -3px; } }
@keyframes boxOpen { to { transform: scale(1.06,.9); opacity: .0; } }

/* ---------- seats ---------- */
.seats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-bottom: calc(var(--dock-h, 90px) + 16px); }
.seat { position: relative; background: var(--surface); border: 2px solid var(--rule); border-radius: 12px; padding: 6px 8px 8px; display: grid; grid-template-columns: 58px 1fr; grid-template-rows: 26px auto auto auto; grid-template-areas: "num flag" "face slot" "name name" "pips pips"; column-gap: 6px; row-gap: 2px; transition: border-color .2s, box-shadow .2s, transform .2s; }
.seat.arrive { animation: seatIn .5s cubic-bezier(.3,1.5,.5,1) both; }
@keyframes seatIn { from { transform: scale(.4) translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.seat.you { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 9%, var(--surface)); }
.seat.you::after { content: 'YOU'; position: absolute; right: 8px; top: 6px; font-size: 10px; font-weight: 700; letter-spacing: .14em; color: var(--primary); }
.seat.active { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent), var(--shadow-hover); }
.seat.you.active::after { content: none; }
.seat .num { grid-area: num; align-self: center; justify-self: start; min-width: 34px; padding: 2px 8px; border-radius: 999px; background: var(--rule-soft); color: var(--text-soft); font: 700 14px 'Fraunces', serif; text-align: center; }
.seat.numbered .num { background: var(--primary); color: var(--on-primary); animation: pop .4s both cubic-bezier(.3,1.6,.5,1); }
.turn-flag { grid-area: flag; align-self: center; justify-self: end; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--accent-text); opacity: 0; }
.seat.active .turn-flag { opacity: 1; }
.seat.you:not(.active) .turn-flag { display: none; }
.seat .face { grid-area: face; width: 58px; height: 58px; align-self: center; }
.face-svg { width: 100%; height: 100%; display: block; }
.seat .name { grid-area: name; font: 700 16px 'Fraunces', serif; text-align: center; padding-top: 4px; line-height: 1.15; word-break: keep-all; overflow-wrap: normal; white-space: nowrap; }
.seat .role { grid-column: 1 / -1; grid-row: 5; text-align: center; font: 600 11px 'Inter', sans-serif; text-transform: uppercase; letter-spacing: .08em; color: var(--on-accent); background: var(--accent); border-radius: 999px; padding: 2px 8px; margin-top: 6px; animation: pop .4s both; }
.seat .role[hidden] { display: none; }
.seat .slot { grid-area: slot; border: 2px dashed var(--rule); border-radius: 10px; background: color-mix(in srgb, var(--bg) 55%, transparent); min-height: 108px; display: flex; align-items: center; justify-content: center; padding: 4px; cursor: default; font: inherit; color: var(--gray); -webkit-tap-highlight-color: transparent; }
.seat .slot img { height: 96px; width: auto; max-width: 100%; object-fit: contain; display: block; user-select: none; -webkit-user-drag: none; }
.seat .slot .empty { font-size: 26px; opacity: .5; }
.seat .slot.incoming img { visibility: hidden; }
.seat .slot.can { cursor: pointer; border: 3px solid var(--accent); border-style: solid; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); animation: glow 1.2s infinite ease-in-out; }
.seat .slot.can:active { transform: scale(.96); }
.seat .slot.blocked img { filter: grayscale(1) opacity(.4); }
.seat .slot.blocked { border-style: dotted; }
.seat .pips { grid-area: pips; display: flex; justify-content: center; gap: 6px; padding-top: 4px; }
.pips i { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--gray); display: block; }
.pips i.on { background: var(--primary); border-color: var(--primary); }
.seat .lock { position: absolute; right: 6px; top: 24px; width: 30px; height: 30px; opacity: 0; transform: scale(.4); pointer-events: none; z-index: 2; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.seat.locked .lock { opacity: 1; transform: none; }
.seat.locked { border-color: color-mix(in srgb, var(--accent) 70%, var(--rule)); }
.seat.snap { animation: shake .5s; }
.seat.snap .lock { animation: snap .55s cubic-bezier(.3,1.7,.5,1); }
.lock svg { width: 100%; height: 100%; }
.seat.snap .shackle { animation: shackle .55s; transform-box: fill-box; transform-origin: 20% 100%; }
.seat.grabbed .slot { animation: grabbed .5s; }
.seat.yuck { animation: shake .6s; }
.seat.malort-holder { border-color: #b7c22a; box-shadow: 0 0 0 3px rgba(183,194,42,.45); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes glow { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 30%, transparent); } }
@keyframes snap { 0% { transform: scale(2.6) rotate(-25deg); opacity: 0; } 60% { transform: scale(.85); opacity: 1; } 100% { transform: scale(1); } }
@keyframes shackle { 0% { transform: translateY(-4px) scaleY(1.4); } 70% { transform: translateY(0) scaleY(.9); } 100% { transform: none; } }
@keyframes shake { 0%,100% { translate: 0 0; } 20% { translate: -4px 0; } 40% { translate: 4px 0; } 60% { translate: -3px 0; } 80% { translate: 3px 0; } }
@keyframes grabbed { 0% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* speech bubble */
.bubble { position: absolute; left: 50%; top: -16px; transform: translate(-50%, 6px) scale(.6); background: #fff; color: #2A1F1A; font: 700 13px 'Fraunces', serif; padding: 4px 10px; border-radius: 12px; border: 2px solid #2A1F1A; white-space: nowrap; opacity: 0; pointer-events: none; z-index: 4; }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -7px; width: 10px; height: 10px; background: #fff; border-right: 2px solid #2A1F1A; border-bottom: 2px solid #2A1F1A; transform: translateX(-50%) rotate(45deg); }
.bubble.show { animation: bubble 1.3s both; }
@keyframes bubble { 0% { opacity: 0; transform: translate(-50%, 6px) scale(.6); } 15%,75% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, -6px) scale(1); } }

/* flying bottle */
.fly { position: fixed; z-index: 1000; pointer-events: none; transform: translate(-50%, -50%); filter: drop-shadow(0 6px 8px rgba(0,0,0,.35)); }

/* ---------- ticker + prompt dock (always visible at the bottom on phones) ---------- */
.dock { position: sticky; bottom: 0; z-index: 20; margin: 0 -10px; padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(6px); border-top: 2px solid var(--rule); }
.ticker { min-height: 22px; display: flex; flex-direction: column; justify-content: flex-end; }
.ticker .now { font: 600 16px/1.2 'Fraunces', serif; color: var(--text); animation: tick .3s both; }
.ticker .prev { display: none; }
.ticker .now.lock { color: var(--accent-text); letter-spacing: .12em; }
.ticker .now.bad { color: var(--primary); }
.ticker .now.cap { color: var(--primary); }
@keyframes tick { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.prompt { margin-top: 4px; padding: 6px 10px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 22%, var(--surface)); border: 1px solid var(--accent); font-size: 14px; line-height: 1.3; display: block; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.prompt.empty { display: none; }
.prompt .soft { display: block; color: var(--text-soft); font-size: 12.5px; }
.prompt .btn.keep { min-height: 46px; width: 100%; margin-top: 6px; }

/* ---------- the draw ---------- */
.draw { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; background: rgba(10,6,8,.6); padding: 16px; }
.draw[hidden] { display: none; }
.draw-card { background: var(--surface); border: 2px solid var(--accent); border-radius: 14px; padding: 24px 20px; max-width: 360px; width: 100%; text-align: center; box-shadow: var(--shadow-hover); }
.draw-msg { font: 600 19px/1.3 'Fraunces', serif; margin-bottom: 14px; min-height: 50px; }
.draw-num { font: 700 96px/1 'Fraunces', serif; color: var(--primary); margin: 6px 0 18px; min-height: 96px; }
.draw-num.landed { animation: pop .5s both cubic-bezier(.3,1.7,.5,1); }

/* ---------- end ---------- */
.end { background: var(--surface); border: 2px solid var(--accent); border-radius: 12px; padding: 18px 16px; margin: 10px 0; scroll-margin-top: 8px; }
.end h2 { font: 700 28px 'Fraunces', serif; margin-bottom: 8px; }
.end p { margin-bottom: 8px; font-size: 17px; }
.end .mal { color: var(--text); }
.end .mal.you { color: var(--primary); font-weight: 600; }
.end h3 { font: 700 15px 'Inter', sans-serif; text-transform: uppercase; letter-spacing: .12em; color: var(--accent-text); margin: 14px 0 6px; }
.reveal { list-style: none; }
.reveal li { padding: 5px 0; font-size: 17px; border-bottom: 1px dotted var(--rule); }
.reveal li:last-child { border-bottom: 0; }
.seed { margin-top: 12px; font-size: 12px; color: var(--gray); }
.seed code { background: var(--rule-soft); padding: 1px 5px; border-radius: 4px; }
.end-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

/* ---------- settings dialog ---------- */
.settings { border: 2px solid var(--rule); border-radius: 12px; background: var(--surface); color: var(--text); padding: 20px; width: min(92vw, 400px); margin: auto; }
.settings::backdrop { background: rgba(10,6,8,.55); }
.settings h2 { font: 700 24px 'Fraunces', serif; margin-bottom: 14px; }
.settings .row { margin-bottom: 16px; }
.settings .label { font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.settings .hint { font-size: 12px; color: var(--gray); margin-top: 4px; }
.settings .seg { display: flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.settings .seg button { flex: 1; min-height: 46px; border: 0; background: var(--surface-2); color: var(--text); font: 500 15px 'Inter', sans-serif; cursor: pointer; }
.settings .seg button + button { border-left: 1px solid var(--rule); }
.settings .seg button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.settings .check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; }
.settings .check input { width: 22px; height: 22px; accent-color: var(--primary); }
.settings select { min-height: 44px; font: 500 16px 'Inter', sans-serif; padding: 0 10px; border-radius: 6px; border: 1px solid var(--rule); background: var(--surface-2); color: var(--text); margin-left: 8px; }
.settings .buttons { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 0; }

/* ---------- wider screens: 5 x 2 ---------- */
@media (min-width: 780px) {
  .game { padding: 12px 20px 32px; }
  .seats { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
  .gift { width: min(calc((100% - 72px) / 10), 72px); }
  .dock { margin: 0; border-radius: 10px 10px 0 0; border: 2px solid var(--rule); border-bottom: 0; }
}
@media (max-width: 420px) {
  .seat { grid-template-columns: 54px 1fr; padding: 6px; }
  .seat .face { width: 54px; height: 54px; }
  .seat .slot img { height: 90px; }
  }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
