/* ==========================================================================
   theme.css - Morse, the game
   PicoCSS overrides for retrofuturism aesthetic (brass/copper + electric blue)
   Dark mode default, light mode supported
   ========================================================================== */

/* ==========================================================================
   1. CSS Custom Properties - Color Palette & Typography
   ========================================================================== */

:root {
  /* Primary Colors */
  --brass-gold: #B8860B;
  --brass-gold-light: #D4AF37;
  --brass-gold-bright: #FFD700;
  --copper: #CD7F32;
  --copper-light: #E77C5D;
  --electric-blue: #00D9FF;
  --electric-blue-dark: #0099CC;
  --aged-paper: #F4F1EA;
  --dark-slate: #1E2738;
  --dark-slate-light: #2D3A4F;
  --dark-slate-lighter: #3A4A5E;
  --dark-slate-border: #4A5A6E;

  /* Semantic Colors */
  --success-green: #4CAF50;
  --error-red: #F44336;
  --warning-amber: #FFA726;
  --info-cyan: #00BCD4;

  /* Muted Semantic (for backgrounds) */
  --success-green-bg: rgba(76, 175, 80, 0.15);
  --error-red-bg: rgba(244, 67, 54, 0.12);
  --warning-amber-bg: rgba(255, 167, 38, 0.15);
  --info-cyan-bg: rgba(0, 188, 212, 0.12);

  /* Typography */
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Fira Code', 'Courier New', monospace;
  --font-display: 'Orbitron', 'Courier New', monospace;

  /* Spacing Scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-round: 50%;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-brass: 0 4px 16px rgba(184, 134, 11, 0.4);
  --shadow-blue: 0 4px 16px rgba(0, 217, 255, 0.3);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Z-Index Scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal-backdrop: 900;
  --z-modal: 1000;
  --z-toast: 1100;
}


/* ==========================================================================
   2. Dark Theme (Default) - PicoCSS Variable Overrides
   ========================================================================== */

[data-theme="dark"],
:root:not([data-theme="light"]) {
  /* PicoCSS color overrides */
  --pico-background-color: var(--dark-slate);
  --pico-color: #d4dce8;
  --pico-text-color: #d4dce8;
  --pico-muted-color: #7a8ba5;
  --pico-muted-border-color: var(--dark-slate-border);
  --pico-primary: var(--brass-gold);
  --pico-primary-hover: var(--brass-gold-light);
  --pico-primary-focus: rgba(184, 134, 11, 0.25);
  --pico-primary-inverse: #000;
  --pico-secondary: var(--dark-slate-lighter);
  --pico-secondary-hover: var(--dark-slate-border);
  --pico-contrast: var(--aged-paper);
  --pico-contrast-inverse: var(--dark-slate);

  /* Card / Surface colors */
  --pico-card-background-color: var(--dark-slate-light);
  --pico-card-border-color: var(--dark-slate-border);
  --pico-card-sectioning-background-color: rgba(0, 0, 0, 0.15);

  /* Form elements */
  --pico-form-element-background-color: rgba(0, 0, 0, 0.2);
  --pico-form-element-border-color: var(--dark-slate-border);
  --pico-form-element-focus-color: var(--brass-gold);
  --pico-form-element-color: #d4dce8;
  --pico-form-element-placeholder-color: #5a6a7e;

  /* Switches */
  --pico-switch-background-color: var(--dark-slate-lighter);
  --pico-switch-checked-background-color: var(--brass-gold);

  /* Table */
  --pico-table-border-color: var(--dark-slate-border);
  --pico-table-row-stripped-background-color: rgba(0, 0, 0, 0.1);

  /* Code */
  --pico-code-background-color: rgba(0, 0, 0, 0.25);
  --pico-code-color: var(--electric-blue);

  /* Blockquote */
  --pico-blockquote-border-color: var(--brass-gold);
  --pico-blockquote-footer-color: var(--pico-muted-color);

  /* Mark / Highlight */
  --pico-mark-background-color: rgba(184, 134, 11, 0.3);
  --pico-mark-color: var(--aged-paper);

  /* Scrollbar */
  scrollbar-color: var(--dark-slate-lighter) var(--dark-slate);

  /* Theme-specific */
  --surface-bg: var(--dark-slate-light);
  --surface-bg-raised: #354259;
  --text-primary: #d4dce8;
  --text-secondary: #a8b4c8;
  --text-muted: #7a8ba5;
  --border-color: var(--dark-slate-border);
  --border-color-subtle: rgba(74, 90, 110, 0.5);
}


/* ==========================================================================
   3. Light Theme
   ========================================================================== */

[data-theme="light"] {
  --pico-background-color: var(--aged-paper);
  --pico-color: #2c3e50;
  --pico-text-color: #2c3e50;
  --pico-muted-color: #6c7a89;
  --pico-muted-border-color: #d5cec3;
  --pico-primary: #8B6914;
  --pico-primary-hover: var(--brass-gold);
  --pico-primary-focus: rgba(184, 134, 11, 0.2);
  --pico-primary-inverse: #fff;
  --pico-secondary: #d5cec3;
  --pico-secondary-hover: #c4bdb2;
  --pico-contrast: var(--dark-slate);
  --pico-contrast-inverse: var(--aged-paper);

  --pico-card-background-color: #fff;
  --pico-card-border-color: #d5cec3;
  --pico-card-sectioning-background-color: rgba(0, 0, 0, 0.03);

  --pico-form-element-background-color: #fff;
  --pico-form-element-border-color: #d5cec3;
  --pico-form-element-focus-color: var(--brass-gold);
  --pico-form-element-color: #2c3e50;
  --pico-form-element-placeholder-color: #a0a8b2;

  --pico-switch-background-color: #d5cec3;
  --pico-switch-checked-background-color: var(--brass-gold);

  --pico-table-border-color: #d5cec3;
  --pico-table-row-stripped-background-color: rgba(0, 0, 0, 0.03);

  --pico-code-background-color: rgba(0, 0, 0, 0.06);
  --pico-code-color: #8B6914;

  --pico-blockquote-border-color: var(--brass-gold);

  --pico-mark-background-color: rgba(184, 134, 11, 0.2);
  --pico-mark-color: #2c3e50;

  --surface-bg: #fff;
  --surface-bg-raised: #f9f6f0;
  --text-primary: #2c3e50;
  --text-secondary: #4a5568;
  --text-muted: #6c7a89;
  --border-color: #d5cec3;
  --border-color-subtle: rgba(213, 206, 195, 0.5);
}


/* ==========================================================================
   4. Base Typography Overrides
   ========================================================================== */

body {
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
}

h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.25rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h4 { font-size: clamp(1.1rem, 2.5vw, 1.375rem); }

code, pre, kbd, samp {
  font-family: var(--font-mono);
}

a {
  color: var(--brass-gold-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--brass-gold-bright);
}

a:focus-visible {
  outline: 2px solid var(--electric-blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background: rgba(184, 134, 11, 0.35);
  color: var(--aged-paper);
}


/* ==========================================================================
   5. Navigation / Header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: rgba(30, 39, 56, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color-subtle);
  padding: var(--space-sm) 0;
}

[data-theme="light"] .site-header {
  background: rgba(244, 241, 234, 0.95);
}

.site-header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.logo-link {
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
  text-decoration: none;
  color: inherit;
  min-height: 44px;
  align-items: center;
}

.logo-link:hover {
  color: inherit;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--aged-paper);
  letter-spacing: 0.05em;
}

[data-theme="light"] .logo-text {
  color: var(--dark-slate);
}

.logo-comma {
  color: var(--electric-blue);
  font-weight: 700;
  font-size: 1.25rem;
  text-shadow: 0 0 8px rgba(0, 217, 255, 0.6);
  animation: logo-pulse 3s ease-in-out infinite;
}

@keyframes logo-pulse {
  0%, 100% { text-shadow: 0 0 8px rgba(0, 217, 255, 0.6); }
  50% { text-shadow: 0 0 16px rgba(0, 217, 255, 0.9); }
}

.logo-sub {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-left: var(--space-sm);
}

.site-header .nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-header .nav-links a {
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 var(--space-xs);
}

.site-header .nav-links a:hover {
  color: var(--brass-gold-light);
}

.site-header .nav-links a.btn-signup {
  color: #000;
}

.site-header .nav-links a.btn-signup:hover {
  color: #000;
}

.nav-user {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.nav-xp {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--brass-gold);
  white-space: nowrap;
}

.nav-xp svg {
  fill: var(--brass-gold);
  flex-shrink: 0;
}

.btn-signup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--space-sm) var(--space-lg);
  background: linear-gradient(135deg, var(--brass-gold-light), var(--brass-gold-bright));
  color: #000;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-brass);
}

.btn-signup:hover {
  background: linear-gradient(135deg, var(--brass-gold-bright), #ffe44d);
  box-shadow: 0 6px 24px rgba(255, 215, 0, 0.5);
  transform: translateY(-1px);
  color: #000;
}

.btn-signup:active {
  transform: translateY(0);
}


/* ---------- Nav User Dropdown ---------- */

.nav-user-menu {
  display: flex;
  align-items: center;
}

.nav-dropdown {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border-color-subtle);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.15);
  transition: all var(--transition-fast);
}

