:root {
  --bg-0: #04080f;
  --bg-1: #08111b;
  --bg-2: #101b28;
  --panel: rgba(10, 18, 29, 0.92);
  --panel-strong: rgba(14, 24, 36, 0.97);
  --line: rgba(154, 178, 201, 0.16);
  --line-strong: rgba(154, 178, 201, 0.28);
  --text: #f2f6fb;
  --muted: #96aabc;
  --pink: #ff5aa5;
  --pink-soft: rgba(255, 90, 165, 0.16);
  --green: #44d07d;
  --green-soft: rgba(68, 208, 125, 0.18);
  --gold: #f0bf56;
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  min-width: 0;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: var(--text);
  font-family: "Tajawal", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(255, 90, 165, 0.16), transparent 24%),
    radial-gradient(circle at bottom left, rgba(68, 208, 125, 0.1), transparent 28%),
    linear-gradient(145deg, var(--bg-0) 0%, var(--bg-1) 38%, var(--bg-2) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: 0.3;
  mask-image: radial-gradient(circle at center, black 38%, transparent 90%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

#app {
  width: 100%;
  height: 100dvh;
}

.shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  padding: 14px;
  overflow: hidden;
}

.landing-shell,
.presenter-shell {
  display: grid;
  gap: 12px;
  height: 100%;
}

.landing-shell {
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  align-items: stretch;
}

.presenter-shell {
  grid-template-rows: auto minmax(0, 1fr);
}

.landing-brand,
.landing-panel,
.landing-domain,
.panel-block,
.presenter-topbar,
.presenter-main,
.player-minimal,
.question-stage,
.modal-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.landing-brand,
.landing-panel,
.landing-domain,
.presenter-topbar,
.presenter-main,
.question-stage {
  overflow: hidden;
}

.landing-top-cow {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 4px;
  pointer-events: none;
}

.landing-brand {
  position: relative;
  padding: 22px;
  display: grid;
  align-content: center;
  gap: 14px;
}

.landing-brand::after {
  content: "";
  position: absolute;
  inset: 6% auto auto 56%;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 90, 165, 0.22), transparent 70%);
  filter: blur(20px);
  pointer-events: none;
}

.landing-brand h1,
.presenter-topbar h1,
.player-question,
.rotate-card h2,
.question-stage h2 {
  margin: 0;
  font-family: "Changa", sans-serif;
  line-height: 1;
  letter-spacing: -0.03em;
}

.landing-brand h1 {
  font-size: clamp(3.6rem, 10vw, 7.8rem);
}

.landing-brand p {
  margin: 0;
  max-width: 20ch;
  font-size: clamp(1rem, 2vw, 1.26rem);
  line-height: 1.7;
  color: var(--muted);
}

.landing-note {
  margin: -4px 0 0;
  max-width: 28ch;
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(224, 233, 242, 0.88);
}

.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pink);
}

.landing-marks,
.inline-actions,
.topbar-meta,
.question-meta,
.topbar-actions,
.bubble-player-row,
.bubble-meta-row,
.question-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.mark-pill,
.status-chip,
.topbar-meta span,
.question-meta span,
.room-chip,
.bubble-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 0.95rem;
}

.landing-panel {
  padding: 16px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
}

