/* TrumpTracker — mobile-first PWA (app-like) */
:root {
  --tt-felt: #1b3d2f;
  --tt-felt-deep: #0f241c;
  --tt-felt-mid: #2e5c45;
  --tt-surface: #f0f4f1;
  --tt-surface-elevated: #ffffff;
  --tt-ink: #122018;
  --tt-ink-muted: #4a6356;
  --tt-team-a: #1565c0;
  --tt-team-b: #c62828;
  --tt-success: #2e7d32;
  --tt-danger: #c62828;
  --tt-warning: #ed6c02;
  --tt-accent: #c9a227;
  --tt-radius: 18px;
  --tt-radius-sm: 12px;
  --tt-shadow: 0 6px 20px rgba(15, 36, 28, 0.14);
  --tt-space: 8px;
  --tt-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tt-topbar-h: 52px;
  --tt-bottom-h: 64px;
  --tt-safe-top: env(safe-area-inset-top, 0px);
  --tt-safe-bottom: env(safe-area-inset-bottom, 0px);
  --tt-content-max: 480px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --tt-surface: #101814;
    --tt-surface-elevated: #1a2420;
    --tt-ink: #e8f0eb;
    --tt-ink-muted: #9bb5a6;
    --tt-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  }
}

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

html, body {
  font-family: var(--tt-font);
  background: var(--tt-felt-deep);
  color: var(--tt-ink);
  min-height: 100%;
  min-height: 100dvh;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

/* ---- App shell ---- */
.tt-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 80% at 50% -10%, var(--tt-felt-mid) 0%, transparent 55%),
    linear-gradient(180deg, var(--tt-felt) 0%, var(--tt-felt-deep) 100%);
}

.tt-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: calc(var(--tt-topbar-h) + var(--tt-safe-top));
  padding-top: var(--tt-safe-top);
  background: rgba(15, 36, 28, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  gap: 8px;
}