.nav-dropdown:hover {
  border-color: var(--brass-gold);
  background: rgba(184, 134, 11, 0.1);
}

.nav-dropdown[open] {
  border-color: var(--brass-gold);
  background: rgba(184, 134, 11, 0.1);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

[data-theme="light"] .nav-dropdown {
  background: rgba(0, 0, 0, 0.04);
  border-color: var(--border-color);
}

[data-theme="light"] .nav-dropdown:hover,
[data-theme="light"] .nav-dropdown[open] {
  background: rgba(184, 134, 11, 0.08);
  border-color: var(--brass-gold);
}

.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
  border: none;
  background: transparent;
  font-size: 0.9rem;
  color: var(--text-secondary);
  list-style: none;
  margin: 0;
}

.nav-dropdown-toggle,
.nav-dropdown-toggle::-webkit-details-marker {
  list-style: none;
  list-style-type: none;
}

.nav-dropdown-toggle::marker,
.nav-dropdown::marker {
  display: none;
  content: "";
  font-size: 0;
}

.nav-dropdown-toggle::after {
  display: none;
  content: none;
}

.nav-user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-chevron {
  transition: transform var(--transition-fast);
  color: var(--text-muted);
  flex-shrink: 0;
}

.nav-dropdown[open] .nav-chevron {
  transform: rotate(180deg);
}

