/* ============================================================
   WARGAME BRIEFINGS — styles.css
   Mobile-first premium dark executive design
   ============================================================ */

/* === CSS Custom Properties === */
:root {
  --bg-primary:      #0a0f1e;
  --bg-card:         #111827;
  --bg-card-hover:   #1a2236;
  --bg-card-active:  #1e2a42;
  --accent-blue:     #2563eb;
  --accent-blue-h:   #1d4ed8;
  --accent-gold:     #d97706;
  --accent-gold-lt:  #f59e0b;
  --text-primary:    #f1f5f9;
  --text-secondary:  #94a3b8;
  --text-muted:      #475569;
  --border:          #1e293b;
  --border-lt:       #2d3f5e;
  --progress-bg:     #1e293b;
  --shadow-card:     0 4px 24px rgba(0, 0, 0, 0.45);
  --shadow-card-h:   0 8px 32px rgba(37, 99, 235, 0.18);
  --shadow-play:     0 4px 20px rgba(37, 99, 235, 0.4);
  --play-btn-size:   80px;
  --radius-card:     12px;
  --radius-btn:      8px;
  --ease:            0.2s ease;
  --safe-top:        env(safe-area-inset-top, 0px);
  --safe-bottom:     env(safe-area-inset-bottom, 0px);
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

/* === Screen Management === */
.screen { display: none; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.screen:not([hidden]) { display: flex; }
.screen[hidden] { display: none !important; }

.screen-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
  padding: calc(var(--safe-top) + 16px) 20px 24px;
}

/* === App Header === */
.app-header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.app-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 21px;
  color: var(--accent-gold);
  line-height: 1;
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.logo-sub {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 3px;
  padding-left: 31px;
}

/* === Buttons === */
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; color: inherit; line-height: inherit; }

button:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 3px;
  border-radius: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 16px;
  transition: var(--ease);
  min-height: 48px;
}

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
  width: 100%;
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.3);
}
.btn-primary:hover  { background: var(--accent-blue-h); }
.btn-primary:active { transform: scale(0.98); }

.btn-large { padding: 16px 28px; font-size: 17px; min-height: 56px; border-radius: 10px; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 500;
  min-height: 44px;
  transition: var(--ease);
}
.btn-ghost:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }

.btn-back {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-blue);
  font-weight: 600;
  font-size: 15px;
  padding-left: 4px;
}

.btn-small { font-size: 13px; padding: 6px 10px; min-height: 36px; }

.btn-text-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 44px;
  cursor: pointer;
  transition: var(--ease);
}
.btn-text-link:hover { color: var(--text-secondary); }

.edit-label { color: var(--accent-blue); font-size: 12px; font-weight: 600; }

/* === Name Screen === */
.name-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 0 48px;
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}

.name-heading {
  font-size: clamp(38px, 10vw, 56px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.name-subheading {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 40px;
  font-weight: 400;
}

.name-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.name-input {
  width: 100%;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 18px;
  font-family: inherit;
  font-weight: 500;
  min-height: 56px;
  transition: border-color var(--ease), background var(--ease);
  appearance: none;
}
.name-input::placeholder { color: var(--text-muted); font-weight: 400; }
.name-input:focus { outline: none; border-color: var(--accent-blue); background: #0f1829; }

.privacy-note {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 12px;
}

/* === Competitor Selection === */
#user-greeting-header { font-weight: 600; color: var(--text-primary); font-size: 13px; }

.section-intro { margin-bottom: 24px; }

.welcome-heading {
  font-size: clamp(24px, 6vw, 34px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 8px;
}

.welcome-name { color: var(--accent-gold-lt); }

.welcome-sub { font-size: 16px; color: var(--text-secondary); }

.competitor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.competitor-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 16px 18px;
  cursor: pointer;
  transition: transform var(--ease), background var(--ease), box-shadow var(--ease), border-color var(--ease);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 110px;
  position: relative;
  text-align: left;
  overflow: hidden;
}
.competitor-card:hover  { background: var(--bg-card-hover); border-color: var(--border-lt); box-shadow: var(--shadow-card-h); transform: translateY(-2px); }
.competitor-card:active { transform: translateY(0); background: var(--bg-card-active); }
.competitor-card:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 3px; }

.card-accent-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 12px 12px 0 0;
}

.card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-top: 6px;
}