.panel-block,
.landing-domain,
.question-stage,
.settings-card,
.rules-collapse {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.panel-block {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.landing-domain {
  min-height: 118px;
  padding: 16px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 6px;
}

.domain-line {
  font-family: "Changa", sans-serif;
  font-size: clamp(1rem, 2vw, 1.28rem);
  color: var(--text);
}

.field,
.textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 14px 16px;
}

.field::placeholder,
.textarea::placeholder {
  color: #7f93a6;
}

.field:focus,
.textarea:focus {
  outline: none;
  border-color: rgba(255, 90, 165, 0.38);
  box-shadow: 0 0 0 3px rgba(255, 90, 165, 0.14);
}

.textarea {
  resize: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  transition:
    transform 140ms ease,
    background-color 140ms ease,
    border-color 140ms ease;
}

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

.btn:disabled {
  opacity: 0.48;
  cursor: default;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, #ff5aa5 0%, #ff7f6e 100%);
  color: #fff;
}

.btn-danger {
  background: linear-gradient(135deg, #ff6686 0%, #ff8e6f 100%);
  color: #fff;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.btn-ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.compact-btn {
  min-height: 40px;
  padding: 0 14px;
}

.error-banner {
  position: absolute;
  inset: 16px 16px auto auto;
  z-index: 20;
  max-width: min(480px, calc(100% - 32px));
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(127, 26, 38, 0.92);
  border: 1px solid rgba(255, 130, 107, 0.32);
  color: #ffd7ce;
}

.presenter-topbar {
  position: relative;
  z-index: 20;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  overflow: visible;
}

.brand-cluster {
  display: grid;
  gap: 4px;
}

.presenter-topbar h1 {
  font-size: clamp(1.35rem, 2.6vw, 2rem);
}

.topbar-meta {
  justify-content: center;
  position: relative;
}

.room-chip {
  position: relative;
  cursor: default;
  outline: none;
}

.room-popover {
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: calc(100% + 10px);
  z-index: 12;
  width: 270px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(8, 16, 27, 0.98);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.room-chip:hover .room-popover,
.room-chip:focus .room-popover,
.room-chip:focus-within .room-popover {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.room-popover-copy {
  display: grid;
  gap: 6px;
}

.room-popover-code {
  font-family: "Changa", sans-serif;
  font-size: 1.5rem;
  color: var(--text);
  letter-spacing: 0.08em;
}

.room-popover-qr {
  width: 96px;
  height: 96px;
  padding: 6px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
}

.room-popover-qr .join-qr {
  width: 100%;
  height: 100%;
}

.topbar-actions {
  justify-content: flex-end;
}

.audit-scrim {
  position: absolute;
  inset: 0;
  z-index: 24;
  background: rgba(4, 8, 15, 0.34);
}

.presenter-grid,
.presenter-main {
  min-height: 0;
}

.presenter-grid {
  display: grid;
}

.presenter-main {
  padding: 14px;
  display: grid;
  gap: 10px;
  grid-template-rows: auto minmax(0, 1fr);
}

.audit-drawer {
  position: absolute;
  inset-block-start: 84px;
  inset-inline-end: 14px;
  inset-block-end: 14px;
  z-index: 26;
  width: min(420px, calc(100vw - 28px));
  padding: 14px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(6, 13, 22, 0.98);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.44);
  backdrop-filter: blur(18px);
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
  transition:
    transform 180ms ease,
    opacity 180ms ease;
}

.audit-drawer.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.audit-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.audit-drawer-note,
.audit-empty span,
.audit-canonical {
  color: var(--muted);
}

.audit-drawer-note,
.audit-question,
.audit-player-line,
.audit-override-line {
  line-height: 1.55;
}

.audit-timeline {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding-inline-end: 4px;
}

.audit-card,
.audit-group {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(15, 24, 36, 0.94);
}

.audit-card {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.audit-card-head,
.audit-group-head,
.audit-player-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.audit-question {
  font-family: "Changa", sans-serif;
  font-size: 1rem;
  color: var(--text);
}

.audit-section {
  display: grid;
  gap: 8px;
}

.audit-group {
  padding: 10px;
  display: grid;
  gap: 8px;
}

.audit-group.is-winning {
  border-color: rgba(68, 208, 125, 0.32);
  background: rgba(22, 43, 31, 0.58);
}

.audit-group.is-secondary {
  border-color: rgba(240, 191, 86, 0.28);
  background: rgba(49, 37, 14, 0.5);
}

.audit-group.is-unique {
  border-color: rgba(154, 178, 201, 0.16);
  background: rgba(15, 24, 36, 0.82);
}

.audit-players,
.audit-override-list,
.audit-empty {
  display: grid;
  gap: 6px;
}

.audit-player-line strong,
.audit-empty strong {
  color: var(--text);
}

.audit-player-line span,
.audit-override-line {
  color: rgba(230, 236, 244, 0.84);
}

.audit-label {
  color: var(--muted);
  font-size: 0.84rem;
}

.audit-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.82rem;
}

.question-stage {
  position: relative;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.question-stage h2 {
  font-size: clamp(1.6rem, 3.8vw, 3.15rem);
  line-height: 1.1;
  max-width: none;
}

.question-subtitle {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
}

.countdown {
  font-family: "Changa", sans-serif;
  color: var(--text);
}

.winner-chip {
  color: var(--gold);
}

.free-cow-chip {
  border-color: rgba(255, 90, 165, 0.28);
  background: rgba(255, 90, 165, 0.12);
  color: #ffd2e4;
}

.bubble-stage,
.rules-list {
  display: grid;
  gap: 10px;
}

.bubble-stage {
  min-height: 0;
  height: 100%;
  grid-template-columns: repeat(var(--bubble-columns, 4), minmax(0, 1fr));
  grid-template-rows: repeat(var(--bubble-rows, 1), minmax(0, 1fr));
  align-content: stretch;
}

.bubble-stage.is-sparse {
  padding: 6px 18px 14px;
  justify-items: center;
  grid-template-rows: repeat(var(--bubble-rows, 1), auto);
  align-content: center;
  row-gap: 34px;
  column-gap: 14px;
}

.bubble-slot {
  min-height: 0;
  display: grid;
  grid-template-rows: clamp(86px, 15vh, 128px) 96px;
  gap: 8px;
  width: 100%;
  align-content: start;
}

.bubble-stage.is-sparse .bubble-slot {
  max-width: 22rem;
}

.bubble-stage.is-sparse .bubble-cow-sticker {
  inset-block-start: 8px;
  inset-inline-start: -6px;
  width: 58px;
  height: 58px;
}

.bubble-stage[data-player-count="1"] .bubble-slot {
  max-width: 24rem;
}

.bubble-stage[data-player-count="2"] .bubble-slot {
  max-width: 21rem;
}

.bubble-stage[data-player-count="3"] .bubble-slot {
  max-width: 19rem;
}

.bubble-stage.is-sparse[data-player-count="3"],
.bubble-stage.is-sparse[data-player-count="4"] {
  row-gap: 52px;
}

.bubble-stage[data-player-count="4"] .bubble-slot {
  max-width: 18.5rem;
}

.bubble-slot.is-inactive {
  opacity: 0.72;
}

.answer-bubble {
  position: relative;
  min-height: 0;
  height: 100%;
  border-radius: 28px;
  padding: 6px;
  overflow: visible;
  background:
    radial-gradient(circle at 16% 22%, rgba(11, 15, 20, 0.92) 0 11%, transparent 12%),
    radial-gradient(circle at 77% 12%, rgba(12, 16, 22, 0.94) 0 9%, transparent 10%),
    radial-gradient(circle at 83% 74%, rgba(17, 22, 28, 0.9) 0 11%, transparent 12%),
    radial-gradient(circle at 39% 82%, rgba(12, 16, 22, 0.88) 0 8%, transparent 9%),
    radial-gradient(circle at 58% 65%, rgba(255, 179, 219, 0.48) 0 7%, transparent 8%),
    linear-gradient(180deg, #fff 0%, #eef2f6 100%);
  box-shadow:
    0 16px 28px rgba(0, 0, 0, 0.24),
    inset 0 0 0 1px rgba(11, 20, 32, 0.08);
}

.holder-card {
  box-shadow:
    0 16px 28px rgba(0, 0, 0, 0.24),
    0 0 0 3px rgba(255, 90, 165, 0.16),
    inset 0 0 0 1px rgba(11, 20, 32, 0.08);
}

.bubble-winner {
  box-shadow:
    0 16px 28px rgba(0, 0, 0, 0.24),
    0 0 0 5px rgba(68, 208, 125, 0.34),
    0 0 32px rgba(68, 208, 125, 0.18),
    inset 0 0 0 1px rgba(11, 20, 32, 0.08);
}

.bubble-surface {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 14px 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 243, 248, 0.94));
  text-align: center;
  overflow: hidden;
}

.bubble-empty {
  background: linear-gradient(180deg, rgba(18, 29, 42, 0.92), rgba(8, 14, 23, 0.98));
}

.bubble-winner .bubble-surface {
  background:
    linear-gradient(180deg, rgba(246, 255, 249, 0.99), rgba(211, 248, 226, 0.98)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 243, 248, 0.94));
}

.bubble-alt-1 {
  box-shadow:
    0 16px 28px rgba(0, 0, 0, 0.24),
    0 0 0 4px rgba(240, 191, 86, 0.28),
    inset 0 0 0 1px rgba(11, 20, 32, 0.08);
}

.bubble-alt-1 .bubble-surface {
  background:
    linear-gradient(180deg, rgba(255, 250, 234, 0.99), rgba(255, 242, 205, 0.98)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 243, 248, 0.94));
}

.bubble-alt-2 {
  box-shadow:
    0 16px 28px rgba(0, 0, 0, 0.24),
    0 0 0 4px rgba(255, 170, 110, 0.28),
    inset 0 0 0 1px rgba(11, 20, 32, 0.08);
}

.bubble-alt-2 .bubble-surface {
  background:
    linear-gradient(180deg, rgba(255, 245, 236, 0.99), rgba(255, 228, 203, 0.98)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 243, 248, 0.94));
}

