/* =========================================================================
   CISCO ARENA — Component styles
   ========================================================================= */

/* ---- Layout shell ---- */
.shell {
  display: grid;
  grid-template-columns: 1fr 340px;
  grid-template-rows: 64px 1fr 36px;
  grid-template-areas:
    "header header"
    "stage sidebar"
    "footer footer";
  height: 100vh;
  background: var(--bg);
  transition: background var(--dur-3) var(--ease), color var(--dur-3) var(--ease);
}

[data-density="compact"] .shell { grid-template-columns: 1fr 300px; grid-template-rows: 56px 1fr 32px; }
[data-density="roomy"] .shell   { grid-template-columns: 1fr 380px; grid-template-rows: 72px 1fr 40px; }
[data-layout="full"] .shell     { grid-template-columns: 1fr 400px; }
[data-layout="ticker"] .shell {
  grid-template-columns: 1fr;
  grid-template-rows: 64px 56px 1fr 36px;
  grid-template-areas: "header" "sidebar" "stage" "footer";
}

.header { grid-area: header; }
.stage  { grid-area: stage; overflow: hidden; position: relative; }
.side   { grid-area: sidebar; overflow: hidden; }
.foot   { grid-area: footer; }

/* ---- Header ---- */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--sp-6) 0 var(--sp-10);
  background: linear-gradient(180deg, var(--bg-elev), var(--bg));
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 2;
  gap: 20px;
}
.brand { min-width: 0; flex-shrink: 1; }
.brand > div { min-width: 0; overflow: hidden; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand { display: flex; align-items: center; gap: var(--sp-3); }
.brand-mark {
  width: 34px; height: 34px; border-radius: var(--r-md);
  background: var(--accent);
  color: var(--accent-ink);
  display: grid; place-items: center;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -.02em;
  position: relative;
  overflow: hidden;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,.28) 50%, transparent 60%);
}
.brand-name {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.brand-tag {
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--ink-muted);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-top: 1px;
  white-space: nowrap;
}

.phase-pill {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 6px 14px;
  background: var(--chip-bg);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}
.phase-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 25%, transparent);
  animation: pulse-live 1.6s infinite var(--ease);
}

.header-right { display: flex; align-items: center; gap: var(--sp-3); }
.me-chip {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--bg-elev);
}
.me-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  font-weight: 700; font-size: 11px;
  color: var(--accent-ink);
}
.me-chip .label { font-size: 12px; font-weight: 600; }
.me-chip .sub { font-size: 10.5px; color: var(--ink-muted); font-family: var(--f-mono); }

.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  display: grid; place-items: center;
  color: var(--ink-dim);
  transition: all var(--dur-2) var(--ease);
}
.icon-btn:hover { background: var(--bg-elev-2); color: var(--ink); }

/* ---- Sidebar (leaderboard / timer / streak / power-ups) ---- */
.side {
  padding: var(--sp-4);
  background: var(--bg);
  border-left: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: var(--sp-3);
  min-height: 0;
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  font-family: var(--f-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-elev-2), var(--bg-elev));
}
.panel-head .live {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--danger);
  font-weight: 700;
}
.panel-head .live .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--danger);
  animation: pulse-live 1.2s infinite;
}

/* Timer */
.timer {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--sp-3);
}
.timer-num {
  font-family: var(--f-mono);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1;
  color: var(--ink);
  transition: color var(--dur-3) var(--ease);
}
.timer-num.urgent { color: var(--danger); animation: pulse-live .8s infinite; }
.timer-meta { text-align: right; font-size: 11px; color: var(--ink-muted); }
.timer-meta .q { font-family: var(--f-mono); color: var(--ink-dim); }
.timer-bar {
  height: 4px; background: var(--line);
  position: relative; overflow: hidden;
}
.timer-bar > span {
  position: absolute; inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 1s linear;
}
.timer-bar.urgent > span { background: var(--danger); }