.nav-dropdown-panel {
  position: absolute;
  top: 100%;
  right: -1px;
  left: -1px;
  background: rgba(184, 134, 11, 0.1);
  border: 1px solid var(--brass-gold);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 0;
  z-index: var(--z-dropdown);
}

[data-theme="light"] .nav-dropdown-panel {
  background: rgba(184, 134, 11, 0.08);
  border-color: var(--brass-gold);
}

.site-header .nav-dropdown-panel a {
  box-sizing: border-box;
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm) var(--space-xs) 0.9rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.site-header .nav-dropdown-panel a:hover {
  color: var(--brass-gold-light);
  background: rgba(184, 134, 11, 0.08);
}

.nav-dropdown-panel a svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.nav-dropdown-panel a:hover svg {
  color: var(--brass-gold-light);
}


/* ==========================================================================
   6. Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--border-color-subtle);
  padding: var(--space-3xl) 0 var(--space-xl);
  margin-top: var(--space-3xl);
  background: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .site-footer {
  background: rgba(0, 0, 0, 0.03);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-xl);
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.footer-col h4 {
  font-family: var(--font-display);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brass-gold);
  margin-bottom: var(--space-md);
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col li {
  margin-bottom: var(--space-sm);
}

.footer-col a {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color var(--transition-fast);
}

.footer-col a:hover {
  color: var(--brass-gold-light);
}

.footer-col p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.footer-version {
  font-size: 0.7rem;
  opacity: 0.5;
  margin-top: var(--space-xs);
}

.site-footer .footer-bottom {
  max-width: 1200px;
  margin: var(--space-xl) auto 0;
  padding: var(--space-md) var(--space-md) 0;
  border-top: 1px solid var(--border-color-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}


/* ==========================================================================
   7. Buttons
   ========================================================================== */

.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: 44px;
  padding: var(--space-sm) var(--space-lg);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-normal);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  line-height: 1.4;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brass-gold-light), var(--brass-gold-bright));
  color: #000;
  border-color: transparent;
  box-shadow: var(--shadow-brass);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--brass-gold-bright), #ffe44d);
  box-shadow: 0 6px 24px rgba(255, 215, 0, 0.5);
  transform: translateY(-2px);
  color: #000;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--electric-blue);
  outline-offset: 2px;
}

.btn-secondary {
  background: transparent;
  color: var(--brass-gold-bright);
  border-color: var(--brass-gold-light);
}

.btn-secondary:hover {
  background: rgba(184, 134, 11, 0.15);
  border-color: var(--brass-gold-bright);
  color: #fff;
  transform: translateY(-1px);
}

[data-theme="light"] .btn-secondary {
  color: #6B4F0A;
  border-color: #8B6914;
}

[data-theme="light"] .btn-secondary:hover {
  background: rgba(184, 134, 11, 0.12);
  border-color: #6B4F0A;
  color: #4A3607;
}

.btn-secondary:active {
  transform: translateY(0);
}

