/*
 * app.css — Super SpyFall game design system
 * Extends the tokens already defined in style.css.
 * Every game screen links to BOTH style.css (base) and app.css (game components).
 */

/* ---------------------------------------------------------------
   Extra tokens not in style.css (bridge to CLAUDE.md §11)
   Uses the existing style.css color values as ground truth.
---------------------------------------------------------------- */
:root {
  /* aliases so game code can use spec names */
  --gold:      var(--yellow);           /* #ffd91f */
  --orange:    #ff7a18;
  --border:    rgba(255, 255, 255, 0.08);
  --panel:     #0d1017;
  --panel-2:   #131820;
  --bg-2:      #05070d;
  --radius:    18px;
  --radius-lg: 24px;
  --radius-pill: 999px;
}

/* ---------------------------------------------------------------
   Layout helpers
---------------------------------------------------------------- */
.page-wrap {
  width: min(520px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  position: relative;
  z-index: 1;
}

/* full-width variant for lobby / game screens */
.page-wrap--wide {
  width: min(860px, calc(100% - 32px));
}

/* ---------------------------------------------------------------
   Panel / card variants
---------------------------------------------------------------- */
.panel {
  width: 100%;
  background: linear-gradient(180deg, var(--panel) 0%, rgba(0,0,0,0.6) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 4vw, 36px);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.panel--sm {
  padding: 16px 20px;
  border-radius: var(--radius);
}

/* ---------------------------------------------------------------
   Eyebrow / phase label badge  (matches the .eyebrow in style.css)
---------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid rgba(255, 217, 31, 0.26);
  border-radius: var(--radius-pill);
  background: rgba(255, 217, 31, 0.08);
  color: #ffe875;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.badge--red {
  border-color: rgba(255, 43, 31, 0.30);
  background: rgba(255, 43, 31, 0.08);
  color: #ff7a6e;
}

.badge--blue {
  border-color: rgba(46, 108, 246, 0.30);
  background: rgba(46, 108, 246, 0.08);
  color: #7aabff;
}

.badge--neutral {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

/* ---------------------------------------------------------------
   Buttons  (extends .button / .button.primary / .button.secondary)
---------------------------------------------------------------- */

/* danger / destructive */
.button.danger {
  background: linear-gradient(135deg, #c0160f, #7a0c08);
  border: 0;
  color: #fff;
  box-shadow: 0 12px 28px rgba(192, 22, 15, 0.28);
}

/* full-width block button */
.button--block {
  width: 100%;
  justify-content: center;
}

/* large tap-target variant */
.button--lg {
  min-height: 60px;
  font-size: 1.05rem;
  padding: 0 32px;
}

/* ---------------------------------------------------------------
   Form elements
---------------------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field input[type="text"],
.field input[type="number"] {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.field input:focus {
  border-color: rgba(255, 217, 31, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 217, 31, 0.10);
}

.field input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

/* Code input — big centered characters */
.input-code {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------
   Slider (timer settings)
---------------------------------------------------------------- */
.slider-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.slider-row__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.slider-row__label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.slider-row__value {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--gold);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--orange));
  box-shadow: 0 4px 12px rgba(255, 180, 0, 0.35);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--orange));
  box-shadow: 0 4px 12px rgba(255, 180, 0, 0.35);
  cursor: pointer;
}

/* ---------------------------------------------------------------
   Player list / roster
---------------------------------------------------------------- */
.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.player-list__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.player-list__item--host::after {
  content: "Host";
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(255, 217, 31, 0.10);
  border: 1px solid rgba(255, 217, 31, 0.22);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
}

/* voting — clickable player row */
.player-list__item--vote {
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.player-list__item--vote:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.player-list__item--selected {
  border-color: rgba(255, 217, 31, 0.55);
  background: rgba(255, 217, 31, 0.07);
}

/* ---------------------------------------------------------------
   Countdown timer display
---------------------------------------------------------------- */
.timer {
  font-size: clamp(2.8rem, 10vw, 4.5rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
}

.timer--warning {
  color: var(--orange);
}

.timer--critical {
  color: var(--red);
  animation: timerPulse 0.6s ease-in-out infinite alternate;
}

@keyframes timerPulse {
  from { opacity: 1; }
  to   { opacity: 0.55; }
}

/* ---------------------------------------------------------------
   Tab bar (Locations / Questions / Notes)
---------------------------------------------------------------- */
.tab-bar {
  display: flex;
  gap: 6px;
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px;
}

.tab-bar__btn {
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: calc(var(--radius-pill) - 4px);
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
  font-family: inherit;
}

.tab-bar__btn--active {
  background: rgba(255, 255, 255, 0.10);
  color: var(--text);
}

.tab-panel {
  display: none;
  width: 100%;
}

.tab-panel--active {
  display: block;
}

/* ---------------------------------------------------------------
   Location list (numbered)
---------------------------------------------------------------- */
.location-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
}

.location-list__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text);
}

.location-list__item b {
  min-width: 22px;
  color: var(--muted);
  font-size: 0.78rem;
}

/* spy's location guess — highlighted when selected */
.location-list__item--selected {
  border-color: rgba(255, 217, 31, 0.55);
  background: rgba(255, 217, 31, 0.07);
  color: var(--gold);
}

/* ---------------------------------------------------------------
   Notes textarea
---------------------------------------------------------------- */
.notes-area {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: block;
  min-height: 180px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 140ms ease;
}

.notes-area:focus {
  border-color: rgba(255, 217, 31, 0.40);
}

.notes-area::placeholder {
  color: rgba(255, 255, 255, 0.22);
}

/* ---------------------------------------------------------------
   Leaderboard
---------------------------------------------------------------- */
.leaderboard {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0 10px;
  border-bottom: 1px solid var(--border);
}

.leaderboard td {
  padding: 11px 0;
  font-size: 0.95rem;
  color: var(--text);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.leaderboard td.score {
  text-align: right;
  font-weight: 800;
  color: var(--gold);
}

.leaderboard tr.winner td {
  color: var(--gold);
}

/* ---------------------------------------------------------------
   Status / feedback messages
---------------------------------------------------------------- */
.alert {
  width: 100%;
  padding: 13px 18px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
}

.alert--error {
  background: rgba(224, 35, 28, 0.12);
  border: 1px solid rgba(224, 35, 28, 0.32);
  color: #ff8f8a;
}

.alert--success {
  background: rgba(34, 197, 94, 0.10);
  border: 1px solid rgba(34, 197, 94, 0.28);
  color: #6ee7a0;
}

.alert--info {
  background: rgba(46, 108, 246, 0.10);
  border: 1px solid rgba(46, 108, 246, 0.28);
  color: #93b8ff;
}

/* ---------------------------------------------------------------
   Section heading inside panels
---------------------------------------------------------------- */
.section-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}

/* ---------------------------------------------------------------
   Divider
---------------------------------------------------------------- */
.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  border: 0;
  margin: 4px 0;
}

/* ---------------------------------------------------------------
   Responsive
---------------------------------------------------------------- */
@media (max-width: 540px) {
  .location-list {
    grid-template-columns: 1fr 1fr;
  }

  .tab-bar__btn {
    font-size: 0.74rem;
  }
}
