:root {
  --ink: #1d1612;
  --cream: #f1e4c4;
  --paper: #f4e8cc;
  --jade: #2f8a6b;
  --cobalt: #2b56a6;
  --terracotta: #c4553a;
  --mustard: #e3b93f;
  --pink: #e27d98;
  --display: 'Lilita One', 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
  --hand: 'Gochi Hand', 'Comic Sans MS', 'Chalkboard SE', cursive;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #16325e; color: var(--ink); font-family: var(--display); }
body.jolt { animation: jolt 0.22s ease-out; }
@keyframes jolt {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-5px, 4px) rotate(-0.3deg); }
  45% { transform: translate(4px, -3px) rotate(0.2deg); }
  70% { transform: translate(-2px, 1px); }
  100% { transform: none; }
}

#stage { position: fixed; inset: 0; }
#stage canvas { display: block; }

.card {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 14px 18px 12px 16px;
  box-shadow: 4px 5px 0 var(--ink);
}
.card.small { padding: 6px 12px; font-size: 16px; }

button { font: inherit; color: inherit; cursor: pointer; }

.btn {
  font-family: var(--display);
  font-size: 20px;
  padding: 10px 22px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 12px 16px 12px 14px;
  box-shadow: 3px 4px 0 var(--ink);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover { transform: translate(-1px, -2px) rotate(-1deg); box-shadow: 4px 6px 0 var(--ink); }
.btn:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn.primary { background: var(--mustard); }
.btn small { display: block; font-family: var(--hand); font-size: 14px; margin-top: -2px; }

/* ---------- markers ---------- */
#markers { position: fixed; inset: 0; pointer-events: none; z-index: 7; }
.marker {
  position: absolute; left: 0; top: 0; width: 64px; height: 64px; pointer-events: auto;
  border-radius: 50%; border: 3px solid var(--ink); background: var(--mustard);
  box-shadow: 3px 4px 0 var(--ink); display: grid; place-items: center; line-height: 1;
  animation: pulse 0.8s infinite alternate;
}
.marker span { font-family: var(--hand); font-size: 13px; }
.marker b { font-size: 24px; font-weight: normal; margin-top: -10px; }
@keyframes pulse { to { box-shadow: 3px 4px 0 var(--ink), 0 0 0 8px rgba(227, 185, 63, 0.35); } }

/* ---------- speech bubbles ---------- */
#bubbles { position: fixed; inset: 0; pointer-events: none; z-index: 8; }
.bubble {
  position: absolute; left: 0; top: 0; max-width: min(340px, 70vw);
  background: #fffaf0; border: 3px solid var(--ink); border-radius: 22px 26px 22px 18px;
  padding: 10px 14px 9px; box-shadow: 4px 5px 0 var(--ink);
}
.bubble::after {
  content: ''; position: absolute; bottom: -16px; left: 50%; width: 22px; height: 18px;
  background: #fffaf0; border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink);
  transform: skewX(35deg) rotate(20deg); border-bottom-right-radius: 6px;
}
.bubble.seat3::after { left: 22%; }
.bubble.seat1::after { left: 72%; }
.bubble.pop { animation: pop 0.25s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes pop { from { scale: 0.4; opacity: 0; } }
.bubble .es { font-family: var(--display); font-size: 19px; line-height: 1.15; }
.bubble .en { font-family: var(--hand); font-size: 16px; color: #5b4a3a; margin-top: 3px; }
.bubble.seat1 { background: #eaf5ee; }
.bubble.seat2 { background: #fdeee6; }

/* ---------- fx ---------- */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 9; overflow: hidden; }
.onoma {
  position: absolute; transform: translate(-50%, -50%) rotate(var(--rot));
  font-family: var(--display); font-size: 58px; color: var(--mustard);
  -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill;
  text-shadow: 4px 5px 0 var(--ink); white-space: nowrap;
  animation: onoma 0.9s ease-out forwards;
}
.onoma.big { font-size: clamp(56px, 11vw, 130px); color: var(--pink); animation-duration: 2.2s; }
@keyframes onoma {
  0% { scale: 0.2; opacity: 0; }
  12% { scale: 1.25; opacity: 1; }
  25% { scale: 1; }
  75% { opacity: 1; }
  100% { scale: 1.1; opacity: 0; translate: 0 -30px; }
}
#flash { position: fixed; inset: 0; pointer-events: none; z-index: 4; background: #fff6d8; opacity: 0; }
#flash.go { animation: flash 0.18s ease-out; }
@keyframes flash { 0% { opacity: var(--a); } 100% { opacity: 0; } }

/* ---------- settings ---------- */
.panel { position: fixed; top: 76px; right: 16px; z-index: 20; padding: 14px 18px; width: min(300px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px; font-size: 17px; }
.panel h3 { margin: 0 0 4px; font-weight: normal; font-size: 24px; }
.panel label { display: flex; align-items: center; gap: 8px; }
.panel label.slider { flex-direction: column; align-items: stretch; gap: 2px; }
.panel input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--jade); }
.panel input[type="range"] { accent-color: var(--terracotta); }

/* ---------- overlay ---------- */
#overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(22, 50, 94, 0.45); backdrop-filter: blur(2px); }
#overlayBox { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 22px 26px; text-align: center; animation: pop 0.3s cubic-bezier(.3, 1.6, .5, 1); }
#overlayBox h1.title { font-size: clamp(56px, 12vw, 96px); margin: 0; line-height: 0.95; font-weight: normal; color: var(--terracotta); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 5px 6px 0 var(--ink); transform: rotate(-3deg); }
#overlayBox h2 { font-size: 44px; margin: 0 0 4px; font-weight: normal; color: var(--jade); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 3px 4px 0 var(--ink); }
#overlayBox .tag { font-family: var(--hand); font-size: 22px; margin: 8px 0 12px; }
#overlayBox .blurb { font-family: system-ui, sans-serif; font-size: 16px; line-height: 1.45; margin: 10px auto; max-width: 440px; }
#overlayBox .warn { font-family: var(--hand); font-size: 18px; margin: 6px 0 4px; }
#overlayBox .who { font-family: var(--hand); font-size: 22px; margin: 4px 0; }
#overlayBox .gain { font-size: 28px; margin: 4px 0 12px; }
#overlayBox .buttons { display: flex; gap: 12px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.rules { text-align: left; font-family: system-ui, sans-serif; font-size: 15px; line-height: 1.45; padding-left: 20px; }
.hands { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.hands .row { display: grid; grid-template-columns: 80px 1fr 40px; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 10px; border: 2px solid var(--ink); }
.hands .row.us { background: rgba(47, 138, 107, 0.18); }
.hands .row.them { background: rgba(196, 85, 58, 0.18); }
.hands .nm { text-align: left; }
.hands .tiles { display: flex; gap: 3px; flex-wrap: wrap; }
.hands .pts { font-size: 22px; }
.scoreline { display: flex; justify-content: center; gap: 22px; font-size: 20px; margin-top: 8px; }
.scoreline b { font-size: 30px; font-weight: normal; }
.scoreline.big b { font-size: 48px; }
.scoreline .tgt { font-family: var(--hand); align-self: center; }

@media (max-width: 640px) {
  .bubble .es { font-size: 16px; }
  .bubble .en { font-size: 14px; }
  .onoma { font-size: 40px; }
}

/* ---------- record, banner, collection, celebration ---------- */

#banner {
  position: fixed; top: 40%; left: 50%; z-index: 7; transform: translateX(-50%);
  padding: 8px 18px; text-align: center; max-width: min(560px, calc(100vw - 32px)); pointer-events: none;
}
#banner.show { animation: bannerIn 0.45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes bannerIn { from { transform: translate(-50%, -60px) rotate(-3deg); opacity: 0; } }
#banner .big { display: block; font-size: 26px; line-height: 1.1; }
#banner .small { display: block; font-family: var(--hand); font-size: 17px; color: #5b4a3a; }

.flying-tile { position: fixed; z-index: 11; pointer-events: none; filter: drop-shadow(3px 4px 0 rgba(29, 22, 18, 0.8)); }
.pip-pop {
  position: fixed; z-index: 11; pointer-events: none; transform: translate(-50%, -50%);
  font-family: var(--display); font-size: 26px; color: var(--mustard); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill;
  animation: pipPop 0.9s ease-out forwards;
}
@keyframes pipPop { 0% { scale: 0.3; opacity: 0; } 20% { scale: 1.3; opacity: 1; } 100% { translate: 0 -40px; opacity: 0; } }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 29; overflow: hidden; }
#confetti i {
  position: absolute; top: -40px; width: 12px; height: 18px; border: 2px solid var(--ink); border-radius: 2px;
  animation-name: fall; animation-timing-function: linear; animation-fill-mode: forwards;
}
#confetti i.leaf { width: 22px; height: 10px; border-radius: 100% 0; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--r)); } }

#overlayBox .explain { font-family: system-ui, sans-serif; font-size: 14px; color: #5b4a3a; margin: 2px auto 8px; max-width: 460px; }
.hands .row { grid-template-columns: 70px 1fr 34px 54px; }
.hands .row em { font-style: normal; font-family: var(--hand); font-size: 16px; padding: 0 6px; border-radius: 8px; border: 2px solid var(--ink); }
.hands .row em.pays { background: var(--terracotta); color: var(--cream); }
.hands .row em.keeps { background: var(--mustard); }
.hands .row.paying .pts { color: var(--terracotta); }

.stamp {
  display: inline-block; font-size: 22px; padding: 4px 16px; border: 4px solid currentColor; border-radius: 12px;
  transform: rotate(-8deg); margin-bottom: 6px; animation: stamp 0.5s cubic-bezier(.3, 1.8, .5, 1);
}
.stamp.win { color: var(--jade); }
.stamp.lose { color: var(--terracotta); }
@keyframes stamp { from { scale: 3; opacity: 0; } }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 6px; }
.stats .stat { border: 3px solid var(--ink); border-radius: 12px; padding: 6px 4px; background: var(--cream); }
.stats .stat b { display: block; font-size: 26px; font-weight: normal; }
.stats .stat span { font-family: var(--hand); font-size: 15px; }
.record-line { font-family: var(--hand); font-size: 18px; margin: 6px 0 0; }
.record-line b { font-family: var(--display); font-weight: normal; }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- shake the table ---------- */
@keyframes wobble { 25% { transform: rotate(-4deg) translateX(-2px); } 75% { transform: rotate(4deg) translateX(2px); } }
body.shaking { animation: bigShake 0.9s ease-out; }
@keyframes bigShake {
  10% { transform: translate(-14px, 6px) rotate(-0.8deg); } 20% { transform: translate(12px, -8px) rotate(0.7deg); }
  30% { transform: translate(-10px, 5px) rotate(-0.5deg); } 45% { transform: translate(8px, -3px); }
  60% { transform: translate(-5px, 2px); } 80% { transform: translate(2px, -1px); } 100% { transform: none; }
}

