:root {
  --bg: #070b0c;
  --bg-2: #0a1011;
  --panel: rgba(13, 20, 21, 0.82);
  --panel-strong: rgba(10, 16, 17, 0.94);
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eef5f3;
  --muted: #8fa3a0;
  --muted-2: #627471;
  --teal: #5ff0c8;
  --teal-2: #2ee6d6;
  --teal-deep: #0c6b62;
  --gold: #f6c453;
  --gold-2: #ffdf8a;
  --red: #ff6472;
  --purple: #c39bff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  --radius: 18px;
  --font: "Bahnschrift", "DIN Alternate", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, rgba(35, 190, 170, 0.13), transparent 42%),
    radial-gradient(circle at 85% 20%, rgba(70, 90, 200, 0.08), transparent 32%),
    linear-gradient(180deg, #080c0d 0%, #06090a 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { width: 1em; height: 1em; fill: currentColor; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.hidden { display: none !important; }
.glass {
  background: linear-gradient(160deg, rgba(18, 27, 28, 0.9), rgba(9, 14, 15, 0.86));
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.ambient__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
}
.ambient__orb--one {
  width: 52vw;
  height: 52vw;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(19, 142, 129, 0.32), transparent 66%);
}
.ambient__orb--two {
  width: 40vw;
  height: 40vw;
  right: -18vw;
  bottom: -10vw;
  background: radial-gradient(circle, rgba(70, 70, 190, 0.18), transparent 66%);
}
.ambient__grain {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.23'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.screen {
  position: relative;
  z-index: 1;
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
}
.screen.is-active { display: flex; }

.toast-root {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(92vw, 520px);
}
.toast {
  padding: 11px 18px;
  border-radius: 999px;
  background: rgba(10, 16, 17, 0.92);
  border: 1px solid var(--line-strong);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0.02em;
  animation: toastIn 0.28s ease both;
  backdrop-filter: blur(14px);
}
.toast--error { border-color: rgba(255, 100, 114, 0.5); color: #ffd6da; }
.toast--success { border-color: rgba(95, 240, 200, 0.45); color: #d8fff5; }
.toast.is-out { animation: toastOut 0.25s ease both; }

@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(0.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px) scale(0.96); } }

/* Buttons & fields */
.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 13px 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
  color: #071010;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn--wide { width: 100%; }
