:root {
  --bg: #fff7fb;
  --card: rgba(255, 255, 255, 0.92);
  --ink: #3c3150;
  --muted: #7a6f8e;
  --line: #f0ddea;
  --primary: #d85b9f;
  --primary-dark: #b94183;
  --danger: #c83232;
  --soft: #fff1f8;
  --shadow: 0 18px 42px rgba(125, 73, 132, 0.13);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 214, 236, .88) 0, rgba(255, 214, 236, 0) 28%),
    radial-gradient(circle at 88% 10%, rgba(210, 241, 255, .82) 0, rgba(210, 241, 255, 0) 30%),
    radial-gradient(circle at 72% 88%, rgba(229, 218, 255, .82) 0, rgba(229, 218, 255, 0) 34%),
    linear-gradient(135deg, #fff8fc 0%, #fffdf7 42%, #f8f2ff 100%);
  color: var(--ink);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(216, 91, 159, .20) 1.5px, transparent 1.8px),
    radial-gradient(circle, rgba(118, 174, 219, .16) 1.2px, transparent 1.6px);
  background-size: 34px 34px, 46px 46px;
  background-position: 0 0, 12px 18px;
  opacity: .42;
  z-index: -1;
}

body::after {
  content: "";
  position: fixed;
  width: 360px;
  height: 360px;
  right: -160px;
  bottom: -150px;
  border-radius: 50%;
  background: rgba(255, 220, 239, .62);
  filter: blur(2px);
  pointer-events: none;
  z-index: -1;
}

.page {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.page-narrow { width: min(720px, calc(100% - 28px)); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, .82);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 18px;
  backdrop-filter: blur(10px);
}

.hero { padding: 34px; }

.muted-card {
  background: linear-gradient(135deg, rgba(255,255,255,.94), rgba(255,242,249,.88));
}

.grid {
  display: grid;
  gap: 18px;
}

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

h1, h2, p { margin-top: 0; }

h1 { font-size: clamp(24px, 4vw, 34px); line-height: 1.15; margin-bottom: 12px; }
h2 { font-size: 22px; margin-bottom: 14px; }

.lead {
  color: var(--muted);
  line-height: 1.8;
  font-size: 16px;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}

.actions.wrap { flex-wrap: wrap; }

