/* Classic Bingo — one stylesheet for the big screen and the phone. */

:root {
  --bg: #0f0626;
  --panel: rgba(255, 255, 255, 0.055);
  --panel-strong: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f6f1ff;
  --muted: #a99ec9;
  --cream: #fffaf0;
  --ink: #1a0a30;
  --yellow: #ffd400;
  --pink: #ff3d81;
  --mint: #35e3b0;
  --blue: #7c9dff;
  --red: #ff4d6d;
  --orange: #ff9f1c;
  --radius: 22px;
  --shadow: 0 24px 60px rgba(3, 0, 15, 0.5);
}

* {
  box-sizing: border-box;
}

/* The `hidden` attribute must win over the component display rules below. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100dvh;
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1100px 700px at 10% -12%, rgba(124, 157, 255, 0.28), transparent 62%),
    radial-gradient(900px 620px at 96% -4%, rgba(255, 61, 129, 0.22), transparent 58%),
    radial-gradient(800px 700px at 50% 118%, rgba(53, 227, 176, 0.16), transparent 62%),
    var(--bg);
  background-attachment: fixed;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
select {
  font-family: inherit;
}

a {
  color: inherit;
}

.kicker {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.sub {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.hint {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 900;
  font-size: 1.12rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
}

.brand.small {
  font-size: 0.98rem;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 9px);
  gap: 3px;
}

.brand-mark i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--pink);
}

.brand-mark i:nth-child(2) {
  background: var(--yellow);
}
.brand-mark i:nth-child(3) {
  background: var(--mint);
}
.brand-mark i:nth-child(4) {
  background: var(--blue);
}

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  transition: transform 0.14s ease, box-shadow 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  background: linear-gradient(135deg, #ffe04a, #ffb400);
  color: #231000;
  box-shadow: 0 12px 28px rgba(255, 196, 0, 0.26);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn.tiny {
  padding: 8px 14px;
  font-size: 0.82rem;
}

.btn.big {
  padding: 16px 30px;
  font-size: 1.04rem;
}

.btn.block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}

.pill b {
  color: var(--text);
}

.room-badge {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.room-badge b {
  font-size: 1.05rem;
  letter-spacing: 0.16em;
  margin-left: 4px;
}

/* ------------------------------------------------------------------ landing */

.landing-page {
  display: grid;
  place-items: center;
  padding: 36px 24px;
  position: relative;
  overflow-x: hidden;
}

.landing-glow {
  position: absolute;
  width: 640px;
  height: 640px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 61, 129, 0.2), transparent 65%);
  top: -220px;
  right: -160px;
  pointer-events: none;
}

