:root {
  --room: radial-gradient(ellipse at 50% 35%, #2a2622 0%, #121110 60%, #070707 100%);
  --felt: #1c5c38;
  --rim1: #7a4a24;
  --rim2: #3b220f;
  --accent: #e8c46a;
  --text: #ecebe8;
  --muted: rgba(236, 235, 232, 0.58);
  --panel: rgba(22, 22, 24, 0.78);
  --line: rgba(255, 255, 255, 0.09);
  --danger: #c9302c;
  --cw: 92px;
  --pw: 104px;
  --ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Archivo', 'Arial Black', sans-serif;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--ui);
  color: var(--text);
  background: #0a0a0a;
  background-image: var(--room);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
h2, h3 { margin: 0 0 12px; font-weight: 700; letter-spacing: -0.01em; }
button, input, select { font: inherit; }

.logo { display: block; width: min(320px, 76vw); margin: 8px auto 26px; filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.6)); }
.logo.small { width: 120px; margin: 0; }
.logo.tiny { width: 78px; margin: 0; }

#fx { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
#fx span { position: absolute; top: -30px; animation: fall linear infinite; }
@keyframes fall {
  0% { transform: translate(0, -5vh) rotate(0); }
  50% { transform: translate(3vw, 50vh) rotate(180deg); }
  100% { transform: translate(-2vw, 105vh) rotate(360deg); }
}

.screen { position: relative; z-index: 1; min-height: 100vh; padding: 16px; }