/* Streak banner */
.streak {
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3);
}
.streak-score .big {
  font-family: var(--f-mono);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -.01em;
  line-height: 1;
  display: inline-block;
  animation: tick-up var(--dur-3) var(--ease);
}
.streak-score .delta {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--success);
  margin-left: 6px;
}
.streak-flames {
  display: flex; gap: 3px;
  padding: 4px 10px;
  background: color-mix(in oklch, var(--accent) 20%, transparent);
  border: 1px solid color-mix(in oklch, var(--accent) 45%, transparent);
  border-radius: var(--r-pill);
  color: var(--accent);
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .1em;
}

/* Leaderboard */
.lb { display: flex; flex-direction: column; min-height: 0; }
.lb-list { overflow-y: auto; flex: 1; padding: 4px 0; }
.lb-row {
  display: grid;
  grid-template-columns: 28px 28px 1fr auto;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px 12px;
  border-bottom: 1px solid color-mix(in oklch, var(--line) 60%, transparent);
  transition: background var(--dur-2) var(--ease);
  position: relative;
}
.lb-row:hover { background: var(--bg-elev-2); }
.lb-row.me { background: color-mix(in oklch, var(--accent) 14%, transparent); }
.lb-row.me::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent);
}
.lb-rank {
  font-family: var(--f-mono);
  font-size: 12px; font-weight: 700;
  color: var(--ink-muted);
  text-align: center;
}
.lb-rank.r1 { color: oklch(0.85 0.18 90); }
.lb-rank.r2 { color: oklch(0.75 0.03 250); }
.lb-rank.r3 { color: oklch(0.65 0.12 55); }

.lb-av {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700;
}

.lb-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-sub { font-size: 10.5px; color: var(--ink-muted); }
.lb-score { font-family: var(--f-mono); font-weight: 700; font-size: 13px; }

.lb-row.climbing .lb-score { color: var(--success); animation: tick-up var(--dur-3) var(--ease); }

/* ---- Lobby waiting room / available players ---- */
.available-panel {
  border-color: color-mix(in oklch, var(--accent) 28%, var(--line));
  background:
    radial-gradient(circle at top right, color-mix(in oklch, var(--accent) 16%, transparent), transparent 42%),
    linear-gradient(180deg, color-mix(in oklch, var(--bg-elev-2) 92%, var(--accent) 8%), var(--bg-elev));
  box-shadow: 0 10px 30px color-mix(in oklch, var(--accent) 12%, transparent);
}

.available-panel-head {
  align-items: flex-start;
  border-bottom-color: color-mix(in oklch, var(--accent) 22%, var(--line));
}

.available-panel-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.available-panel-sub {
  font-size: 9px;
  letter-spacing: .18em;
  color: color-mix(in oklch, var(--accent) 56%, var(--ink-muted));
}

.available-panel-count {
  color: var(--accent);
}

.available-list {
  padding: 8px;
  display: grid;
  gap: 8px;
}

.available-card {
  position: relative;
  border: 1px solid color-mix(in oklch, var(--accent) 22%, var(--line));
  border-radius: calc(var(--r-md) + 2px);
  background:
    linear-gradient(180deg, color-mix(in oklch, var(--bg-elev-2) 88%, var(--accent) 12%), var(--bg-elev));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  overflow: hidden;
}

.available-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.available-card.me {
  border-color: color-mix(in oklch, var(--accent) 50%, white 10%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.05),
    0 0 0 1px color-mix(in oklch, var(--accent) 14%, transparent),
    0 12px 24px color-mix(in oklch, var(--accent) 14%, transparent);
}

.available-card-main {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 14px;
}

.available-av {
  width: 34px;
  height: 34px;
  font-size: 11px;
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 14%, transparent);
}

.available-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.available-topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.available-topline .lb-name {
  font-size: 13px;
}

.available-score {
  font-size: 11px;
  color: var(--accent);
  padding: 2px 7px;
  border-radius: var(--r-pill);
  border: 1px solid color-mix(in oklch, var(--accent) 30%, transparent);
  background: color-mix(in oklch, var(--accent) 12%, transparent);
}

