/* Yaniv — faithful web recreation of the classic iOS table. */
:root {
  --paper-bg: #d3c09d;
  --wood-1: #ffe4ad;
  --wood-2: #e5b56f;
  --wood-3: #c38c46;
  --wood-edge: #6b3a14;
  --ink: #2b1d10;
  --red: #cf2f22;
  --blue: #22a9d8;
  --blue-deep: #0a86b4;
  --gold: #ffd23f;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
body[data-theme="paper"] {
  --bg: #cdb995;
  --name-stroke: rgba(112, 129, 122, 0.65);
  --name-shadow: rgba(90, 70, 40, 0.3);
  --label-ink: #4a4a4a;
  --label-stroke: #f2e8d2;
  --label-shadow: rgba(255, 255, 255, 0.45);
}
body[data-theme="ocean"] {
  --bg: #2cb9e9;
  --name-stroke: rgba(9, 80, 112, 0.8);
  --name-shadow: rgba(0, 50, 80, 0.35);
  --label-ink: #fff;
  --label-stroke: #0a6d9c;
  --label-shadow: rgba(0, 40, 60, 0.35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: #fff;
  font-family: "Fredoka", "Trebuchet MS", sans-serif;
  font-size: 15px;
  line-height: 1.3;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  overscroll-behavior: none;
  transition: background 0.3s;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; }
.hidden { display: none !important; }
button:focus { outline: none; }
button:focus-visible { outline: 3px solid rgba(255, 210, 63, 0.8); outline-offset: 2px; }

#app {
  position: fixed; inset: 0; max-width: 560px; margin: 0 auto; overflow: hidden;
  background: var(--bg); box-shadow: 0 0 60px rgba(0, 0, 0, 0.3);
}
@media (min-width: 700px) {
  body { background: #6b5a3f; }
  #app { border-left: 1px solid rgba(255, 255, 255, 0.12); border-right: 1px solid rgba(255, 255, 255, 0.12); }
}
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- backgrounds */
.water {
  position: absolute; inset: 0; overflow: hidden;
  background:
    radial-gradient(120% 85% at 50% 38%, rgba(255, 255, 255, 0.16), transparent 62%),
    radial-gradient(120% 100% at 50% 50%, transparent 45%, rgba(96, 72, 42, 0.18) 100%),
    var(--paper-bg);
}
.water::before {
  content: ""; position: absolute; inset: -10%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='260' height='260' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  background-size: 260px 260px;
  opacity: 0.4;
  mix-blend-mode: multiply;
  pointer-events: none;
}
.water::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(90% 60% at 50% 34%, transparent 55%, rgba(96, 72, 42, 0.12) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 30%);
}
body[data-theme="ocean"] .water {
  background:
    radial-gradient(110% 70% at 50% -10%, rgba(255, 255, 255, 0.4), transparent 55%),
    linear-gradient(180deg, #86e3fb 0%, #39c6ec 34%, #0fb0e2 78%, #0698ca 100%);
}
body[data-theme="ocean"] .water::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='420' viewBox='0 0 420 420'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.55' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M-40 70 C 50 20, 130 120, 210 70 S 370 20, 460 70'/%3E%3Cpath d='M-40 160 C 50 110, 130 210, 210 160 S 370 110, 460 160'/%3E%3Cpath d='M-40 250 C 50 200, 130 300, 210 250 S 370 200, 460 250'/%3E%3Cpath d='M-40 340 C 50 290, 130 390, 210 340 S 370 290, 460 340'/%3E%3Cpath d='M90 -40 C 40 60, 140 120, 90 210 S 40 360, 90 460'/%3E%3Cpath d='M300 -40 C 250 60, 350 120, 300 210 S 250 360, 300 460'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 360px 360px;
  opacity: 0.72;
  mix-blend-mode: screen;
  animation: drift 26s linear infinite;
}
@keyframes drift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-420px, -140px, 0); } }

