:root {
  --bg: #0b1020;
  --surface: rgba(255, 255, 255, .06);
  --surface2: rgba(255, 255, 255, .09);
  --line: rgba(255, 255, 255, .12);
  --text: rgba(255, 255, 255, .92);
  --muted: rgba(255, 255, 255, .68);
  --muted2: rgba(255, 255, 255, .52);

  --brand: #7c5cff;
  --brand2: #31d3ff;

  --ok: #19d17f;
  --err: #ff4d4d;

  --r-lg: 18px;
  --r-md: 14px;

  --shadow: 0 16px 50px rgba(0, 0, 0, .45);
  --shadow-soft: 0 10px 26px rgba(0, 0, 0, .28);
}

/* Time pill has a fixed width (prevents layout jitter) */
#time {
  display: block;
  width: 100%;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  zoom: 85%;
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 12% 8%, rgba(124, 92, 255, .22), transparent 60%),
    radial-gradient(900px 520px at 88% 18%, rgba(49, 211, 255, .18), transparent 60%),
    linear-gradient(180deg, #070a14, var(--bg));
}

a { color: inherit; }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 18px 56px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 10px 0 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  letter-spacing: .6px;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  box-shadow: 0 0 0 6px rgba(124, 92, 255, .12);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 18px;
}

.row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  margin: 12px 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
}

/* ===== Fixed-size host status pills (Timer & Last Buzz) ===== */
.pillBig {
  min-width: 220px;      /* lock width */
  height: 64px;          /* lock height */
  display: flex;
  align-items: center;
  justify-content: center;

  font-variant-numeric: tabular-nums;
}

.hostTimer {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0.5px;
  line-height: 1;
}


.muted { color: var(--muted); }
.ok { color: var(--ok); }
.err { color: var(--err); }

h1, h2 { margin: 0; }

h1 {
  font-size: 34px;
  letter-spacing: -.4px;
}

h2 {
  font-size: 18px;
  color: var(--muted);
  font-weight: 700;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}

input, select {
  padding: 12px 12px;
  font-size: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  outline: none;
}

input:focus, select:focus {
  border-color: rgba(49, 211, 255, .45);
  box-shadow: 0 0 0 4px rgba(49, 211, 255, .12);
}

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .08s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease, filter .2s ease;
}

.btn:hover {
  filter: none;                 /* no darkening */
  transform: translateY(-1px);
}

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

.btn-round {
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
}

.btn-round:hover { filter: none; }

.btn-primary {
  border: none;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  color: #050712;
  box-shadow: 0 14px 30px rgba(124, 92, 255, .25);
}

.btn-primary:hover { filter: brightness(1.03); }

/* Layout helpers */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr; }
}

/* ===== Host split layout ===== */
.hostSplit {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items: start;
}

.hostRight {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 140px);
  overflow: auto;
  padding-right: 6px;
}