.button {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform .08s ease, background .12s ease, border-color .12s ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { background: linear-gradient(135deg, #e567ad, var(--primary-dark)); border-color: transparent; color: #fff; }
.button.primary:hover:not(:disabled) { background: linear-gradient(135deg, #d85b9f, #9f3477); }
.button.danger { border-color: #f0b6b6; color: var(--danger); }
.button.small { padding: 9px 13px; font-size: 13px; }
.button.full { width: 100%; justify-content: center; }

.text-link { color: var(--primary); text-decoration: none; font-weight: 700; }

.room-info {
  margin-top: 22px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 244, 250, .9);
  border: 1px solid #f2d6e8;
}

.room-code-label { color: var(--muted); font-weight: 700; font-size: 12px; }
.room-code { font-size: 42px; font-weight: 900; letter-spacing: .16em; margin: 4px 0 10px; }
.join-url { word-break: break-all; color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.qr-box { margin-top: 16px; background: white; display: inline-block; padding: 12px; border-radius: 16px; }

.status-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.status-panel.stacked { grid-template-columns: 1fr; }

.status-panel > div {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fbfcff;
}

.label { display: block; color: var(--muted); font-size: 12px; font-weight: 700; margin-bottom: 4px; }

.note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  margin-top: 18px;
}

.field { display: block; margin-bottom: 16px; }
.field span { display: block; margin-bottom: 6px; color: var(--muted); font-weight: 800; font-size: 13px; }
.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 15px;
  font-size: 18px;
  outline: none;
  background: #fff;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(216, 91, 159, .16); }

.result-list, .player-list { display: grid; gap: 10px; }
.empty { color: var(--muted); }

.result-row, .player-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #fbfcff;
}

.rank {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  border-radius: 50%;
  font-weight: 900;
}

.player-name { font-weight: 900; }
.sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.score-actions { display: flex; gap: 6px; }
.score-badge { font-weight: 900; padding: 6px 10px; background: var(--soft); border-radius: 999px; }

.push-button {
  width: min(380px, 100%);
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  display: block;
  margin: 24px auto 16px;
  font-size: clamp(42px, 12vw, 76px);
  font-weight: 950;
  color: #fff;
  background: radial-gradient(circle at 35% 25%, #ff8a8a, #df2639 55%, #971928);
  box-shadow: 0 22px 0 #7d1521, 0 28px 38px rgba(75, 0, 16, .28);
  cursor: pointer;
}

.push-button:disabled {
  filter: grayscale(1);
  opacity: .55;
  cursor: not-allowed;
  box-shadow: 0 14px 0 #777, 0 18px 28px rgba(0, 0, 0, .12);
}

.push-button:not(:disabled):active {
  transform: translateY(10px);
  box-shadow: 0 10px 0 #7d1521, 0 14px 22px rgba(75, 0, 16, .22);
}

.push-message, .my-result {
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.error-text { color: var(--danger); font-weight: 800; min-height: 1.5em; }
.hidden { display: none !important; }

ol, ul { padding-left: 1.4em; line-height: 1.8; color: var(--muted); }

@media (max-width: 760px) {
  .grid.two { grid-template-columns: 1fr; }
  .card { padding: 20px; border-radius: 18px; }
  .hero { padding: 26px; }
  .actions { flex-direction: column; align-items: stretch; }
  .button { text-align: center; }
  .status-panel { grid-template-columns: 1fr; }
  .result-row, .player-row { grid-template-columns: auto 1fr; }
  .score-actions { grid-column: 1 / -1; }
}

.room-name {
  font-size: 20px;
  font-weight: 900;
  margin: 4px 0 12px;
}

.room-list { display: grid; gap: 10px; }
.room-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #fbfcff;
}
.room-row.active {
  border-color: var(--primary);
  background: var(--soft);
}
.room-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.note.compact { margin-top: -4px; margin-bottom: 14px; }
.score-stack { display: grid; gap: 6px; justify-items: end; }
.score-badge.pending { background: #fff3d4; }
.score-rank { background: var(--primary); }

@media (max-width: 760px) {
  .room-row { grid-template-columns: 1fr; }
  .room-actions { justify-content: stretch; }
  .room-actions .button { flex: 1; }
  .score-stack { grid-column: 1 / -1; justify-items: start; }
}

.room-preview {
  color: var(--muted);
  font-weight: 800;
  margin: -6px 0 14px;
  line-height: 1.6;
}
.room-preview.ok { color: var(--primary); }
.room-preview.ng { color: var(--danger); }

.admin-tabs {
  display: flex;
  gap: 10px;
  margin: 0 0 18px;
  padding: 8px;
  background: #e9eefb;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.tab-button {
  flex: 1;
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.tab-button.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 8px 20px rgba(18, 35, 74, 0.08);
}

.tab-panel { display: block; }

.admin-room-grid {
  align-items: start;
}

.operation-card h2 {
  margin-bottom: 16px;
}

.operation-strip {
  display: flex;
  gap: 16px;
  align-items: stretch;
  flex-wrap: nowrap;
}

.operation-status {
  flex: 1 1 340px;
  margin: 0;
}

.operation-actions {
  flex: 0 0 auto;
  margin-top: 0;
  flex-wrap: nowrap;
  align-items: stretch;
}

.operation-actions .button {
  white-space: nowrap;
  min-width: 120px;
}

@media (max-width: 900px) {
  .operation-strip {
    flex-direction: column;
  }
  .operation-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .operation-actions .button {
    flex: 1;
  }
}

@media (max-width: 760px) {
  .admin-tabs {
    border-radius: 20px;
    flex-direction: column;
  }
  .tab-button {
    width: 100%;
  }
  .operation-actions {
    flex-direction: column;
  }
}


/* v7 participant screen layout */
.player-play-card {
  text-align: center;
}

.player-room-name {
  color: var(--muted);
  font-size: clamp(14px, 3.5vw, 18px);
  font-weight: 900;
  line-height: 1.4;
  margin: 0 0 6px;
  word-break: break-word;
}

.player-buzzer-title {
  font-size: clamp(44px, 13vw, 76px);
  line-height: 1;
  margin: 0 0 20px;
  letter-spacing: .02em;
}

.player-status-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.player-status-row > div {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 8px;
  background: #fbfcff;
}

.player-status-row strong {
  display: block;
  font-size: clamp(18px, 5vw, 26px);
  line-height: 1.15;
}

@media (max-width: 420px) {
  .player-status-row {
    gap: 8px;
  }
  .player-status-row > div {
    padding: 10px 6px;
  }
  .player-status-row .label {
    font-size: 11px;
  }
}
