/* PlayDelay BYU — calm dark theme, huge tap targets (ALS / one-handed) */

:root {
  --bg: #0a1628;
  --bg-elevated: #122038;
  --bg-button: #1a2f4d;
  --bg-button-hover: #243d63;
  --navy: #002e5d;
  --navy-bright: #0b4a8a;
  --white: #f5f7fa;
  --muted: #9aabc2;
  --accent: #ffffff;
  --accent-soft: #c8d6e8;
  --live: #3dd68c;
  --warn: #f0c14b;
  --error: #f07178;
  --border: rgba(255, 255, 255, 0.12);
  --radius: 16px;
  --tap-min: 56px;
  --play-min: 88px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --landing-max: 720px;
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--white);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
}

a {
  color: var(--accent-soft);
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 20px 40px;
  padding-bottom: max(40px, env(safe-area-inset-bottom));
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--navy);
  border: 2px solid var(--white);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  color: var(--white);
  text-decoration: none;
}

.brand-mark-link:hover {
  background: var(--navy-bright);
}

.brand-text h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.subtitle {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.status-chip {
  flex-shrink: 0;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--muted);
  align-self: center;
}

.status-chip.status-loading { color: var(--warn); border-color: rgba(240, 193, 75, 0.4); }
.status-chip.status-live { color: var(--live); border-color: rgba(61, 214, 140, 0.45); }
.status-chip.status-paused { color: var(--accent-soft); }
.status-chip.status-error { color: var(--error); border-color: rgba(240, 113, 120, 0.45); }

.banner {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: rgba(240, 193, 75, 0.12);
  border: 1px solid rgba(240, 193, 75, 0.45);
  color: var(--warn);
  font-size: 0.95rem;
  line-height: 1.4;
}

.banner.banner-error {
  background: rgba(240, 113, 120, 0.12);
  border-color: rgba(240, 113, 120, 0.45);
  color: var(--error);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 50;
  max-width: min(440px, calc(100vw - 32px));
  padding: 14px 18px;
  border-radius: 12px;
  background: #1e3354;
  border: 1px solid var(--border);
  color: var(--white);
  font-size: 0.95rem;
  line-height: 1.35;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.delay-readout {
  text-align: center;
  padding: 28px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.delay-value {
  font-size: clamp(3.2rem, 12vw, 4.5rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.delay-label {
  margin-top: 8px;
  font-size: 0.95rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.transport {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-button);
  color: var(--white);
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 650;
  border-radius: var(--radius);
  min-height: var(--tap-min);
  padding: 12px 18px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
  user-select: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.btn:hover {
  background: var(--bg-button-hover);
}

.btn:active {
  transform: scale(0.98);
}

.btn:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}

.btn-play {
  min-height: var(--play-min);
  font-size: 1.55rem;
  background: var(--navy-bright);
  border-color: rgba(255, 255, 255, 0.28);
}

.btn-play[aria-pressed="true"] {
  background: #1a4a3a;
  border-color: rgba(61, 214, 140, 0.5);
}

.btn-mute {
  min-width: 96px;
  min-height: var(--play-min);
}

.btn-mute[aria-pressed="true"] {
  background: #4a2a32;
  border-color: rgba(240, 113, 120, 0.45);
  color: #ffc4c8;
}

.volume-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 2px;
}

.volume-label {
  font-size: 0.95rem;
  color: var(--muted);
  min-width: 4.5rem;
}

#volume {
  flex: 1;
  height: 44px;
  accent-color: var(--accent-soft);
  cursor: pointer;
}

.presets,
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 10px;
}

.btn-preset,
.btn-step {
  min-height: var(--tap-min);
  font-size: 1.15rem;
}

.btn-preset.is-active {
  background: var(--navy);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.sync-tip {
  margin: 4px 0 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--accent-soft);
  font-size: 0.95rem;
  line-height: 1.45;
}

.shortcuts {
  margin: 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

#audio {
  display: none;
}

/* ——— Landing ——— */

.landing {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(11, 74, 138, 0.45), transparent 60%),
    var(--bg);
}

/* Game-night stadium backdrop (fixed cover + navy overlay) */
.env-landing {
  background-color: var(--bg);
  background-image:
    linear-gradient(
      180deg,
      rgba(10, 22, 40, 0.82) 0%,
      rgba(10, 22, 40, 0.88) 45%,
      rgba(10, 22, 40, 0.94) 100%
    ),
    url("assets/env-stadium-night.jpg");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-attachment: scroll;
}

@media (min-width: 720px) {
  .env-landing {
    background-attachment: fixed;
  }
}

.landing-shell {
  position: relative;
  z-index: 1;
  max-width: var(--landing-max);
  margin: 0 auto;
  padding: 24px 22px 48px;
  padding-bottom: max(48px, env(safe-area-inset-bottom));
}

/* Soft gold edge on elevated cards for navy/gold feel */
.env-landing .hero-art,
.env-landing .step-card,
.env-landing .focus-note,
.env-landing .login-card {
  border-color: rgba(240, 193, 75, 0.22);
  background: rgba(18, 32, 56, 0.88);
  backdrop-filter: blur(8px);
}

.env-gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 0 0 40px;
}