.card-tagline {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  font-weight: 500;
}

.card-description {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 2px;
  flex: 1;
}

.card-arrow {
  font-size: 16px;
  color: var(--text-muted);
  align-self: flex-end;
  margin-top: 4px;
}

/* === Mode Selection === */
.competitor-badge {
  display: inline-block;
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(37, 99, 235, 0.28);
  color: #60a5fa;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
}

.section-heading {
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 6px;
}

.section-sub { font-size: 15px; color: var(--text-secondary); }

.mode-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mode-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  cursor: pointer;
  transition: transform var(--ease), background var(--ease), box-shadow var(--ease), border-color var(--ease);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 80px;
  text-align: left;
}
.mode-card:hover  { background: var(--bg-card-hover); border-color: var(--border-lt); box-shadow: var(--shadow-card-h); }
.mode-card:active { background: var(--bg-card-active); }
.mode-card:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 3px; }

.mode-icon {
  font-size: 24px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  flex-shrink: 0;
}

.mode-text { flex: 1; min-width: 0; }

.mode-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 3px;
}

.mode-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.mode-arrow { color: var(--text-muted); font-size: 18px; flex-shrink: 0; }

/* === Player Screen === */
.player-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.player-identity {
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.player-competitor {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 8px;
}

.player-mode {
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.2;
}

.player-listener { font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; }
.player-duration  { font-size: 12px; color: var(--text-muted); font-style: italic; }

/* Intro Overlay */
.intro-overlay {
  background: rgba(10, 15, 30, 0.96);
  border: 1px solid var(--border-lt);
  border-radius: var(--radius-card);
  padding: 32px 24px;
  text-align: center;
}

.intro-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.intro-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-lt);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.intro-overlay-text {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.65;
  font-style: italic;
  max-width: 300px;
}

/* Start Panel */
.start-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 4px 0;
}