/* Scoreboard vertical list */
.hostRight .grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* ===== Host scoreboard compact + glass ===== */
.teamCard {
  border-radius: 16px;
  padding: 14px 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.teamHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.teamMeta { min-width: 0; }

.teamTitle {
  font-weight: 800;
  font-size: 16px;
  line-height: 1.2;
  margin-bottom: 4px;
}

.teamRight {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.score {
  font-size: 28px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  min-width: 44px;
  text-align: right;
}

.scoreBtns {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

.scoreBtns .btn {
  padding: 8px 10px;
  font-size: 14px;
  border-radius: 12px;
}

.lockout {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.9;
}

/* ===== Host control button variants ===== */
.btn-ghost {
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .14);
}

.btn-success {
  border: none;
  background: linear-gradient(135deg, rgba(25, 209, 127, .95), rgba(49, 211, 255, .65));
  color: #04110b;
}

.btn-danger {
  border: none;
  background: linear-gradient(135deg, rgba(255, 77, 77, .95), rgba(255, 170, 60, .70));
  color: #160505;
}

.btn-warn {
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .08);
}

/* ===== Centered host controls ===== */
.controlsCenter { margin: 14px 0; }

.controlsTop,
.controlsBottom {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.controlsBottom { margin-top: 10px; }

/* Equalize top controls sizing a bit */
.controlsTop .btn { min-width: 140px; height: 46px; }

/* ===== START button (red spacebar + fire glow) ===== */
.btn-start{
  min-width: 220px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  color: white;
  font-weight: 900;
  letter-spacing: .6px;

  background: linear-gradient(180deg, rgba(255,70,70,.95), rgba(185,20,20,.95));
  box-shadow: 0 10px 30px rgba(255,60,60,.18);
}

.btn-start:hover{
  box-shadow:
    0 14px 40px rgba(255, 80, 30, .25),
    0 0 18px rgba(255, 170, 60, .25);
}

.btn-start.isArmed{
  animation: firePulse 1.1s ease-in-out infinite;
}

@keyframes firePulse{
  0%   { box-shadow: 0 10px 30px rgba(255,60,60,.18), 0 0 0 rgba(255,170,60,0); }
  50%  { box-shadow: 0 16px 44px rgba(255,80,30,.26), 0 0 22px rgba(255,170,60,.25); }
  100% { box-shadow: 0 10px 30px rgba(255,60,60,.18), 0 0 0 rgba(255,170,60,0); }
}

/* ===== Key/Value grid (Teams + Duration alignment) ===== */
.kvGrid{
  display:grid;
  grid-template-columns: 140px 1fr;
  gap: 10px 14px;
  align-items:center;
  margin-top: 10px;
}

.kvLabel{
  color: rgba(255,255,255,.75);
  font-weight: 600;
}

.kvField{
  display:grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  align-items:center;
}

.field{
  width: 100%;
  height: 42px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.92);
  outline: none;
}

/* ===== Host big timer ===== */
.timeHero{
  width: 100%;
  border-radius: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  box-shadow: 0 12px 34px rgba(0,0,0,.22);
}

.timeHeroLabel{
  font-weight: 700;
  letter-spacing: .3px;
  margin-bottom: 6px;
}

.timeHeroValue{
  font-size: 44px;
  font-weight: 900;
  letter-spacing: .6px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  min-width: 200px; /* prevents width jitter */
  display: inline-block;
}

/* Instructions section on home page */
/* ===== Index: Rules section (SaaS-style accordion) ===== */
.rulesSection {
  margin-top: 18px;
}

.rulesCard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

.rulesHeader {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.rulesTitle {
  margin: 0;
  font-size: 20px;
  letter-spacing: -.2px;
}

.rulesSubtitle {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.rulesDetails {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.rulesSummary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 12px 12px;
  border-radius: 14px;

  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  font-weight: 800;
  user-select: none;
}

.rulesSummary::-webkit-details-marker {
  display: none;
}

.rulesChevron {
  transition: transform .18s ease;
  opacity: .9;
}

.rulesDetails[open] .rulesChevron {
  transform: rotate(180deg);
}

.rulesBody {
  padding: 14px 2px 4px;
}

.rulesGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.rulesBlock {
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  border-radius: 16px;
  padding: 14px 14px;
}

.rulesBlock h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  letter-spacing: -.1px;
}

.rulesBlock ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.rulesBlock ul ul {
  margin-top: 6px;
}

.rulesCallout {
  margin-top: 10px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.88);
}

@media (max-width: 900px) {
  .rulesGrid {
    grid-template-columns: 1fr;
  }
}

/*Footer*/
.app-footer {
  margin-top: 40px;
  padding: 14px 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  opacity: 0.75;
}

.app-footer .heart {
  color: #ff4d6d;
  display: inline-block;
  animation: heartBeat 1.6s ease-in-out infinite;
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* timer danger + score pop + team avatar */

.timerDanger {
  color: #ff4d4d !important;
  text-shadow: 0 0 18px rgba(255, 77, 77, .25);
}

.timerPulse {
  animation: timerPulse 0.9s ease-in-out infinite;
}

@keyframes timerPulse {
  0%   { transform: scale(1);   filter: brightness(1); }
  50%  { transform: scale(1.02); filter: brightness(1.08); }
  100% { transform: scale(1);   filter: brightness(1); }
}

.scorePop {
  animation: scorePop 260ms ease-out;
}

@keyframes scorePop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.teamAvatar {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  display: inline-block;
  box-shadow: 0 0 0 4px rgba(255,255,255,.06);
  flex: 0 0 auto;
}

/* small confetti pieces */
.confettiWrap {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 99999;
}

.confetti {
  position: absolute;
  width: 14px;
  height: 10px;
  border-radius: 3px;
  opacity: 0.98;
  animation: confettiFall 1600ms ease-out forwards;
}

@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translateY(520px) rotate(420deg); opacity: 0; }
}

/* QR Overlay */
.qrOverlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 18px;
}

.qrModal{
  width: min(420px, 100%);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(20, 24, 40, .72);
  box-shadow: 0 26px 80px rgba(0,0,0,.55);
  padding: 14px;
}

.qrModalTop{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.qrBox{
  width: 100%;
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
}
/* Disabled buttons*/
body.hostLocked button:disabled,
body.hostLocked .btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(0.6);
}
body.hostLocked .controlsCenter {
  opacity: 0.65;
}
.teamBtn.isRemoved {
  opacity: 0.45;
  cursor: not-allowed;
  text-decoration: line-through;
}