.tt-topbar-title {
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tt-topbar-meta {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.75rem;
  font-weight: 600;
  max-width: 46%;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tt-main {
  flex: 1;
  width: 100%;
  max-width: var(--tt-content-max);
  margin: 0 auto;
  padding: 12px 14px;
  padding-bottom: calc(var(--tt-bottom-h) + var(--tt-safe-bottom) + 20px);
  min-height: 0;
}

/* ---- Bottom tab bar ---- */
.tt-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  height: calc(var(--tt-bottom-h) + var(--tt-safe-bottom));
  padding-bottom: var(--tt-safe-bottom);
  background: rgba(12, 28, 22, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: center;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.25);
}

.tt-bottom-nav-inner {
  width: 100%;
  max-width: var(--tt-content-max);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: var(--tt-bottom-h);
  align-items: stretch;
}

.tt-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  min-height: 48px;
  padding: 4px 2px;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.tt-tab .tt-tab-icon {
  font-size: 1.25rem;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.tt-tab.active,
.tt-tab:hover {
  color: #fff;
}

.tt-tab.active .tt-tab-icon {
  background: rgba(201, 162, 39, 0.22);
  color: var(--tt-accent);
}

.tt-tab-play.active .tt-tab-icon {
  background: var(--tt-accent);
  color: #1a1405;
  box-shadow: 0 2px 10px rgba(201, 162, 39, 0.45);
}

/* ---- Typography / surfaces ---- */
.tt-hero-title {
  color: #f5f8f6;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 0.2rem;
  line-height: 1.2;
}

.tt-hero-sub {
  color: rgba(245, 248, 246, 0.78);
  margin: 0 0 1rem;
  font-size: 0.9rem;
  line-height: 1.35;
}

.tt-card {
  background: var(--tt-surface-elevated);
  border-radius: var(--tt-radius);
  box-shadow: var(--tt-shadow);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.tt-card h2, .tt-card h3 {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.tt-section-label {
  color: rgba(245, 248, 246, 0.7);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0.5rem 0 0.5rem;
}

/* ---- Scoreboard (play-first) ---- */
.tt-scoreboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tt-score-card {
  border-radius: var(--tt-radius);
  padding: 14px 10px 12px;
  color: #fff;
  text-align: center;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.tt-score-card.team-a { background: linear-gradient(155deg, #1e88e5, #0d47a1); }
.tt-score-card.team-b { background: linear-gradient(155deg, #e53935, #b71c1c); }
.tt-score-card.selected { outline: 3px solid var(--tt-accent); outline-offset: 2px; }

.tt-score-card .label {
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0.92;
  margin-bottom: 0.15rem;
}

.tt-score-card .score {
  font-size: clamp(2rem, 11vw, 2.75rem);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.tt-score-card .meta {
  font-size: 0.7rem;
  opacity: 0.85;
  margin-top: 0.35rem;
}

/* Sticky play action dock (above bottom nav) */
.tt-play-dock {
  position: sticky;
  bottom: calc(var(--tt-bottom-h) + var(--tt-safe-bottom) + 8px);
  z-index: 15;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 8px;
  padding: 8px 0 4px;
  background: linear-gradient(180deg, transparent, var(--tt-felt-deep) 28%);
}

/* ---- Controls ---- */
.tt-btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.15rem;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.1s ease;
  min-height: 48px;
  touch-action: manipulation;
}

.tt-btn:active { transform: scale(0.98); }
.tt-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.tt-btn-primary {
  background: var(--tt-accent);
  color: #1a1405;
  width: 100%;
  box-shadow: 0 4px 14px rgba(201, 162, 39, 0.35);
}

.tt-btn-secondary {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  width: 100%;
}

.tt-btn-ghost {
  background: transparent;
  color: var(--tt-ink);
  border: 1px solid rgba(0, 0, 0, 0.12);
  width: 100%;
}

.tt-btn-danger {
  background: transparent;
  color: var(--tt-danger);
  border: 1px solid color-mix(in srgb, var(--tt-danger) 40%, transparent);
  width: 100%;
}

.tt-btn-block { width: 100%; }

.tt-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

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

.tt-field input,
.tt-field select {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--tt-radius-sm);
  padding: 0.85rem 0.95rem;
  font-size: 16px; /* prevents iOS zoom */
  background: var(--tt-surface);
  color: var(--tt-ink);
  min-height: 48px;
  width: 100%;
}

.tt-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tt-chip {
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: var(--tt-surface);
  padding: 0.55rem 0.9rem;
  min-height: 42px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--tt-ink);
  touch-action: manipulation;
}

.tt-chip.active {
  background: var(--tt-felt);
  color: #fff;
  border-color: transparent;
}

.tt-chip.team-a.active { background: var(--tt-team-a); }
.tt-chip.team-b.active { background: var(--tt-team-b); }

.tt-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.tt-stepper button {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--tt-felt);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  flex-shrink: 0;
}

.tt-stepper .value {
  font-size: 2.1rem;
  font-weight: 800;
  min-width: 4.5ch;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--tt-ink);
}

.tt-alert {
  border-radius: var(--tt-radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  font-size: 0.92rem;
}

.tt-alert.error { background: #fdecea; color: #b71c1c; }
.tt-alert.info { background: #e8f5e9; color: #1b5e20; }
.tt-alert.warn { background: #fff4e5; color: #e65100; }

.tt-seat-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.tt-seat-row input {
  flex: 1;
  min-width: 0;
}

.tt-seat-clear {
  flex-shrink: 0;
  width: 42px;
  min-height: 42px;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
  margin: 0 !important;
}

.tt-seat-field.tt-seat-focus input {
  outline: 2px solid var(--tt-felt);
  outline-offset: 1px;
  border-color: var(--tt-felt);
}

.tt-round-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tt-round-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 0.92rem;
}

.tt-grid-actions {
  display: grid;
  gap: 0.65rem;
}

.tt-muted { color: var(--tt-ink-muted); }
.tt-success-text { color: var(--tt-success); font-weight: 700; }
.tt-fail-text { color: var(--tt-danger); font-weight: 700; }

.tt-check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0.55rem 0;
  color: var(--tt-ink);
  min-height: 44px;
}

.tt-check input {
  width: 20px;
  height: 20px;
  accent-color: var(--tt-felt);
}


/* More menu list */
.tt-menu-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tt-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  border-radius: 14px;
  background: var(--tt-surface-elevated);
  color: var(--tt-ink);
  text-decoration: none;
  font-weight: 700;
  min-height: 52px;
  box-shadow: var(--tt-shadow);
}

.tt-menu-item .tt-menu-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(27, 61, 47, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.tt-menu-item .tt-menu-chevron {
  margin-left: auto;
  opacity: 0.4;
}

.tt-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.75rem;
  font-weight: 700;
}

.tt-collapse-toggle {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--tt-ink-muted);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.5rem 0;
  cursor: pointer;
}

/* Tablet / wider phones */
@media (min-width: 640px) {
  :root { --tt-content-max: 560px; }
  .tt-hero-title { font-size: 1.7rem; }
  .tt-grid-actions { grid-template-columns: 1fr 1fr; }
}

/* Hide bottom nav print etc */
@media print {
  .tt-topbar, .tt-bottom-nav, .tt-play-dock { display: none !important; }
  .tt-main { padding: 0; max-width: none; }
}
