/* ==========================================================================
   BoredBay Design System & Theme Presets (base.css)
   Zero-bloat CSS tokens: Neon (default), Pastel (daylight), Retro (CRT amber)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;700&family=Space+Grotesk:wght@600;700&display=swap');

:root,
[data-theme="neon"] {
  --bg: #0c1117;
  --bg-elevated: #131a24;
  --surface: #17202c;
  --surface-2: #1f2b3a;
  --surface-hover: #263446;
  --text: #f1f5f9;
  --text-soft: #cbd5e1;
  --muted: #8b9bb4;
  --accent: #22d3ee;
  --accent-ink: #062028;
  --accent-2: #f59e0b;
  --accent-2-ink: #1f1300;
  --ok: #34d399;
  --ok-bg: rgba(52, 211, 153, 0.14);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.14);
  --warn-bg: rgba(245, 158, 11, 0.14);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.38);
  --canvas-bg: #090d12;
  --canvas-grid: rgba(255, 255, 255, 0.035);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
}

[data-theme="pastel"] {
  --bg: #f6f4ef;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --surface-hover: #e6e2d8;
  --text: #182230;
  --text-soft: #334155;
  --muted: #64748b;
  --accent: #0d9488;
  --accent-ink: #ffffff;
  --accent-2: #d97706;
  --accent-2-ink: #ffffff;
  --ok: #15803d;
  --ok-bg: rgba(21, 128, 61, 0.11);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.1);
  --warn-bg: rgba(217, 119, 6, 0.12);
  --border: rgba(24, 34, 48, 0.1);
  --border-strong: rgba(24, 34, 48, 0.18);
  --shadow-sm: 0 2px 6px rgba(24, 34, 48, 0.05);
  --shadow-md: 0 12px 28px rgba(24, 34, 48, 0.09);
  --canvas-bg: #ebe7de;
  --canvas-grid: rgba(24, 34, 48, 0.05);
}

[data-theme="retro"] {
  --bg: #120e0a;
  --bg-elevated: #1a140e;
  --surface: #1e1710;
  --surface-2: #281f15;
  --surface-hover: #33271b;
  --text: #fde68a;
  --text-soft: #fcd34d;
  --muted: #b4925a;
  --accent: #fbbf24;
  --accent-ink: #1c1204;
  --accent-2: #fb923c;
  --accent-2-ink: #1c0e04;
  --ok: #a3e635;
  --ok-bg: rgba(163, 230, 53, 0.14);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.15);
  --warn-bg: rgba(251, 191, 36, 0.14);
  --border: rgba(251, 191, 36, 0.16);
  --border-strong: rgba(251, 191, 36, 0.28);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 14px 34px rgba(0, 0, 0, 0.55);
  --canvas-bg: #0d0a07;
  --canvas-grid: rgba(251, 191, 36, 0.05);
}

/* Reset & Base Typography */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.55;
  transition: background-color 0.18s ease, color 0.18s ease;
}

[data-theme="retro"] body {
  background-image: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.12) 3px
  );
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 0.5rem;
  color: var(--text);
}

h1 { font-size: clamp(1.65rem, 3.2vw, 2.25rem); }
h2 { font-size: clamp(1.25rem, 2.2vw, 1.55rem); }
h3 { font-size: 1.08rem; }

p {
  margin: 0 0 0.75rem;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

/* Layout Shell */
.shell-wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 16px 56px;
  flex: 1;
}

/* Shared Top Navbar */
.site-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
}

.brand-link:hover {
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.03em;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-copy {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.brand-domain {
  font-size: 0.76rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  max-width: 100%;
  padding: 2px 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.nav-link.active {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Theme Switcher */
.theme-switcher {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.theme-opt {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.theme-opt:hover {
  color: var(--text);
}

.theme-opt.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Page Intro / Hero */
.page-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-hero-copy {
  max-width: 680px;
}

.page-hero-copy p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
  display: block;
}

/* Grid Utilities */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 16px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.row-between {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Surfaces & Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-subtle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.bay-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s ease, border-color 0.14s ease, background-color 0.14s ease;
}

.bay-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: var(--bg-elevated);
  text-decoration: none;
}

.bay-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.bay-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.bay-meta {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface-2);
}

/* Controls: Buttons & Inputs */
button,
.btn,
select,
input,
textarea {
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 13px;
  line-height: 1.35;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

textarea {
  width: 100%;
  resize: vertical;
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  user-select: none;
  transition: background-color 0.14s ease, transform 0.06s ease, border-color 0.14s ease;
}

button:hover:not(:disabled),
.btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  text-decoration: none;
}

button:active:not(:disabled),
.btn:active {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

button.primary,
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}

button.primary:hover:not(:disabled),
.btn.primary:hover {
  filter: brightness(1.06);
}

button.warn,
.btn.warn {
  background: var(--accent-2);
  color: var(--accent-2-ink);
  border-color: transparent;
}

button.warn:hover:not(:disabled),
.btn.warn:hover {
  filter: brightness(1.06);
}

button.ok,
.btn.ok {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: transparent;
}

button.danger,
.btn.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: transparent;
}

button.sm,
.btn.sm {
  font-size: 0.82rem;
  padding: 5px 10px;
}

button.lg,
.btn.lg {
  font-size: 1rem;
  padding: 11px 18px;
}

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-soft);
}

.badge.town,
.badge.ok {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: transparent;
}

.badge.evil,
.badge.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: transparent;
}

.badge.neutral,
.badge.warn {
  background: var(--warn-bg);
  color: var(--accent-2);
  border-color: transparent;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.readout-lg {
  font-family: var(--font-mono);
  font-size: clamp(1.6rem, 3.5vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* Segmented Tabs (Intra-page) */
.seg-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.seg-tab {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
}

.seg-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Modular Ad Pit-Stop */
.ad-pitstop {
  margin: 24px 0 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.84rem;
  color: var(--muted);
}

.ad-pitstop-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ad-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-soft);
  border: 1px solid var(--border);
}

/* Shared Footer */
.site-footer {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.84rem;
  color: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.footer-links a {
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--text);
}

/* Feedback / Idea Drawer Modal */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 14, 0.62);
  backdrop-filter: blur(3px);
  z-index: 900;
  display: none;
  justify-content: flex-end;
}

.drawer-backdrop.open {
  display: flex;
}

.drawer-panel {
  width: min(440px, 100vw);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  padding: 22px 20px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 5px;
}

/* Table / Ledger Rows */
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.list-row.eliminated {
  opacity: 0.52;
}

.list-row.eliminated .player-label {
  text-decoration: line-through;
}

/* Responsive Adjustments */
@media (max-width: 720px) {
  .shell-wrap {
    padding: 10px 12px 44px;
  }

  .site-header {
    padding: 12px;
  }

  .site-nav {
    order: 3;
    width: 100%;
    border-top: 1px solid var(--border);
    padding-top: 8px;
  }

  .page-hero,
  .card {
    padding: 16px;
  }
}