.btn-danger {
  background: transparent;
  color: var(--error-red);
  border-color: var(--error-red);
}

.btn-danger:hover {
  background: var(--error-red-bg);
  border-color: var(--error-red);
  color: #ff6659;
  transform: translateY(-1px);
}

.btn-danger:active {
  transform: translateY(0);
}

.btn-large {
  min-height: 52px;
  padding: var(--space-md) var(--space-xl);
  font-size: 1.1rem;
}

.btn-small {
  min-height: 36px;
  padding: var(--space-xs) var(--space-md);
  font-size: 0.85rem;
}

/* Disabled state for all buttons */
.btn-primary[disabled],
.btn-secondary[disabled],
.btn-danger[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Icon-only buttons */
.btn-icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: var(--space-sm);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon-only:hover {
  border-color: var(--brass-gold);
  color: var(--brass-gold-light);
  background: rgba(184, 134, 11, 0.1);
}


/* ==========================================================================
   8. Auth Pages (Login, Signup, Forgot Password)
   ========================================================================== */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 200px);
  padding: var(--space-xl) var(--space-md);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brass-gold), var(--electric-blue));
}

.auth-card h1,
.auth-card h2 {
  font-family: var(--font-heading);
  text-align: center;
  margin-bottom: var(--space-lg);
  color: var(--brass-gold-light);
}

.auth-card .auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: var(--space-xl);
}

.auth-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
  width: 100%;
  min-height: 44px;
  padding: var(--space-sm) var(--space-md);
  background: var(--pico-form-element-background-color);
  border: 1px solid var(--pico-form-element-border-color);
  border-radius: var(--radius-md);
  color: var(--pico-form-element-color);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color var(--transition-fast);
}

.auth-form input:focus {
  border-color: var(--brass-gold);
  box-shadow: 0 0 0 3px var(--pico-primary-focus);
  outline: none;
}

.auth-form .form-group {
  margin-bottom: var(--space-md);
}

.auth-form .form-error {
  font-size: 0.8rem;
  color: var(--error-red);
  margin-top: var(--space-xs);
}

.auth-form button[type="submit"] {
  width: 100%;
  margin-top: var(--space-md);
}

.auth-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-color-subtle);
}

.auth-links a {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.auth-links a:hover {
  color: var(--brass-gold-light);
}

/* Social/OAuth buttons */
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color-subtle);
}


/* ==========================================================================
   9. Legal & Help Page Base Styles
   ========================================================================== */

.legal-page,
.help-page-content {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-md);
}

.legal-page h1 {
  font-family: var(--font-heading);
  color: var(--brass-gold-light);
  margin-bottom: var(--space-sm);
}

.legal-page .last-updated {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xl);
}

.legal-page h2 {
  font-size: 1.35rem;
  color: var(--text-primary);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-color-subtle);
}

.legal-page h3 {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.legal-page p,
.legal-page li {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.legal-page ul,
.legal-page ol {
  padding-left: var(--space-lg);
  margin-bottom: var(--space-md);
}

.legal-page a {
  color: var(--electric-blue);
}

.legal-page a:hover {
  text-decoration: underline;
}


/* ==========================================================================
   10. Settings Page
   ========================================================================== */

.settings-page {
  max-width: 700px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
}

.settings-page h1 {
  font-family: var(--font-heading);
  color: var(--brass-gold-light);
  margin-bottom: var(--space-xl);
}

.settings-section {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.settings-section h2 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brass-gold);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-color-subtle);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border-color-subtle);
  gap: var(--space-md);
}

.setting-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.setting-row:first-of-type {
  padding-top: 0;
}

.setting-row .setting-info {
  flex: 1;
}

.setting-row .setting-label {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.setting-row .setting-description {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.setting-row .setting-control {
  flex-shrink: 0;
}

.setting-row select,
.setting-row input {
  min-height: 44px;
  min-width: 44px;
}

.settings-danger {
  border-color: rgba(244, 67, 54, 0.3);
}

.settings-danger h2 {
  color: var(--error-red);
}

.settings-danger .setting-row {
  border-bottom-color: rgba(244, 67, 54, 0.15);
}


/* ==========================================================================
   11. Success Page (Post-purchase, etc.)
   ========================================================================== */

.success-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 200px);
  padding: var(--space-xl) var(--space-md);
  text-align: center;
}