.bubble-alt-3 {
  box-shadow:
    0 16px 28px rgba(0, 0, 0, 0.24),
    0 0 0 4px rgba(120, 174, 255, 0.22),
    inset 0 0 0 1px rgba(11, 20, 32, 0.08);
}

.bubble-alt-3 .bubble-surface {
  background:
    linear-gradient(180deg, rgba(240, 247, 255, 0.99), rgba(217, 232, 255, 0.98)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 243, 248, 0.94));
}

.bubble-answer {
  font-family: "Changa", sans-serif;
  font-size: clamp(1.08rem, 1.95vw, 1.68rem);
  line-height: 1.12;
  color: #111317;
  word-break: break-word;
}

.bubble-placeholder {
  min-height: 1.2rem;
  color: rgba(242, 246, 251, 0.8);
  font-size: 0.96rem;
  text-align: center;
}

.bubble-footer {
  display: grid;
  grid-template-rows: 30px 30px 30px;
  gap: 6px;
  padding-inline: 4px;
  align-content: start;
}

.bubble-player-row,
.bubble-meta-row {
  justify-content: space-between;
}

.bubble-row-fixed {
  min-height: 0;
}

.bubble-name {
  min-width: 0;
  font-size: 1.06rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bubble-pill {
  min-height: 30px;
  font-size: 0.86rem;
}

.bubble-pill-score {
  color: var(--text);
  background: rgba(20, 29, 42, 0.92);
  border-color: rgba(154, 178, 201, 0.18);
}

.bubble-pill-win,
.is-ready {
  border-color: rgba(68, 208, 125, 0.28);
  background: rgba(56, 193, 111, 0.22);
  color: #ceffe0;
}

.bubble-pill-alt-1 {
  border-color: rgba(240, 191, 86, 0.34);
  background: rgba(240, 191, 86, 0.18);
  color: #ffe9b2;
}

.bubble-pill-alt-2 {
  border-color: rgba(255, 170, 110, 0.34);
  background: rgba(255, 170, 110, 0.18);
  color: #ffd8bc;
}

.bubble-pill-alt-3 {
  border-color: rgba(120, 174, 255, 0.3);
  background: rgba(120, 174, 255, 0.16);
  color: #d9e8ff;
}

.bubble-pill-cow {
  border-color: rgba(255, 90, 165, 0.28);
  background: var(--pink-soft);
  color: #ffd5e6;
}

.bubble-row-spacer {
  width: 100%;
  min-height: 30px;
}

.bubble-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 30px;
  align-items: center;
}