@media (min-width: 560px) {
  .env-gallery {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 720px) {
  .env-gallery {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.env-card {
  margin: 0;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(240, 193, 75, 0.28);
  background: rgba(18, 32, 56, 0.75);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
}

.env-card img {
  display: block;
  width: 100%;
  height: clamp(140px, 28vw, 200px);
  object-fit: cover;
  object-position: center;
}

.env-card figcaption {
  margin: 0;
  padding: 12px 14px 14px;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--warn);
  letter-spacing: -0.01em;
}

/* Login: muted turf band under shell */
.login-page {
  background-image:
    linear-gradient(
      180deg,
      rgba(10, 22, 40, 0.88) 0%,
      rgba(10, 22, 40, 0.92) 50%,
      rgba(10, 22, 40, 0.96) 100%
    ),
    url("assets/env-football-turf.jpg");
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
}

.landing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 40px;
}

.nav-link {
  flex-shrink: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-soft);
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.nav-link:hover {
  background: var(--bg-button-hover);
  color: var(--white);
}

.hero {
  margin-bottom: 48px;
}

.hero-kicker {
  margin: 0 0 12px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-soft);
}

.hero-title {
  margin: 0 0 16px;
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero-lead {
  margin: 0 0 28px;
  max-width: 36rem;
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--muted);
}

.hero-actions {
  margin-bottom: 14px;
}

.btn-cta {
  min-height: 64px;
  padding: 16px 28px;
  font-size: 1.25rem;
  background: var(--navy-bright);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 12px 40px rgba(0, 46, 93, 0.55);
}

.btn-cta:hover {
  background: #0d5aa3;
}

.hero-note {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.section-title {
  margin: 0 0 18px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.how {
  margin-bottom: 36px;
}

.steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.step-num {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--navy);
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
}

.step-card h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
}

.step-card p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--muted);
}

.focus-note {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  margin-bottom: 40px;
}

.focus-note p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--accent-soft);
}

.focus-note strong {
  color: var(--white);
  font-weight: 650;
}

.landing-footer {
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.landing-footer p {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.landing-footer a {
  color: var(--accent-soft);
  text-decoration: none;
}

.landing-footer a:hover {
  text-decoration: underline;
  color: var(--white);
}

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

  .btn-mute {
    min-height: var(--tap-min);
  }

  .landing-header {
    flex-wrap: wrap;
  }
}

/* ——— Auth / login (optional; never blocks player) ——— */

.header-actions,
.header-end {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.auth-slot {
  display: flex;
  align-items: center;
}

.auth-user {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(220px, 46vw);
}

.auth-email {
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
}

.btn-auth {
  min-height: 44px;
  padding: 10px 14px;
  font-size: 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
  color: var(--accent-soft);
  text-decoration: none;
}

.btn-auth:hover {
  color: var(--white);
  background: var(--bg-button-hover);
}

.btn-auth-secondary {
  min-height: var(--tap-min);
  font-size: 1.05rem;
  background: transparent;
  border-color: rgba(240, 193, 75, 0.45);
  color: var(--warn);
}

.btn-auth-secondary:hover {
  background: rgba(240, 193, 75, 0.1);
}

.hero-art {
  margin: 0 0 28px;
  padding: 0;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.hero-art img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.step-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(0, 46, 93, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px;
}

.player-app {
  position: relative;
}

.player-accent {
  position: absolute;
  inset: 0 0 auto 0;
  height: 160px;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  opacity: 0.9;
  mask-image: linear-gradient(to bottom, #000 40%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent);
}

.player-accent img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.player-app > .header,
.player-app > .banner,
.player-app > .main {
  position: relative;
  z-index: 1;
}

.login-shell {
  max-width: 480px;
}

.login-card {
  padding: 24px 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.login-demo-note {
  margin: 0 0 22px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-soft);
  margin-top: 8px;
}

.field-input {
  appearance: none;
  width: 100%;
  min-height: var(--tap-min);
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--white);
  font-family: inherit;
  font-size: 1.1rem;
}

.field-input:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}

.field-input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.login-error {
  margin: 8px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(240, 113, 120, 0.12);
  border: 1px solid rgba(240, 113, 120, 0.45);
  color: var(--error);
  font-size: 0.95rem;
}

.login-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}

.login-back {
  margin-top: 20px;
  text-align: center;
}

.login-back a {
  color: var(--accent-soft);
  font-weight: 600;
}

@media (max-width: 480px) {
  .auth-email {
    max-width: 90px;
  }

  .header-end {
    max-width: 58%;
  }
}


/* ——— Supabase auth UI ——— */

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.auth-tab {
  min-height: var(--tap-min);
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 650;
  cursor: pointer;
  touch-action: manipulation;
}

.auth-tab.is-active {
  background: var(--navy-bright);
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--white);
}

.login-info {
  margin: 8px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(61, 214, 140, 0.1);
  border: 1px solid rgba(61, 214, 140, 0.4);
  color: var(--live);
  font-size: 0.95rem;
}

.session-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(240px, 52vw);
}

.session-email {
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 130px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.banner.banner-ok {
  background: rgba(61, 214, 140, 0.12);
  border-color: rgba(61, 214, 140, 0.45);
  color: var(--live);
}