/* ---------- controls ---------- */
.btn {
  border: 1px solid #050505;
  background: linear-gradient(180deg, #3b3b3d, #232325);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 2px 5px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s, filter 0.15s, opacity 0.2s;
}
.btn:hover:not(:disabled) { filter: brightness(1.15); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #ecd08a, #b98f3e); border-color: #6b4e17; color: #2a1d05; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35); }
.btn.danger { background: linear-gradient(180deg, #d4413c, #8e1d1a); border-color: #4a0b09; color: #fff; }
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--line); }
.btn.big { width: 100%; padding: 13px; font-size: 1.02rem; margin-top: 6px; }
.btn.small { padding: 5px 11px; font-size: 0.84rem; border-radius: 7px; }
.btn.uno {
  background: linear-gradient(180deg, #e3392d, #a01b13);
  border-color: #4d0905;
  color: #fff;
  font-family: var(--display);
  font-style: italic;
  font-weight: 900;
  letter-spacing: 0.04em;
  padding-left: 22px;
  padding-right: 22px;
}
.btn.uno:disabled { background: linear-gradient(180deg, #3b3b3d, #232325); border-color: #050505; }
.pulse { animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent), 0 2px 5px rgba(0, 0, 0, 0.5); } 50% { box-shadow: 0 0 0 7px transparent, 0 2px 5px rgba(0, 0, 0, 0.5); } }

input, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}
input:focus, select:focus { outline: 1px solid var(--accent); outline-offset: 1px; }
select option { background: #1d1d1f; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.field.inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field.inline > span { margin: 0; }
.field.inline input { width: 90px; }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); box-shadow: none; }
.row { display: flex; gap: 8px; align-items: center; }
.row.center { justify-content: center; flex-wrap: wrap; margin: 12px 0; }
.code-input { text-transform: uppercase; letter-spacing: 5px; font-weight: 700; text-align: center; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.tag { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; background: rgba(255, 255, 255, 0.1); color: var(--muted); white-space: nowrap; }
.tag.gold { background: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--accent); }
.warn { color: #e6c27a; font-size: 0.84rem; margin: 10px 0 0; }
.avatar {
  --av: 30;
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.85rem; color: #fff;
  background: radial-gradient(circle at 35% 30%, hsl(var(--av) 35% 55%), hsl(var(--av) 40% 28%));
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25), 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* ---------- home ---------- */
.home-wrap { max-width: 860px; margin: 0 auto; padding-top: 4vh; }
.back-link { display: inline-block; margin-bottom: 6px; color: rgba(255,255,255,0.7); font-size: 0.9rem; text-decoration: none; }
.back-link:hover { color: #fff; }
.home-wrap > .field { max-width: 420px; margin: 0 auto 18px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; }
.invite { max-width: 420px; margin: 0 auto 18px; text-align: center; border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.or { text-align: center; margin: 16px 0 10px; color: var(--muted); font-size: 0.82rem; }

/* ---------- lobby ---------- */
.lobby-wrap { max-width: 1000px; margin: 0 auto; display: grid; gap: 16px; }
.lobby-head { display: flex; align-items: center; gap: 16px; }
.room-code { flex: 1; font-size: 1.1rem; color: var(--muted); }
.room-code b { letter-spacing: 5px; font-size: 1.5rem; color: var(--accent); font-weight: 700; }
.lobby-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(300px, 1.4fr); gap: 16px; align-items: start; }
.members { list-style: none; padding: 0; margin: 0 0 12px; }
.members li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); margin-bottom: 6px; }
.members li.offline { opacity: 0.5; }
.mname { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#btn-add-bot { width: 100%; margin-bottom: 6px; }
body:not(.is-host) .host-only { display: none !important; }
body.is-host .guest-only { display: none !important; }
details { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
summary { cursor: pointer; font-weight: 600; margin-bottom: 10px; }
.theme-preview { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; padding: 12px; border-radius: 10px; background: var(--noise), radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--felt) 88%, #fff), var(--felt) 60%, color-mix(in srgb, var(--felt) 60%, #000)); box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6); }
.custom-list { list-style: none; padding: 0; margin: 0 0 10px; }
.custom-list li { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; background: rgba(255, 255, 255, 0.04); border-radius: 8px; margin-bottom: 4px; }
.custom-add { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.custom-add select { flex: 1 1 200px; }
.mini-field { display: flex; align-items: center; gap: 4px; font-weight: 600; }
.mini-field input { width: 64px; }

/* ================= CARDS ================= */
.card {
  width: var(--cw);
  height: calc(var(--cw) * 1.5);
  border-radius: calc(var(--cw) * 0.085);
  position: relative;
  flex: none;
  user-select: none;
  background: linear-gradient(155deg, #ffffff 0%, #f5f3ee 55%, #e3e0d8 100%);
  box-shadow:
    inset 0 0 0 0.5px rgba(0, 0, 0, 0.18),
    0 1px 1px rgba(0, 0, 0, 0.35),
    0 3px 6px rgba(0, 0, 0, 0.22),
    0 12px 20px -8px rgba(0, 0, 0, 0.55);
  transform: translate(var(--dx, 0), var(--dy, 0)) rotate(var(--rot, 0deg));
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.2s;
}
/* glossy lamination */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(118deg, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0.1) 22%, rgba(255, 255, 255, 0) 40%, rgba(0, 0, 0, 0) 72%, rgba(0, 0, 0, 0.1) 100%);
}
.card .face {
  position: absolute;
  inset: calc(var(--cw) * 0.068);
  border-radius: calc(var(--cw) * 0.055);
  overflow: hidden;
  background: radial-gradient(135% 100% at 30% 18%, color-mix(in srgb, var(--cc) 80%, #fff) 0%, var(--cc) 40%, color-mix(in srgb, var(--cc) 72%, #000) 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28), inset 0 0 calc(var(--cw) * 0.1) rgba(0, 0, 0, 0.28);
}
/* printed-ink grain */
.card .face::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--noise);
  background-size: 120px;
  opacity: 0.16;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 3;
}
.card.wild .face { background: radial-gradient(135% 100% at 30% 18%, #3b3b3b 0%, #171717 48%, #040404 100%); }
.card .oval {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 74%;
  height: 84%;
  transform: translate(-50%, -50%) rotate(28deg);
  border-radius: 50%;
  background: radial-gradient(ellipse at 42% 35%, #ffffff 0%, #f6f4ef 60%, #dedbd3 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), inset 0 -2px 6px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.card .art { position: absolute; inset: 0; display: grid; place-items: center; z-index: 1; }
.card .art > * { grid-area: 1 / 1; }
.card .art svg { width: 76%; height: auto; overflow: visible; filter: drop-shadow(calc(var(--cw) * 0.012) calc(var(--cw) * 0.02) 0 rgba(0, 0, 0, 0.28)); }
.card.wild .art svg { width: 84%; }
.card .num {
  font-family: var(--display);
  font-style: italic;
  font-weight: 900;
  font-size: calc(var(--cw) * 0.64);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--nc);
  -webkit-text-stroke: calc(var(--cw) * 0.024) #141414;
  paint-order: stroke fill;
  text-shadow: calc(var(--cw) * 0.028) calc(var(--cw) * 0.034) 0 #141414;
  padding-right: 0.06em;
  position: relative;
  z-index: 1;
}
.card .num.ul { text-decoration: underline; text-decoration-thickness: calc(var(--cw) * 0.04); text-underline-offset: calc(var(--cw) * 0.05); text-decoration-color: #141414; }
.card .num.draw { font-size: calc(var(--cw) * 0.42); }
.card .num.over { color: #fff; font-size: calc(var(--cw) * 0.36); }
.card .num.badge { color: #fff; font-size: calc(var(--cw) * 0.24); align-self: end; margin-bottom: 24%; }
.card .idx { position: absolute; width: calc(var(--cw) * 0.22); height: calc(var(--cw) * 0.24); display: grid; place-items: center; z-index: 2; }
.card .idx.tl { top: 3%; left: 5%; }
.card .idx.br { bottom: 3%; right: 5%; transform: rotate(180deg); }
.card .idx svg { width: 100%; height: 100%; overflow: visible; }
.card .idx-t {
  font-family: var(--display);
  font-style: italic;
  font-weight: 900;
  font-size: calc(var(--cw) * 0.19);
  color: #fff;
  -webkit-text-stroke: calc(var(--cw) * 0.014) #141414;
  paint-order: stroke fill;
  text-shadow: calc(var(--cw) * 0.01) calc(var(--cw) * 0.014) 0 #141414;
  white-space: nowrap;
  line-height: 1;
}

/* card back */
.card.back .face { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5), inset 0 0 calc(var(--cw) * 0.12) rgba(0, 0, 0, 0.5); }
.back-oval {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 74%;
  height: 84%;
  transform: translate(-50%, -50%) rotate(28deg);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 40% 32%, color-mix(in srgb, var(--oc) 70%, #fff) 0%, var(--oc) 50%, color-mix(in srgb, var(--oc) 65%, #000) 100%);
  box-shadow: inset 0 -3px 8px rgba(0, 0, 0, 0.3), 0 0 0 calc(var(--cw) * 0.012) rgba(0, 0, 0, 0.35);
}
.back-oval span {
  transform: rotate(-50deg);
  font-family: var(--display);
  font-style: italic;
  font-weight: 900;
  font-size: calc(var(--cw) * 0.3);
  line-height: 1;
  -webkit-text-stroke: calc(var(--cw) * 0.012) #141414;
  paint-order: stroke fill;
  text-shadow: calc(var(--cw) * 0.02) calc(var(--cw) * 0.025) 0 #141414;
  white-space: nowrap;
}

.back-oval span.long { font-size: calc(var(--cw) * 0.17); }

.card.small { --cw: 56px; }
.card.mini { --cw: 28px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.card.mini .idx, .card.mini .back-oval span, .card.mini .face::before { display: none; }
.card.small .face::before { display: none; }

.card.land { animation: land 0.42s cubic-bezier(0.2, 0.8, 0.3, 1.1); }
@keyframes land {
  from { transform: translate(var(--dx, 0), calc(var(--dy, 0px) - 80px)) rotate(calc(var(--rot, 0deg) - 30deg)) scale(1.12); opacity: 0; }
}
.card.shake { animation: shake 0.35s; }
@keyframes shake { 0%, 100% { translate: 0; } 25% { translate: -6px; } 75% { translate: 6px; } }

/* ================= GAME TABLE ================= */
#screen-game { display: flex; flex-direction: column; gap: 8px; padding: 10px 16px 0; min-height: 100vh; min-height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 12px; }
.game-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.92rem; }
.topbar-right { display: flex; gap: 6px; }

.arena { flex: 1; display: flex; flex-direction: column; align-items: center; min-height: 0; }
.rim {
  width: min(1120px, 100%);
  flex: 1;
  display: flex;
  min-height: 360px;
  border-radius: 260px / 190px;
  padding: 15px;
  background:
    repeating-linear-gradient(92deg, rgba(0, 0, 0, 0.09) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(88deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 13px),
    linear-gradient(180deg, var(--rim1), var(--rim2));
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.28),
    inset 0 -4px 8px rgba(0, 0, 0, 0.55),
    0 2px 0 rgba(0, 0, 0, 0.6),
    0 30px 60px rgba(0, 0, 0, 0.75);
}
.felt {
  flex: 1;
  min-width: 0;
  border-radius: 245px / 176px;
  display: flex;
  flex-direction: column;
  padding: 16px 48px 12px;
  background:
    var(--noise),
    radial-gradient(ellipse at 50% 42%, color-mix(in srgb, var(--felt) 86%, #fff) 0%, var(--felt) 50%, color-mix(in srgb, var(--felt) 55%, #000) 100%);
  background-size: 180px, auto;
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.45),
    inset 0 10px 28px rgba(0, 0, 0, 0.55),
    inset 0 0 140px rgba(0, 0, 0, 0.4);
  transition: background 0.8s;
}

.opponents { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.opp {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.58));
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 8px 12px 8px;
  min-width: 136px;
  max-width: 220px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: box-shadow 0.25s, transform 0.25s;
}
.opp.turn { box-shadow: 0 0 0 1.5px var(--accent), 0 0 22px color-mix(in srgb, var(--accent) 45%, transparent); transform: translateY(-2px); }
.opp.out { opacity: 0.35; }
.opp.offline { opacity: 0.55; }
.opp-head { display: flex; align-items: center; gap: 8px; }
.opp-head .avatar { width: 26px; height: 26px; font-size: 0.75rem; }
.opp-name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.opp-cards { display: flex; justify-content: center; margin: 8px 0 4px; min-height: 46px; align-items: flex-end; padding-left: 14px; }
.opp-cards .card { margin-left: -14px; transform-origin: 50% 140%; transform: rotate(var(--rot, 0deg)); }
.opp-cards .more { font-size: 0.72rem; margin-left: 6px; color: var(--muted); align-self: center; }
.opp-meta { display: flex; gap: 6px; align-items: center; justify-content: center; font-size: 0.8rem; color: var(--muted); }
.uno-tag { background: #c9302c; color: #fff; }

.table { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; gap: clamp(16px, 5vw, 64px); min-height: 200px; }
.dir-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(330px, 70vw);
  height: min(330px, 70vw);
  translate: -50% -50%;
  color: rgba(255, 255, 255, 0.13);
  pointer-events: none;
  animation: spin 22s linear infinite;
}
.dir-ring path { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.dir-ring.ccw { transform: scaleX(-1); }
@keyframes spin { to { rotate: 360deg; } }
.piles { display: flex; gap: clamp(20px, 4vw, 44px); position: relative; }
.pile { position: relative; width: var(--pw); height: calc(var(--pw) * 1.5); }
.pile .card { --cw: var(--pw); position: absolute; left: 0; top: 0; }
.draw-pile { cursor: pointer; }
.draw-pile .card.under { transform: translate(var(--dx), var(--dy)); }
.draw-pile:hover .card:not(.under) { transform: translateY(-4px); }
.pile-empty { width: 100%; height: 100%; border-radius: 10px; border: 2px dashed rgba(255, 255, 255, 0.15); }
.pile-count { position: absolute; bottom: -24px; left: 0; right: 0; text-align: center; font-size: 0.75rem; color: rgba(255, 255, 255, 0.5); }
.claim-badge { position: absolute; top: -12px; right: -14px; width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(180deg, #d4413c, #8e1d1a); color: #fff; display: grid; place-items: center; font-weight: 800; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6); z-index: 5; }

.table-info { display: flex; flex-direction: column; gap: 10px; align-items: center; min-width: 90px; position: relative; }
.color-ind { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 600; font-size: 0.8rem; text-align: center; color: rgba(255, 255, 255, 0.85); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); }
/* poker chip showing the active colour */
.chip-token {
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--cc) 0 50%, transparent 51%),
    repeating-conic-gradient(var(--cc) 0 22.5deg, #f2f0ea 22.5deg 45deg);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 3px 0 color-mix(in srgb, var(--cc) 55%, #000), 0 6px 10px rgba(0, 0, 0, 0.55);
  transition: background 0.3s;
}
.chip-token::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 255, 255, 0.7);
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.3), transparent 60%);
}
.pending { background: linear-gradient(180deg, #d4413c, #8e1d1a); color: #fff; font-weight: 700; font-size: 0.85rem; padding: 4px 10px; border-radius: 6px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.side-badge { white-space: nowrap; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 8px; border-radius: 5px; background: rgba(0, 0, 0, 0.35); color: rgba(255, 255, 255, 0.8); }

.status { text-align: center; font-size: 0.98rem; min-height: 1.6em; padding: 4px; color: rgba(255, 255, 255, 0.85); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.status.mine { color: var(--accent); font-weight: 600; }

.player-area { width: 100%; display: flex; flex-direction: column; align-items: center; }
.actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.catch-buttons { display: contents; }

.hand {
  --gap: -20px;
  width: 100%;
  display: flex;
  justify-content: safe center;
  align-items: flex-end;
  padding: 30px 24px 26px;
  overflow-x: auto;
  min-height: calc(var(--cw) * 1.5 + 64px);
}
.hand .card { transform-origin: 50% 130%; transform: translateY(var(--ty, 0px)) rotate(var(--rot, 0deg)); }
.hand .card + .card { margin-left: var(--gap); }
.hand .card.playable, .hand .card.clickable { cursor: pointer; }
.hand .card.playable {
  transform: translateY(calc(var(--ty, 0px) - 18px)) rotate(var(--rot, 0deg));
  box-shadow: 0 0 0 2px var(--accent), 0 0 16px color-mix(in srgb, var(--accent) 55%, transparent), 0 14px 22px -6px rgba(0, 0, 0, 0.6);
  z-index: 1;
}
.hand .card.playable:hover, .hand .card.clickable:hover { transform: translateY(calc(var(--ty, 0px) - 30px)) rotate(var(--rot, 0deg)) scale(1.04); z-index: 5; }
.hand .card.dim { filter: brightness(0.7) saturate(0.85); }
.hand .card.drawn { outline: 2px dashed rgba(255, 255, 255, 0.85); outline-offset: 3px; }

/* log */
.log-panel {
  position: fixed;
  right: 12px;
  top: 60px;
  width: 280px;
  max-height: calc(100vh - 84px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 5;
  transform: translateX(calc(100% + 20px));
  transition: transform 0.25s;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}
.log-panel.open { transform: none; }
.log-head { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; font-weight: 600; font-size: 0.9rem; border-bottom: 1px solid var(--line); }
.log { list-style: none; margin: 0; padding: 8px 12px; overflow-y: auto; font-size: 0.82rem; line-height: 1.5; color: rgba(255, 255, 255, 0.82); }
.log li { padding: 4px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.log b { color: #fff; font-weight: 600; }
.chip { display: inline-block; padding: 0 7px; border-radius: 4px; background: var(--cc); color: #fff; font-weight: 600; font-size: 0.78rem; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25); }

/* ---------- modal / toast / banner ---------- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.62); display: grid; place-items: center; z-index: 20; padding: 16px; animation: fade 0.15s; backdrop-filter: blur(2px); }
@keyframes fade { from { opacity: 0; } }
.modal-box {
  background: linear-gradient(180deg, #232325, #18181a);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}
.modal-box > .btn { margin-top: 10px; }
.color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.color-btn {
  background: radial-gradient(130% 100% at 30% 20%, color-mix(in srgb, var(--cc) 80%, #fff), var(--cc) 45%, color-mix(in srgb, var(--cc) 70%, #000));
  color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  padding: 24px 10px;
  font-weight: 700;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 3px 8px rgba(0, 0, 0, 0.5);
  transition: transform 0.12s, filter 0.12s;
}
.color-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.player-grid { display: grid; gap: 8px; margin: 12px 0; }
.claim-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0; padding: 12px; border-radius: 10px; background: var(--noise), var(--felt); box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6); }
.claim { background: none; border: 0; padding: 2px; cursor: pointer; border-radius: 8px; }
.claim:hover .card { transform: translateY(-4px); box-shadow: 0 0 0 2px var(--accent), 0 8px 14px rgba(0, 0, 0, 0.5); }
.center-card { display: flex; justify-content: center; margin: 14px 0; }
.center-card .card { --cw: 110px; }
.gameover .go-kicker { font-size: 0.78rem; letter-spacing: 0.25em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.gameover h2 { font-size: 1.9rem; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 120px);
  background: #232325;
  border: 1px solid var(--line);
  padding: 10px 18px;
  border-radius: 10px;
  z-index: 30;
  transition: transform 0.25s;
  max-width: calc(100vw - 32px);
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}
.toast.show { transform: translate(-50%, 0); }
.banner { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(0.9); opacity: 0; pointer-events: none; z-index: 25; transition: all 0.25s; }
.banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.reveal { background: linear-gradient(180deg, #232325, #18181a); border: 1px solid; border-radius: 14px; padding: 18px 26px; text-align: center; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75); }
.reveal.honest { border-color: #3c9a52; }
.reveal.liar { border-color: var(--danger); }
.reveal-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 12px; letter-spacing: 0.02em; }
.reveal-cards { display: flex; gap: 22px; justify-content: center; }

/* ---------- responsive ---------- */
@media (min-width: 1280px) {
  .log-panel { transform: none; }
  #btn-log, #btn-log-close { display: none; }
  #screen-game { padding-right: 312px; }
}
@media (max-width: 760px) {
  :root { --cw: 68px; --pw: 76px; }
  .lobby-grid { grid-template-columns: 1fr; }
  .rim { border-radius: 36px; padding: 10px; min-height: 380px; }
  .felt { border-radius: 28px; padding: 12px 10px; }
  .opp { min-width: 100px; padding: 6px 8px; }
  .opp-cards { min-height: 40px; }
  .table-info { min-width: 60px; }
  .chip-token { width: 38px; height: 38px; }
  .chip-token::after { inset: 7px; }
  .log-panel { left: 12px; right: 12px; width: auto; }
  .lobby-head { flex-wrap: wrap; }
  .share .row { flex-wrap: wrap; }
  .hand { padding-left: 12px; padding-right: 12px; }
}

/* phones in landscape (short screens): everything fits one screen, no scrolling */
@media (orientation: landscape) and (max-height: 600px) {
  :root { --cw: 42px; --pw: 44px; }
  #screen-game { gap: 2px; padding: 2px 12px 0; height: 100dvh; min-height: 0; overflow: hidden; }
  .topbar .logo.tiny { height: 22px; }
  .rim { min-height: 0; padding: 6px; border-radius: 120px / 80px; }
  .felt { padding: 6px 28px 4px; border-radius: 114px / 74px; }
  .opponents { flex-wrap: nowrap; gap: 6px; overflow-x: auto; }
  .opp { min-width: 84px; padding: 3px 6px; }
  .opp-cards { min-height: 20px; }
  .opp .count, .opp-count { display: none; }
  .table { min-height: 84px; gap: 24px; }
  .table-info { min-width: 50px; }
  .chip-token { width: 30px; height: 30px; }
  .chip-token::after { inset: 5px; }
  .actions { margin-top: 2px; gap: 6px; }
  .actions .btn { padding: 5px 12px; font-size: 0.8rem; }
  .hand { padding: 12px 16px 4px; min-height: calc(var(--cw) * 1.5 + 16px); --gap: -10px; }
  .hand .card.playable:hover, .hand .card.clickable:hover { transform: translateY(calc(var(--ty, 0px) - 14px)) rotate(var(--rot, 0deg)) scale(1.04); }
}