.available-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.available-tag,
.available-status {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  border-radius: var(--r-pill);
  font-size: 9.5px;
  line-height: 1;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.available-tag {
  padding: 4px 7px;
  color: var(--ink-dim);
  background: color-mix(in oklch, var(--bg) 50%, transparent);
  border: 1px solid color-mix(in oklch, var(--line) 72%, transparent);
}

.available-tag.me {
  color: var(--accent);
  border-color: color-mix(in oklch, var(--accent) 38%, transparent);
  background: color-mix(in oklch, var(--accent) 12%, transparent);
}

.available-status {
  padding: 0;
  color: var(--ink-muted);
}

/* Power-ups */
.powerups { display: flex; gap: 6px; padding: 10px; }
.powerup {
  flex: 1;
  padding: 8px 4px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--ink-dim);
  transition: all var(--dur-2) var(--ease);
  position: relative;
  overflow: hidden;
}
.powerup:hover:not(.spent):not(:disabled) {
  border-color: var(--accent);
  color: var(--ink);
  transform: translateY(-1px);
}
.powerup .icon { font-size: 16px; line-height: 1; font-family: var(--f-display); font-weight: 800; }
.powerup .name { font-size: 9.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.powerup .cost { font-family: var(--f-mono); font-size: 9px; color: var(--ink-muted); }
.powerup.spent { opacity: .38; text-decoration: line-through; cursor: not-allowed; }

/* ---- Footer ---- */
.foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--sp-5);
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
}
.foot .cisco-mark {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-dim);
}
.foot .cisco-mark .swatch {
  width: 10px; height: 10px; border-radius: 2px;
  background: var(--cisco);
  box-shadow: 0 0 8px color-mix(in oklch, var(--cisco) 50%, transparent);
}
.foot .sep { opacity: .3; padding: 0 6px; }

/* ---- Stage (inner screen area) ---- */
/* .screen is the scroll container for any screen whose content can overflow the .stage area.
   .stage has overflow:hidden, so without overflow-y on .screen the content gets clipped (no scrollbar). */
.screen { height: 100%; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.screen-inner { flex: 1; overflow-y: auto; padding: var(--sp-8) var(--sp-10); }

[data-density="compact"] .screen-inner { padding: var(--sp-5) var(--sp-6); }
[data-density="roomy"]   .screen-inner { padding: var(--sp-10) var(--sp-12); }

.eyebrow {
  font-family: var(--f-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--ink-muted);
  margin-bottom: 10px;
}
.h1 {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 48px;
  letter-spacing: -.02em;
  line-height: 1.02;
  margin: 0 0 12px 0;
  text-wrap: balance;
}
.h2 {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -.01em;
  line-height: 1.1;
  margin: 0 0 8px 0;
}
.lede {
  font-size: 16px;
  color: var(--ink-dim);
  max-width: 60ch;
  line-height: 1.55;
  text-wrap: pretty;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .02em;
  transition: all var(--dur-2) var(--ease);
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 2px 0 color-mix(in oklch, var(--accent-ink) 30%, transparent),
              0 6px 18px color-mix(in oklch, var(--accent) 35%, transparent);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: var(--bg-elev);
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover { background: var(--bg-elev-2); border-color: var(--ink-muted); }
.btn-lg { padding: 16px 28px; font-size: 15px; }
.btn-sm { padding: 8px 14px; font-size: 12.5px; }
.btn-danger { background: var(--danger); color: white; }

/* Inputs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.input {
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink);
  font-size: 14.5px;
  transition: border-color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
  width: 100%;
}
.input:focus { outline: none; border-color: var(--accent); background: var(--bg-elev-2); }
.input::placeholder { color: var(--ink-muted); }
.textarea { min-height: 120px; resize: vertical; font-family: var(--f-mono); font-size: 13px; line-height: 1.55; }

/* Cards */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}

/* Chip */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--chip-bg);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-dim);
}

/* "LIVE" dot */
.live-dot {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--danger);
  font-weight: 700;
}
.live-dot::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger);
  animation: pulse-live 1.2s infinite;
}