.landing {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  grid-template-areas:
    "copy side"
    "foot foot";
  gap: 48px 56px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.landing-copy {
  grid-area: copy;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}

.landing h1 {
  font-size: clamp(2.4rem, 5.2vw, 4.1rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 900;
}

.landing h1 em {
  font-style: normal;
  background: linear-gradient(100deg, #ffd400, #ff7ab6 55%, #7c9dff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.landing-copy .sub {
  max-width: 33rem;
}

.landing-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.landing-or {
  color: var(--muted);
  font-size: 0.88rem;
}

.landing-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.landing-side {
  grid-area: side;
}

.preview-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  transform: rotate(-1.2deg);
}

.preview-card {
  background: var(--cream);
  color: var(--ink);
  border-radius: 26px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.preview-head {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.preview-head span {
  display: grid;
  place-items: center;
  height: 30px;
  border-radius: 9px;
  font-weight: 900;
  font-size: 0.86rem;
  background: var(--pink);
  color: #fff;
}

.preview-head span:nth-child(1) {
  background: var(--red);
}
.preview-head span:nth-child(2) {
  background: var(--orange);
}
.preview-head span:nth-child(3) {
  background: var(--yellow);
  color: var(--ink);
}
.preview-head span:nth-child(4) {
  background: var(--mint);
  color: var(--ink);
}
.preview-head span:nth-child(5) {
  background: var(--blue);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.preview-grid span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px solid #ece1c9;
  background: #fff;
  font-weight: 800;
  font-size: clamp(0.9rem, 2.4vw, 1.25rem);
}

.preview-grid span.daub {
  background: radial-gradient(circle at 35% 28%, #ff8ab6, #e0216b 72%);
  border-color: transparent;
  color: #fff;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.15);
}

.preview-grid span.free {
  background: radial-gradient(circle at 35% 28%, #ffe98a, #ffc400 72%);
  border-color: transparent;
  color: var(--ink);
  font-size: 0.62rem;
  letter-spacing: 0.05em;
}

.join-card {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 18px;
  backdrop-filter: blur(12px);
}

.join-card label {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.join-row-nowrap {
  display: flex;
  gap: 10px;
}

.code-input {
  width: 100%;
  min-width: 0;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(8, 2, 22, 0.5);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  outline: none;
}

.code-input::placeholder {
  color: rgba(246, 241, 255, 0.28);
}

.code-input:focus {
  border-color: rgba(255, 212, 0, 0.7);
  box-shadow: 0 0 0 3px rgba(255, 212, 0, 0.14);
}

.join-card .hint {
  margin-top: 9px;
}

.landing-foot {
  grid-area: foot;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.landing-foot div {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.landing-foot b {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  font-size: 0.8rem;
  flex: none;
}

/* --------------------------------------------------------------------- top */

.host-page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.topbar,
.pbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px clamp(16px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  background: rgba(15, 6, 38, 0.55);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.room-badge {
  margin-left: 8px;
}

.stage {
  flex: 1;
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 36px) clamp(16px, 3vw, 34px) 40px;
  display: flex;
  flex-direction: column;
}

.center-card {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  padding: 40px 24px;
}

.center-card h1 {
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
}

.loading {
  color: var(--muted);
  font-size: 1rem;
  animation: breathe 1.6s ease-in-out infinite;
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

/* -------------------------------------------------------------------- setup */

.setup {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: clamp(28px, 5vw, 70px);
  align-items: center;
  margin: auto 0;
  width: 100%;
}

.setup-copy {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.setup-copy h1 {
  font-size: clamp(2.1rem, 4.4vw, 3.5rem);
  line-height: 1.03;
  letter-spacing: -0.035em;
  font-weight: 900;
}

.setup-copy h1 em {
  font-style: normal;
  color: var(--yellow);
}

.setup-copy .sub {
  max-width: 34rem;
}

.setup-points {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.setup-points li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.setup-points li > span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  font-size: 1.15rem;
  flex: none;
}

.setup-points b {
  display: block;
  font-size: 0.98rem;
}

.setup-points small {
  color: var(--muted);
  font-size: 0.85rem;
}

.setup-card {
  background: rgba(255, 255, 255, 0.065);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: clamp(22px, 3vw, 32px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.setup-card h2 {
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field > span {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  padding: 13px 15px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(8, 2, 22, 0.45);
  color: var(--text);
  font-size: 1rem;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: rgba(255, 212, 0, 0.6);
  box-shadow: 0 0 0 3px rgba(255, 212, 0, 0.12);
}

.field select option {
  background: #1b0d3e;
}

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  background: rgba(8, 2, 22, 0.45);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.seg button {
  padding: 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

.seg button.on {
  background: var(--cream);
  color: var(--ink);
}

/* -------------------------------------------------------------------- lobby */

.lobby {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: clamp(20px, 3vw, 36px);
  flex: 1;
}

.join-panel,
.roster {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: clamp(22px, 3vw, 34px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pin-label {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.pin-big {
  font-size: clamp(3rem, 7vw, 5.2rem);
  font-weight: 900;
  letter-spacing: 0.16em;
  line-height: 1;
  color: var(--yellow);
  text-shadow: 0 8px 40px rgba(255, 212, 0, 0.3);
}

.qr-frame {
  align-self: flex-start;
  background: #fff;
  border-radius: 20px;
  padding: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.qr-code svg {
  display: block;
  width: clamp(140px, 18vw, 200px);
  height: auto;
}

.join-url {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.88rem;
}

.join-url b {
  color: var(--text);
}

.lobby-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.tag {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.78rem;
  color: var(--text);
}

.roster-head {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.95rem;
}

.roster-head b {
  color: var(--text);
  font-size: 1.3rem;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 0 rgba(53, 227, 176, 0.55);
  animation: live 2s infinite;
  flex: none;
}

@keyframes live {
  0% {
    box-shadow: 0 0 0 0 rgba(53, 227, 176, 0.5);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(53, 227, 176, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(53, 227, 176, 0);
  }
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-content: flex-start;
  min-height: 40px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px 7px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  font-size: 0.88rem;
  font-weight: 600;
  animation: chipIn 0.25s ease;
}

@keyframes chipIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.94);
  }
}

.chip-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  font-size: 1.05rem;
}

.lobby-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.empty-balls {
  display: flex;
  gap: 8px;
}

.empty-balls i {
  display: grid;
  place-items: center;
  width: clamp(38px, 4.6vw, 52px);
  height: clamp(38px, 4.6vw, 52px);
  border-radius: 50%;
  font-style: normal;
  font-weight: 900;
  color: var(--ink);
  background: var(--yellow);
  opacity: 0.5;
  animation: bob 2.4s ease-in-out infinite;
}

.empty-balls i:nth-child(1) {
  background: var(--red);
  color: #fff;
}
.empty-balls i:nth-child(2) {
  background: var(--orange);
  animation-delay: 0.12s;
}
.empty-balls i:nth-child(3) {
  background: var(--yellow);
  animation-delay: 0.24s;
}
.empty-balls i:nth-child(4) {
  background: var(--mint);
  animation-delay: 0.36s;
}
.empty-balls i:nth-child(5) {
  background: var(--blue);
  animation-delay: 0.48s;
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

.roster-foot {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: auto;
  flex-wrap: wrap;
}

.roster-foot .btn.primary {
  flex: 1;
  min-width: 200px;
}

/* ------------------------------------------------------------------ playing */

.live {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.55fr);
  gap: clamp(18px, 3vw, 34px);
  flex: 1;
}

.call-panel,
.board-panel {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: clamp(20px, 2.6vw, 32px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.call-panel {
  align-items: center;
  text-align: center;
}

.call-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
}

.ball {
  --c: var(--pink);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 46%),
    var(--c);
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.42), inset 0 -12px 0 rgba(0, 0, 0, 0.15);
}

.ball.mega {
  width: clamp(180px, 21vw, 250px);
  aspect-ratio: 1;
  margin: 6px 0;
}

.ball-letter {
  font-size: clamp(0.9rem, 1.6vw, 1.2rem);
  font-weight: 900;
  letter-spacing: 0.32em;
  margin-left: 0.32em;
  opacity: 0.9;
}

.ball-num {
  font-size: clamp(3.4rem, 6.4vw, 5.4rem);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: -0.03em;
}

.ball.empty {
  background: rgba(255, 255, 255, 0.05);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  box-shadow: none;
  color: var(--muted);
}

.ball-wait {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
}

.ball.pop {
  animation: ballPop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes ballPop {
  0% {
    transform: scale(0.7) rotate(-6deg);
  }
  60% {
    transform: scale(1.06) rotate(2deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

.call-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.auto-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.87rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.switch input {
  appearance: none;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  position: relative;
  cursor: pointer;
  transition: background 0.18s;
  margin: 0;
  flex: none;
}

.switch input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s;
}

.switch input:checked {
  background: var(--mint);
}

.switch input:checked::after {
  transform: translateX(14px);
}

.auto-row select {
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(8, 2, 22, 0.5);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
}

.board-panel {
  min-width: 0;
}

.board-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.board75 {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.brow {
  display: grid;
  grid-template-columns: clamp(30px, 3vw, 42px) repeat(15, minmax(0, 1fr));
  gap: 6px;
}

.bletter {
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-weight: 900;
  color: var(--ink);
  background: var(--c);
  font-size: clamp(0.8rem, 1vw, 1rem);
}

.bcell {
  display: grid;
  place-items: center;
  height: clamp(28px, 3.4vw, 44px);
  border-radius: 10px;
  font-size: clamp(0.62rem, 0.88vw, 0.92rem);
  font-weight: 700;
  color: rgba(246, 241, 255, 0.42);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.055);
  transition: background 0.25s, color 0.25s, transform 0.25s;
}

.bcell.hit {
  color: var(--ink);
  background: var(--cream);
  border-color: var(--cream);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
}

.bcell.current {
  background: var(--yellow);
  border-color: var(--yellow);
  transform: scale(1.08);
  z-index: 1;
}

.history-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.hist-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  min-height: 46px;
  align-items: center;
  scrollbar-width: thin;
}

.hchip {
  --c: var(--pink);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  font-weight: 800;
  font-size: 0.9rem;
  white-space: nowrap;
  flex: none;
}

.hchip i {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c);
  color: var(--ink);
  font-style: normal;
  font-size: 0.7rem;
  font-weight: 900;
}

/* ----------------------------------------------------------------- finished */

.finish {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 20px;
  max-width: 780px;
}

.finish-avatar {
  font-size: clamp(3.6rem, 8vw, 6rem);
  line-height: 1;
  filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.4));
  animation: ballPop 0.6s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.finish h1 {
  font-size: clamp(2.4rem, 5.6vw, 4.2rem);
  line-height: 1;
  letter-spacing: -0.035em;
  font-weight: 900;
  background: linear-gradient(100deg, #ffd400, #ff7ab6 60%, #7c9dff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.finish-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 8px 0;
}

.finish-stats div {
  min-width: 128px;
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.finish-stats b {
  font-size: 1.35rem;
}

.finish-stats span {
  color: var(--muted);
  font-size: 0.78rem;
}

.winners-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.wchip {
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  font-size: 0.82rem;
}

.finish-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 6px;
}

.win-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.win-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--yellow);
}

.win-card {
  width: min(340px, 74vw);
  background: var(--cream);
  border-radius: 18px;
  padding: 10px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
}

.win-card-head {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-bottom: 6px;
}

.win-card-head span {
  display: grid;
  place-items: center;
  height: 26px;
  border-radius: 8px;
  background: var(--c);
  color: var(--ink);
  font-weight: 900;
  font-size: 0.8rem;
}

.win-card-head span:first-child,
.win-card-head span:last-child {
  color: #fff;
}

.win-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.win-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #fff;
  border: 1.5px solid #e9dec6;
  color: var(--ink);
  font-weight: 800;
  font-size: clamp(0.8rem, 1.4vw, 1.05rem);
}

.win-cell.free {
  background: #ffe9a8;
  border-color: transparent;
  font-size: 0.55rem;
  letter-spacing: 0.05em;
}

.win-cell.line {
  background: radial-gradient(circle at 35% 28%, #fff6b8, #ffc400 74%);
  border-color: transparent;
  color: #231000;
  box-shadow: 0 0 0 3px rgba(255, 212, 0, 0.35);
  animation: winGlow 1.8s ease-in-out infinite;
}

@keyframes winGlow {
  0%,
  100% {
    box-shadow: 0 0 0 2px rgba(255, 212, 0, 0.25);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(255, 212, 0, 0.12);
  }
}

.pend-card-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(100%, 360px);
  margin: 4px 0 2px;
}

.pend-card {
  width: 100%;
  margin: 0;
}

/* ------------------------------------------------------------------ player */

.play-page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.pbar {
  padding: 11px 16px;
}

.pbar .pill {
  margin-left: auto;
}

.pstage {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 14px 24px;
  display: flex;
  flex-direction: column;
}

.big-avatar {
  font-size: clamp(4.2rem, 16vw, 5.2rem);
  line-height: 1;
}

/* join */

.join-flow {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 4px 0;
}

.join-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}

.join-head h1 {
  font-size: 2rem;
  letter-spacing: -0.03em;
}

.code-input.big {
  font-size: 1.5rem;
  padding: 15px 18px;
  letter-spacing: 0.34em;
  text-align: center;
}

.emoji-groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 360px;
  overflow-y: auto;
  padding: 2px 4px 2px 0;
  scrollbar-width: thin;
}

.emoji-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.emoji-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 7px;
}

.emoji-btn {
  aspect-ratio: 1;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  font-size: clamp(1.45rem, 4vw, 1.8rem);
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: transform 0.12s, background 0.15s;
}

.emoji-btn:hover {
  transform: translateY(-1px);
}

.emoji-btn.on {
  background: var(--cream);
  border-color: var(--cream);
  box-shadow: 0 6px 18px rgba(255, 250, 240, 0.25);
}

.form-error {
  color: #ff8fa8;
  font-size: 0.86rem;
  min-height: 1.2em;
}

/* waiting */

.waiting {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  padding: 18px 6px;
}

.ticket {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.ticket::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--red), var(--orange), var(--yellow), var(--mint), var(--blue));
}

.ticket-avatar {
  font-size: clamp(3.8rem, 14vw, 4.8rem);
  line-height: 1.1;
  margin-top: 8px;
}

.ticket-name {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.ticket-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.ticket-rule {
  margin-top: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 212, 0, 0.14);
  color: var(--yellow);
  font-size: 0.78rem;
  font-weight: 700;
}

.waiting-note {
  color: var(--muted);
  font-size: 0.95rem;
}

.room-count {
  font-size: 0.92rem;
  color: var(--muted);
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}

.room-count b {
  color: var(--text);
  font-size: 1.05rem;
}

.dots {
  display: inline-flex;
  gap: 6px;
}

.dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: bob 1.2s ease-in-out infinite;
}

.dots i:nth-child(2) {
  animation-delay: 0.18s;
}
.dots i:nth-child(3) {
  animation-delay: 0.36s;
}

/* card */

.play-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.call-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.ball.mini {
  width: 56px;
  height: 56px;
  flex: none;
  gap: 0;
}

.ball.mini .ball-letter {
  font-size: 0.62rem;
  letter-spacing: 0.24em;
  margin-left: 0.24em;
}

.ball.mini .ball-num {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.call-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.call-text b {
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}

.call-text .hint {
  font-size: 0.78rem;
}

.call-banner .btn {
  margin-left: auto;
}

.call-banner .btn.on {
  background: var(--cream);
  color: var(--ink);
}

.called-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(8, 2, 22, 0.4);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-x: auto;
}

.prow {
  display: grid;
  grid-template-columns: 26px repeat(15, minmax(0, 1fr));
  gap: 4px;
  min-width: 340px;
}

.pletter {
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--c);
  color: var(--ink);
  font-weight: 900;
  font-size: 0.72rem;
}

.pn {
  display: grid;
  place-items: center;
  height: 22px;
  border-radius: 5px;
  font-size: 0.62rem;
  font-weight: 700;
  color: rgba(246, 241, 255, 0.4);
  background: rgba(255, 255, 255, 0.05);
}

.pn.hit {
  background: var(--cream);
  color: var(--ink);
}

.pcard {
  background: var(--cream);
  color: var(--ink);
  border-radius: 22px;
  padding: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
  margin-top: auto;
}

.pcard-head {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-bottom: 7px;
}

.pcard-head span {
  display: grid;
  place-items: center;
  height: 30px;
  border-radius: 9px;
  background: var(--c);
  color: var(--ink);
  font-weight: 900;
  font-size: 0.88rem;
}

.pcard-head span:first-child,
.pcard-head span:last-child {
  color: #fff;
}

.pgrid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.pcell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 2px solid #e9dec6;
  background: #fff;
  color: var(--ink);
  font-size: clamp(1.05rem, 5vw, 1.55rem);
  font-weight: 800;
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s ease, background 0.16s ease, box-shadow 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}

.pcell:active {
  transform: scale(0.93);
}

.pcell.daubed {
  background: radial-gradient(circle at 35% 28%, #ff8ab6, #e0216b 72%);
  color: #fff;
  border-color: transparent;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.16), 0 6px 14px rgba(224, 33, 107, 0.32);
  animation: daub 0.22s ease;
}

@keyframes daub {
  0% {
    transform: scale(0.86);
  }
  70% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
  }
}

.pcell.free {
  background: radial-gradient(circle at 35% 28%, #ffe98a, #ffc400 72%);
  border-color: transparent;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.1);
  cursor: default;
}

/* The completed line on the winner's result card. Declared after .daubed so it
   wins the cascade even if the player had tapped those squares. */
.pcell.win {
  background: radial-gradient(circle at 35% 28%, #fff6b8, #ffc400 74%);
  color: #231000;
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(255, 212, 0, 0.35), inset 0 -6px 0 rgba(0, 0, 0, 0.1);
  animation: winGlow 1.8s ease-in-out infinite;
}

.pfree {
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  font-weight: 900;
}

.play-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  text-align: center;
  padding-bottom: env(safe-area-inset-bottom);
}

.bingo-btn {
  width: 100%;
  padding: 17px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, #ffd400, #ffb400);
  color: #231000;
  font-size: 1.18rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(255, 196, 0, 0.24);
  transition: transform 0.12s;
}

.bingo-btn:active {
  transform: scale(0.98);
}

.bingo-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.bingo-btn.ready {
  background: linear-gradient(135deg, var(--mint), var(--blue));
  box-shadow: 0 0 0 0 rgba(53, 227, 176, 0.5);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(53, 227, 176, 0.55);
    transform: scale(1);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(53, 227, 176, 0);
    transform: scale(1.012);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(53, 227, 176, 0);
    transform: scale(1);
  }
}

.shake {
  animation: shake 0.5s;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-7px);
  }
  40% {
    transform: translateX(7px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

/* player finish */

.pend {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 20px 6px;
  width: 100%;
}

.pend h1 {
  font-size: clamp(1.9rem, 8vw, 2.6rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.pend.won h1 {
  font-size: clamp(2.6rem, 13vw, 3.6rem);
  background: linear-gradient(100deg, #ffd400, #ff7ab6 60%, #7c9dff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.pend .finish-avatar {
  margin: 4px 0;
}

.pend-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  margin: 8px 0;
}

.pend-stats div {
  padding: 12px 8px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pend-stats b {
  font-size: 1rem;
}

.pend-stats span {
  color: var(--muted);
  font-size: 0.68rem;
}

.placed {
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(53, 227, 176, 0.14);
  color: var(--mint);
  font-size: 0.84rem;
  font-weight: 700;
}

/* ------------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  max-width: min(92vw, 520px);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
  z-index: 60;
}

.toast.on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

/* --------------------------------------------------------------- responsive */

@media (max-width: 1080px) {
  .live {
    grid-template-columns: minmax(0, 1fr);
  }

  .call-panel {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    text-align: left;
  }

  .call-meta {
    width: 100%;
  }

  .ball.mega {
    width: clamp(140px, 22vw, 190px);
  }

  .call-actions {
    width: auto;
    flex: 1;
    min-width: 220px;
  }

  .call-panel > .hint {
    width: 100%;
  }

  .board75 {
    overflow-x: auto;
  }

  .brow {
    min-width: 640px;
  }
}

@media (max-width: 900px) {
  .landing {
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "side"
      "foot";
    gap: 32px;
  }

  .setup {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .lobby {
    grid-template-columns: 1fr;
  }

  .join-panel {
    align-items: flex-start;
  }
}

@media (max-width: 620px) {
  .landing-page {
    padding: 22px 16px;
    place-items: start center;
  }

  .landing h1 {
    font-size: 2.3rem;
  }

  .landing-foot {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .emoji-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .emoji-groups {
    max-height: 300px;
  }

  .topbar {
    gap: 10px;
    padding: 12px 14px;
  }

  .topbar .brand {
    font-size: 0.95rem;
  }

  .room-badge {
    padding: 6px 11px;
  }

  .room-badge b {
    font-size: 0.92rem;
  }

  .pill {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .pcell {
    border-radius: 9px;
    border-width: 1.5px;
  }

  .pcard {
    padding: 10px;
    border-radius: 18px;
  }

  .pcard-head span {
    height: 26px;
  }
}

@media (max-height: 720px) and (max-width: 620px) {
  .pstage {
    padding-top: 8px;
    padding-bottom: 14px;
  }

  .play-view {
    gap: 8px;
  }

  .call-banner {
    padding: 8px 12px;
  }

  .ball.mini {
    width: 46px;
    height: 46px;
  }

  .pcard {
    padding: 8px;
  }

  .pgrid {
    gap: 4px;
  }

  .pcell {
    font-size: 1.05rem;
  }

  .bingo-btn {
    padding: 13px;
    font-size: 1.05rem;
  }

  .play-foot .hint {
    display: none;
  }
}

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

/* ------------------------------------------------- pre-game countdown */
.call-countdown,
.play-countdown {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 18px 14px;
  margin: 6px 0 4px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: radial-gradient(circle at 50% 0%, rgba(255, 212, 0, 0.18), rgba(124, 157, 255, 0.12) 60%, transparent 100%);
}

.call-countdown[hidden],
.play-countdown[hidden] {
  display: none;
}

.cd-num,
.play-countdown b {
  font-size: clamp(52px, 11vw, 116px);
  line-height: 0.92;
  font-weight: 900;
  color: #ffd400;
  letter-spacing: -0.03em;
  text-shadow: 0 0 42px rgba(255, 212, 0, 0.4);
  font-variant-numeric: tabular-nums;
}

.call-countdown .hint {
  text-align: center;
}

.play-countdown {
  padding: 12px;
}

.play-countdown b {
  font-size: clamp(44px, 15vw, 72px);
}

.play-countdown span {
  font-size: 13px;
  text-align: center;
  opacity: 0.78;
}

.ball.mega.counting {
  display: none;
}

/* ------------------------------------------------------ win tally */
.chip-wins {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #ffd400;
  opacity: 0.9;
}

.tally {
  width: 100%;
  max-width: 520px;
  margin: 20px auto 0;
  text-align: left;
}

.tally-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.tally-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 15px;
}

.tally-row.has {
  background: rgba(255, 212, 0, 0.14);
}

.tally-row b {
  margin-left: auto;
  color: #ffd400;
  font-variant-numeric: tabular-nums;
}

.tally-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-wins {
  margin-top: 10px;
  font-size: 14px;
  opacity: 0.85;
}

.play-wins b {
  color: #ffd400;
  font-variant-numeric: tabular-nums;
}

.ticket-wins {
  margin-top: 8px;
  font-size: 14px;
  color: #ffd400;
}

/* --------------------------------------------------- live win leaders */
.leaders-wrap {
  margin: 14px 0 4px;
}

.leaders-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.leaders {
  display: grid;
  gap: 6px;
}

.leader-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 15px;
}

.leader-row.lead {
  background: rgba(255, 212, 0, 0.16);
  border: 1px solid rgba(255, 212, 0, 0.3);
}

.leader-rank {
  width: 18px;
  font-size: 12px;
  font-weight: 700;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

.leader-avatar {
  font-size: 20px;
  line-height: 1;
}

.leader-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-wins {
  margin-left: auto;
  color: #ffd400;
  font-variant-numeric: tabular-nums;
}

/* Long rooms scroll the leaders list instead of growing the panel. */
.leaders {
  max-height: min(46vh, 380px);
  overflow-y: auto;
  padding-right: 4px;
}