/* ---------- vecinos ---------- */
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.unlock-face canvas { width: 140px; height: 140px; display: block; margin: 6px auto; }

/* ---------- leaderboard ---------- */
.tabs { display: flex; gap: 8px; justify-content: center; margin: 6px 0 4px; flex-wrap: wrap; }
.tab { font-family: var(--display); font-size: 16px; padding: 6px 12px; border: 3px solid var(--ink); border-radius: 12px; background: var(--cream); }
.tab.on { background: var(--mustard); box-shadow: 2px 3px 0 var(--ink); }
.board-wrap { overflow-x: auto; max-height: 52vh; overflow-y: auto; }
.board { width: 100%; border-collapse: collapse; font-family: system-ui, sans-serif; font-size: 14px; }
.board th { font-family: var(--display); font-weight: normal; font-size: 14px; text-align: left; border-bottom: 3px solid var(--ink); padding: 4px 6px; position: sticky; top: 0; background: var(--paper); }
.board td { padding: 5px 6px; border-bottom: 1px solid rgba(29, 22, 18, 0.2); text-align: left; }
.board tr.you td { background: rgba(227, 185, 63, 0.45); font-weight: 600; }
.board tr.win td:nth-child(4) b { color: var(--jade); }
.board tr.loss td:nth-child(4) b { color: var(--terracotta); }
.board tr.unfinished td:nth-child(4) b { color: #7a6a5a; }
.board em { font-style: normal; font-family: var(--hand); }
.linkish { background: none; border: 0; padding: 0; font-family: var(--hand); font-size: 17px; text-decoration: underline; color: var(--cobalt); }
.name-input { font-family: var(--display); font-size: 22px; padding: 8px 12px; border: 3px solid var(--ink); border-radius: 12px; width: min(320px, 100%); text-align: center; background: #fffaf0; margin-top: 8px; }

.name-row { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 12px auto 4px; font-family: var(--hand); font-size: 19px; }
.name-row small { font-family: system-ui, sans-serif; font-size: 12px; color: #5b4a3a; }
.name-row .name-input { margin-top: 4px; font-size: 20px; padding: 6px 12px; }

/* ---------- phones ---------- */
html, body { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
input { -webkit-user-select: text; user-select: text; }


@media (max-height: 520px) {
  #banner { top: 52%; padding: 4px 12px; max-width: min(460px, calc(100vw - 32px)); }
  #banner .big { font-size: 18px; }
  #banner .small { font-size: 13px; }
  .marker { width: 48px; height: 48px; }
  .marker b { font-size: 18px; }
  .onoma { font-size: 34px; }
  #overlayBox { padding: 10px 16px; max-height: calc(100vh - 16px); }
  #overlayBox h1.title { font-size: 44px; }
  #overlayBox h2 { font-size: 26px; }
  #overlayBox .tag { font-size: 16px; margin: 2px 0 4px; }
  #overlayBox .blurb { font-size: 12px; margin: 4px auto; }
  #overlayBox .buttons { margin-top: 8px; gap: 8px; }
  #overlayBox .btn { font-size: 15px; padding: 5px 12px; }
  .name-row { margin: 4px auto 2px; font-size: 15px; }
  .name-row .name-input { font-size: 16px; padding: 3px 10px; }
  .hands .row { padding: 2px 6px; }
  .stats .stat b { font-size: 18px; }
}

/* ---------- neighborhood events ---------- */
#night {
  position: fixed; inset: 0; z-index: 3; pointer-events: none;
  background: radial-gradient(ellipse 42% 46% at 50% 58%, rgba(255, 190, 90, 0.08) 0%, rgba(20, 12, 30, 0.55) 55%, rgba(8, 6, 16, 0.9) 100%);
  animation: candle 3.2s ease-in-out infinite;
  transition: opacity 1.2s ease;
}
#night.lightsBack { opacity: 0; }
@keyframes candle { 0%, 100% { filter: brightness(1); } 40% { filter: brightness(1.12); } 55% { filter: brightness(0.94); } 70% { filter: brightness(1.06); } }
#rain { position: fixed; inset: 0; z-index: 3; pointer-events: none; }

/* ---------- controller focus ---------- */
.pad-focus { outline: 4px solid var(--mustard) !important; outline-offset: 3px; box-shadow: 0 0 0 7px var(--ink) !important; }
.tile.pad-focus { transform: translateY(-18px) scale(1.06); border-radius: 8px; }
.marker.pad-focus { transform-origin: center; }
body.pad-mode { cursor: none; }

/* ---------- tutorial + resume ---------- */
.tile.hint { animation: hintPulse 0.9s ease-in-out infinite; }
.tile.hint canvas { outline: 4px solid var(--jade); outline-offset: 2px; border-radius: 8px; }
@keyframes hintPulse { 50% { transform: translateY(-16px); } }
.resume-line { font-family: var(--hand); font-size: 18px; margin: 6px 0; background: rgba(227, 185, 63, 0.35); border: 2px dashed var(--ink); border-radius: 10px; padding: 4px 10px; }
.resume-line b { font-family: var(--display); font-weight: normal; }
#settings #tutorialBtn { background: var(--jade); color: var(--cream); }

/* ---------- match format (quick / classic) ---------- */
.format-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 10px auto 4px; }
.format-row label { cursor: pointer; }
.format-row input { position: absolute; opacity: 0; pointer-events: none; }
.format-row label > span { display: flex; flex-direction: column; align-items: center; padding: 6px 14px; border: 3px solid var(--ink); border-radius: 12px; background: var(--paper); font-size: 18px; line-height: 1.1; }
.format-row label > span small { font-family: system-ui, sans-serif; font-size: 11px; color: #5b4a3a; }
.format-row input:checked + span { background: var(--mustard); box-shadow: 3px 3px 0 var(--ink); }
.format-row input:focus-visible + span { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.panel label.select { flex-wrap: wrap; }
.panel label.select select { font: inherit; font-size: 14px; padding: 2px 4px; }
.panel label.select small { flex-basis: 100%; font-family: system-ui, sans-serif; font-size: 11px; color: #5b4a3a; }
#overlayBox .match-note { font-family: var(--hand); font-size: 20px; margin: -4px 0 10px; }
#overlayBox .match-note i { font-size: 15px; color: #5b4a3a; }
@media (max-height: 520px) {
  .format-row { margin: 2px auto; gap: 6px; }
  .format-row label > span { padding: 1px 10px; font-size: 14px; border-width: 2px; }
  .format-row label > span small { font-size: 10px; }
}

/* ---------- polish pass ---------- */
#overlayBox.wide { width: min(760px, 100%); }
/* long modals keep their buttons in reach */
#overlayBox .buttons { position: sticky; bottom: -22px; margin-bottom: -22px; padding: 10px 0 18px; background: var(--paper); box-shadow: 0 -16px 14px -6px var(--paper); z-index: 2; }
.panel-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.panel-buttons .btn { flex: 1 1 120px; font-size: 16px; padding: 8px 10px; }
.panel-note { margin: -2px 0 2px; font-family: var(--hand); font-size: 14px; color: #5b4a3a; }
.panel-note i { font-size: 12px; }
#overlayBox .warn i { font-size: 14px; color: #5b4a3a; }
@media (max-height: 520px) {
  #overlayBox .buttons { bottom: -10px; margin-bottom: -10px; padding: 6px 0 10px; }
}
#loading { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 10px; background: #16325e; color: var(--cream); text-align: center; padding: 16px; }
#loading .loading-title { font-family: var(--display); font-size: clamp(56px, 12vw, 96px); color: var(--terracotta); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 5px 6px 0 var(--ink); transform: rotate(-3deg); }
#loading p { margin: 0; font-family: var(--hand); font-size: 22px; }
#loading .loading-slow { font-size: 16px; max-width: 360px; }
#loading .loading-tiles { display: flex; gap: 10px; }
#loading .loading-tiles span { width: 22px; height: 44px; background: var(--paper); border: 3px solid var(--ink); border-radius: 5px; animation: tileHop 0.9s ease-in-out infinite; }
#loading .loading-tiles span:nth-child(2) { animation-delay: 0.15s; }
#loading .loading-tiles span:nth-child(3) { animation-delay: 0.3s; }
@keyframes tileHop { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-12px) rotate(6deg); } }

/* ---------- accessibility ---------- */
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; }
.btn:focus-visible, .tile:focus-visible, .marker:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  *:not(.onoma), *:not(.onoma)::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  body.jolt { animation: none !important; }
}

/* ================= Cine layout (chosen from four UI directions, Sept 2026) =================
   A thin paper strip on top (menu, score, who's at the table), talk as bubbles on desktop and as paper
   captions on tall phones, and the hand as a paper sheet at the bottom that rises on your turn.
   Bright on purpose: Adrián liked the strip and the menu but not a black bar or dark shading. */
:root {
  --strip-h: 56px;
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .11  0 0 0 0 .09  0 0 0 0 .07  0 0 0 .2 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --r1: 16px 11px 18px 10px / 11px 17px 10px 15px;
}
.card, .btn { background-image: var(--grain); }

/* ---- top: a floating paper card (menu + score) on the left, the neighbor chips on the right. No full-width bar. ---- */
#hud {
  position: fixed; z-index: 9; top: max(10px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 14px; padding: 6px 16px 6px 7px;
  background: var(--paper) var(--grain); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 18px 22px 16px 20px; box-shadow: 3px 4px 0 var(--ink);
}
.menu-btn {
  display: inline-flex; align-items: center; gap: 9px; height: 40px; padding: 0 13px 0 11px; flex: none;
  border: 2.5px solid var(--ink); color: var(--ink); background: var(--cream); border-radius: var(--r1); font: 17px var(--display); box-shadow: 2px 3px 0 var(--ink);
}
.menu-btn small { font: 16px var(--hand); color: #5b4a3a; }
.menu-btn[aria-expanded="true"] { background: var(--mustard); }
.burger { display: inline-grid; gap: 4px; }
.burger i { display: block; width: 19px; height: 3px; background: currentColor; border-radius: 2px; }
.burger i:nth-child(2) { width: 14px; }
.score { display: flex; align-items: center; gap: 10px; font-family: var(--display); }
.score .team { display: flex; align-items: center; gap: 7px; }
.score .pts { font-size: 26px; line-height: 1; font-weight: normal; }
.score .lbl { font: 12px/1 var(--display); letter-spacing: 0.8px; text-transform: uppercase; opacity: 0.85; }
.score .us { color: var(--jade); }
.score .them { color: var(--terracotta); }
.score .pts.bump { animation: bump 0.4s; }
@keyframes bump { 40% { transform: scale(1.35) rotate(-6deg); } }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid currentColor; }
.us .dots i.won { background: var(--jade); border-color: var(--ink); }
.them .dots i.won { background: var(--terracotta); border-color: var(--ink); }
.score .sep { width: 2px; height: 26px; background: var(--ink); opacity: 0.3; transform: rotate(12deg); }
.fmt { font: 16px/1.1 var(--hand); color: #5b4a3a; margin-left: 4px; }
.fmt b { font-family: var(--display); font-weight: normal; }

/* ---- who's at the table: portrait chips (left seat, partner, right seat) ---- */
.chips { position: fixed; z-index: 10; top: calc(max(10px, env(safe-area-inset-top)) + 8px); right: max(22px, env(safe-area-inset-right)); display: flex; gap: 26px; align-items: center; }
.chip { position: relative; width: 46px; height: 46px; flex: none; }
.chip .face { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; border: 3px solid var(--ink); background: var(--paper); box-shadow: 2px 3px 0 var(--ink); }
.chip .face canvas { width: 100%; height: 100%; display: block; transform: scale(1.18) translateY(4%); }
.chip.them .face { outline: 3px solid var(--terracotta); }
.chip.us .face { outline: 3px solid var(--jade); }
.chip .count {
  position: absolute; right: -9px; bottom: -6px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 9px 7px 10px 6px;
  background: var(--cream); color: var(--ink); border: 2.5px solid var(--ink); font: 14px/17px var(--display); text-align: center;
}
.chip.last .count { background: var(--terracotta); color: var(--cream); animation: bump 0.9s infinite; }
.chip .name { position: absolute; left: 50%; top: calc(100% + 2px); transform: translateX(-50%); white-space: nowrap; font: 11px/1 var(--display); color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-radius: 6px; padding: 1px 5px; display: none; }
.chip.turn::before { content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 4px dashed var(--mustard); animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.chip .talk { position: absolute; left: -9px; top: -8px; width: 24px; height: 20px; border-radius: 10px 8px 11px 4px; background: var(--mustard); border: 2.5px solid var(--ink); display: none; place-items: center; }
.chip.talking .talk { display: grid; }
.talkbars { display: inline-flex; gap: 2px; align-items: flex-end; height: 9px; color: var(--ink); }
.talkbars i { width: 3px; height: 100%; background: currentColor; border-radius: 2px; transform-origin: bottom; animation: talkbar 0.9s ease-in-out infinite; }
.talkbars i:nth-child(2) { animation-delay: -0.3s; }
.talkbars i:nth-child(3) { animation-delay: -0.6s; }
@keyframes talkbar { 0%, 100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }
.chip .stamp { position: absolute; left: 50%; top: 100%; transform: translateX(-50%) rotate(-8deg) scale(0); font: 14px var(--display); color: var(--cream); background: var(--cobalt); border: 2px solid var(--ink); border-radius: 7px; padding: 0 6px; opacity: 0; white-space: nowrap; }
.chip.passed .stamp { animation: stampPass 1.6s ease-out; }
@keyframes stampPass {
  0% { transform: translateX(-50%) rotate(-8deg) scale(0); opacity: 1; }
  15% { transform: translateX(-50%) rotate(-8deg) scale(1.2); opacity: 1; }
  25%, 75% { transform: translateX(-50%) rotate(-8deg) scale(1); opacity: 1; }
  100% { transform: translateX(-50%) rotate(-8deg) translateY(6px) scale(1); opacity: 0; }
}

/* ---- menu ---- */
.menu { position: fixed; z-index: 21; top: calc(var(--strip-h) + env(safe-area-inset-top) + 6px); left: max(12px, env(safe-area-inset-left)); width: min(280px, calc(100vw - 24px)); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 48px; border: 0; background: transparent; border-radius: 10px; font: 20px var(--display); text-align: left; }
.menu-item:hover, .menu-item:focus-visible { background: rgba(227, 185, 63, 0.4); }
.menu-item .ic { width: 26px; text-align: center; }
.menu-item small { margin-left: auto; font: 15px var(--hand); color: #5b4a3a; }
.menu .record { border-top: 2px dashed rgba(29, 22, 18, 0.35); margin-top: 4px; padding: 8px 12px 4px; font-size: 15px; display: flex; gap: 6px; align-items: baseline; }
.menu .record span { font-family: var(--hand); font-size: 16px; margin-right: 4px; }
.menu .record b { font-weight: normal; font-size: 19px; }
.panel { top: calc(var(--strip-h) + env(safe-area-inset-top) + 8px); left: max(12px, env(safe-area-inset-left)); right: auto; max-height: calc(100vh - var(--strip-h) - 24px); overflow: auto; }

/* ---- talk: bubbles (wide screens) sit below the strip ---- */
#bubbles { z-index: 8; }

/* ---- captions (tall phones): a bright paper card right above the hand ---- */
#caption {
  position: fixed; z-index: 8; left: 10px; right: 10px; bottom: calc(var(--sheet-h, 150px) + 16px); pointer-events: none;
  display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px;
  background: #fffaf0 var(--grain); color: var(--ink); border: 3px solid var(--ink); border-radius: 20px 24px 18px 22px; box-shadow: 3px 4px 0 var(--ink);
}
#caption.seat1 { background-color: #eaf5ee; }
#caption.seat2 { background-color: #fdeee6; }
#caption.pop { animation: pop 0.25s cubic-bezier(.3, 1.8, .5, 1); }
#caption .cap-face { width: 54px; height: 54px; flex: none; border-radius: 50%; overflow: hidden; border: 3px solid var(--ink); outline: 3px solid var(--terracotta); background: var(--paper); }
#caption.seat2 .cap-face { outline-color: var(--jade); }
#caption .cap-face canvas { width: 100%; height: 100%; display: block; transform: scale(1.18) translateY(4%); }
#caption .who { font: 12px var(--display); color: var(--terracotta); text-transform: uppercase; letter-spacing: 1px; }
#caption.seat2 .who { color: var(--jade); }
#caption .es { font: 20px/1.12 var(--display); color: var(--ink); }
#caption .en { font: 15px/1.2 var(--hand); color: #5b4a3a; margin-top: 3px; }
#caption .en:empty, #caption .en[hidden] { display: none; }

/* ---- the hand sheet ---- */
#handbar {
  position: fixed; left: 50%; bottom: 0; z-index: 10; transform: translateX(-50%);
  width: min(1020px, 100vw); padding: 6px 22px max(10px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 4px;
  background: var(--paper) var(--grain); color: var(--ink);
  border: 4px solid var(--ink); border-bottom: 0; border-radius: 30px 22px 0 0 / 24px 30px 0 0;
  box-shadow: 0 -6px 0 var(--mustard), 0 -10px 0 var(--ink);
  transition: transform 0.35s cubic-bezier(.3, 1.3, .5, 1), box-shadow 0.3s;
}
body:not(.my-turn) #handbar { box-shadow: 0 -4px 0 var(--ink); }
body.in-hand:not(.my-turn) #handbar { transform: translateX(-50%) translateY(var(--tuck, 38%)); }
body:not(.in-hand) #handbar { transform: translateX(-50%) translateY(110%); }
.sheet-head { display: flex; align-items: center; gap: 10px; min-height: 46px; }
.sheet-head .spacer { flex: 1; }
#turn { font: 22px/1 var(--display); white-space: nowrap; }
#turn b { font-weight: normal; }
#turn[data-seat="0"] { font-size: 30px; position: relative; z-index: 0; }
#turn[data-seat="0"] b::after { content: ''; position: absolute; left: -6px; right: -8px; bottom: 2px; height: 45%; z-index: -1; background: var(--mustard); border-radius: 8px 3px 9px 4px; transform: rotate(-2deg); }
#turn small { display: inline; margin-left: 8px; font: 17px var(--hand); color: #5a4a3a; }
#ends { display: flex; align-items: center; gap: 6px; font: 14px var(--hand); color: #5a4a3a; }
#ends.empty { display: none; }
#ends .ends-tile { transform: rotate(90deg); margin: -10px 6px; filter: drop-shadow(1px 2px 0 rgba(29, 22, 18, 0.6)); }
.sheet-head .btn { height: 46px; padding: 0 16px; font-size: 18px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sheet-head .btn small { display: inline; font: 14px/1 var(--hand); opacity: 0.85; margin: 0; }
#passBtn { background: var(--mustard); animation: nudge 1s infinite; }
#passBtn.off { background: transparent; border-style: dashed; box-shadow: none; color: #7b6a55; border-color: #8c7a63; animation: none; }
#shakeBtn { background: var(--cobalt); color: var(--cream); }
#shakeBtn:disabled { background: transparent; color: #7b6a55; border-style: dashed; box-shadow: none; }
#shakeBtn:not(:disabled):hover { animation: wobble 0.35s infinite; }
body:not(.my-turn) #passBtn, body:not(.my-turn) #shakeBtn { display: none; }
@keyframes nudge { 50% { transform: rotate(-2deg) scale(1.04); } }

#hand { display: flex; gap: 8px; min-height: 60px; justify-content: center; align-items: flex-end; padding: 10px 0 4px; }
#hand.two-rows { flex-wrap: wrap; gap: 6px; margin: 0 auto; }
.tile {
  padding: 0; border: 0; background: none; border-radius: 10px;
  filter: drop-shadow(2px 3px 0 rgba(29, 22, 18, 0.6));
  transition: transform 0.14s cubic-bezier(.3, 1.6, .5, 1), filter 0.14s, opacity 0.2s;
  animation: dealIn 0.35s backwards; animation-delay: calc(var(--i) * 40ms);
}
.tile canvas { display: block; }
.tile.playable { transform: translateY(-8px); }
.tile.playable:hover { transform: translateY(-18px) rotate(-3deg); }
.tile.selected { transform: translateY(-20px) rotate(-3deg) !important; filter: drop-shadow(0 0 0 var(--ink)) drop-shadow(4px 6px 0 var(--mustard)) drop-shadow(2px 2px 0 var(--ink)); }
.tile.dead { opacity: 0.42; filter: grayscale(0.55); }
.tile:disabled { cursor: default; }
@keyframes dealIn { from { transform: translateY(80px) rotate(12deg); opacity: 0; } }
body:not(.my-turn) .tile { opacity: 0.9; }

/* where does it go: two big buttons inside the sheet */
#sideChoice { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 2px 0 4px; animation: capIn 0.2s ease-out; }
#sideChoice .q { font: 18px var(--display); }
#sideChoice .q small { display: block; font: 14px var(--hand); color: #5a4a3a; }
.side-btn { display: inline-flex; align-items: center; gap: 10px; height: 64px; min-width: 150px; padding: 0 16px; font-size: 22px; background: var(--cream); border-width: 4px; box-shadow: 4px 5px 0 var(--ink); }
.side-btn b { font-size: 30px; font-weight: normal; }
.side-btn i { font-style: normal; font-size: 20px; color: var(--terracotta); }
.side-btn canvas { flex: none; filter: drop-shadow(1px 2px 0 rgba(29, 22, 18, 0.6)); }
.marker.clamped { opacity: 0.85; }

/* banner and big words stay clear of the strip and sheet */
#banner { top: 34%; }

/* ---- short landscape phones ---- */
@media (max-height: 520px) {
  :root { --strip-h: 44px; }
  #hud { gap: 10px; top: max(6px, env(safe-area-inset-top)); padding: 3px 12px 3px 4px; border-width: 2px; box-shadow: 2px 3px 0 var(--ink); }
  .menu-btn { height: 34px; padding: 0 9px; }
  .menu-btn small { display: none; }
  .score .pts { font-size: 20px; }
  .score .lbl { display: none; }
  .dots i { width: 10px; height: 10px; border-width: 2px; }
  .chip { width: 34px; height: 34px; }
  .chips { gap: 18px; top: calc(max(6px, env(safe-area-inset-top)) + 5px); }
  .chip .count { min-width: 18px; height: 18px; font-size: 11px; line-height: 13px; right: -7px; }
  #handbar { padding: 2px 14px max(4px, env(safe-area-inset-bottom)); width: min(760px, 100vw); }
  .sheet-head { min-height: 34px; }
  #turn { font-size: 16px; }
  #turn[data-seat="0"] { font-size: 20px; }
  #turn small { font-size: 13px; }
  .sheet-head .btn { height: 34px; font-size: 14px; padding: 0 10px; }
  .sheet-head .btn small { display: none; }
  #hand { padding-top: 6px; gap: 4px; }
  .side-btn { height: 40px; min-width: 104px; font-size: 16px; }
  .side-btn b { font-size: 22px; }
  /* keep the sheet short: the side choice shares the header row */
  #handbar { display: grid; grid-template-columns: 1fr auto; column-gap: 10px; }
  .sheet-head { grid-column: 1; grid-row: 1; }
  #sideChoice { grid-column: 2; grid-row: 1; padding: 0; }
  #sideChoice .q { display: none; }
  #hand { grid-column: 1 / -1; }
}

/* ---- tall phones: captions, chips under the strip, big two-row hand ---- */
@media (orientation: portrait) and (max-width: 700px) {
  :root { --strip-h: 52px; }
  #hud { gap: 8px; top: max(8px, env(safe-area-inset-top)); left: max(8px, env(safe-area-inset-left)); padding: 4px 12px 4px 5px; }
  .menu-btn { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .menu-btn small { display: none; }
  .score { gap: 6px; }
  .score .lbl { display: none; }
  .score .pts { font-size: 22px; }
  .dots i { width: 11px; height: 11px; border-width: 2px; }
  .fmt { font-size: 13px; }
  .chips { position: fixed; top: calc(max(8px, env(safe-area-inset-top)) + 70px); left: 14px; right: 14px; margin: 0; padding: 0; justify-content: space-between; pointer-events: none; }
  .chip { width: 44px; height: 44px; }
  .chip .name { display: block; }
  #handbar { width: 100vw; padding: 4px 8px max(8px, env(safe-area-inset-bottom)); border-radius: 26px 20px 0 0 / 20px 26px 0 0; border-left: 0; border-right: 0; }
  .sheet-head { min-height: 44px; gap: 6px; }
  #turn { font-size: 18px; }
  #turn[data-seat="0"] { font-size: 26px; }
  #turn small { display: none; }
  #ends span { display: none; }
  .sheet-head .btn { height: 44px; font-size: 15px; padding: 0 11px; }
  .sheet-head .btn small { display: none; }
  #hand { padding-top: 8px; }
  #sideChoice { gap: 8px; }
  #sideChoice .q { display: none; }
  .side-btn { flex: 1; min-width: 0; height: 60px; justify-content: center; font-size: 19px; }
  #banner { top: 26%; width: min(340px, calc(100vw - 32px)); max-width: none; }
  #overlayBox .buttons { gap: 8px; }
  #overlayBox .buttons .btn:not(.primary) { font-size: 16px; padding: 7px 12px; }
  #overlayBox .buttons .btn.primary { flex-basis: 100%; font-size: 24px; }
}
body.caption-mode .bubble { display: none !important; }

/* ---------- account level ---------- */
.level { display: grid; grid-template-columns: auto 1fr; grid-template-areas: 'badge text' 'badge bar'; column-gap: 10px; row-gap: 3px; align-items: center; text-align: left; }
.level .lvl-badge { grid-area: badge; }
.lvl-badge { display: inline-grid; place-items: center; line-height: 0; filter: drop-shadow(2px 3px 0 rgba(29, 22, 18, 0.35)); }
.lvl-badge.small { filter: none; }
.badge-svg { display: block; overflow: visible; }
.lvl-text { grid-area: text; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; line-height: 1.1; }
.lvl-text b { font: 18px var(--display); font-weight: normal; }
.lvl-text small { font: 14px var(--hand); color: #5b4a3a; }
.lvl-bar { grid-area: bar; position: relative; height: 12px; border: 2.5px solid var(--ink); border-radius: 8px; background: var(--cream); overflow: hidden; margin-right: 64px; }
.lvl-bar i { position: absolute; inset: 0 auto 0 0; background: repeating-linear-gradient(-45deg, var(--jade) 0 8px, #3aa07c 8px 14px); border-right: 2px solid var(--ink); transition: width 1.2s cubic-bezier(.3, 1.2, .5, 1); }
.lvl-xp { grid-area: bar; justify-self: end; font: 12px var(--display); color: #5b4a3a; }
.menu-level { padding: 8px 10px 10px; border-bottom: 2px dashed rgba(29, 22, 18, 0.35); margin-bottom: 4px; }
.title-level { max-width: 340px; margin: 6px auto 2px; padding: 8px 12px; background: rgba(227, 185, 63, 0.18); border: 2px dashed rgba(29, 22, 18, 0.35); border-radius: 12px; }
.xp-gain { position: relative; margin: 10px auto 4px; max-width: 380px; padding: 10px 14px; border: 3px solid var(--ink); border-radius: 14px; background: var(--cream); box-shadow: 3px 4px 0 var(--ink); }
.xp-gain .xp-plus { position: absolute; right: 12px; top: -14px; font: 20px var(--display); background: var(--jade); color: var(--cream); border: 2.5px solid var(--ink); border-radius: 9px; padding: 0 8px; transform: rotate(4deg); }
.xp-gain .level-up { position: absolute; left: 10px; top: -16px; font-size: 18px; margin: 0; }
.xp-gain.up { background: #fff4cf; }
@media (max-height: 520px) {
  .title-level { margin: 2px auto; padding: 3px 8px; }
  .title-level .lvl-badge { min-width: 32px; height: 32px; font-size: 16px; }
  .title-level .lvl-text small, .title-level .lvl-xp { display: none; }
  .title-level .lvl-bar { margin-right: 0; height: 9px; }
}

/* ---------- charge slam: hold a tile (three steps: fuerte, duro, ¡cataplún!) ---------- */
.tile { -webkit-touch-callout: none; touch-action: none; }
.tile.charging {
  position: relative; z-index: 5;
  transform: translateY(calc(-18px - var(--charge, 0) * 26px)) scale(calc(1.06 + var(--charge, 0) * 0.3)) !important;
  transition: transform 0.12s ease-out, filter 0.2s;
  filter: drop-shadow(0 0 calc(4px + var(--charge, 0) * 10px) rgba(227, 185, 63, 0.9)) drop-shadow(3px 5px 0 var(--ink));
}
/* the shake only starts once there's a real step, and gets stronger per step */
.tile.charging.tier1 { animation: chargeShake 0.14s linear infinite; --amp: 1px; }
.tile.charging.tier2 { animation: chargeShake 0.1s linear infinite; --amp: 2px; filter: drop-shadow(0 0 12px rgba(240, 140, 60, 0.95)) drop-shadow(3px 5px 0 var(--ink)); }
.tile.charging.tier3 { animation: chargeShake 0.07s linear infinite; --amp: 3.5px; filter: drop-shadow(0 0 18px rgba(196, 85, 58, 1)) drop-shadow(0 0 4px #fff4cf) drop-shadow(3px 5px 0 var(--ink)); }
@keyframes chargeShake {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  25% { translate: calc(var(--amp) * -1) calc(var(--amp) * 0.4); rotate: -1.5deg; }
  75% { translate: var(--amp) calc(var(--amp) * -0.4); rotate: 1.5deg; }
}
/* a little pop each time you cross into the next step */
.tile.tier-pop canvas { animation: tierPop 0.28s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes tierPop { 40% { transform: scale(1.14); } }
.charge-label {
  position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%) rotate(-6deg);
  white-space: nowrap; pointer-events: none; font: 15px/1 var(--display); padding: 3px 8px;
  background: var(--mustard); color: var(--ink); border: 2.5px solid var(--ink); border-radius: 9px; box-shadow: 2px 3px 0 var(--ink);
  animation: tierPop 0.28s cubic-bezier(.3, 1.8, .5, 1);
}
.tile.tier2 .charge-label { background: #f08c3c; }
.tile.tier3 .charge-label { background: var(--terracotta); color: var(--cream); font-size: 17px; }

/* ---------- level-up: a small paper ribbon that drops in at the top, then gets out of the way ---------- */
.levelup {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 14px); z-index: 60;
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 12px;
  width: min(340px, calc(100vw - 32px)); padding: 8px 16px 10px 10px;
  background: var(--cream); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 3px 4px 0 var(--ink);
  translate: -50% -140%; rotate: -1.5deg; cursor: pointer;
  transition: translate 0.5s cubic-bezier(.3, 1.5, .5, 1);
}
.levelup.show { translate: -50% 0; }
.levelup.bye { translate: -50% -140%; transition: translate 0.35s ease-in; }
.lu-badge { position: relative; grid-row: span 3; width: 62px; height: 62px; line-height: 0; overflow: visible; }
.lu-badge > span { position: absolute; inset: 0; display: grid; place-items: center; }
.lu-badge svg { width: 62px; height: 62px; filter: drop-shadow(2px 3px 0 rgba(29, 22, 18, 0.3)); }
/* the cigar band unrolls, a gold shine sweeps over it, and a little stamp lands */
.lu-old { animation: luOld 0.3s ease-in 0.45s forwards; }
.lu-new { opacity: 0; transform-origin: left center; animation: luNew 0.65s cubic-bezier(.3, 1.35, .5, 1) 0.7s forwards; }
@keyframes luOld { to { transform: scaleX(0.08) rotate(-6deg); opacity: 0; } }
@keyframes luNew { 0% { opacity: 1; transform: scaleX(0.08) rotate(-6deg); } 70% { transform: scaleX(1.06) rotate(1deg); } 100% { opacity: 1; transform: none; } }
.lu-shine { position: absolute; top: -6px; bottom: -6px; width: 20px; rotate: 16deg; opacity: 0; pointer-events: none; background: linear-gradient(90deg, transparent, rgba(255, 246, 214, 0.95), transparent); animation: luShine 0.75s ease-in-out 1.25s; }
@keyframes luShine { 0% { opacity: 1; translate: -46px 0; } 100% { opacity: 0; translate: 52px 0; } }
.lu-stamp { position: absolute; left: -16px; top: -12px; font: 12px/18px var(--display); font-style: normal; color: var(--terracotta); border: 2.5px solid var(--terracotta); border-radius: 7px; padding: 0 5px; rotate: -12deg; background: rgba(255, 250, 240, 0.7); opacity: 0; animation: luStamp 0.3s cubic-bezier(.3, 1.6, .5, 1) 1.75s forwards; }
@keyframes luStamp { from { opacity: 0; scale: 2.4; } to { opacity: 1; scale: 1; } }
.lu-kicker { font: 13px/1 var(--display); color: var(--terracotta); letter-spacing: 0.02em; }
.lu-kicker small { font: 13px var(--hand); color: #5b4a3a; margin-left: 4px; }
.lu-level { font: 20px/1.1 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lu-level b { font-weight: normal; color: var(--jade); }
.lu-bar { position: relative; height: 9px; border: 2.5px solid var(--ink); border-radius: 6px; background: #fffaf0; overflow: hidden; }
.lu-bar i { position: absolute; inset: 0 auto 0 0; background: var(--jade); transition: width 1s cubic-bezier(.3, 1.2, .5, 1); }
@media (max-width: 430px) { .levelup { width: calc(100vw - 20px); padding-right: 10px; } .lu-level { font-size: 17px; } .lu-kicker { font-size: 12px; } }
@media (prefers-reduced-motion: reduce) { .levelup, .levelup.bye { transition: opacity 0.2s; } .lu-old, .lu-new, .lu-shine, .lu-stamp { animation: none; } .lu-old, .lu-shine { display: none; } .lu-new, .lu-stamp { opacity: 1; } }

/* ---------- title screen: the table, you, one big button ---------- */
#overlayBox.title-screen { width: min(460px, 100%); padding: 20px 24px 18px; }
.title-screen .tag { margin: 6px 0 14px; }
.lineup { display: flex; align-items: flex-end; justify-content: center; gap: 12px; margin: 4px 0 14px; }
.lineup-seat { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 72px; }
.lineup-face { width: 62px; height: 62px; border-radius: 50%; overflow: hidden; border: 3px solid var(--ink); outline: 3px solid var(--terracotta); background: var(--paper); box-shadow: 2px 3px 0 var(--ink); }
.lineup-seat.us .lineup-face { width: 74px; height: 74px; outline-color: var(--jade); }
.lineup-face canvas { width: 100%; height: 100%; display: block; transform: scale(1.18) translateY(4%); }
.lineup-seat b { font-size: 15px; font-weight: normal; margin-top: 4px; }
.lineup-seat small { font: 13px/1 var(--hand); color: #5b4a3a; }
.lineup-vs { font: 22px var(--display); color: var(--terracotta); align-self: center; margin: 0 2px 26px; }
.me-row { display: flex; align-items: center; gap: 10px; margin: 0 auto 12px; max-width: 340px; }
.me-badge { line-height: 0; flex: none; }
.me-fields { flex: 1; display: flex; flex-direction: column; gap: 5px; text-align: left; min-width: 0; }
.title-screen .name-input { width: 100%; font-size: 20px; padding: 6px 12px; margin: 0; }
.me-level { display: flex; align-items: center; gap: 8px; font: 14px var(--hand); color: #5b4a3a; white-space: nowrap; }
.me-level i { flex: 1; height: 9px; border: 2px solid var(--ink); border-radius: 6px; background: linear-gradient(90deg, var(--jade) var(--p), var(--cream) var(--p)); }
.format-toggle { display: inline-flex; border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; box-shadow: 2px 3px 0 var(--ink); }
.format-toggle label { cursor: pointer; }
.format-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.format-toggle span { display: block; padding: 6px 16px; font: 17px var(--display); background: var(--cream); }
.format-toggle span small { font: 14px var(--hand); color: #5b4a3a; }
.format-toggle label + label span { border-left: 3px solid var(--ink); }
.format-toggle input:checked + span { background: var(--mustard); }
.format-toggle input:focus-visible + span { outline: 3px solid var(--cobalt); outline-offset: -5px; }
.resume-note { font: 15px var(--hand); color: #5b4a3a; margin: 10px 0 0; }
#overlayBox.title-screen .buttons { position: static; margin: 12px 0 0; padding: 0; background: none; box-shadow: none; gap: 8px 6px; }
#overlayBox.title-screen .buttons .btn.primary { flex-basis: 100%; font-size: 26px; padding: 12px; }
#overlayBox.title-screen .buttons .btn:not(.primary) { font-size: 15px; padding: 5px 11px; background: transparent; border-width: 2px; box-shadow: none; }
#overlayBox.title-screen .buttons .btn:not(.primary):hover { background: rgba(227, 185, 63, 0.35); }
@media (max-height: 520px) {
  #overlayBox.title-screen { width: min(620px, 100%); padding: 8px 16px; }
  .title-screen h1.title { font-size: 40px; }
  .title-screen .tag { margin: 0 0 6px; }
  .lineup { margin: 0 0 6px; }
  .lineup-face { width: 40px; height: 40px; }
  .lineup-seat.us .lineup-face { width: 46px; height: 46px; }
  .lineup-seat small { display: none; }
  .me-row { margin-bottom: 6px; }
  .me-badge svg { width: 40px; height: 40px; }
  .title-screen .name-input { font-size: 16px; padding: 3px 10px; }
  #overlayBox.title-screen .buttons { margin-top: 6px; }
  #overlayBox.title-screen .buttons .btn.primary { font-size: 20px; padding: 6px; }
}

/* ---------- vecinos: the table up top, everybody below ---------- */
#overlayBox.vecinos-modal { width: min(720px, 100%); padding-top: 16px; }
.vecinos h2 { margin-bottom: 0 !important; }
.vecinos .who { margin: 0 0 6px !important; }
.mesa {
  position: sticky; top: -16px; z-index: 3; margin: 0 -26px; padding: 8px 18px 16px;
  display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 10px;
  background: var(--paper); box-shadow: 0 12px 12px -8px var(--paper);
}
.mesa-table {
  position: absolute; left: 8%; right: 8%; bottom: 8px; height: 46%; z-index: -1;
  background: var(--jade); border: 3px solid var(--ink); border-radius: 50% 50% 18px 18px / 60% 60% 18px 18px;
  box-shadow: inset 0 -8px 0 rgba(29, 22, 18, 0.18), 3px 4px 0 var(--ink);
}
.mesa-table::after { content: ''; position: absolute; inset: 8px 12%; border: 2px dashed rgba(241, 228, 196, 0.45); border-radius: inherit; }
.mesa-you { position: absolute; left: 50%; bottom: 0; translate: -50% 40%; padding: 0 10px; background: var(--mustard); border: 2.5px solid var(--ink); border-radius: 8px; font: 13px/18px var(--display); }
.seat-slot {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 0; padding: 6px 4px 5px;
  background: var(--cream); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 2px 3px 0 var(--ink);
  font-family: var(--display); cursor: pointer; transition: transform 0.15s, background 0.15s;
  margin-bottom: 22px;
}
.seat-slot.across { margin-bottom: 44px; }
.seat-slot:hover { transform: translateY(-2px); }
.seat-slot.active { background: var(--mustard); transform: translateY(-4px) rotate(-1.5deg); box-shadow: 3px 5px 0 var(--ink); }
.seat-slot.active::before { content: '▼'; position: absolute; top: -17px; left: 50%; translate: -50% 0; font-size: 13px; color: var(--terracotta); animation: nudge 0.9s ease-in-out infinite; }
@keyframes nudge { 50% { translate: -50% 4px; } }
.seat-slot.empty { border-style: dashed; background: #fffaf0; }
.seat-slot.empty.active { background: #f6dc8c; }
.slot-face { display: grid; place-items: center; width: 64px; height: 64px; font: 34px var(--display); color: #b9a47a; }
.slot-face canvas { width: 64px; height: 64px; }
.seat-slot.landed .slot-face canvas { animation: land 0.35s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes land { from { transform: translateY(-14px) scale(0.8); } }
.slot-name { font-size: 17px; font-weight: normal; line-height: 1.1; }
.slot-role { font: 13px var(--hand); color: #5b4a3a; line-height: 1; }
.seat-slot.across .slot-role { color: var(--jade); }
.mesa-hint { font: 19px var(--hand); margin: 12px 0 8px; }
.mesa-hint b { font-weight: normal; color: var(--terracotta); }
.mesa-hint small { display: block; font: 12px system-ui, sans-serif; color: #5b4a3a; }

.vecino-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 2px 2px 6px; }
.vecino {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 8px 10px;
  background: var(--cream); border: 3px solid var(--ink); border-radius: 14px; box-shadow: 2px 3px 0 var(--ink);
  font-family: var(--display); cursor: pointer; transition: transform 0.12s, background 0.15s;
}
.vecino:hover { transform: translateY(-2px); }
.vecino:active { transform: translateY(1px); box-shadow: 1px 1px 0 var(--ink); }
.vecino canvas { width: 76px; height: 76px; }
.vecino b { font-size: 18px; font-weight: normal; line-height: 1.1; }
.v-tag { font: 14px/1.1 var(--hand); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.v-tag.en { font: 11px/1.2 system-ui, sans-serif; color: #5b4a3a; }
.v-tag i { font-style: normal; font-family: var(--display); font-size: 12px; background: #fffaf0; border: 2px solid var(--ink); border-radius: 6px; padding: 0 5px; }
.v-vs { margin-top: 4px; font-size: 12px; padding: 0 6px; background: #fffaf0; border: 2px solid var(--ink); border-radius: 7px; }
.v-seat:empty { display: none; }
.v-seat { position: absolute; top: -9px; right: -6px; padding: 0 8px; font: 13px/19px var(--display); background: var(--terracotta); color: var(--cream); border: 2.5px solid var(--ink); border-radius: 8px; rotate: 4deg; }
.vecino.seated { background: #efe0b8; }
.vecino.seated canvas { opacity: 0.75; }
.vecino.here { background: var(--mustard); }
.vecino.here canvas { opacity: 1; }
.vecino.seated:not(.here) .v-seat { background: var(--cobalt); }
.vecino.locked { cursor: default; background: #ece0c2; border-style: dashed; box-shadow: none; }
.vecino.locked canvas { filter: brightness(0) opacity(0.28); }
.vecino.locked b { color: #6d5c47; }
.vecino.locked:hover { transform: none; }
.vecino.nope { animation: wobble 0.3s; }

@media (max-width: 560px) {
  #overlayBox.vecinos-modal { padding-left: 14px; padding-right: 14px; }
  .vecinos h2 { font-size: 34px !important; }
  .vecinos .who { font-size: 18px !important; }
  .mesa { margin: 0 -14px; padding: 6px 10px 14px; gap: 6px; }
  .slot-face, .slot-face canvas { width: 52px; height: 52px; }
  .slot-name { font-size: 15px; }
  .seat-slot.across { margin-bottom: 34px; }
  .vecino-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .vecino { padding: 6px 4px 8px; }
  .vecino canvas { width: 58px; height: 58px; }
  .vecino b { font-size: 15px; }
  .v-tag { font-size: 12px; }
  .v-tag.en, .v-vs { display: none; }
  .mesa-hint { font-size: 17px; }
}
@media (max-height: 520px) {
  .mesa { grid-template-columns: repeat(3, minmax(0, 170px)); justify-content: center; }
  .slot-face, .slot-face canvas { width: 42px; height: 42px; }
  .seat-slot.across { margin-bottom: 26px; }
  .seat-slot { margin-bottom: 14px; }
  .vecino-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .vecino canvas { width: 50px; height: 50px; }
  .v-tag.en { display: none; }
}

/* scrollbars that belong to the game: a thin ink thumb on paper, not the browser's gray one */
#overlayBox, .panel, .changelog, #menu, .board-wrap { scrollbar-width: thin; scrollbar-color: var(--ink) transparent; }
#overlayBox::-webkit-scrollbar, .panel::-webkit-scrollbar, .changelog::-webkit-scrollbar, #menu::-webkit-scrollbar, .board-wrap::-webkit-scrollbar { width: 12px; height: 12px; }
#overlayBox::-webkit-scrollbar-track, .panel::-webkit-scrollbar-track, .changelog::-webkit-scrollbar-track, #menu::-webkit-scrollbar-track, .board-wrap::-webkit-scrollbar-track { background: transparent; margin: 14px; }
#overlayBox::-webkit-scrollbar-thumb, .panel::-webkit-scrollbar-thumb, .changelog::-webkit-scrollbar-thumb, #menu::-webkit-scrollbar-thumb, .board-wrap::-webkit-scrollbar-thumb { background: var(--ink); border: 3px solid var(--paper); border-radius: 10px; }

/* ---------- what's new ---------- */
#overlayBox.changelog-modal { width: min(480px, 100%); text-align: left; }
.changelog-modal h2, .changelog-modal > .explain { text-align: center; }
.changelog { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.cl-entry { background: var(--cream); border: 2.5px solid var(--ink); border-radius: 14px; padding: 8px 14px 6px; box-shadow: 2px 3px 0 var(--ink); }
.cl-entry h3 { margin: 0 0 4px; font: 19px var(--display); font-weight: normal; }
.cl-entry h3 small { font: 14px var(--hand); color: #5b4a3a; margin-left: 6px; }
.cl-entry ul { margin: 0; padding-left: 18px; }
.cl-entry li { font: 16px/1.25 var(--hand); margin: 3px 0; }
.cl-entry li small { display: block; font: 12px/1.2 system-ui, sans-serif; color: #5b4a3a; }
.menu-item.small { min-height: 40px; font-size: 16px; }

/* ---------- Opina (feedback) ---------- */
.fb-moods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0 10px; }
.fb-mood { display: flex; flex-direction: column; align-items: center; padding: 8px 6px; font: 17px/1.1 var(--display); background: #fffaf0; border: 3px solid var(--ink); border-radius: 12px; box-shadow: 2px 3px 0 var(--ink); cursor: pointer; transition: transform 0.12s, background 0.15s; }
.fb-mood small { font: 12px var(--hand); color: #5b4a3a; }
.fb-mood:hover { transform: translateY(-2px); }
.fb-mood.on { background: var(--mustard); transform: rotate(-1.5deg) translateY(-2px); }
.fb-label { display: block; text-align: left; font: 17px var(--display); margin: 6px 0 4px; }
.fb-label small { font: 13px var(--hand); color: #5b4a3a; }
.fb-text { width: 100%; box-sizing: border-box; font: 17px/1.35 var(--hand); color: var(--ink); background: #fffaf0; border: 3px solid var(--ink); border-radius: 12px; padding: 10px 12px; resize: vertical; min-height: 110px; }
.fb-text:focus { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.fb-note { font: 13px system-ui, sans-serif; color: #5b4a3a; margin: 8px 0 0; }
.fb-kept { text-align: left; white-space: pre-wrap; font: 15px var(--hand); background: #fffaf0; border: 2px dashed var(--ink); border-radius: 10px; padding: 8px 10px; }
@media (max-width: 420px) { .fb-mood { font-size: 15px; } }