/* ---------------------------------------------------------------- wood signs */
.wood {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  background:
    repeating-linear-gradient(90deg, rgba(120, 70, 20, 0.05) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(0deg, rgba(120, 70, 20, 0.05) 0 1px, transparent 1px 26px),
    linear-gradient(180deg, var(--wood-1), var(--wood-2) 58%, var(--wood-3));
  color: var(--wood-edge);
  font-family: "Bree Serif", Georgia, serif; font-weight: 400; font-size: 15px;
  padding: 6px 14px;
  border-radius: 4px;
  clip-path: polygon(1% 14%, 9% 4%, 24% 8%, 39% 2%, 57% 7%, 74% 1%, 90% 6%, 99% 20%, 96% 42%, 100% 63%, 95% 84%, 99% 96%, 78% 92%, 58% 99%, 38% 93%, 19% 98%, 3% 90%, 0% 66%, 3% 44%);
  filter: drop-shadow(0 4px 4px rgba(60, 40, 15, 0.35));
  text-shadow: 0 1px 0 rgba(255, 240, 205, 0.9), 0 -1px 0 rgba(120, 70, 20, 0.35);
  transition: transform 0.1s;
}
.wood:active { transform: translateY(2px) rotate(-1deg); }
.wood:disabled { opacity: 0.75; }
.wood.big { width: 100%; padding: 12px; font-size: 20px; border-radius: 6px; }
.wood.small { padding: 7px 17px; font-size: 13px; }
.wood-play { font-family: Bangers, Impact, sans-serif; font-size: 30px; letter-spacing: 3px; color: #5a2c0c; }
.sign { padding: 5px 12px; }
.menu-sign { transform: rotate(-3deg); font-size: 20px; z-index: 1; }
.menu-pole { position: absolute; left: 46px; top: -16px; width: 11px; height: 100px; background: linear-gradient(90deg, #a9713c, #e3b97e 42%, #b27a44); border: 1px solid #6b3a14; border-radius: 5px; transform: rotate(4deg); box-shadow: 0 3px 4px rgba(60, 40, 15, 0.25); }
.coach-sign { transform: rotate(3deg); font-size: 12px; font-family: "Fredoka", sans-serif; font-weight: 600; padding: 4px 9px; }
.coach-sign svg { width: 12px; height: 12px; fill: #6b3a14; }

/* paper */
.paper-panel {
  background:
    repeating-linear-gradient(0deg, rgba(150, 115, 60, 0.05) 0 1px, transparent 1px 5px),
    linear-gradient(180deg, #fffdf6, #f3e6ca);
  border: 2px solid #d8c19a; border-radius: 16px; color: var(--ink);
  box-shadow: 0 12px 26px rgba(60, 40, 15, 0.28), inset 0 1px 0 #fff;
  --muted: rgba(43, 29, 16, 0.6);
  --gold: #b3700a;
}
.paper-panel .label, .paper-panel .section-label { color: rgba(43, 29, 16, 0.55); }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 1.6px; color: rgba(43, 29, 16, 0.55); margin-bottom: 5px; font-weight: 600; }
.field input, .join-row input, .chat-form input {
  width: 100%; background: #fff; border: 2px solid #d8c19a; border-radius: 10px;
  padding: 12px; outline: none; color: var(--ink); font-weight: 500;
}
.join-row { display: flex; gap: 8px; margin-top: 10px; }
.join-row input { flex: 1; text-transform: uppercase; letter-spacing: 3px; text-align: center; }
.fine { color: rgba(43, 29, 16, 0.55); font-size: 11px; text-align: center; margin: 10px 0 0; }
.plain-link { color: #fff; font-weight: 600; text-shadow: 0 2px 0 rgba(60, 40, 15, 0.45); font-size: 13px; }

/* ---------------------------------------------------------------- home */
.home { justify-content: center; }
.home-inner { position: relative; z-index: 2; padding: calc(12px + var(--safe-top)) 20px calc(12px + var(--safe-bottom)); display: flex; flex-direction: column; justify-content: center; }
.brand { text-align: center; margin-bottom: 14px; }
.brand-cards { display: flex; justify-content: center; align-items: flex-end; height: 70px; margin-bottom: 12px; }
.mini-card {
  width: 44px; height: 62px; border-radius: 6px; background: #fff; color: #232323;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-family: Georgia, serif; font-weight: 700;
  border: 1px solid #b9b9b9; box-shadow: 0 5px 10px rgba(60, 40, 15, 0.35);
}
.mini-card b { font-size: 17px; line-height: 1; }
.mini-card i { font-style: normal; font-size: 15px; line-height: 1; }
.mini-card.red { color: var(--red); transform: rotate(-15deg) translateY(6px); }
.mini-card.black { color: #232323; transform: rotate(-5deg); }
.mini-card.blue { background: linear-gradient(160deg, #55d2f4, #1199cf); color: #ffe14a; border-color: #fff; transform: rotate(5deg) translateY(-4px); z-index: 2; }
.mini-card.black:last-child { transform: rotate(15deg) translateY(6px); }
.logo {
  margin: 0; font-family: Bangers, Impact, sans-serif; font-size: 66px; line-height: 0.95;
  letter-spacing: 3px; color: #ffe14a;
  -webkit-text-stroke: 3px #5d3100;
  text-shadow: 0 5px 0 #e08a00, 0 10px 0 #a85f00, 0 18px 26px rgba(60, 40, 15, 0.5);
  transform: rotate(-4deg);
}
.tag { margin: 8px 0 0; color: #fff; font-weight: 600; letter-spacing: 2.4px; text-transform: uppercase; font-size: 10.5px; text-shadow: 0 2px 0 rgba(60, 40, 15, 0.45); }
.home-card { padding: 16px; animation: popIn 0.4s ease both; }
@keyframes popIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.row2 { display: flex; gap: 8px; margin-top: 8px; }
.row2 .wood { flex: 1; }
.home-links { display: flex; justify-content: center; gap: 26px; margin-top: 16px; }
.footnote { text-align: center; color: rgba(255, 255, 255, 0.6); font-size: 9.5px; margin: 10px 0 0; text-shadow: 0 1px 2px rgba(60, 40, 15, 0.4); }

/* ---------------------------------------------------------------- lobby */
.topbar-lobby { position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; padding: calc(10px + var(--safe-top)) 14px 8px; }
.topbar-title { font-family: Bangers, sans-serif; letter-spacing: 3px; font-size: 18px; color: #fff; text-shadow: 0 2px 0 rgba(60, 40, 15, 0.5); }
.lobby-body { position: relative; z-index: 2; flex: 1; overflow-y: auto; padding: 4px 16px calc(20px + var(--safe-bottom)); }
.room-code-card { padding: 14px; margin-bottom: 12px; }
.room-code-card .label { font-size: 9.5px; letter-spacing: 2px; text-transform: uppercase; font-weight: 600; }
.code-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.code { font-family: Bangers, sans-serif; font-size: 34px; letter-spacing: 5px; color: #0a86b4; padding: 0; }
.lobby-status { display: flex; align-items: center; gap: 8px; margin: 6px 2px 10px; color: #fff; font-size: 12.5px; font-weight: 500; text-shadow: 0 1px 0 rgba(60, 40, 15, 0.4); }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: #ffe14a; animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 210, 63, 0.55); } 70% { box-shadow: 0 0 0 9px rgba(255, 210, 63, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 210, 63, 0); } }
.seats-lobby { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.lobby-seat {
  background: linear-gradient(180deg, #fffdf6, #f3e6ca); border: 2px solid #d8c19a; border-radius: 14px;
  padding: 10px; min-height: 78px; color: var(--ink); display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: 0 6px 12px rgba(60, 40, 15, 0.22);
}
.lobby-seat.empty { background: rgba(255, 255, 255, 0.16); border: 2px dashed rgba(255, 255, 255, 0.5); color: #fff; align-items: center; justify-content: center; font-size: 12px; box-shadow: none; }
.lobby-seat .ls-top { display: flex; align-items: center; gap: 8px; }
.lobby-seat .ls-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-seat .ls-rating { color: rgba(43, 29, 16, 0.55); font-size: 10.5px; }
.avatar { display: grid; place-items: center; border-radius: 50%; font-weight: 600; color: #fff; flex: 0 0 auto; border: 2px solid rgba(255, 255, 255, 0.6); box-shadow: 0 3px 6px rgba(60, 40, 15, 0.3); }
.lobby-actions { display: flex; gap: 8px; margin: 12px 0 4px; }
.lobby-actions .wood { flex: 1; }
.lobby-chat { padding: 12px; margin-top: 14px; }
.section-label { font-size: 9.5px; letter-spacing: 1.8px; text-transform: uppercase; margin-bottom: 6px; font-weight: 600; }
.chat-list { max-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; margin-bottom: 7px; }
.chat-line { font-size: 12.5px; color: var(--ink); }
.chat-line b { color: #0a7fb3; }
.chat-line.system { color: rgba(43, 29, 16, 0.5); font-style: italic; font-size: 11.5px; }
.chat-form { display: flex; gap: 6px; }
.chat-form input { padding: 9px 10px; font-size: 13px; }

/* ---------------------------------------------------------------- table */
.table { overflow: hidden; }
.table-inner { position: absolute; inset: 0; z-index: 3; }
.table-arc { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 310px; z-index: 2; pointer-events: none; display: none; }
body[data-theme="paper"] .table-arc { display: block; }
.table-top { position: absolute; top: calc(6px + var(--safe-top)); left: 8px; right: 8px; display: flex; align-items: flex-start; justify-content: space-between; z-index: 9; }

/* opponents */
.seats { position: absolute; top: calc(40px + var(--safe-top)); left: 0; right: 0; height: 48%; pointer-events: none; }
.opp { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.opp-top { top: -46px; left: 50%; transform: translateX(-50%); }
.opp-left { left: -6px; top: 36%; align-items: flex-start; }
.opp-right { right: -6px; top: 36%; align-items: flex-end; }
.opp .back-fan { position: relative; height: 66px; width: 96px; }
.opp-left .back-fan, .opp-right .back-fan { height: 78px; width: 70px; }
.opp .back-mini {
  position: absolute; left: 50%; top: 50%; width: 40px; height: 56px; margin: -28px 0 0 -20px;
  border-radius: 6px; background: #2cb9e9;
  border: 3px solid #fff; outline: 1.5px solid #2b2b2b;
  box-shadow: 0 3px 6px rgba(60, 40, 15, 0.35);
  transform: rotate(var(--rot, 0deg)) translate(var(--x, 0px), calc(var(--y, 0px) - 10px));
  overflow: hidden;
}
.opp .back-mini::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-conic-gradient(from 0deg at 50% 50%, #5ed3f7 0 10deg, #1fa7dd 10deg 20deg);
}
.opp .back-mini::after {
  content: "YANIV"; position: absolute; inset: 0; display: grid; place-items: center;
  font-family: Bangers, sans-serif; font-size: 10px; color: #ffe14a;
  -webkit-text-stroke: 0.8px #6b3f00; transform: rotate(-18deg);
}
.opp .name {
  font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 21px; line-height: 1.1;
  color: #fff; -webkit-text-stroke: 1.6px var(--name-stroke); paint-order: stroke fill;
  text-shadow: 0 2px 0 var(--name-shadow);
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 4px;
}
.opp-left .name { margin-left: 10px; }
.opp-right .name { margin-right: 10px; }
.opp .token {
  position: relative; width: 40px; height: 40px; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #3fc3ee, #1ba6d8 62%, #1594c4);
  border: 3px solid #0a86b4; color: #fff;
  font-family: "Fredoka", sans-serif; font-weight: 600; font-style: italic; font-size: 19px;
  display: grid; place-items: center;
  box-shadow: 0 3px 5px rgba(60, 40, 15, 0.3);
}
.opp .token::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; border: 1.5px solid rgba(0, 0, 0, 0.1); }
.opp.active .token { box-shadow: 0 3px 5px rgba(60, 40, 15, 0.3), 0 0 0 3px rgba(255, 220, 70, 0.9), 0 0 18px rgba(255, 220, 70, 0.7); }
.opp.eliminated { opacity: 0.45; filter: grayscale(0.6); }
.opp .delta { position: absolute; right: -18px; top: 50%; transform: translateY(-50%); background: #333; color: #fff; font-size: 11px; font-weight: 600; border-radius: 9px; padding: 1px 6px; }

/* centre */
.table-center { position: absolute; top: 25%; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; z-index: 4; }
.deck-swirl { position: relative; width: 168px; height: 168px; }
.deck-swirl .swirl {
  position: absolute; left: 50%; top: 50%; width: 56px; height: 80px; margin: -40px 0 0 -28px;
  background: #fff; border: 3px solid #3a3a3a; border-radius: 8px;
  transform: rotate(var(--a)) translateY(-30px);
}
.deck-swirl .yaniv-back {
  position: absolute; left: 50%; top: 50%; width: 90px; height: 126px; margin: -63px 0 0 -45px;
  transform: rotate(-15deg);
  background: #2cb9e9; border: 6px solid #fff; outline: 3px solid #2b2b2b; border-radius: 9px;
  overflow: hidden; display: grid; place-items: center; z-index: 3;
  box-shadow: 0 8px 12px rgba(60, 40, 15, 0.4);
}
.deck-swirl .yaniv-back::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-conic-gradient(from 0deg at 50% 50%, #6fd8f6 0 8deg, #27aee2 8deg 16deg);
  opacity: 0.85;
}
.deck-swirl .yaniv-back em {
  position: relative; z-index: 2; font-style: normal; font-family: Bangers, sans-serif;
  font-size: 30px; letter-spacing: 0.5px; color: #ffe14a;
  -webkit-text-stroke: 1.6px #6b3f00; transform: rotate(-18deg);
  text-shadow: 0 2px 0 #b37400;
}
.deck-swirl .deck-count {
  position: absolute; right: 4px; bottom: 22px; z-index: 5;
  background: #0a86b4; border: 2px solid #fff; border-radius: 10px;
  font-size: 10px; font-weight: 600; padding: 1px 7px; color: #fff;
}
.deck-swirl.drawable .yaniv-back { animation: deckGlow 1.3s infinite; }
@keyframes deckGlow {
  0%, 100% { box-shadow: 0 8px 12px rgba(60, 40, 15, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(255, 220, 70, 0.85), 0 0 26px rgba(255, 220, 70, 0.9); }
}
.deck-swirl:active { transform: scale(0.97); }

.pile { position: relative; width: 200px; height: 96px; margin-top: -44px; z-index: 6; transform: translateX(-6px); }
.pile .card { position: absolute; width: 60px; height: 84px; top: 4px; }
.pile .empty-label { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); font-size: 10px; color: rgba(80, 60, 35, 0.5); }
.take-row { position: relative; display: flex; justify-content: center; gap: 12px; z-index: 8; margin-top: 6px; }
.take-row:empty { display: none; }
.take-card { position: relative; animation: takeGlow 1.4s infinite; border-radius: 8px; cursor: pointer; }
.take-card .card { width: 52px; height: 74px; }
.take-tag {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  font-size: 8px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase;
  color: #4a2a0e; background: #ffd23f; border-radius: 6px; padding: 0 5px; z-index: 9;
}
@keyframes takeGlow {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(255, 210, 63, 0)); }
  50% { filter: drop-shadow(0 0 8px rgba(255, 210, 63, 0.95)); }
}

/* cards — visuals live in css/cards.css; only base box sizing here */
.card {
  position: relative; flex: 0 0 auto; width: 64px; height: 92px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center; padding: 0;
}

/* bottom hand */
.bottom { position: absolute; bottom: 0; left: 0; right: 0; z-index: 9; padding: 0 12px calc(3px + var(--safe-bottom)); }
.hand-wrap { position: relative; }
.hand { display: flex; justify-content: center; align-items: flex-end; gap: 7px; height: 104px; padding-bottom: 2px; }
.hand .card.dealt { animation: dealIn 0.32s ease both; }
@keyframes dealIn { from { opacity: 0; transform: translate(70px, -50px) rotate(10deg) scale(0.7); } }
.hand-count {
  text-align: center; font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 17px;
  letter-spacing: 0.6px; color: var(--label-ink);
  -webkit-text-stroke: 1.2px var(--label-stroke); paint-order: stroke fill;
  text-shadow: 0 1px 0 var(--label-shadow);
}
body[data-theme="paper"] .hand-count { color: #4a4a4a; }
.me-line {
  text-align: center; font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 21px; line-height: 1.2;
  color: #fff; -webkit-text-stroke: 2px var(--name-stroke); paint-order: stroke fill;
  text-shadow: 0 2px 0 var(--name-shadow);
  margin: 1px 0 6px;
}
.bottom-row { display: flex; align-items: center; justify-content: space-between; height: 56px; position: relative; padding-right: 2px; }

/* scores note */
.scores-note { position: relative; width: 88px; height: 62px; margin-left: 4px; transform: rotate(-9deg); filter: drop-shadow(0 4px 4px rgba(60, 40, 15, 0.35)); }
.scores-note .note-paper {
  position: absolute; inset: 0;
  background: #fdfcf4 repeating-linear-gradient(0deg, transparent 0 10px, #cfe0e8 10px 11px);
  clip-path: polygon(3% 2%, 97% 0, 100% 88%, 93% 100%, 60% 96%, 26% 100%, 0 92%, 1% 10%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}
.scores-note .note-paper::before { content: ""; position: absolute; left: 12px; top: 0; bottom: 0; width: 1px; background: #e6a7a7; }
.scores-note .note-text {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: Caveat, cursive; font-size: 25px; color: #5a5a5a; transform: rotate(-3deg);
}
.scores-note .pencil {
  position: absolute; top: -11px; right: -2px; width: 52px; height: 7px; border-radius: 1px;
  background: linear-gradient(180deg, #f6c94b, #e2a91d 60%, #c98f10);
  transform: rotate(-9deg); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
}
.scores-note .pencil::before { content: ""; position: absolute; left: -9px; top: 0; border-top: 3.5px solid transparent; border-bottom: 3.5px solid transparent; border-right: 9px solid #eed3ac; }
.scores-note .pencil::after { content: ""; position: absolute; left: -3px; top: 2.5px; width: 3px; height: 2px; background: #333; }
.scores-note:active { transform: rotate(-9deg) scale(0.96); }

/* YANIV logo button */
.yaniv-logo { display: flex; align-items: center; gap: 1px; transform: rotate(-8deg); margin-right: 20px; filter: drop-shadow(0 3px 2px rgba(60, 40, 15, 0.4)); padding: 2px 0; }
.yaniv-logo .megaphone { width: 38px; height: 30px; margin-right: -3px; }
.yaniv-logo .txt {
  font-family: Bangers, Impact, sans-serif; font-size: 25px; letter-spacing: 0.5px; line-height: 1;
  background: linear-gradient(180deg, #fafafa, #c6c6c6 55%, #8f8f8f);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 1.7px #3f3f3f;
  text-shadow: 0 3px 0 rgba(90, 90, 90, 0.5);
}
.yaniv-logo.live { animation: yanivGlow 1.4s infinite; }
@keyframes yanivGlow {
  0%, 100% { filter: drop-shadow(0 3px 2px rgba(60, 40, 15, 0.4)); }
  50% { filter: drop-shadow(0 0 10px rgba(255, 220, 70, 0.95)) drop-shadow(0 3px 2px rgba(60, 40, 15, 0.4)); }
}
.yaniv-logo:active { transform: rotate(-8deg) translateY(2px); }

.discard-tag {
  position: absolute; left: 50%; transform: translateX(-50%) rotate(-2deg);
  background: linear-gradient(180deg, #ffe4ad, #e5b56f 58%, #c38c46);
  color: #5a2c0c; font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 15px;
  padding: 7px 20px; border-radius: 5px;
  clip-path: polygon(2% 14%, 12% 3%, 30% 8%, 52% 1%, 74% 6%, 92% 2%, 99% 24%, 96% 52%, 100% 78%, 91% 98%, 66% 94%, 40% 100%, 14% 95%, 1% 88%, 3% 58%, 0% 34%);
  filter: drop-shadow(0 3px 3px rgba(60, 40, 15, 0.35));
}

.turn-banner {
  position: absolute; left: 50%; bottom: 214px; transform: translateX(-50%); z-index: 12;
  white-space: nowrap; text-align: center; font-weight: 700; font-size: 10.5px;
  letter-spacing: 0.8px; text-transform: uppercase;
  color: #4a2a0e; background: linear-gradient(180deg, #ffe680, #ffcf3f);
  border: 2px solid #b3700a; border-radius: 20px; padding: 6px 14px;
  box-shadow: 0 5px 14px rgba(60, 40, 15, 0.35);
  animation: turnPulse 1.3s infinite;
}
.turn-banner.mine { color: #4a2a0e; }
@keyframes turnPulse {
  0%, 100% { box-shadow: 0 5px 14px rgba(60, 40, 15, 0.35); }
  50% { box-shadow: 0 0 0 5px rgba(255, 209, 63, 0.3), 0 5px 20px rgba(255, 170, 0, 0.55); }
}

/* YANIV! call */
.call-fx {
  position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; pointer-events: none;
  font-family: Bangers, Impact, sans-serif; font-size: 96px; letter-spacing: 2px;
  color: #ffe14a; -webkit-text-stroke: 4px #5d3100;
  text-shadow: 0 7px 0 #e08a00, 0 14px 0 #a85f00, 0 22px 34px rgba(60, 40, 15, 0.55);
  transform: rotate(-7deg);
  animation: callIn 0.55s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
@keyframes callIn { from { opacity: 0; transform: rotate(-7deg) scale(0.5); } to { opacity: 1; transform: rotate(-7deg) scale(1); } }

/* ---------------------------------------------------------------- sheets */
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 60;
  background:
    repeating-linear-gradient(0deg, rgba(150, 115, 60, 0.05) 0 1px, transparent 1px 5px),
    linear-gradient(180deg, #fffdf6, #f3e6ca);
  border-top: 3px solid #d8c19a; border-radius: 20px 20px 0 0;
  padding: 8px 16px calc(14px + var(--safe-bottom));
  box-shadow: 0 -16px 40px rgba(60, 40, 15, 0.45);
  animation: sheetUp 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-height: 72%; display: flex; flex-direction: column; color: var(--ink);
  --muted: rgba(43, 29, 16, 0.6); --gold: #b3700a;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet-grip { width: 44px; height: 4px; border-radius: 2px; background: rgba(120, 90, 50, 0.25); margin: 2px auto 8px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-title { font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.spark { color: #d99a00; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; border: 2px solid rgba(120, 90, 50, 0.25); background: rgba(255, 255, 255, 0.6); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.coach-sheet { max-height: 68%; }
.coach-top { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.coach-verdict { flex: 1; background: rgba(34, 169, 216, 0.09); border: 2px solid rgba(34, 169, 216, 0.35); border-radius: 12px; padding: 10px 12px; }
.coach-verdict .kicker { font-size: 9px; letter-spacing: 1.8px; text-transform: uppercase; color: #0a7fb3; font-weight: 600; margin-bottom: 2px; }
.coach-verdict .msg { font-size: 14px; line-height: 1.35; font-weight: 500; color: var(--ink); }
.coach-metrics { display: flex; gap: 7px; margin: 10px 0; }
.metric { flex: 1; background: rgba(255, 255, 255, 0.7); border: 2px solid rgba(120, 90, 50, 0.15); border-radius: 10px; padding: 7px 9px; }
.metric .mv { font-size: 17px; font-weight: 600; }
.metric .ml { font-size: 8.5px; letter-spacing: 1.2px; text-transform: uppercase; color: rgba(43, 29, 16, 0.55); font-weight: 500; }
.coach-actions { display: flex; gap: 7px; margin: 10px 0 2px; }
.coach-actions .btn { flex: 1; }
.coach-note { font-size: 10.5px; color: rgba(43, 29, 16, 0.5); margin-top: 8px; line-height: 1.45; }
.alt-row { display: flex; align-items: center; gap: 7px; padding: 6px 0; border-top: 1px solid rgba(120, 90, 50, 0.12); font-size: 11.5px; color: rgba(43, 29, 16, 0.75); }
.alt-row .mini-hand { display: flex; gap: 2px; }
.alt-row .ev { margin-left: auto; color: rgba(43, 29, 16, 0.6); font-size: 10.5px; }
.coach-loading { display: flex; align-items: center; gap: 8px; color: rgba(43, 29, 16, 0.6); font-size: 13px; padding: 12px 0; }
.spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(34, 169, 216, 0.25); border-top-color: #0a7fb3; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.chat-body { min-height: 160px; }
.chat-sheet .chat-form { margin-top: 8px; }

/* buttons inside paper sheets/modals */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 10px; padding: 10px 16px; font-weight: 600; font-size: 13px;
  border: 2px solid #b98a4a; color: #4a2a0e;
  background: linear-gradient(180deg, #ffe4ad, #e5b56f 58%, #c38c46);
  box-shadow: 0 3px 0 #9a6a30, 0 5px 10px rgba(60, 40, 15, 0.25);
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #9a6a30; }
.btn.ghost { background: #fff; color: var(--ink); border-color: #d8c19a; box-shadow: 0 3px 0 #d8c19a; }
.btn.primary { background: linear-gradient(180deg, #ffe4ad, #e5b56f 58%, #c38c46); }
.btn.small { padding: 7px 10px; font-size: 12px; }
.btn.big { width: 100%; padding: 12px; font-size: 16px; }
.btn .spinner { border-color: rgba(0, 0, 0, 0.2); border-top-color: #4a2a0e; }

/* ---------------------------------------------------------------- modals */
.modal-root { position: absolute; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(40, 28, 14, 0.55); backdrop-filter: blur(4px); }
.modal-card {
  position: relative; width: 100%; max-width: 420px; max-height: 92%; overflow-y: auto;
  background: linear-gradient(180deg, #fffdf6, #f3e6ca);
  border: 3px solid #d8c19a; border-radius: 20px; padding: 20px; color: var(--ink);
  box-shadow: 0 24px 50px rgba(60, 40, 15, 0.5);
  animation: modalIn 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  --muted: rgba(43, 29, 16, 0.6); --gold: #b3700a;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
.modal-card h2 { margin: 0 0 2px; font-family: Bangers, Impact, sans-serif; font-size: 30px; letter-spacing: 1px; color: #2b1d10; }
.modal-card .sub { color: rgba(43, 29, 16, 0.6); font-size: 12px; margin-bottom: 12px; }
.modal-card .btn { width: 100%; margin-top: 9px; }
.modal-card .btn + .btn { margin-top: 7px; }
.result-banner { text-align: center; border-radius: 14px; padding: 12px; margin-bottom: 12px; background: rgba(255, 210, 63, 0.22); border: 2px solid rgba(224, 138, 0, 0.4); }
.result-banner.bad { background: rgba(204, 58, 40, 0.12); border-color: rgba(204, 58, 40, 0.4); }
.result-banner .big { font-family: Bangers, sans-serif; font-size: 30px; letter-spacing: 2px; color: #b3700a; }
.result-banner.bad .big { color: #b3261c; }
.result-banner .small { font-size: 11.5px; color: rgba(43, 29, 16, 0.65); margin-top: 2px; }
.score-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.score-table th { text-align: left; font-size: 9px; letter-spacing: 1.2px; text-transform: uppercase; color: rgba(43, 29, 16, 0.55); padding: 5px 3px; }
.score-table td { padding: 6px 3px; border-top: 1px solid rgba(120, 90, 50, 0.14); }
.score-table tr.caller td { background: rgba(255, 210, 63, 0.18); }
.score-table .pts { color: #b3261c; font-weight: 600; white-space: nowrap; }
.reveal-hand { display: flex; gap: 2px; margin: 2px 0; }
.tiny-card { width: 19px; height: 26px; border-radius: 3px; background: #fff; color: #232323; font-family: Georgia, serif; font-size: 9px; display: grid; place-items: center; font-weight: 700; border: 1px solid #aaa; }
.tiny-card.red { color: var(--red); }
.standings { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.standing { display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.65); border: 2px solid #e2d3b2; border-radius: 10px; padding: 7px 9px; }
.standing .place { width: 16px; color: rgba(43, 29, 16, 0.5); font-weight: 600; font-size: 11px; }
.standing .who { flex: 1; font-weight: 600; font-size: 12.5px; }
.standing .sc { color: #0a86b4; font-weight: 600; font-size: 12.5px; }
.tutorial-step { display: flex; flex-direction: column; gap: 10px; }
.tutorial-visual { background: rgba(34, 169, 216, 0.1); border-radius: 12px; padding: 14px; display: flex; justify-content: center; gap: 5px; min-height: 100px; align-items: center; }
.tutorial-text h3 { margin: 0 0 4px; font-size: 16px; }
.tutorial-text p { margin: 0; color: rgba(43, 29, 16, 0.7); font-size: 13px; line-height: 1.5; }
.steps-dots { display: flex; gap: 5px; justify-content: center; margin: 14px 0 2px; }
.steps-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(43, 29, 16, 0.2); }
.steps-dots i.on { background: #d99a00; width: 16px; border-radius: 3px; }
.lb-list { display: flex; flex-direction: column; gap: 2px; }
.lb-row { display: flex; align-items: center; gap: 8px; padding: 7px 2px; border-top: 1px solid rgba(120, 90, 50, 0.14); font-size: 12.5px; }
.lb-row .r { width: 16px; color: rgba(43, 29, 16, 0.5); font-size: 10px; }
.lb-row .n { flex: 1; }
.lb-row .v { color: #0a86b4; font-weight: 600; }
.menu-list { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 10px; text-align: left; width: 100%; color: var(--ink); font-weight: 500; font-size: 13.5px; }
.menu-item:hover { background: rgba(34, 169, 216, 0.1); }
.menu-item svg { width: 17px; height: 17px; fill: none; stroke: #0a7fb3; stroke-width: 2; }
.menu-item .badge { margin-left: auto; background: #cf2f22; color: #fff; font-size: 9px; border-radius: 8px; padding: 1px 5px; }

/* misc */
.toast {
  position: absolute; left: 50%; bottom: calc(120px + var(--safe-bottom)); transform: translate(-50%, 16px);
  background: #fffdf6; border: 2px solid #d8c19a; color: var(--ink); font-weight: 500;
  border-radius: 10px; padding: 8px 13px; font-size: 12px; z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; max-width: 86%; text-align: center;
  box-shadow: 0 8px 18px rgba(60, 40, 15, 0.35);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.conn { position: absolute; top: calc(54px + var(--safe-top)); left: 50%; transform: translateX(-50%); background: #b3700a; color: #fff; font-size: 10.5px; font-weight: 600; padding: 4px 11px; border-radius: 20px; z-index: 90; }
.badge { display: inline-block; }

@media (max-height: 720px) {
  .logo { font-size: 54px; }
  .hand { height: 96px; gap: 6px; }
  .card { width: 56px; height: 82px; }
  .hand-count { font-size: 15px; }
  .me-line { font-size: 19px; }
  .turn-banner { bottom: 178px; }
  .table-center { top: 25%; }
  .deck-swirl { transform: scale(0.92); }
  .bottom-row { height: 52px; }
}
@media (max-height: 640px) {
  .brand-cards { height: 50px; }
  .mini-card { width: 34px; height: 48px; }
  .mini-card b { font-size: 13px; }
  .logo { font-size: 44px; }
  .home-card { padding: 12px; }
  .footnote { display: none; }
  .hand { height: 84px; gap: 5px; }
  .card { width: 48px; height: 70px; }
  .turn-banner { bottom: 156px; }
  .table-center { top: 23%; }
  .opp .name { font-size: 17px; }
}

/* hidden coach gesture */
#gestureCanvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 35; pointer-events: none; }
.table { touch-action: none; }
.coach-sign.revealed { animation: coachPop 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes coachPop {
  from { opacity: 0; transform: rotate(22deg) scale(0.35); }
  to { opacity: 1; transform: rotate(3deg) scale(1); }
}

/* friends + invites */
.invite-bar {
  position: absolute; top: calc(8px + var(--safe-top)); left: 10px; right: 10px; z-index: 70;
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: #fff9ea; border: 2px solid #d8c19a; border-radius: 12px;
  color: var(--ink); font-size: 12.5px; font-weight: 500;
  box-shadow: 0 10px 22px rgba(60, 40, 15, 0.3);
  animation: popIn 0.25s ease both;
}
.invite-bar #inviteText { flex: 1; }
.invite-x { width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,0.06); color: #8a5a2b; font-size: 12px; }
.friend-add { display: flex; gap: 6px; margin: 10px 0 4px; }
.friend-add input { flex: 1; border: 2px solid #d8c19a; border-radius: 9px; padding: 9px 10px; background: #fff; color: var(--ink); text-transform: uppercase; letter-spacing: 1.5px; outline: none; }
.friend-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid rgba(120,90,50,0.12); font-size: 13px; }
.friend-row.ghost { opacity: 0.55; }
.friend-avatar { width: 26px; height: 26px; border-radius: 50%; background: #1aa3d8; color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 600; }
.friend-name { flex: 1; }
.friend-x { width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,0.05); color: #8a5a2b; font-size: 12px; }
.friends-cta { width: 100%; margin-top: 8px; font-size: 14px; }