.bubble-controls:not(.is-visible) {
  visibility: hidden;
}

.mini-btn {
  min-width: 34px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.icon-btn.active {
  background: var(--pink-soft);
  color: #ffd9ea;
  border-color: rgba(255, 90, 165, 0.3);
}

.bubble-cow-sticker {
  position: absolute;
  inset-block-start: -18px;
  inset-inline-start: -10px;
  z-index: 3;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(9, 16, 25, 0.95);
  box-shadow:
    0 12px 20px rgba(0, 0, 0, 0.36),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.bubble-cow-sticker .cow-icon {
  width: 3.3rem;
  height: 3.3rem;
}

.bubble-cow-sticker .cow-icon img {
  object-position: center;
  transform: scale(1.08);
  transform-origin: center;
}

.bubble-award-flash {
  position: absolute;
  inset-block-start: -10px;
  inset-inline-end: 10px;
  z-index: 4;
  min-width: 54px;
  min-height: 34px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #45d57f 0%, #85f0b1 100%);
  color: #0d1a13;
  font-family: "Changa", sans-serif;
  font-size: 1rem;
  box-shadow: 0 14px 24px rgba(23, 87, 49, 0.34);
  animation: award-pop 3s ease forwards;
}

@keyframes award-pop {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.82);
  }

  12%,
  56% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-12px) scale(0.92);
  }
}

