/* Red/White/Blue theme, ported from the Next.js reference app (globals.css +
   layout.tsx's Tailwind classes translated to plain CSS custom properties + rules,
   since there's no build step here). Navy is "the blue", page background/cards stay
   white/slate ("the white"), red is reserved for the header's bottom border, the
   active-tab underline, and incorrect-pick shading, so it doesn't get diluted by
   overuse elsewhere - same restraint as the original. */

:root {
  --navy: #1e3a8a;       /* header background (Tailwind blue-900) */
  --navy-text: #bfdbfe;  /* inactive nav text (blue-200) */
  --navy-text-dim: #dbeafe; /* "Playing as" text (blue-100) */
  --red: #ef4444;        /* header bottom border (red-500) */
  --red-active: #f87171; /* active nav underline (red-400) */
  --red-600: #dc2626;
  --red-700: #b91c1c;
  --green-600: #16a34a;
  --green-700: #15803d;
  --bg: #f8fafc;         /* page background (slate-50) */
  --text: #0f172a;       /* body text (slate-900) */
  --text-muted: #64748b; /* slate-500 */
  --border: #e2e8f0;     /* slate-200 */
  --card: #ffffff;
  --font: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

body {
  display: flex;
  flex-direction: column;
}

a { color: inherit; }

/* ---- header / nav ---- */

.sp-header {
  border-bottom: 4px solid var(--red);
  background: var(--navy);
}

.sp-header-inner {
  max-width: 1024px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 1.5rem;
}

.sp-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.sp-nav a {
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding-bottom: 0.25rem;
  color: var(--navy-text);
  transition: color 0.15s;
}

.sp-nav a:hover { color: #fff; }

.sp-nav a.active {
  color: #fff;
  border-bottom-color: var(--red-active);
}

.sp-session {
  font-size: 0.875rem;
  color: var(--navy-text-dim);
}

.sp-session strong { color: #fff; }

.sp-session a {
  text-decoration: underline;
}

/* The Apex logo, top-left, doubles as a "back to the Command Center" button (shown only to
   visitors who came from the Apex OS hub). Rendered flush and crisp to match the Command
   Center's own top-left logo -- deliberately NO filter, so it stays sharp instead of hazy. */
.sp-apexos-back {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  opacity: 0.95;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.sp-apexos-back:hover {
  opacity: 1;
  transform: translateY(-1px);
}
.sp-apexos-back img {
  height: 40px;
  width: auto;
  display: block;
  mix-blend-mode: normal;
}

/* Nav + session share the width to the right of the logo. */
.sp-header-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
}

.sp-session a:hover { color: #fff; }

/* ---- layout ---- */

.sp-main {
  max-width: 1024px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
  padding: 2rem 1.5rem;
}

h1 { font-size: 1.5rem; font-weight: 600; margin: 0 0 1.5rem; }
h2 { font-size: 1.125rem; font-weight: 500; margin: 0 0 0.75rem; }
h3 { font-size: 0.875rem; font-weight: 500; color: var(--text-muted); margin: 0 0 0.5rem; }

/* ---- components ---- */

.sp-card {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 0.375rem;
  padding: 1rem;
}

.sp-card + .sp-card { margin-top: 1rem; }

.sp-card-correct { border-color: #86efac; background: #f0fdf4; }
.sp-card-incorrect { border-color: #fca5a5; background: #fef2f2; }

.sp-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 0.375rem;
  border: 1px solid var(--border);
  background: #fff;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.sp-btn:hover { background: #f8fafc; }

.sp-btn-primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  font-weight: 600;
}

.sp-btn-primary:hover { background: #1a3170; }

.sp-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.sp-input, .sp-select, .sp-textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
}

.sp-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.sp-team-btn {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-bottom: none;
  background: #fff;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}

.sp-team-btn:last-child { border-bottom: 1px solid var(--border); }
.sp-team-btn:hover { background: #f8fafc; }
.sp-team-btn.picked { background: #eff6ff; font-weight: 600; color: #1e3a8a; }

.team-icon { flex-shrink: 0; }

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: #0f172a;
  color: #fff;
  padding: 0.625rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: transform 0.2s;
  z-index: 100;
}

.toast-visible { transform: translateX(-50%) translateY(0); }
.toast-error { background: var(--red-700); }

.sp-details {
  margin-bottom: 1rem;
  border-radius: 0.375rem;
  border: 1px solid #bfdbfe;
  background: rgba(239, 246, 255, 0.4);
}

.sp-details summary {
  cursor: pointer;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #1e3a8a;
}

.sp-details-body {
  border-top: 1px solid #dbeafe;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sp-muted { color: var(--text-muted); font-size: 0.875rem; }
.sp-error { color: var(--red-700); font-size: 0.875rem; }
.sp-success { color: var(--green-700); font-size: 0.875rem; }

@media (max-width: 640px) {
  .sp-header-inner { padding: 0.75rem 1rem; }
  .sp-nav { gap: 0.75rem; font-size: 0.8125rem; }
  .sp-main { padding: 1.25rem 1rem; }
}