.success-icon {
  width: 80px;
  height: 80px;
  margin-bottom: var(--space-lg);
  color: var(--success-green);
  animation: success-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes success-pop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  60% {
    transform: scale(1.15);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.success-page h1 {
  font-family: var(--font-heading);
  color: var(--brass-gold-light);
  margin-bottom: var(--space-md);
}

.success-page p {
  color: var(--text-secondary);
  max-width: 480px;
  margin-bottom: var(--space-lg);
}

.success-page .success-actions {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  justify-content: center;
}


/* ==========================================================================
   12. Toast Notifications
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  min-width: 300px;
  max-width: 420px;
  padding: var(--space-md) var(--space-lg);
  background: var(--dark-slate-light);
  border: 1px solid var(--dark-slate-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.4;
  pointer-events: auto;
  animation: toast-slide-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

[data-theme="light"] .toast {
  background: #fff;
  border-color: var(--border-color);
  color: var(--text-primary);
}

.toast.toast-removing {
  animation: toast-slide-out 0.25s ease-in forwards;
}

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.toast-content {
  flex: 1;
}

.toast-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  padding: 0;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.toast-info {
  border-left: 3px solid var(--info-cyan);
}

.toast-info .toast-icon {
  color: var(--info-cyan);
}

.toast-success {
  border-left: 3px solid var(--success-green);
}

.toast-success .toast-icon {
  color: var(--success-green);
}

.toast-error {
  border-left: 3px solid var(--error-red);
}

.toast-error .toast-icon {
  color: var(--error-red);
}

.toast-warning {
  border-left: 3px solid var(--warning-amber);
}

.toast-warning .toast-icon {
  color: var(--warning-amber);
}

@keyframes toast-slide-in {
  0% {
    transform: translateX(120%);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toast-slide-out {
  0% {
    transform: translateX(0);
    opacity: 1;
  }
  100% {
    transform: translateX(120%);
    opacity: 0;
  }
}


/* ==========================================================================
   13. Modal
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: var(--space-md);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  z-index: var(--z-modal);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - var(--space-2xl) * 2);
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-color-subtle);
}

.modal-header h2,
.modal-header h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--text-primary);
}

.modal-header .modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
}

.modal-header .modal-close:hover {
  border-color: var(--border-color);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-color-subtle);
}

/* Modal width variants */
.modal-content.modal-sm {
  max-width: 380px;
}

.modal-content.modal-lg {
  max-width: 700px;
}


/* ==========================================================================
   14. Utility Classes
   ========================================================================== */

.text-brass { color: var(--brass-gold-light); }
.text-blue { color: var(--electric-blue); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success-green); }
.text-error { color: var(--error-red); }
.text-center { text-align: center; }
.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }
.font-heading { font-family: var(--font-heading); }

.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;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.container-narrow {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}


/* ==========================================================================
   15. Responsive Breakpoints
   ========================================================================== */

/* Mobile-first base styles are default (320px+) */

/* Tablet (768px+) */
@media (min-width: 768px) {
  .site-header nav {
    padding: 0 var(--space-lg);
  }

  .footer-grid {
    padding: 0 var(--space-lg);
  }

  .auth-card {
    padding: var(--space-2xl) var(--space-2xl);
  }

  .settings-page {
    padding: var(--space-2xl) var(--space-lg);
  }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
  .site-header nav {
    padding: 0 var(--space-xl);
  }

  .footer-grid {
    padding: 0 var(--space-xl);
  }
}

/* Large Desktop (1440px+) */
@media (min-width: 1440px) {
  .site-header nav {
    max-width: 1400px;
  }

  .footer-grid {
    max-width: 1400px;
  }
}

/* Small mobile adjustments (below 768px) */
@media (max-width: 767px) {
  .site-header .nav-links {
    gap: var(--space-md);
  }

  .logo-sub {
    display: none;
  }

  .nav-xp {
    display: none;
  }

  .nav-user-name {
    max-width: 80px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  .toast-container {
    left: var(--space-md);
    right: var(--space-md);
    bottom: var(--space-md);
  }

  .toast {
    min-width: auto;
    max-width: none;
  }

  .modal-content {
    max-height: calc(100vh - var(--space-md) * 2);
    border-radius: var(--radius-lg);
  }

  .modal-content.modal-lg {
    max-width: none;
  }

  .setting-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .setting-row .setting-control {
    width: 100%;
  }

  .success-page .success-actions {
    flex-direction: column;
    width: 100%;
  }

  .success-page .success-actions .btn-primary,
  .success-page .success-actions .btn-secondary {
    width: 100%;
  }
}

/* Ensure minimum touch targets on all interactive elements */
@media (pointer: coarse) {
  button,
  [role="button"],
  input[type="submit"],
  input[type="button"],
  a {
    min-height: 44px;
  }

  select {
    min-height: 44px;
  }
}