.btn--gold {
  background: linear-gradient(135deg, #ffe099, #f6c453 52%, #e2a930);
  box-shadow: 0 10px 30px rgba(246, 196, 83, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn--teal {
  background: linear-gradient(135deg, #7ff9d8, #37e5c5 55%, #14b8a6);
  box-shadow: 0 10px 30px rgba(46, 230, 214, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn--ghost {
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--line-strong);
  color: var(--text);
}
.btn--glow { position: relative; overflow: hidden; }
.btn--glow::after {
  content: "";
  position: absolute;
  inset: -50% -20%;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.34) 50%, transparent 65%);
  transform: translateX(-70%);
  transition: transform 0.6s ease;
}
.btn--glow:hover::after { transform: translateX(70%); }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.icon-btn--glass {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line);
}
.icon-btn.is-off { color: var(--muted-2); }

.text-input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  padding: 13px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.text-input::placeholder { color: #5e706d; }
.text-input:focus {
  border-color: rgba(95, 240, 200, 0.55);
  box-shadow: 0 0 0 3px rgba(95, 240, 200, 0.08);
}
.text-input--code {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 16px;
  font-weight: 700;
}
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 7px;
}
.mini-note {
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.55;
  margin: 9px 0 0;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.badge--admin {
  color: #171006;
  background: linear-gradient(135deg, #ffe099, #f6c453);
}

/* Landing */
.landing-nav {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 23px clamp(20px, 5vw, 72px) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(145deg, #102321, #081110);
  border: 1px solid rgba(95, 240, 200, 0.22);
  box-shadow: 0 0 30px rgba(46, 230, 214, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--teal);
  font-size: 23px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-size: 16px; letter-spacing: 0.06em; }
.brand-text small { font-size: 9px; letter-spacing: 0.22em; color: var(--muted-2); margin-top: 3px; }
.brand--small .brand-mark { width: 34px; height: 34px; border-radius: 10px; font-size: 18px; }
.brand--small .brand-text strong { font-size: 14px; }
.brand--small .brand-text small { font-size: 8px; }
.landing-nav__right { display: flex; align-items: center; gap: 12px; }
.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.025);
}
.live-chip i, .status-pill i, .landing-footer__status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 9px var(--teal);
}

.landing-main {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(28px, 5vh, 70px) clamp(22px, 5vw, 72px) 0;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: clamp(20px, 3vw, 60px);
  align-items: center;
  flex: 1;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--teal);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 12px rgba(95, 240, 200, 0.8);
  animation: pulseDot 2.4s ease-in-out infinite;
}
@keyframes pulseDot { 50% { opacity: 0.45; transform: scale(0.8); } }
.landing-copy h1 {
  margin: 18px 0 20px;
  font-size: clamp(48px, 6.4vw, 96px);
  line-height: 0.92;
  letter-spacing: -0.055em;
  font-weight: 800;
}
.landing-copy h1 span {
  background: linear-gradient(100deg, #eafff8 10%, #5ff0c8 45%, #19b8ae 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 30px rgba(46, 230, 214, 0.18));
}
.landing-lead {
  max-width: 510px;
  color: var(--muted);
  font-size: clamp(14px, 1.25vw, 17px);
  line-height: 1.85;
  margin: 0;
}
.feature-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 26px;
  margin-top: 32px;
}
.feature { display: flex; align-items: center; gap: 10px; }
.feature-ico {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--teal);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
.feature div { display: flex; flex-direction: column; }
.feature strong { font-size: 12px; letter-spacing: 0.02em; }
.feature small { font-size: 10px; color: var(--muted-2); margin-top: 3px; }

.landing-visual {
  position: relative;
  min-height: min(54vh, 560px);
  height: 100%;
}
.hero-glow {
  position: absolute;
  width: 75%;
  height: 55%;
  left: 50%;
  top: 47%;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, rgba(31, 220, 193, 0.28), transparent 68%);
  filter: blur(20px);
}
.hero-table {
  position: absolute;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%) rotate(-7deg);
  width: min(100%, 590px);
  aspect-ratio: 1.52;
  border-radius: 50%;
  border: clamp(10px, 1.4vw, 17px) solid #0a1010;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(55, 232, 205, 0.42), transparent 36%),
    radial-gradient(ellipse at 50% 50%, #0d766c 0%, #075a53 52%, #043e3a 100%);
  box-shadow:
    inset 0 0 70px rgba(0, 0, 0, 0.5),
    inset 0 0 0 2px rgba(120, 255, 230, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 80px rgba(24, 210, 185, 0.2),
    0 42px 90px rgba(0, 0, 0, 0.7);
}
.hero-table::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  border: 1px solid rgba(150, 255, 235, 0.12);
}
.hero-table::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-radial-gradient(circle at 50% 50%, transparent 0 34px, rgba(255, 255, 255, 0.014) 35px 36px);
  pointer-events: none;
}
.hero-table__inner {
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.hero-table__brand {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 0.36em;
  color: rgba(210, 255, 244, 0.24);
}
.hero-pot {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(3, 21, 20, 0.45);
  border: 1px solid rgba(150, 255, 235, 0.15);
  color: rgba(215, 255, 246, 0.7);
}
.hero-pot span { font-size: 9px; letter-spacing: 0.18em; }
.hero-pot strong { font-size: 19px; color: var(--teal); font-weight: 700; }
.hero-card-fan {
  position: absolute;
  left: 50%;
  bottom: 3%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  filter: drop-shadow(0 24px 26px rgba(0, 0, 0, 0.45));
}
.playing-card {
  position: relative;
  flex: 0 0 auto;
  width: 62px;
  height: 88px;
  border-radius: 9px;
  background: linear-gradient(145deg, #fffdf5, #e8e2d2);
  color: #1a2426;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), 0 8px 20px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  user-select: none;
}
.playing-card::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 6px;
  pointer-events: none;
}
.playing-card span {
  position: absolute;
  left: 6px;
  top: 5px;
  font-size: 13px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.playing-card b {
  position: absolute;
  right: 6px;
  bottom: 3px;
  font-size: 27px;
  line-height: 1;
  font-weight: 400;
}
.playing-card.is-red { color: #cf3345; }
.playing-card.is-black { color: #182326; }
.playing-card--hero {
  width: clamp(68px, 6.2vw, 92px);
  height: clamp(96px, 8.8vw, 130px);
  border-radius: 11px;
  transform: rotate(calc(var(--i) * 7deg)) translateY(calc(var(--i) * -5px));
  transform-origin: 50% 120%;
  z-index: calc(10 + var(--i));
  transition: transform 0.25s ease;
}
.playing-card--hero + .playing-card--hero { margin-left: clamp(-31px, -2.2vw, -23px); }
.playing-card--hero span { font-size: clamp(15px, 1.4vw, 20px); left: 9px; top: 8px; }
.playing-card--hero b { font-size: clamp(33px, 3vw, 44px); right: 9px; bottom: 5px; }
.hero-card-fan:hover .playing-card--hero { transform: rotate(calc(var(--i) * 10deg)) translateY(-10px); }

.hero-chip {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 5px dashed rgba(255, 255, 255, 0.45);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), inset 0 0 0 3px rgba(0, 0, 0, 0.16);
  animation: floatChip 5s ease-in-out infinite;
}
.hero-chip--1 {
  left: 4%;
  top: 27%;
  background: radial-gradient(circle at 35% 30%, #ff9da7, #c22e41 55%, #6d1420);
  transform: rotate(-18deg);
}
.hero-chip--2 {
  right: 4%;
  top: 58%;
  width: 38px;
  height: 38px;
  background: radial-gradient(circle at 35% 30%, #91ffe7, #18b99f 55%, #086451);
  animation-delay: -1.8s;
}
.hero-chip--3 {
  left: 12%;
  bottom: 5%;
  width: 32px;
  height: 32px;
  background: radial-gradient(circle at 35% 30%, #ffe8a3, #d39a27 55%, #765411);
  animation-delay: -3.1s;
}
@keyframes floatChip {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -12px; }
}
.hero-seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 12px;
  min-width: 100px;
  border-radius: 14px;
  background: rgba(8, 14, 15, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(10px);
}
.hero-seat--top { right: 8%; top: 6%; }
.hero-seat--left { left: 1%; bottom: 24%; }
.hero-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(145deg, #7feee0, #126e73);
  border: 2px solid rgba(255, 255, 255, 0.24);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #071110;
}
.hero-avatar--warm { background: linear-gradient(145deg, #ffd898, #b43846); color: #2a0b0e; }
.hero-name { font-size: 10px; color: #dbe8e5; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-stack { font-size: 11px; color: var(--teal); font-weight: 700; }
.hero-badge {
  position: absolute;
  right: 3%;
  bottom: 10%;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.entry-wrap {
  width: 100%;
  max-width: 590px;
  margin: -2vh auto 0;
  padding: 0 22px;
}
.entry-card {
  border-radius: 22px;
  padding: clamp(18px, 2.6vw, 28px);
}
.entry-profile {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}
.entry-profile__field { flex: 1; }
.avatar-picker { position: relative; flex: 0 0 auto; cursor: pointer; }
.avatar {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 auto;
  background: linear-gradient(145deg, hsl(var(--hue, 168), 45%, 38%), hsl(var(--hue, 168), 55%, 16%));
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #eafff9;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar--lg { width: 76px; height: 76px; font-size: 26px; border-width: 3px; }
.avatar-edit {
  position: absolute;
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
  padding: 3px 8px;
  border-radius: 999px;
  background: #13201f;
  border: 1px solid var(--line-strong);
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
}
.avatar-picker:hover .avatar-edit { color: var(--teal); border-color: rgba(95, 240, 200, 0.4); }
.entry-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 14px;
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 0.2em;
}
.entry-divider::before, .entry-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.entry-room { display: flex; align-items: flex-end; gap: 10px; }
.entry-room__field { flex: 1; }
.btn--join { flex: 0 0 auto; height: 46px; padding: 0 24px; }
#createBtn { margin-top: 12px; height: 52px; font-size: 15px; }
.entry-note { margin: 12px 0 0; text-align: center; color: var(--muted-2); font-size: 10px; line-height: 1.6; }
.landing-footer {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px clamp(22px, 5vw, 72px) 26px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.landing-footer__status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }

/* Topbar */
.topbar {
  position: relative;
  z-index: 20;
  width: 100%;
  min-height: 64px;
  padding: max(10px, env(safe-area-inset-top)) clamp(12px, 2.6vw, 28px) 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.topbar__left, .topbar__right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.room-pill, .meta-pill {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.room-pill strong {
  color: var(--text);
  font-size: 12px;
  letter-spacing: 0.16em;
}
.room-pill button {
  border: 0;
  background: transparent;
  color: var(--muted-2);
  display: inline-flex;
  padding: 2px;
}
.room-pill button:hover { color: var(--teal); }
.meta-pill svg { font-size: 14px; color: var(--teal); }
.meta-pill--hand { color: var(--text); }
.meta-pill--players { color: var(--muted); }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(95, 240, 200, 0.16);
  color: var(--teal);
  background: rgba(95, 240, 200, 0.05);
  font-size: 10px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* Room */
.room-layout {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 4px clamp(12px, 2.6vw, 28px) 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: clamp(12px, 2vw, 26px);
  align-items: stretch;
}
.room-stage { min-height: 0; display: flex; align-items: center; }
.table-shell {
  position: relative;
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.table-shell--lobby { min-height: min(66vh, 720px); }
.poker-table {
  position: relative;
  border-radius: 50%;
  isolation: isolate;
}
.poker-table--lobby {
  width: min(96%, 1000px);
  aspect-ratio: 1.42;
  border: clamp(10px, 1.25vw, 16px) solid #0b1111;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(50, 226, 199, 0.36), transparent 38%),
    radial-gradient(ellipse at 50% 50%, #0d756b 0%, #075a53 50%, #043d39 100%);
  box-shadow:
    inset 0 0 80px rgba(0, 0, 0, 0.55),
    inset 0 0 0 2px rgba(130, 255, 235, 0.13),
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 0 70px rgba(20, 205, 180, 0.16),
    0 38px 90px rgba(0, 0, 0, 0.65);
}
.poker-table::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  border: 1px solid rgba(160, 255, 235, 0.1);
  pointer-events: none;
}
.poker-table::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background:
    repeating-radial-gradient(circle at 50% 50%, transparent 0 40px, rgba(255, 255, 255, 0.012) 41px 42px),
    radial-gradient(ellipse at 50% 20%, rgba(255, 255, 255, 0.06), transparent 55%);
}
.table-watermark {
  position: absolute;
  left: 50%;
  top: 16%;
  transform: translateX(-50%);
  font-size: clamp(9px, 1vw, 12px);
  letter-spacing: 0.4em;
  color: rgba(205, 255, 243, 0.2);
  white-space: nowrap;
  pointer-events: none;
}
.table-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: 52%;
  z-index: 2;
}
.lobby-center { display: flex; flex-direction: column; align-items: center; }
.table-center__eyebrow { font-size: 9px; letter-spacing: 0.3em; color: rgba(205, 255, 243, 0.36); }
.room-code-display {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.room-code-display span { font-size: 9px; letter-spacing: 0.24em; color: rgba(205, 255, 243, 0.42); }
.room-code-display strong {
  font-size: clamp(30px, 5vw, 54px);
  letter-spacing: 0.16em;
  line-height: 1;
  color: #d6fff7;
  text-shadow: 0 0 30px rgba(95, 240, 200, 0.28);
}
.lobby-center p { margin: 10px 0 0; color: rgba(205, 255, 243, 0.5); font-size: 11px; letter-spacing: 0.08em; }
.invite-btn {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(160, 255, 235, 0.16);
  background: rgba(0, 30, 27, 0.3);
  color: rgba(218, 255, 246, 0.7);
  font-size: 10px;
  letter-spacing: 0.06em;
}
.invite-btn:hover { color: var(--teal); border-color: rgba(95, 240, 200, 0.4); }
.seat-layer { position: absolute; inset: 0; z-index: 4; }
.bet-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; }

.room-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}
.panel { border-radius: 16px; padding: 15px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 11px;
}
.panel-head h2 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #d9e8e5;
}
.panel-head > span { font-size: 10px; color: var(--muted-2); }
.panel-head__hint { color: var(--muted-2); }
.player-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.player-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid transparent;
}
.player-row.is-you { border-color: rgba(95, 240, 200, 0.18); background: rgba(95, 240, 200, 0.04); }
.player-row .avatar { width: 36px; height: 36px; font-size: 13px; border-width: 1px; }
.player-row__main { flex: 1; min-width: 0; }
.player-row__name {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-row__sub { margin-top: 2px; font-size: 9px; color: var(--muted-2); }
.player-row__chips { color: var(--teal); font-size: 11px; font-weight: 700; }
.player-actions { display: flex; gap: 4px; }
.mini-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 7px;
  font-size: 9px;
  padding: 4px 6px;
}
.mini-btn:hover { color: var(--text); border-color: var(--line-strong); }
.mini-btn--danger:hover { color: #ffd0d5; border-color: rgba(255, 100, 114, 0.35); }
.empty-row { padding: 18px 10px; text-align: center; color: var(--muted-2); font-size: 11px; }
#startBtn { margin-top: 2px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.settings-grid label { font-size: 9px; color: var(--muted-2); letter-spacing: 0.04em; }
.settings-grid input {
  width: 100%;
  margin-top: 5px;
  padding: 9px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  outline: none;
  font-size: 11px;
}
.settings-grid input:focus { border-color: rgba(95, 240, 200, 0.4); }
.settings-grid__wide { grid-column: 1 / -1; }
.preset-row { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0; }
.preset-row button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  border-radius: 7px;
  padding: 5px 7px;
  font-size: 9px;
}
.preset-row button:hover { color: var(--teal); border-color: rgba(95, 240, 200, 0.3); }
.panel--chat { display: flex; flex-direction: column; min-height: 180px; flex: 1; }
.chat-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  min-height: 60px;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}
.chat-line { font-size: 10px; line-height: 1.5; color: var(--muted); }
.chat-line b { color: #d9e8e5; font-weight: 700; margin-right: 5px; }
.chat-line.is-system { color: var(--muted-2); font-style: italic; }
.chat-form { display: flex; gap: 6px; margin-top: 9px; }
.chat-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  padding: 9px 10px;
  outline: none;
  font-size: 10px;
}
.chat-form input:focus { border-color: rgba(95, 240, 200, 0.35); }
.chat-form button {
  border: 1px solid rgba(95, 240, 200, 0.2);
  background: rgba(95, 240, 200, 0.08);
  color: var(--teal);
  border-radius: 9px;
  padding: 0 11px;
  font-size: 10px;
}

/* Game table */
.game-layout {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 clamp(8px, 2vw, 22px) 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(10px, 1.8vw, 20px);
}
.game-stage {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.table-shell--game {
  flex: 1;
  min-height: 420px;
  padding-bottom: 2px;
}
.poker-table--game {
  width: min(94%, 1040px);
  height: min(100%, 690px);
  aspect-ratio: 1.48;
  border: clamp(10px, 1.3vw, 17px) solid #0a1010;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(55, 232, 205, 0.4), transparent 38%),
    radial-gradient(ellipse at 50% 50%, #0e786d 0%, #075a53 50%, #043d39 100%);
  box-shadow:
    inset 0 0 100px rgba(0, 0, 0, 0.58),
    inset 0 0 0 2px rgba(130, 255, 235, 0.13),
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 0 90px rgba(20, 205, 180, 0.17),
    0 44px 100px rgba(0, 0, 0, 0.7);
}
.table-glow {
  position: absolute;
  inset: -3%;
  border-radius: 50%;
  box-shadow: 0 0 70px rgba(46, 230, 214, 0.16);
  pointer-events: none;
}
.board-zone {
  position: absolute;
  left: 50%;
  top: 43%;
  transform: translate(-50%, -50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  width: 62%;
}
.pot-display {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(2, 25, 23, 0.32);
  border: 1px solid rgba(160, 255, 235, 0.1);
  color: rgba(215, 255, 246, 0.62);
}
.pot-label { font-size: 8px; letter-spacing: 0.24em; }
.pot-display strong { font-size: clamp(21px, 2.2vw, 30px); color: #d9fff6; font-weight: 700; letter-spacing: -0.02em; }
.pot-side { font-size: 9px; color: var(--muted); }
.community-cards { display: flex; align-items: center; justify-content: center; gap: clamp(4px, 0.65vw, 9px); min-height: 74px; }
.community-cards .playing-card {
  width: clamp(42px, 5.1vw, 64px);
  height: clamp(60px, 7.2vw, 90px);
  animation: dealCard 0.42s cubic-bezier(0.2, 0.8, 0.3, 1.1) both;
}
.community-cards .playing-card span { font-size: clamp(11px, 1.2vw, 15px); left: 5px; top: 4px; }
.community-cards .playing-card b { font-size: clamp(20px, 2.3vw, 30px); right: 5px; bottom: 3px; }
.community-cards .playing-card--empty {
  background: rgba(4, 30, 27, 0.22);
  border: 1px dashed rgba(190, 255, 240, 0.18);
  box-shadow: none;
}
.community-cards .playing-card--empty::after { display: none; }
@keyframes dealCard {
  from { opacity: 0; transform: translateY(-18px) scale(0.82) rotate(-4deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}
.phase-row { display: flex; align-items: center; gap: 8px; min-height: 22px; }
.phase-pill {
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(2, 25, 23, 0.3);
  border: 1px solid rgba(160, 255, 235, 0.1);
  color: rgba(220, 255, 247, 0.62);
  font-size: 9px;
  letter-spacing: 0.1em;
}
.turn-label { font-size: 9px; color: rgba(220, 255, 247, 0.4); letter-spacing: 0.04em; }

/* Seats */
.seat {
  position: absolute;
  width: 132px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -50%);
  transition: left 0.38s ease, top 0.38s ease, opacity 0.25s ease;
  z-index: 5;
}
.seat--top { flex-direction: column; }
.seat--bottom { flex-direction: column-reverse; }
.seat--left, .seat--right { flex-direction: column; }
.seat-avatar-wrap { position: relative; width: 58px; height: 58px; flex: 0 0 auto; }
.seat .avatar {
  width: 58px;
  height: 58px;
  border-width: 2px;
  font-size: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
}
.seat.is-active .avatar {
  border-color: rgba(95, 240, 200, 0.7);
  box-shadow: 0 0 0 4px rgba(95, 240, 200, 0.13), 0 0 30px rgba(95, 240, 200, 0.4);
}
.seat.is-active .seat-avatar-wrap::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1px solid rgba(95, 240, 200, 0.55);
  animation: seatPulse 1.8s ease-out infinite;
  pointer-events: none;
}
@keyframes seatPulse {
  0% { transform: scale(0.92); opacity: 0.8; }
  75%, 100% { transform: scale(1.18); opacity: 0; }
}
.seat.is-folded { opacity: 0.46; }
.seat.is-offline .avatar { filter: grayscale(0.7); opacity: 0.65; }
.seat.is-self .seat-avatar-wrap { display: none; }
.seat-plate {
  position: relative;
  margin-top: -5px;
  min-width: 96px;
  max-width: 132px;
  padding: 5px 9px 6px;
  border-radius: 10px;
  background: rgba(7, 12, 13, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.38);
  text-align: center;
  z-index: 2;
}
.seat--bottom .seat-plate { margin-top: 0; margin-bottom: -5px; }
.seat.is-active .seat-plate { border-color: rgba(95, 240, 200, 0.35); box-shadow: 0 0 22px rgba(95, 240, 200, 0.12), 0 8px 22px rgba(0, 0, 0, 0.38); }
.seat-name {
  display: block;
  color: #c9d8d5;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seat-chips { display: block; margin-top: 1px; color: var(--teal); font-size: 13px; font-weight: 700; letter-spacing: -0.01em; }
.seat-you {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 5px;
  border-radius: 999px;
  background: #122220;
  border: 1px solid rgba(95, 240, 200, 0.2);
  color: var(--teal);
  font-size: 8px;
  letter-spacing: 0.08em;
}
.seat-status {
  position: absolute;
  left: 50%;
  bottom: -19px;
  transform: translateX(-50%);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
  color: #0b1513;
  background: #c6d4d0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  animation: popIn 0.24s ease both;
}
.seat-status[data-kind="raise"], .seat-status[data-kind="bet"] { background: #ffbf69; }
.seat-status[data-kind="call"] { background: #69e6cf; }
.seat-status[data-kind="check"] { background: #8bc7ff; }
.seat-status[data-kind="fold"] { background: #7d8c89; }
.seat-status[data-kind="allin"] { background: #ff8b9a; }
.seat-status[data-kind="blind"] { background: #d1b06a; }
.seat-status[data-kind="win"] { background: #ffe08a; }
.seat--bottom .seat-status { bottom: auto; top: -19px; }
@keyframes popIn { from { opacity: 0; transform: translateX(-50%) scale(0.82); } }
.dealer-btn {
  position: absolute;
  right: -4px;
  bottom: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f4f1e6;
  color: #1a2426;
  font-size: 9px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(0, 0, 0, 0.15);
}
.blind-badge {
  position: absolute;
  left: -8px;
  top: -5px;
  padding: 1px 4px;
  border-radius: 5px;
  background: #1a2a28;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #d9e8e5;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.blind-badge--bb { background: #30281b; color: #f6d38a; }
.seat-cards {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 10px);
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  z-index: 1;
}
.seat--top .seat-cards { bottom: auto; top: calc(100% - 10px); }
.seat-cards .playing-card {
  width: 25px;
  height: 35px;
  border-radius: 4px;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.3);
}
.seat-cards .playing-card span { font-size: 8px; left: 3px; top: 2px; }
.seat-cards .playing-card b { font-size: 12px; right: 3px; bottom: 1px; }
.seat-cards .card-back {
  background:
    linear-gradient(135deg, rgba(95, 240, 200, 0.16), transparent 45%),
    repeating-linear-gradient(45deg, #0d2c2c 0 3px, #092020 3px 6px);
  border: 1px solid rgba(95, 240, 200, 0.2);
  color: rgba(95, 240, 200, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}
.seat-cards .playing-card:nth-child(2) { transform: rotate(4deg); }
.seat--self .seat-cards { display: none; }
.seat.is-self .seat-plate { min-width: 104px; }
.seat.is-self .seat-name { color: var(--teal); }

.hero-hand {
  position: absolute;
  left: 50%;
  bottom: 8.5%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  z-index: 8;
  filter: drop-shadow(0 18px 20px rgba(0, 0, 0, 0.42));
  pointer-events: none;
}
.hero-hand .playing-card {
  width: clamp(54px, 5.3vw, 74px);
  height: clamp(76px, 7.5vw, 104px);
  border-radius: 8px;
  animation: heroDeal 0.44s cubic-bezier(0.2, 0.8, 0.3, 1.1) both;
}
.hero-hand .playing-card:nth-child(2) { animation-delay: 0.07s; }
.hero-hand .playing-card span { font-size: clamp(13px, 1.3vw, 17px); left: 6px; top: 5px; }
.hero-hand .playing-card b { font-size: clamp(27px, 2.7vw, 36px); right: 6px; bottom: 3px; }
.hero-hand .playing-card.is-dim { opacity: 0.42; filter: saturate(0.5); }
@keyframes heroDeal { from { opacity: 0; transform: translateY(16px) scale(0.86); } }

.bet-pill {
  position: absolute;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(6, 13, 14, 0.76);
  border: 1px solid rgba(255, 210, 120, 0.22);
  color: #ffe0a3;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
  animation: popIn 0.22s ease both;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.bet-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe5a8, #d4a43d 60%, #8c681d);
  box-shadow: 0 0 6px rgba(246, 196, 83, 0.45);
}
.bet-pill--small { font-size: 8px; padding: 2px 6px; }

/* Action dock */
.action-dock {
  position: relative;
  z-index: 12;
  width: min(760px, 96%);
  margin: -4px auto 0;
  border-radius: 17px;
  background: linear-gradient(160deg, rgba(18, 28, 29, 0.94), rgba(8, 13, 14, 0.94));
  border: 1px solid var(--line-strong);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  padding: 10px 12px 12px;
}
.action-timer {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 0;
  height: 2px;
  border-radius: 2px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}
.action-timer div {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal-2), var(--teal));
  transition: width 0.12s linear, background 0.3s ease;
  box-shadow: 0 0 10px rgba(46, 230, 214, 0.6);
}
.action-timer.is-low div { background: linear-gradient(90deg, #ff9a68, var(--red)); box-shadow: 0 0 10px rgba(255, 100, 114, 0.6); }
.action-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 20px;
  padding: 1px 2px 8px;
}
.action-position {
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--teal);
  text-transform: uppercase;
}
.action-status { font-size: 10px; color: var(--muted); }
.action-buttons { display: grid; grid-template-columns: 1fr 1.15fr 1.15fr 1fr; gap: 8px; }
.action-btn {
  position: relative;
  min-height: 50px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: transform 0.14s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.action-btn small { font-size: 8px; opacity: 0.4; font-weight: 600; letter-spacing: 0.1em; }
.action-btn:hover { transform: translateY(-1px); }
.action-btn:active { transform: translateY(0); }
.action-btn:disabled { opacity: 0.28; cursor: not-allowed; transform: none; }
.action-btn--fold {
  background: rgba(255, 100, 114, 0.075);
  border-color: rgba(255, 100, 114, 0.24);
  color: #ffbdc4;
}
.action-btn--fold:hover { background: rgba(255, 100, 114, 0.14); }
.action-btn--call {
  background: linear-gradient(135deg, rgba(95, 240, 200, 0.18), rgba(46, 230, 214, 0.09));
  border-color: rgba(95, 240, 200, 0.34);
  color: #d7fff5;
}
.action-btn--raise {
  background: linear-gradient(135deg, #ffe29a, #f6c453 60%, #dfa72c);
  color: #191004;
  box-shadow: 0 8px 22px rgba(246, 196, 83, 0.18);
}
.action-btn--allin {
  background: linear-gradient(135deg, rgba(195, 155, 255, 0.24), rgba(150, 95, 235, 0.14));
  border-color: rgba(195, 155, 255, 0.36);
  color: #eadcff;
}
.action-btn.is-pulse { animation: actionPulse 1.8s ease-in-out infinite; }
@keyframes actionPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(95, 240, 200, 0); }
  50% { box-shadow: 0 0 22px rgba(95, 240, 200, 0.16); }
}
.raise-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 9px);
  padding: 13px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(18, 28, 29, 0.98), rgba(8, 13, 14, 0.98));
  border: 1px solid var(--line-strong);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
  display: none;
}
.raise-panel.is-open { display: block; animation: popPanel 0.2s ease both; }
@keyframes popPanel { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
.raise-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 9px; }
.raise-head span { font-size: 9px; letter-spacing: 0.12em; color: var(--muted); }
.raise-head strong { font-size: 24px; color: var(--gold-2); }
.raise-head small { margin-left: auto; font-size: 9px; color: var(--muted-2); }
.raise-panel input[type="range"] {
  width: 100%;
  height: 4px;
  appearance: none;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(95, 240, 200, 0.55), rgba(95, 240, 200, 0.1));
  outline: none;
  margin: 8px 0 12px;
}
.raise-panel input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #eafff9;
  border: 3px solid var(--teal-2);
  box-shadow: 0 0 14px rgba(46, 230, 214, 0.5);
  cursor: pointer;
}
.raise-panel input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #eafff9;
  border: 3px solid var(--teal-2);
  box-shadow: 0 0 14px rgba(46, 230, 214, 0.5);
  cursor: pointer;
}
.raise-presets { display: flex; gap: 6px; }
.raise-presets button {
  flex: 1;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 8px;
  padding: 7px;
  font-size: 9px;
}
.raise-presets button:hover { color: var(--teal); border-color: rgba(95, 240, 200, 0.3); }
.raise-actions { display: flex; gap: 7px; margin-top: 9px; }
.raise-actions .btn { flex: 1; padding: 10px; font-size: 11px; }

/* Side panel */
.game-side {
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100vh - 96px);
  overflow: hidden;
}
.side-tabs { display: flex; padding: 5px; gap: 4px; border-bottom: 1px solid var(--line); }
.side-tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted-2);
  border-radius: 9px;
  padding: 9px;
  font-size: 10px;
  letter-spacing: 0.06em;
}
.side-tabs button.is-active { background: rgba(255, 255, 255, 0.055); color: var(--text); }
.hand-log { flex: 1; overflow-y: auto; padding: 10px 12px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.12) transparent; }
.log-entry {
  display: flex;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
  font-size: 10px;
  line-height: 1.5;
  color: var(--muted);
}
.log-entry__phase {
  flex: 0 0 34px;
  color: var(--muted-2);
  font-size: 8px;
  letter-spacing: 0.04em;
  padding-top: 2px;
}
.log-entry b { color: #d9e8e5; font-weight: 700; }
.log-entry__amount { margin-left: auto; color: var(--gold); white-space: nowrap; }
.log-empty { padding: 30px 10px; text-align: center; color: var(--muted-2); font-size: 10px; line-height: 1.7; }
.game-chat { flex: 1; display: flex; flex-direction: column; padding: 10px 12px; min-height: 0; }
.game-chat .chat-list { flex: 1; }
.game-chat .chat-form { margin-top: 8px; }
.side-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 9px;
}
.side-footer button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
}
.side-footer button:hover { color: var(--red); }

/* Overlays and modals */
.overlay, .modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(2, 6, 7, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.result-card, .modal-card {
  position: relative;
  width: min(94vw, 520px);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 24px;
  padding: clamp(22px, 4vw, 34px);
  background:
    radial-gradient(circle at 50% 0%, rgba(246, 196, 83, 0.13), transparent 44%),
    linear-gradient(160deg, rgba(20, 30, 31, 0.98), rgba(7, 12, 13, 0.99));
  border: 1px solid rgba(246, 196, 83, 0.2);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-align: center;
  animation: resultIn 0.38s cubic-bezier(0.2, 0.8, 0.25, 1.1) both;
}
.modal-card { border-color: var(--line-strong); text-align: left; }
@keyframes resultIn { from { opacity: 0; transform: translateY(18px) scale(0.96); } }
.overlay-close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
.overlay-close:hover { color: var(--text); }
.result-glow {
  position: absolute;
  left: 50%;
  top: -30%;
  width: 70%;
  height: 55%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(246, 196, 83, 0.24), transparent 68%);
  filter: blur(18px);
  pointer-events: none;
}
.result-kicker {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 9px;
  letter-spacing: 0.24em;
  color: var(--gold);
}
.result-kicker svg { font-size: 15px; }
.result-card h2 { position: relative; margin: 10px 0 4px; font-size: clamp(26px, 5vw, 38px); letter-spacing: -0.03em; }
.result-winners { position: relative; display: flex; flex-direction: column; gap: 5px; margin: 12px 0 6px; }
.result-winner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  color: #ffe9b0;
  font-weight: 700;
}
.result-winner span { color: var(--muted); font-size: 10px; font-weight: 400; }
.result-winner strong { color: var(--gold-2); font-size: 17px; }
.result-cards { position: relative; display: flex; justify-content: center; gap: 4px; margin: 14px 0 10px; flex-wrap: wrap; }
.result-cards .playing-card {
  width: 42px;
  height: 60px;
  border-radius: 7px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}
.result-cards .playing-card span { font-size: 11px; left: 4px; top: 3px; }
.result-cards .playing-card b { font-size: 19px; right: 4px; bottom: 2px; }
.result-pot {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin: 4px auto 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(246, 196, 83, 0.06);
  border: 1px solid rgba(246, 196, 83, 0.16);
}
.result-pot span { font-size: 9px; letter-spacing: 0.16em; color: var(--muted); }
.result-pot strong { font-size: 24px; color: var(--gold-2); }
.result-hint { margin: 13px 0 0; color: var(--muted-2); font-size: 10px; letter-spacing: 0.04em; }
#nextHandBtn { margin-top: 14px; }

.modal-kicker { font-size: 9px; letter-spacing: 0.24em; color: var(--teal); }
.modal-card h2 { margin: 8px 0 18px; font-size: 26px; letter-spacing: -0.03em; }
.rules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.rules-grid h3 { margin: 0 0 6px; font-size: 11px; color: var(--teal); letter-spacing: 0.08em; }
.rules-grid p { margin: 0 0 13px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.rank-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.rank-list li { display: flex; flex-direction: column; padding: 7px 9px; border-radius: 8px; background: rgba(255, 255, 255, 0.025); border: 1px solid rgba(255, 255, 255, 0.04); }
.rank-list b { font-size: 10px; color: #d9e8e5; }
.rank-list span { font-size: 9px; color: var(--muted-2); margin-top: 2px; }
.rules-note { padding: 9px 10px; border-left: 2px solid rgba(95, 240, 200, 0.3); background: rgba(95, 240, 200, 0.03); border-radius: 0 8px 8px 0; }
#rulesOk { margin-top: 20px; }

.connecting {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: rgba(4, 8, 9, 0.82);
  backdrop-filter: blur(14px);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}
.connecting__ring {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid rgba(95, 240, 200, 0.16);
  border-top-color: var(--teal);
  animation: spin 0.9s linear infinite;
  box-shadow: 0 0 24px rgba(95, 240, 200, 0.15);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty seats in lobby */
.seat--empty .seat-avatar-wrap {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px dashed rgba(190, 255, 240, 0.22);
  color: rgba(190, 255, 240, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 300;
  background: rgba(0, 0, 0, 0.12);
}
.seat--empty .seat-plate {
  min-width: 76px;
  padding: 4px 8px;
  background: rgba(7, 12, 13, 0.5);
  border-style: dashed;
  color: rgba(190, 255, 240, 0.28);
  font-size: 8px;
}

/* Mobile side drawer */
.side-toggle { display: none; }

/* Responsive */
@media (max-width: 1180px) {
  .room-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .game-layout { grid-template-columns: minmax(0, 1fr) 270px; }
  .poker-table--game { width: 97%; }
}

@media (max-width: 980px) {
  .landing-main { grid-template-columns: 1fr; padding-top: 26px; }
  .landing-copy { max-width: 680px; }
  .landing-visual { min-height: 400px; height: 44vh; max-height: 500px; }
  .entry-wrap { margin-top: 8px; }
  .room-layout { grid-template-columns: 1fr; }
  .room-panel {
    max-height: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .panel--chat { grid-column: 1 / -1; }
  .room-stage { min-height: 420px; }
  .table-shell--lobby { min-height: 500px; }
  .game-layout { grid-template-columns: 1fr; }
  .game-side {
    position: fixed;
    right: 10px;
    top: 76px;
    bottom: 10px;
    width: min(330px, calc(100vw - 20px));
    z-index: 40;
    transform: translateX(calc(100% + 20px));
    transition: transform 0.28s ease;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  }
  .game-side.is-open { transform: translateX(0); }
  .side-toggle { display: inline-flex; }
  .poker-table--game { width: 96%; height: min(70vh, 620px); }
}

@media (max-width: 760px) {
  body { font-size: 14px; }
  .landing-nav { padding-top: 16px; }
  .landing-nav__right .live-chip { display: none; }
  .landing-copy h1 { font-size: clamp(44px, 12vw, 66px); margin-top: 14px; }
  .landing-lead { font-size: 13px; line-height: 1.75; }
  .feature-row { gap: 12px 16px; margin-top: 24px; }
  .feature-ico { width: 30px; height: 30px; }
  .landing-visual { min-height: 330px; height: 38vh; }
  .hero-seat--top { right: 2%; top: 2%; }
  .hero-seat--left { left: 0; bottom: 20%; }
  .hero-badge { right: 0; bottom: 4%; }
  .entry-wrap { padding: 0 16px; }
  .entry-card { border-radius: 18px; }
  .landing-footer { flex-direction: column; align-items: center; gap: 6px; text-align: center; }
  .topbar { padding-left: 10px; padding-right: 10px; gap: 6px; }
  .topbar .brand { display: none; }
  .topbar__left, .topbar__right { gap: 5px; }
  .room-pill { padding: 0 8px; height: 34px; }
  .meta-pill { height: 34px; padding: 0 8px; }
  .meta-pill--players { display: none; }
  .status-pill { display: none; }
  .room-layout { padding: 0 8px 16px; }
  .room-panel { grid-template-columns: 1fr; }
  .room-stage { min-height: 350px; }
  .table-shell--lobby { min-height: 420px; }
  .poker-table--lobby { width: 100%; aspect-ratio: 1.05; }
  .poker-table--lobby .table-watermark { top: 10%; }
  .room-code-display strong { font-size: 36px; }
  .poker-table--game {
    width: 100%;
    height: min(62vh, 590px);
    aspect-ratio: auto;
    border-width: 9px;
  }
  .table-shell--game { min-height: 0; }
  .table-shell--game .poker-table { height: 100%; }
  .board-zone { top: 40%; width: 76%; gap: 6px; }
  .community-cards .playing-card { width: 38px; height: 54px; }
  .community-cards .playing-card span { font-size: 10px; left: 4px; top: 3px; }
  .community-cards .playing-card b { font-size: 18px; right: 4px; bottom: 1px; }
  .pot-display strong { font-size: 20px; }
  .seat { width: 96px; }
  .seat-avatar-wrap, .seat .avatar { width: 42px; height: 42px; }
  .seat .avatar { font-size: 15px; border-width: 1.5px; }
  .seat-plate { min-width: 76px; max-width: 96px; padding: 4px 6px; border-radius: 8px; }
  .seat-name { font-size: 8px; }
  .seat-chips { font-size: 11px; }
  .seat-status { font-size: 8px; padding: 1px 6px; bottom: -16px; }
  .seat--bottom .seat-status { top: -16px; }
  .seat-cards { bottom: calc(100% - 6px); }
  .seat--top .seat-cards { top: calc(100% - 6px); }
  .seat-cards .playing-card { width: 18px; height: 26px; }
  .seat-cards .playing-card span { font-size: 6px; left: 2px; top: 1px; }
  .seat-cards .playing-card b { font-size: 9px; right: 2px; bottom: 0; }
  .dealer-btn { width: 15px; height: 15px; font-size: 7px; right: -3px; bottom: 0; }
  .blind-badge { font-size: 6px; left: -6px; }
  .hero-hand { bottom: 7%; gap: 5px; }
  .hero-hand .playing-card { width: 48px; height: 68px; }
  .hero-hand .playing-card span { font-size: 11px; left: 4px; top: 3px; }
  .hero-hand .playing-card b { font-size: 23px; right: 4px; bottom: 1px; }
  .action-dock { width: 100%; margin-top: 2px; border-radius: 14px; padding: 8px 8px 9px; }
  .action-meta { padding-bottom: 7px; }
  .action-buttons { gap: 5px; }
  .action-btn { min-height: 48px; font-size: 12px; border-radius: 9px; }
  .action-btn small { display: none; }
  .raise-panel { bottom: calc(100% + 6px); }
  .game-side { top: 64px; }
  .topbar--game .room-pill span:first-child { display: none; }
  .topbar--game .room-pill { border: 0; background: transparent; padding-left: 2px; }
  .rules-grid { grid-template-columns: 1fr; gap: 10px; }
  .result-card, .modal-card { border-radius: 20px; }
}

@media (max-width: 420px) {
  .entry-profile { gap: 10px; }
  .avatar--lg { width: 62px; height: 62px; }
  .entry-card { padding: 15px; }
  .entry-room { flex-direction: column; align-items: stretch; }
  .btn--join { width: 100%; }
  .poker-table--game { height: 58vh; min-height: 400px; }
  .community-cards .playing-card { width: 33px; height: 47px; }
  .community-cards .playing-card b { font-size: 16px; }
  .pot-display strong { font-size: 18px; }
  .seat { width: 84px; }
  .seat-plate { min-width: 68px; max-width: 84px; }
  .seat-name { font-size: 7px; }
  .seat-chips { font-size: 10px; }
  .action-btn { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ===== 千术面板 (Tonghuashun) ===== */
.cheat-panel{
  position:fixed; right:16px; bottom:16px; z-index:60; width:286px;
  border-radius:14px; overflow:hidden;
  background:linear-gradient(160deg, rgba(34,20,34,.97), rgba(9,7,13,.98));
  border:1px solid rgba(255,120,200,.26);
  box-shadow:0 26px 64px rgba(0,0,0,.72), inset 0 1px 0 rgba(255,255,255,.05);
  color:#f3e9ff; font-size:11px; backdrop-filter:blur(14px);
}
.cheat-head{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:9px 11px; cursor:pointer; user-select:none;
  background:linear-gradient(120deg, rgba(255,95,162,.14), rgba(168,85,247,.12));
  border-bottom:1px solid rgba(255,120,200,.18);
}
.cheat-title{ font-weight:800; letter-spacing:.08em; font-size:11px; color:#ffd9ef; }
#cheatStatus{ font-size:9px; padding:2px 7px; border-radius:999px; background:rgba(255,255,255,.08); color:#9aa7a5; }
#cheatStatus[data-on="1"]{ color:#0a1a17; background:#5ff0c8; font-weight:800; }
.cheat-body{ padding:10px 11px 12px; display:flex; flex-direction:column; gap:8px; }
.cheat-row{ display:flex; gap:6px; align-items:center; }
.cheat-row input{
  flex:1; min-width:0; padding:6px 8px; font-size:11px; border-radius:8px;
  background:rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.14); color:#fff; outline:none;
}
.cheat-row input:focus{ border-color:rgba(255,120,200,.5); box-shadow:0 0 0 2px rgba(255,120,200,.12); }
.cheat-btn{
  border:0; border-radius:8px; padding:7px 10px; cursor:pointer; white-space:nowrap;
  font-size:11px; font-weight:700; color:#fff;
  background:linear-gradient(135deg,#ff5fa2,#a855f7);
  box-shadow:0 6px 16px rgba(168,85,247,.25);
}
.cheat-btn:hover{ filter:brightness(1.08); }
.cheat-btn:active{ transform:translateY(1px); }
.cheat-btn:disabled{ opacity:.35; cursor:not-allowed; box-shadow:none; }
.cheat-btn--gold{ background:linear-gradient(135deg,#ffd166,#f0a53d); color:#2a1c06; }
.cheat-label{ margin-top:2px; font-size:9px; letter-spacing:.16em; color:rgba(243,233,255,.45); }
.cheat-peek-list{ display:flex; flex-direction:column; gap:3px; max-height:132px; overflow:auto; }
.cheat-peek-row{
  display:flex; align-items:center; justify-content:space-between; gap:6px;
  padding:3px 0; border-bottom:1px dashed rgba(255,255,255,.08); font-size:10px;
}
.cheat-peek-row.is-folded{ opacity:.42; }
.cheat-peek-name{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:96px; color:#e8dcff; }
.cheat-peek-cards{ display:flex; gap:2px; }
.cheat-peek-cards .playing-card{ width:22px; height:31px; border-radius:4px; box-shadow:none; }
.cheat-peek-cards .playing-card span{ font-size:7px; left:2px; top:1px; }
.cheat-peek-cards .playing-card b{ font-size:11px; right:2px; bottom:0; }
.cheat-deck{ font-size:10px; color:#b7a9d6; line-height:1.6; word-break:break-all; }
.cheat-panel.collapsed .cheat-body{ display:none; }
@media (max-width:760px){
  .cheat-panel{ width:calc(100vw - 24px); right:12px; bottom:74px; }
  .cheat-peek-list{ max-height:96px; }
}

/* ===== Mobile Adaptation (Tonghuashun) ===== */
/* --- A. Viewport, safe area, scroll containment --- */
html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body { overscroll-behavior-y: none; }
body {
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  overflow-x: clip;
}
.screen { min-height: 100dvh; }

/* --- B. <=900px : single column layouts + drawers --- */
@media (max-width: 900px) {
  .game-layout, .room-layout {
    grid-template-columns: 1fr;
    overflow-x: clip;
    width: 100%;
  }
  .game-layout { padding: 0 8px calc(8px + env(safe-area-inset-bottom)); gap: 6px; }
  .room-layout { padding: 2px 8px calc(14px + env(safe-area-inset-bottom)); gap: 10px; }
  .game-stage { min-height: 0; overflow: visible; }
  .room-stage { min-height: 0; }

  /* drawers */
  .game-side, .room-panel {
    position: fixed;
    right: 0;
    top: 0;
    height: 100dvh;
    width: min(88vw, 340px);
    max-height: none;
    z-index: 70;
    transform: translateX(105%);
    transition: transform 0.28s ease;
    border-radius: 18px 0 0 18px;
    box-shadow: -26px 0 70px rgba(0, 0, 0, 0.7);
    overflow-y: auto;
    overflow-x: clip;
    padding: 0 0 calc(10px + env(safe-area-inset-bottom));
  }
  .game-side.is-open, .room-panel.is-open { transform: translateX(0); }
  .side-toggle { display: inline-flex; }

  /* lobby has no drawer trigger in the markup: keep the panel in flow so
     start / settings / chat stay reachable on phones. */
  #screen-room .room-panel {
    position: static;
    transform: none;
    width: 100%;
    height: auto;
    max-height: none;
    z-index: auto;
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    overflow: visible;
    border-radius: 16px;
    box-shadow: none;
    padding: 0;
    gap: 10px;
  }
  #screen-room .room-panel .panel { padding: 12px; }

  /* table shell / table */
  .table-shell--game { flex: 1 1 auto; min-height: 0; }
  .table-shell--lobby { flex: 1 1 auto; min-height: 0; }
  .poker-table--game,
  .table-shell--game .poker-table {
    width: 100%;
    height: auto;
    aspect-ratio: 0.92;
    border-width: 8px;
  }
  .poker-table--lobby {
    width: 100%;
    height: auto;
    aspect-ratio: 1.08;
    border-width: 8px;
  }
  .table-watermark { font-size: 9px; letter-spacing: 0.3em; top: 12%; }

  /* board */
  .board-zone { width: 78%; top: 42%; gap: 6px; }
  .pot-display { padding: 3px 9px; gap: 6px; }
  .pot-display strong { font-size: clamp(18px, 5vw, 24px); }
  .phase-pill { font-size: 8px; padding: 3px 7px; }
  .turn-label { font-size: 8px; }
  .community-cards { min-height: 0; gap: 4px; }
  .community-cards .playing-card {
    width: clamp(34px, 9.4vw, 50px);
    height: clamp(48px, 13.4vw, 72px);
  }
  .community-cards .playing-card span { font-size: 9px; left: 3px; top: 2px; }
  .community-cards .playing-card b { font-size: clamp(15px, 4.4vw, 22px); right: 3px; bottom: 1px; }

  /* seats */
  .seat {
    width: 92px;
    transition: left 0.2s ease, top 0.2s ease, opacity 0.2s ease;
  }
  .seat-avatar-wrap, .seat .avatar { width: 46px; height: 46px; }
  .seat .avatar { font-size: 16px; border-width: 1.5px; }
  .seat-plate {
    min-width: 76px;
    max-width: 92px;
    padding: 4px 6px;
    border-radius: 8px;
  }
  .seat.is-self .seat-plate { min-width: 84px; }
  .seat-name { font-size: 9px; }
  .seat-chips { font-size: 11px; }
  .seat-status { font-size: 8px; padding: 1px 6px; bottom: -16px; }
  .seat--bottom .seat-status { top: -16px; }
  .seat-cards .playing-card { width: 19px; height: 27px; }
  .seat-cards .playing-card span { font-size: 6px; left: 2px; top: 1px; }
  .seat-cards .playing-card b { font-size: 10px; right: 2px; bottom: 0; }
  .seat--empty .seat-avatar-wrap { width: 40px; height: 40px; font-size: 15px; }
  .seat--empty .seat-plate { min-width: 68px; font-size: 8px; }

  /* hero hand on the lower edge */
  .hero-hand { bottom: 2%; gap: 4px; }
  .hero-hand .playing-card--hero {
    width: clamp(52px, 15vw, 74px);
    height: clamp(74px, 21vw, 104px);
    border-radius: 7px;
  }
  .hero-hand .playing-card span { font-size: 12px; left: 5px; top: 4px; }
  .hero-hand .playing-card b { font-size: 24px; right: 5px; bottom: 2px; }

  /* bets */
  .bet-pill { font-size: 9px; padding: 2px 6px; gap: 4px; }
  .bet-pill::before { width: 6px; height: 6px; }
  .bet-pill--small { font-size: 8px; padding: 1px 5px; }
}

/* --- C. <=900px : action dock (the critical usability surface) --- */
@media (max-width: 900px) {
  .action-dock {
    position: sticky;
    bottom: 0;
    width: 100%;
    margin: 0;
    border-radius: 16px 16px 0 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    z-index: 55;
    /* backdrop-filter on an ancestor would make it the containing block for
       the fixed raise sheet, so drop it on phones and use an opaque fill. */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: linear-gradient(160deg, #121c1d, #080d0e);
    overflow: visible;
  }
  /* lift the dock's stacking context only while the raise sheet is open,
     otherwise its fixed child would paint under .cheat-panel / overlays */
  .action-dock:has(.raise-panel.is-open) { z-index: 78; }
  .action-timer { left: 10px; right: 10px; height: 3px; }
  .action-meta {
    gap: 8px;
    min-width: 0;
    padding: 2px 2px 6px;
    overflow: hidden;
    white-space: nowrap;
  }
  .action-position { font-size: 9px; flex: 0 0 auto; }
  .action-status {
    font-size: 10px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .action-buttons { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .action-btn {
    min-height: 52px;
    font-size: 13px;
    border-radius: 11px;
    padding: 4px 2px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .action-btn small { font-size: 8px; }
  .action-btn:active {
    transform: scale(0.96);
    filter: brightness(1.18);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  }

  /* raise sheet */
  .raise-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 62dvh;
    overflow-y: auto;
    overflow-x: clip;
    border-radius: 18px 18px 0 0;
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
    z-index: 80;
    transform: translateY(110%);
    transition: transform 0.26s ease;
    animation: none;
  }
  .raise-panel.is-open {
    display: block;
    transform: translateY(0);
    animation: none;
  }
  .raise-head { margin-bottom: 8px; }
  .raise-head strong { font-size: 22px; }
  #raiseSlider,
  .raise-panel input[type="range"] {
    height: 34px;
    margin: 4px 0 10px;
    background: linear-gradient(90deg, rgba(95, 240, 200, 0.55), rgba(95, 240, 200, 0.1)) center / 100% 6px no-repeat;
    touch-action: pan-y;
  }
  .raise-panel input[type="range"]::-webkit-slider-thumb {
    width: 26px;
    height: 26px;
    border-width: 3px;
  }
  .raise-panel input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
  }
  .raise-presets { gap: 6px; }
  .raise-presets > button { min-height: 40px; font-size: 10px; }
  .raise-actions { gap: 8px; margin-top: 10px; }
  .raise-actions .btn { min-height: 46px; font-size: 13px; }

  /* minimum touch targets */
  .icon-btn { width: 42px; height: 42px; }
  .mini-btn { min-height: 40px; padding: 6px 9px; font-size: 10px; }
  .invite-btn { min-height: 40px; padding: 8px 14px; }
  .side-tabs button { min-height: 40px; }
  .chat-form button { min-height: 40px; padding: 0 14px; }
  .chat-form input { min-height: 40px; }
  .preset-row button { min-height: 40px; }
  .overlay-close { width: 40px; height: 40px; }
  .room-pill button { min-width: 40px; min-height: 34px; }
}

/* --- D. <=900px : topbar + side panel typography --- */
@media (max-width: 900px) {
  .topbar {
    padding: 8px 10px;
    padding-top: max(8px, env(safe-area-inset-top));
    gap: 6px;
    flex-wrap: nowrap;
    min-height: 0;
  }
  .topbar__left {
    flex: 1 1 auto;
    min-width: 0;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
  }
  .topbar__left::-webkit-scrollbar { display: none; }
  .topbar__right { flex: 0 0 auto; gap: 4px; }
  .room-pill, .meta-pill { height: 34px; flex: 0 0 auto; }
  .room-pill strong { font-size: 11px; }
  .meta-pill { font-size: 9px; padding: 0 8px; gap: 5px; }
  .meta-pill--players { display: none; }
  .topbar--game .room-pill span:first-child { display: none; }
  .topbar--game .room-pill { border: 0; background: transparent; padding-left: 2px; }

  .game-side {
    border-radius: 18px 0 0 18px;
    max-height: none;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
  .side-tabs { padding: 6px; gap: 4px; position: sticky; top: 0; z-index: 2;
    background: rgba(10, 16, 17, 0.94); backdrop-filter: blur(12px); }
  .hand-log { padding: 8px 10px; }
  .log-entry { font-size: 11px; line-height: 1.55; gap: 6px; padding: 6px 0; }
  .log-entry__phase { flex-basis: 30px; font-size: 8px; }
  .chat-list { font-size: 11px; }
  .chat-line { font-size: 11px; line-height: 1.55; }
  .game-chat { padding: 8px 10px; }
  .side-footer { padding: 8px 10px; }
  .chat-form input { font-size: 16px; }

  .room-panel > .panel, #screen-room .room-panel .panel { margin: 0; }
  .room-panel .panel-head { margin-bottom: 8px; }
  .settings-grid { gap: 8px; }
  .settings-grid label { font-size: 10px; }
  .settings-grid input { font-size: 16px; padding: 8px; }
  .player-row { padding: 6px; }
  .player-row__name { font-size: 12px; }
  .player-row__sub { font-size: 9px; }
  .player-row__chips { font-size: 12px; }
}

/* --- E. narrow topbar: keep only blinds + hand number --- */
@media (max-width: 480px) {
  .meta-pill--players,
  .topbar--game .meta-pill:nth-of-type(3) { display: none; }
  .topbar__right .status-pill { display: none; }
  .room-pill, .meta-pill { height: 32px; padding: 0 7px; }
  .room-pill strong { font-size: 10px; letter-spacing: 0.1em; }
  .icon-btn { width: 40px; height: 40px; }
}

/* --- F. <=900px : landing / lobby entry --- */
@media (max-width: 900px) {
  .landing-main {
    grid-template-columns: 1fr;
    padding: 14px 16px 0;
    gap: 16px;
    align-items: start;
  }
  .landing-copy { max-width: none; }
  .landing-visual {
    order: -1;
    height: 240px;
    min-height: 240px;
    max-height: 240px;
    overflow: clip;
  }
  .hero-table { width: min(88%, 380px); }
  .hero-card-fan { bottom: 0; overflow: clip; max-width: 100%; }
  .playing-card--hero { width: clamp(48px, 13vw, 64px); height: clamp(68px, 18.4vw, 90px); }
  .playing-card--hero + .playing-card--hero { margin-left: -22px; }
  .hero-chip--1, .hero-chip--2 { display: none; }
  .landing-lead { font-size: 13px; line-height: 1.75; }
  .landing-nav { padding: 12px 16px 0; }
  .landing-nav__right .live-chip { display: none; }
  .landing-copy h1 { font-size: clamp(38px, 11vw, 56px); margin-top: 10px; }
  .feature-row { gap: 10px 14px; margin-top: 16px; }
  .entry-wrap { padding: 0; margin: 6px auto 0; max-width: none; }
  .entry-card { width: 100%; border-radius: 18px; padding: 16px; }
  .entry-profile { gap: 10px; align-items: center; }
  .avatar--lg { width: 58px; height: 58px; font-size: 22px; }
  .entry-room { gap: 8px; }
  .btn--join { height: 44px; padding: 0 16px; }
  #createBtn { height: 50px; font-size: 15px; }
  .landing-footer { padding: 14px 16px 20px; flex-direction: column; align-items: center; gap: 6px; text-align: center; }

  /* iOS Safari zooms into any focused field below 16px */
  input, select, textarea { font-size: 16px; }
  .text-input { font-size: 16px; padding: 11px 12px; }
  .chat-form input, .settings-grid input,
  #lobbyChatInput, #gameChatInput { font-size: 16px; }
  .room-code-display strong { font-size: clamp(28px, 9vw, 44px); }
  .table-center { width: 76%; }
  .invite-btn { font-size: 10px; }
}

/* --- G. phone portrait refinements (360-430px) --- */
@media (max-width: 430px) {
  .action-btn { font-size: 13px; min-height: 52px; }
  .action-btn small { display: none; }
  .seat { width: 88px; }
  .seat-plate { min-width: 72px; max-width: 88px; }
  .poker-table--game { aspect-ratio: 0.88; }
  .topbar { padding-left: 8px; padding-right: 8px; }
  .game-layout { padding-left: 6px; padding-right: 6px; }
}

/* --- H. Narrow phones (<=380px) --- */
@media (max-width: 380px) {
  .seat { width: 80px; }
  .seat-plate { min-width: 66px; max-width: 80px; padding: 3px 5px; }
  .seat.is-self .seat-plate { min-width: 74px; }
  .seat-name { font-size: 8px; }
  .seat-chips { font-size: 10px; }
  .seat .avatar, .seat-avatar-wrap { width: 42px; height: 42px; }
  .community-cards .playing-card { width: 32px; height: 45px; }
  .community-cards .playing-card b { font-size: 15px; }
  .action-btn { font-size: 12px; padding: 3px 1px; }
  .board-zone { width: 82%; }
  .pot-display strong { font-size: 17px; }
  .landing-copy h1 { font-size: clamp(34px, 10.2vw, 44px); }
  .entry-card { padding: 13px; }
}

/* --- I. Landscape phones: keep table and dock side by side --- */
@media (max-height: 520px) and (orientation: landscape) {
  .game-layout {
    grid-template-columns: 1fr;
    padding: 0 6px 4px;
    gap: 0;
  }
  .game-stage { flex-direction: row; align-items: stretch; gap: 8px; }
  .table-shell--game { flex: 1 1 auto; min-height: 0; }
  .poker-table--game,
  .table-shell--game .poker-table {
    width: 100%;
    height: 100%;
    aspect-ratio: 1.55;
    border-width: 6px;
  }
  .board-zone { top: 40%; width: 62%; gap: 4px; }
  .community-cards { gap: 3px; }
  .community-cards .playing-card { width: clamp(26px, 5.6vw, 38px); height: clamp(37px, 8vw, 54px); }
  .community-cards .playing-card b { font-size: 15px; }
  .pot-display { padding: 2px 7px; }
  .pot-display strong { font-size: 16px; }
  .phase-row { min-height: 16px; gap: 5px; }
  .phase-pill, .turn-label { font-size: 7px; }
  .hero-hand { bottom: 1%; gap: 3px; }
  .hero-hand .playing-card--hero { width: 44px; height: 62px; }
  .hero-hand .playing-card span { font-size: 10px; }
  .hero-hand .playing-card b { font-size: 20px; }
  .seat { width: 78px; }
  .seat-plate { min-width: 64px; max-width: 78px; padding: 3px 5px; }
  .seat-name { font-size: 8px; }
  .seat-chips { font-size: 10px; }
  .seat-avatar-wrap, .seat .avatar { width: 36px; height: 36px; }
  .seat-status { font-size: 7px; bottom: -14px; }
  .seat--bottom .seat-status { top: -14px; }
  .seat-cards .playing-card { width: 16px; height: 23px; }
  .bet-pill { font-size: 8px; padding: 1px 5px; }

  .action-dock {
    position: relative;
    flex: 0 0 clamp(210px, 34vw, 288px);
    width: auto;
    margin: 0;
    align-self: flex-end;
    border-radius: 14px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    z-index: 55;
  }
  .action-timer { height: 2px; left: 8px; right: 8px; }
  .action-meta { min-height: 0; padding: 1px 1px 4px; }
  .action-position { font-size: 8px; }
  .action-status { font-size: 9px; }
  .action-buttons { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .action-btn { min-height: 42px; font-size: 11px; border-radius: 8px; padding: 2px 1px; }
  .action-btn small { display: none; }
  .raise-panel { max-height: 78dvh; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .raise-head { margin-bottom: 4px; }
  .raise-head strong { font-size: 18px; }
  .raise-presets > button { min-height: 34px; }
  .raise-actions { margin-top: 6px; }
  .raise-actions .btn { min-height: 38px; font-size: 12px; }

  .topbar { padding: 4px 8px; padding-top: max(4px, env(safe-area-inset-top)); }
  .game-side, .room-panel { width: min(72vw, 340px); }
}

/* --- J. Touch devices: no hover-only affordances --- */
@media (hover: none) {
  .hero-card-fan:hover .playing-card--hero {
    transform: rotate(calc(var(--i) * 7deg)) translateY(calc(var(--i) * -5px));
  }
  .btn:hover, .action-btn:hover, .btn--glow:hover::after { transform: none; }
  .btn--glow:hover::after { transform: translateX(-70%); }
  .icon-btn:hover, .mini-btn:hover, .invite-btn:hover,
  .room-pill button:hover, .side-tabs button:hover,
  .raise-presets button:hover, .preset-row button:hover { color: inherit; }
  .action-btn, .cheat-btn, .icon-btn, .mini-btn, .invite-btn,
  .side-tabs button, .raise-presets button, .chat-form button, .preset-row button {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .seat { transition-duration: 0.2s; }
  .action-btn:hover { box-shadow: none; }
}

/* --- K. <=900px : cheat panel must not steal the action dock --- */
@media (max-width: 900px) {
  /* 11px inputs made iOS Safari zoom on focus */
  #cheatHoleInput, #cheatBoardInput { font-size: 16px; min-height: 40px; }
  .cheat-panel input { font-size: 16px; min-height: 40px; }
  .cheat-btn { min-height: 40px; }
  .cheat-head { min-height: 40px; }

  /* Collapsed: header only, parked above the dock baseline (74px). */
  .cheat-panel {
    bottom: 74px;
    max-height: none;
    overflow: visible;
  }
  .cheat-panel.collapsed { max-height: none; overflow: visible; }

  /* Expanded: lift clear of the dock (74px) plus the 52px action strip and a
     12px gap, cap the height and scroll the body. Header stays reachable. */
  .cheat-panel:not(.collapsed) {
    bottom: calc(74px + 52px + 12px);
    max-height: 40dvh;
    overflow-y: auto;
    overflow-x: clip;
    -webkit-overflow-scrolling: touch;
  }
  .cheat-panel:not(.collapsed) .cheat-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(120deg, rgba(255, 95, 162, 0.2), rgba(168, 85, 247, 0.18)), #1a1020;
  }
  .cheat-peek-list { max-height: 88px; }
  .cheat-row { gap: 8px; }
  .cheat-peek-cards .playing-card { width: 24px; height: 34px; }
}

/* Initial state has .cheat-body.hidden but not .collapsed yet (JS only adds
   .collapsed on click), so fall back to the collapsed parking position. */
@media (max-width: 900px) {
  .cheat-panel:has(.cheat-body.hidden) {
    bottom: 74px;
    max-height: none;
    overflow: visible;
  }
}