.player-shell {
  display: grid;
  place-items: center;
  overflow: auto;
}

.player-minimal {
  width: min(680px, 100%);
  max-height: min(calc(100dvh - 28px), 920px);
  padding: 22px;
  display: grid;
  grid-template-rows: auto auto auto auto;
  align-content: center;
  gap: 14px;
}

.player-question {
  font-size: clamp(1.8rem, 7vw, 3.6rem);
  line-height: 1.08;
}

.player-cow-note {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border-radius: 18px;
  border: 1px solid rgba(255, 90, 165, 0.26);
  background: linear-gradient(135deg, rgba(85, 23, 55, 0.94), rgba(48, 18, 44, 0.92));
}

.player-cow-icon {
  display: grid;
  place-items: center;
}

.player-cow-copy {
  display: grid;
  gap: 4px;
}

.player-cow-copy strong {
  font-size: 1.02rem;
}

.player-cow-copy span {
  color: #ffd7e8;
  line-height: 1.5;
}

.player-textarea {
  min-height: 6.75rem;
  height: 7.25rem;
  max-height: 8rem;
  font-size: clamp(1rem, 4.2vw, 1.26rem);
  line-height: 1.6;
}

.player-submit {
  min-height: 58px;
  font-size: 1.02rem;
}

.player-actions {
  display: grid;
  gap: 10px;
}

.player-leave {
  min-height: 46px;
}

.cow-icon {
  display: inline-flex;
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 1rem;
}

.cow-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.cow-icon.tiny {
  width: 1.02rem;
  height: 1.02rem;
  font-size: 0.92rem;
}

.cow-icon.large {
  width: 2.8rem;
  height: 2.8rem;
  font-size: 2.2rem;
}

.cow-icon.hero {
  width: 7rem;
  height: 7rem;
  font-size: 5.6rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(3, 8, 14, 0.74);
}

.dialog-backdrop {
  z-index: 60;
}

.modal-panel {
  width: min(760px, 100%);
  max-height: calc(100dvh - 32px);
  padding: 14px;
  display: grid;
  gap: 12px;
  overflow: auto;
  overscroll-behavior: contain;
}

.rules-modal {
  width: min(420px, 100%);
}

.settings-modal {
  width: min(820px, 100%);
}

.confirm-modal {
  width: min(480px, 100%);
  gap: 16px;
}

.confirm-copy {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

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

.icon-toggle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  gap: 12px;
}

.settings-card {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.settings-card-join {
  justify-items: center;
  text-align: center;
  grid-row: span 2;
}

.settings-label,
.settings-note {
  color: var(--muted);
}

.settings-label {
  font-size: 0.82rem;
}

.settings-note {
  font-size: 0.76rem;
}

.settings-editor {
  display: flex;
  gap: 8px;
  align-items: center;
}

.timer-field {
  width: 96px;
  text-align: center;
}

.code-display {
  font-family: "Changa", sans-serif;
  font-size: clamp(1.8rem, 4.2vw, 2.3rem);
  letter-spacing: 0.12em;
}

.panel-link {
  word-break: break-word;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.qr-frame {
  width: min(220px, 100%);
  aspect-ratio: 1;
  padding: 12px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  border: 1px solid rgba(8, 16, 26, 0.14);
  background:
    radial-gradient(circle at top, rgba(255, 90, 165, 0.12), transparent 56%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 250, 0.98));
}

.join-qr {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.rules-collapse {
  padding: 12px 14px;
}

.rules-collapse summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.rules-collapse summary::-webkit-details-marker {
  display: none;
}

.rules-collapse[open] summary {
  margin-bottom: 12px;
}

.rules-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rules-item {
  min-height: 48px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.rotate-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 8, 14, 0.96);
}

.rotate-card {
  width: min(420px, 100%);
  padding: 24px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(19, 31, 45, 0.96), rgba(10, 18, 29, 0.96));
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
}