.btn-start-briefing {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--accent-blue);
  color: #fff;
  padding: 18px 40px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  width: 100%;
  min-height: 64px;
  transition: transform var(--ease), background var(--ease), box-shadow var(--ease);
  box-shadow: var(--shadow-play);
}
.btn-start-briefing:hover    { background: var(--accent-blue-h); box-shadow: 0 6px 28px rgba(37,99,235,0.5); transform: translateY(-1px); }
.btn-start-briefing:active   { transform: translateY(0); }
.btn-start-briefing:disabled { opacity: 0.65; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-start-briefing:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

.start-icon { font-size: 20px; }
.start-hint { font-size: 13px; color: var(--text-muted); text-align: center; }

/* Audio Controls */
.player-controls {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.progress-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-bar {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  touch-action: none;
}

.progress-bar::before {
  content: '';
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 5px;
  transform: translateY(-50%);
  background: var(--progress-bg);
  border-radius: 3px;
}

.progress-fill {
  position: absolute;
  top: 50%; left: 0;
  height: 5px;
  transform: translateY(-50%);
  background: var(--accent-blue);
  border-radius: 3px;
  width: 0%;
  pointer-events: none;
}

.progress-thumb {
  position: absolute;
  top: 50%; left: 0%;
  width: 16px; height: 16px;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.progress-bar:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 4px; border-radius: 3px; }

.time-display {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  padding: 0 2px;
}

/* Transport Buttons */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.btn-control {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  width: 56px;
  height: 56px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 22px;
  transition: background var(--ease), color var(--ease), transform var(--ease);
}
.btn-control:hover  { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-control:active { transform: scale(0.9); }
.btn-rewind { flex-direction: column-reverse; }

.control-label { font-size: 11px; font-weight: 700; line-height: 1; }

.btn-play-pause {
  width: var(--play-btn-size);
  height: var(--play-btn-size);
  background: var(--accent-blue);
  border-radius: 50%;
  color: #fff;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--ease), background var(--ease), box-shadow var(--ease);
  box-shadow: var(--shadow-play);
  flex-shrink: 0;
}
.btn-play-pause:hover  { background: var(--accent-blue-h); transform: scale(1.06); box-shadow: 0 6px 28px rgba(37,99,235,0.5); }
.btn-play-pause:active { transform: scale(0.96); }
.btn-play-pause:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }

/* Speed Controls */
.speed-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.speed-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-right: 4px; }

.btn-speed {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  min-height: 36px;
  min-width: 48px;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.btn-speed:hover { color: var(--text-secondary); border-color: var(--border-lt); }
.btn-speed.active { background: rgba(37,99,235,0.14); border-color: var(--accent-blue); color: #60a5fa; }

/* Episode Notes */
.episode-notes {
  border-top: 1px solid var(--border);
  padding-top: 4px;
}

.notes-section { border-radius: var(--radius-card); }

.notes-summary {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 14px 0;
  list-style: none;
  display: flex;
  align-items: center;
  user-select: none;
  transition: color var(--ease);
}
.notes-summary::-webkit-details-marker { display: none; }
.notes-summary::marker { display: none; }
.notes-summary::after { content: '\203A'; font-size: 20px; margin-left: auto; transition: transform 0.2s ease; color: var(--text-muted); }
details[open] .notes-summary::after { transform: rotate(90deg); }
.notes-summary:hover { color: var(--text-primary); }

.notes-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-bottom: 8px;
}

.notes-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 10px;
}

.notes-list { list-style: none; display: flex; flex-direction: column; gap: 9px; }

.notes-list li {
  font-size: 14px;
  color: var(--text-secondary);
  padding-left: 20px;
  position: relative;
  line-height: 1.55;
}
.notes-list li::before { content: '\2014'; position: absolute; left: 0; color: var(--text-muted); }

/* Player Footer */
.player-footer-actions {
  display: flex;
  justify-content: center;
  padding: 4px 0 12px;
}

/* === Compliance Footer === */
.compliance-footer {
  padding: 14px 20px;
  padding-bottom: calc(14px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  text-align: center;
}
.compliance-footer p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 520px;
  margin: 0 auto;
}

/* === Competitor Logo (card + player) === */

/* Card: logo left, name right */
.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  margin-bottom: 8px;
}

.card-logo {
  flex-shrink: 0;
  line-height: 1;
  display: flex;
  align-items: center;
}

/* Player: logo centered above competitor name */
.player-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

/* Shared image rules */
.logo-img {
  display: block;
  object-fit: contain;
}
.card-logo .logo-img   { height: 28px; max-width: 80px; }
.player-logo .logo-img { height: 48px; max-width: 180px; }

/* === Demo Badge === */
.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(249, 115, 22, 0.12);
  border: 1px solid rgba(249, 115, 22, 0.3);
  color: #fb923c;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  padding: 5px 12px;
  border-radius: 20px;
  margin-top: 10px;
  animation: pulse-demo 2s ease-in-out infinite;
}

@keyframes pulse-demo {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.65; }
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .intro-spinner { animation: none; border-color: var(--accent-blue); }
}

/* === Responsive: Tablet & Desktop === */
@media (min-width: 640px) {
  .screen-inner { padding: calc(var(--safe-top) + 24px) 32px 32px; }
  .name-main { padding: 40px 0 60px; }
  .competitor-grid { gap: 18px; }
  .competitor-card { padding: 24px 20px 20px; min-height: 120px; }
  .card-name { font-size: 15px; }
  .player-mode { font-size: 28px; }
  .controls-row { gap: 36px; }
  .btn-control { width: 60px; height: 60px; }
}

@media (min-width: 1024px) {
  .screen-inner { padding: calc(var(--safe-top) + 32px) 48px 40px; }
}