/* Shimmer skeleton */
.skel {
  background: linear-gradient(90deg, var(--bg-elev) 0%, var(--bg-elev-2) 50%, var(--bg-elev) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite linear;
  border-radius: var(--r-sm);
}

@media (max-width: 768px) {
  .shell,
  [data-density="compact"] .shell,
  [data-density="roomy"] .shell,
  [data-layout="full"] .shell,
  [data-layout="ticker"] .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    grid-template-areas:
      "header"
      "stage"
      "sidebar"
      "footer";
    height: 100dvh;
  }

  .header {
    padding: 0 var(--sp-4);
    gap: var(--sp-3);
  }

  .brand-name { max-width: 160px; }

  .header-right {
    gap: var(--sp-2);
    min-width: 0;
  }

  .me-chip { min-width: 0; }

  .me-chip .label,
  .me-chip .sub {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .icon-btn {
    width: 44px;
    height: 44px;
  }

  .side {
    padding: var(--sp-4);
    border-left: 0;
    border-top: 1px solid var(--line);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    align-content: start;
    overflow-y: auto;
  }

  .side > .lb {
    grid-column: 1 / -1;
    min-height: 260px;
  }

  .timer {
    padding: 12px 14px;
  }

  .timer-num { font-size: 36px; }

  .streak { align-items: flex-start; }

  .powerups {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .powerup { min-height: 44px; }

  .foot {
    padding: 0 var(--sp-4);
    gap: var(--sp-2);
    flex-wrap: wrap;
    justify-content: center;
    min-height: 44px;
  }

  .screen-inner,
  [data-density="compact"] .screen-inner,
  [data-density="roomy"] .screen-inner {
    padding: var(--sp-6);
  }

  .h1 { font-size: 40px; }
  .h2 { font-size: 24px; }

  .lede {
    font-size: 15px;
    max-width: 52ch;
  }

  .btn {
    min-height: 44px;
    padding: 12px 18px;
  }

  .shell[data-screen="quiz"] .side {
    display: none !important;
  }

  .shell[data-screen="quiz"] {
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    grid-template-areas:
      "header"
      "stage"
      "footer" !important;
  }

  .shell[data-screen="quiz"] .stage,
  .shell[data-screen="quiz"] .screen,
  .shell[data-screen="quiz"] .screen-inner {
    overflow-y: auto;
  }

  .shell[data-screen="quiz"] .header {
    padding: 0 var(--sp-3);
    min-height: 52px;
  }

  .shell[data-screen="quiz"] .quiz {
    padding: 12px 8px !important;
  }

  .shell[data-screen="quiz"] .quiz-prompt {
    font-size: clamp(18px, 5vw, 24px) !important;
    line-height: 1.3;
  }
}

@media (max-width: 480px) {
  .shell,
  [data-density="compact"] .shell,
  [data-density="roomy"] .shell,
  [data-layout="full"] .shell,
  [data-layout="ticker"] .shell {
    grid-template-rows: auto minmax(0, 1fr) auto auto;
  }

  .header {
    padding: var(--sp-3);
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .brand-name { max-width: 120px; }
  .brand-tag,
  .me-chip .sub { display: none; }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .phase-pill {
    padding: 6px 12px;
    font-size: 10.5px;
  }

  .me-chip { padding-right: 10px; }

  .side {
    padding: var(--sp-3);
    gap: var(--sp-2);
    grid-template-columns: 1fr;
    max-height: 42vh;
  }

  .side > .lb { min-height: 220px; }

  .panel-head { padding: 10px 12px; }

  .timer {
    grid-template-columns: 1fr;
    gap: var(--sp-2);
  }

  .timer-num { font-size: 32px; }
  .timer-meta { text-align: left; }

  .streak {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 14px;
  }

  .streak-score .big { font-size: 22px; }

  .lb-row {
    grid-template-columns: 24px 24px 1fr auto;
    padding: 8px 10px;
  }

  .lb-av {
    width: 24px;
    height: 24px;
  }

  .lb-name { font-size: 12px; }

  .powerups { gap: 8px; }

  .powerup { padding: 10px 6px; }

  .screen-inner { padding: var(--sp-4); }
  .h1 { font-size: 32px; }
  .h2 { font-size: 22px; }
  .lede { font-size: 14px; }

  .btn-lg {
    padding: 14px 20px;
    font-size: 14px;
  }

  .input {
    min-height: 44px;
    font-size: 16px;
  }
}

@media (max-width: 375px) {
  /* Typography: tighter for iPhone SE/13 mini */
  .h1 { font-size: 28px; }
  .h2 { font-size: 20px; }
  .lede { font-size: 13.5px; }

  /* Header: prevent horizontal overflow */
  .header { padding: var(--sp-2); gap: var(--sp-2); }
  .brand-name { max-width: 90px; font-size: 12px; }
  .phase-pill { padding: 5px 10px; font-size: 10px; letter-spacing: .1em; }
  .me-chip .label { font-size: 11px; max-width: 60px; }

  /* Screen inner: tighter padding */
  .screen-inner { padding: var(--sp-3); }

  /* Sidebar: condense for small screens */
  .side { max-height: 36vh; padding: var(--sp-2); gap: var(--sp-2); }
  .panel-head { padding: 8px 10px; font-size: 10px; }
  .timer { padding: 10px 12px; }
  .timer-num { font-size: 28px; }
  .streak { padding: 10px 12px; }
  .streak-score .big { font-size: 20px; }

  /* Leaderboard: tighter rows */
  .lb-row { grid-template-columns: 22px 22px 1fr auto; padding: 6px 8px; }
  .lb-av { width: 22px; height: 22px; font-size: 9px; }
  .lb-name { font-size: 11px; }
  .lb-score { font-size: 12px; }

  /* Power-ups: maintain touch targets */
  .powerup { min-height: 48px; }
  .powerup .name { font-size: 9px; }

  /* Buttons: slightly tighter */
  .btn-lg { padding: 14px 16px; font-size: 13.5px; }

  /* Footer: compact */
  .foot { min-height: 32px; padding: 0 var(--sp-3); font-size: 9.5px; }
}

/* ── Accessibility ─────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Remove outline on mouse click but keep for keyboard */
:focus:not(:focus-visible) {
  outline: none;
}

/* High-contrast focus for buttons and interactive elements */
.btn:focus-visible,
.icon-btn:focus-visible,
.join-btn:focus-visible,
.answer-card:focus-visible,
.tweak-toggle:focus-visible,
.scr-nav button:focus-visible,
.me-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px oklch(from var(--accent) l c h / 0.25);
}

/* Skip navigation link */
.sr-only-focusable {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only-focusable:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  width: auto;
  height: auto;
  margin: 0;
  padding: 8px 16px;
  overflow: visible;
  clip: auto;
  background: var(--bg);
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  z-index: 10000;
  white-space: normal;
}

/* ── Reduced Motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================================
   TEAM-GROUPED LEADERBOARD — Sidebar (team-lb-*)
   ========================================================================= */

.team-lb-group {
  border-radius: var(--r-sm);
  overflow: hidden;
  margin-bottom: 2px;
}

.team-lb-group--mine {
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--team-accent, var(--accent)) 55%, transparent),
              0 0 12px color-mix(in oklch, var(--team-accent, var(--accent)) 20%, transparent);
}

.team-lb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px 5px 8px;
  background: color-mix(in oklch, var(--bg-elev) 80%, transparent);
  gap: 6px;
}

.team-lb-header-left {
  display: flex;
  align-items: center;
  gap: 5px;
}

.team-lb-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.team-lb-rank {
  font-size: 11px;
  min-width: 14px;
  text-align: center;
}

.team-lb-emoji {
  font-size: 13px;
}

.team-lb-short {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--ink);
}

.team-lb-count {
  font-size: 10px;
}

.team-lb-total {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.team-lb-player {
  background: color-mix(in oklch, var(--bg) 60%, transparent);
  /* Override .lb-row's 4-col grid (rank, avatar, name, score). Team rows
     have only 3 children (avatar, name+role, score) — without this override
     the name lands in the 28px rank slot and gets clipped to "MO" / "JO". */
  grid-template-columns: 28px 1fr auto;
}
.team-lb-player .lb-name {
  /* Allow the name to take the full available width and wrap if very long
     instead of clipping to ellipsis-on-overflow inside a tiny column. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