.rotate-card h2 {
  font-size: clamp(2rem, 7vw, 3rem);
}

.rotate-card p {
  margin: 0;
  color: var(--muted);
}

.hidden {
  display: none;
}

@media (max-width: 900px) and (orientation: portrait) {
  .landing-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) and (orientation: portrait) {
  .settings-grid,
  .rules-list {
    grid-template-columns: 1fr;
  }

  .settings-card-join {
    grid-row: span 1;
  }
}

@media (max-height: 480px) and (orientation: landscape) {
  .shell {
    padding: 8px;
  }

  .landing-shell,
  .presenter-shell {
    gap: 8px;
  }

  .landing-brand,
  .landing-panel,
  .player-minimal,
  .presenter-topbar,
  .presenter-main,
  .modal-panel {
    padding: 10px 12px;
  }

  .landing-shell {
    grid-template-columns: minmax(0, 1fr) minmax(250px, 0.9fr);
  }

  .landing-top-cow {
    padding-top: 0;
  }

  .landing-brand {
    gap: 10px;
  }

  .landing-brand h1 {
    font-size: clamp(2.5rem, 12vw, 4.3rem);
  }

  .landing-brand p {
    font-size: 0.88rem;
    line-height: 1.5;
  }

  .landing-marks {
    display: none;
  }

  .landing-domain {
    min-height: 92px;
    padding: 12px;
  }

  .landing-top-cow .cow-icon.hero {
    width: 5.3rem;
    height: 5.3rem;
  }

  .presenter-topbar {
    gap: 8px;
  }

  .presenter-topbar h1 {
    font-size: 1.18rem;
  }

  .eyebrow {
    font-size: 0.64rem;
  }

  .topbar-meta span,
  .question-meta span,
  .room-chip,
  .mark-pill,
  .status-chip,
  .bubble-pill {
    min-height: 26px;
    padding: 0 8px;
    font-size: 0.72rem;
  }

  .btn,
  .compact-btn,
  .timer-field {
    min-height: 34px;
  }

  .compact-btn,
  .btn {
    padding-inline: 12px;
  }

  .presenter-main {
    gap: 8px;
  }

  .question-stage {
    padding: 10px 12px;
    gap: 8px;
  }

  .question-stage h2 {
    font-size: clamp(1.12rem, 3.3vw, 1.6rem);
  }

  .question-subtitle {
    display: none;
  }

  .bubble-stage {
    gap: 8px;
  }

  .bubble-stage.is-sparse {
    padding-inline: 10px;
    padding-block: 4px 10px;
    align-content: start;
    row-gap: 22px;
    column-gap: 8px;
  }

  .bubble-stage.is-sparse[data-player-count="3"],
  .bubble-stage.is-sparse[data-player-count="4"] {
    row-gap: 30px;
  }

  .bubble-slot {
    gap: 5px;
    grid-template-rows: 74px 70px;
  }

  .bubble-stage[data-player-count="1"] .bubble-slot {
    max-width: 26rem;
  }

  .bubble-stage[data-player-count="2"] .bubble-slot {
    max-width: 18rem;
  }

  .bubble-stage[data-player-count="3"] .bubble-slot,
  .bubble-stage[data-player-count="4"] .bubble-slot {
    max-width: 14rem;
  }

  .answer-bubble {
    border-radius: 18px;
    padding: 5px;
  }

  .bubble-surface {
    padding: 8px 8px;
    border-radius: 15px;
  }

  .bubble-answer {
    font-size: clamp(0.78rem, 1.28vw, 1rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .bubble-placeholder,
  .bubble-name {
    font-size: 0.78rem;
  }

  .bubble-footer {
    gap: 3px;
    grid-template-rows: 22px 22px 22px;
  }

  .bubble-player-row,
  .bubble-meta-row {
    flex-wrap: nowrap;
    gap: 4px;
  }

  .bubble-controls {
    gap: 4px;
  }

  .mini-btn {
    min-width: 28px;
    min-height: 24px;
    padding: 0 8px;
    font-size: 0.66rem;
  }

  .bubble-award-flash {
    min-width: 44px;
    min-height: 28px;
    padding: 0 10px;
    font-size: 0.84rem;
  }

  .bubble-cow-sticker {
    width: 42px;
    height: 42px;
    inset-block-start: -6px;
    inset-inline-start: -4px;
  }

  .bubble-stage.is-sparse .bubble-cow-sticker {
    inset-block-start: 6px;
    inset-inline-start: -4px;
  }

  .audit-drawer {
    inset-block-start: 62px;
    width: min(340px, calc(100vw - 16px));
    padding: 10px;
    gap: 8px;
  }

  .audit-card {
    padding: 10px;
    gap: 8px;
  }

  .settings-grid,
  .rules-list {
    gap: 8px;
  }

  .modal-backdrop {
    padding: 6px;
  }

  .modal-panel {
    width: min(620px, 100%);
    max-height: calc(100dvh - 12px);
    padding: 8px;
    gap: 6px;
  }

  .settings-modal {
    gap: 6px;
  }

  .settings-grid {
    gap: 6px;
  }

  .settings-card,
  .rules-item {
    padding: 7px 9px;
  }

  .settings-card {
    gap: 6px;
  }

  .settings-label,
  .settings-note,
  .panel-link {
    font-size: 0.68rem;
  }

  .rules-collapse {
    padding: 6px 9px;
  }

  .rules-item {
    min-height: 40px;
    font-size: 0.74rem;
  }

  .code-display {
    font-size: 1.34rem;
  }

  .settings-card-join {
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 10px;
    row-gap: 6px;
    justify-items: start;
    text-align: start;
  }

  .settings-card-join > .settings-label,
  .settings-card-join > .settings-note,
  .settings-card-join > .code-display,
  .settings-card-join > .domain-line,
  .settings-card-join > .panel-link,
  .settings-card-join > .inline-actions {
    grid-column: 2;
  }

  .settings-card-join > .qr-frame {
    grid-column: 1;
    grid-row: 1 / span 6;
    width: 98px;
    padding: 4px;
    border-radius: 14px;
    align-self: start;
  }
}

@media (max-width: 640px) and (orientation: portrait) {
  .shell {
    padding: 12px;
  }

  .player-minimal {
    padding: 18px;
  }

  .player-cow-note {
    padding: 12px 14px;
  }

  .player-textarea {
    min-height: 6rem;
    height: 6.25rem;
    max-height: 7rem;
  }
}

@media (max-width: 430px) and (max-height: 700px) and (orientation: portrait) {
  .shell {
    padding: 8px;
  }

  .landing-shell {
    gap: 8px;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .landing-top-cow {
    padding-top: 0;
  }

  .landing-top-cow .cow-icon.hero {
    width: 4.4rem;
    height: 4.4rem;
  }

  .landing-brand,
  .landing-panel {
    padding: 10px 12px;
  }

  .landing-brand {
    gap: 8px;
    align-content: start;
  }

  .landing-brand h1 {
    font-size: clamp(2.45rem, 14vw, 3.5rem);
  }

  .landing-brand p {
    max-width: none;
    font-size: 0.84rem;
    line-height: 1.45;
  }

  .landing-marks {
    display: none;
  }

  .landing-panel {
    grid-template-rows: 1fr;
    padding: 10px;
  }

  .panel-block {
    padding: 12px;
    gap: 10px;
  }

  .field {
    padding: 12px 14px;
  }

  .btn {
    min-height: 40px;
    padding-inline: 14px;
  }
}

@media (orientation: portrait) {
  .rotate-overlay {
    display: flex;
  }
}
