/* ===== Color tokens ===== */
:root {
  --bg: #f5f7f5;
  --text: #222;
  --text-muted: #444;
  --nav-bg: #1a3d2b;
  --card-bg: #fff;
  --card-shadow: rgba(0,0,0,0.07);
  --card-heading: #1a3d2b;
  --accent: #31895b;
  --accent-hover: #256b47;
  --divider: #e5e9e6;
  --scheme-tint: rgba(49,137,91,0.08);
  --scheme-tint-hover: rgba(49,137,91,0.18);
}

html.dark {
  --bg: #181a1b;
  --text: #e8e8e8;
  --text-muted: #aaa;
  --nav-bg: #0f2419;
  --card-bg: #242628;
  --card-shadow: rgba(0,0,0,0.35);
  --card-heading: #5cb882;
  --accent: #5cb882;
  --accent-hover: #4aa370;
  --divider: #333;
  --scheme-tint: rgba(92,184,130,0.08);
  --scheme-tint-hover: rgba(92,184,130,0.15);
}

/* ===== Blue scheme ===== */
html[data-scheme="blue"] {
  --bg: #f5f7fa;
  --nav-bg: #1a2d4a;
  --card-heading: #1a2d4a;
  --accent: #2e7ab8;
  --accent-hover: #2563a0;
  --divider: #e5e9f0;
  --scheme-tint: rgba(46,122,184,0.08);
  --scheme-tint-hover: rgba(46,122,184,0.18);
}

html[data-scheme="blue"].dark {
  --bg: #181a1b;
  --nav-bg: #0f1d30;
  --card-heading: #5b9bd4;
  --accent: #5b9bd4;
  --accent-hover: #4a86c0;
  --divider: #333;
  --scheme-tint: rgba(91,155,212,0.08);
  --scheme-tint-hover: rgba(91,155,212,0.15);
}

/* ===== Gray scheme ===== */
html[data-scheme="gray"] {
  --bg: #f6f7f7;
  --nav-bg: #2b3138;
  --card-heading: #2b3138;
  --accent: #546470;
  --accent-hover: #42505a;
  --divider: #e6e8e9;
  --scheme-tint: rgba(84,100,112,0.08);
  --scheme-tint-hover: rgba(84,100,112,0.18);
}

html[data-scheme="gray"].dark {
  --bg: #181a1b;
  --nav-bg: #191d20;
  --card-heading: #98a5ae;
  --accent: #98a5ae;
  --accent-hover: #8695a0;
  --divider: #333;
  --scheme-tint: rgba(152,165,174,0.08);
  --scheme-tint-hover: rgba(152,165,174,0.15);
}

/* ===== Purple scheme ===== */
html[data-scheme="purple"] {
  --bg: #f8f5fc;
  --nav-bg: #2e1a52;
  --card-heading: #2e1a52;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --divider: #ede9f5;
  --scheme-tint: rgba(124,58,237,0.08);
  --scheme-tint-hover: rgba(124,58,237,0.18);
}

html[data-scheme="purple"].dark {
  --bg: #181a1b;
  --nav-bg: #1e1035;
  --card-heading: #a78bfa;
  --accent: #a78bfa;
  --accent-hover: #8b5cf6;
  --divider: #333;
  --scheme-tint: rgba(167,139,250,0.08);
  --scheme-tint-hover: rgba(167,139,250,0.15);
}

/* ===== Teal scheme ===== */
html[data-scheme="teal"] {
  --bg: #f3f9f9;
  --nav-bg: #14393a;
  --card-heading: #14393a;
  --accent: #0f766e;
  --accent-hover: #0d6760;
  --divider: #e0f0ef;
  --scheme-tint: rgba(15,118,110,0.08);
  --scheme-tint-hover: rgba(15,118,110,0.18);
}

html[data-scheme="teal"].dark {
  --bg: #181a1b;
  --nav-bg: #0a2525;
  --card-heading: #2dd4bf;
  --accent: #2dd4bf;
  --accent-hover: #14b8a6;
  --divider: #333;
  --scheme-tint: rgba(45,212,191,0.08);
  --scheme-tint-hover: rgba(45,212,191,0.15);
}

/* ===== Amber scheme ===== */
html[data-scheme="amber"] {
  --bg: #faf8f2;
  --nav-bg: #3c2a0a;
  --card-heading: #3c2a0a;
  --accent: #b45309;
  --accent-hover: #92400e;
  --divider: #f0e8d5;
  --scheme-tint: rgba(180,83,9,0.08);
  --scheme-tint-hover: rgba(180,83,9,0.18);
}

html[data-scheme="amber"].dark {
  --bg: #181a1b;
  --nav-bg: #251a07;
  --card-heading: #fbbf24;
  --accent: #fbbf24;
  --accent-hover: #f59e0b;
  --divider: #333;
  --scheme-tint: rgba(251,191,36,0.08);
  --scheme-tint-hover: rgba(251,191,36,0.15);
}

/* ===== Red scheme ===== */
html[data-scheme="red"] {
  --bg: #fdf5f5;
  --nav-bg: #3d1515;
  --card-heading: #3d1515;
  --accent: #b91c1c;
  --accent-hover: #991b1b;
  --divider: #f5e0e0;
  --scheme-tint: rgba(185,28,28,0.08);
  --scheme-tint-hover: rgba(185,28,28,0.18);
}

html[data-scheme="red"].dark {
  --bg: #181a1b;
  --nav-bg: #280d0d;
  --card-heading: #f87171;
  --accent: #f87171;
  --accent-hover: #ef4444;
  --divider: #333;
  --scheme-tint: rgba(248,113,113,0.08);
  --scheme-tint-hover: rgba(248,113,113,0.15);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.25s, color 0.25s;
}

/* Nav */
nav {
  background: var(--nav-bg);
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0 2rem;
  height: 64px;
  transition: background 0.25s;
}

nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  opacity: 0.85;
  transition: opacity 0.15s;
}

nav a:hover { opacity: 1; }
nav a.brand { font-size: 1.1rem; opacity: 1; margin-right: auto; }

/* Hero */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1.5rem 1rem;
  text-align: center;
}

.hero img.logo {
  width: 160px;
  height: 160px;
  object-fit: contain;
  border-radius: 16px;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
  transition: color 0.25s;
}

/* Main content */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Card */
.card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 12px var(--card-shadow);
  transition: background 0.25s, box-shadow 0.25s;
}

.card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--card-heading);
  margin-bottom: 1rem;
  transition: color 0.25s;
}

.card p {
  line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 1rem;
  transition: color 0.25s;
}

.card p:last-child { margin-bottom: 0; }

/* Referral block */
.referral {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.referral img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  flex-shrink: 0;
}

.referral-links {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Prose (about page) */
.prose h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1.5rem;
  transition: color 0.25s;
}

.prose p {
  line-height: 1.8;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  transition: color 0.25s;
}

.prose a { color: var(--accent); transition: color 0.25s; }

/* Buttons */
a.green-button, button.green-button {
  display: inline-block;
  background-color: var(--accent);
  color: #fff;
  padding: 0.55rem 1.1rem;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s;
}

a.green-button:hover, button.green-button:hover { background-color: var(--accent-hover); }
button.green-button { border: none; cursor: pointer; }

a.blue-button, button.blue-button {
  display: inline-block;
  background-color: #0d3a47;
  color: #fff;
  padding: 0.55rem 1.1rem;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s;
}

a.blue-button:hover, button.blue-button:hover { background-color: #092b36; }
button.blue-button { border: none; cursor: pointer; }

/* Apps & Projects page */
.project-list { display: flex; flex-direction: column; gap: 0; }
.project-item { padding: 1.5rem 0; }
.project-item:first-child { padding-top: 0; }
.project-row { display: flex; gap: 1.25rem; align-items: flex-start; }
.project-icon { width: 80px; height: 80px; border-radius: 14px; object-fit: contain; flex-shrink: 0; }
.github-icon { border-radius: 50%; }
html.dark .github-icon { filter: invert(1); }
.project-content { flex: 1; }
.project-content h2 { font-size: 1.2rem; font-weight: 700; color: var(--card-heading); margin-bottom: 0.75rem; transition: color 0.25s; }
.project-divider { border: none; border-top: 1px solid var(--divider); margin: 0; transition: border-color 0.25s; }
.game-thumb { width: 80px; height: 80px; border-radius: 14px; background: var(--nav-bg); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; flex-shrink: 0; }
.desktop-badge { display: inline-flex; align-items: center; font-size: 0.75rem; font-weight: 600; padding: 0.3rem 0.7rem; border-radius: 6px; background: #f5e9d0; color: #7a5100; letter-spacing: 0.02em; }
html.dark .desktop-badge { background: #3a2e1a; color: #d4a84b; }

/* Dark mode toggle */
.dark-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.5rem;
}

.dark-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }

.toggle-icon {
  color: rgba(255,255,255,0.75);
  font-size: 0.95rem;
  line-height: 1;
  user-select: none;
}

.toggle-track {
  width: 38px;
  height: 22px;
  background: rgba(255,255,255,0.2);
  border-radius: 11px;
  position: relative;
  transition: background 0.2s;
  border: 1px solid rgba(255,255,255,0.35);
}

.dark-toggle input:checked ~ .toggle-track { background: rgba(255,255,255,0.4); }

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.dark-toggle input:checked ~ .toggle-track .toggle-thumb { transform: translateX(16px); }

/* Auth nav area */
#auth-area { display: flex; align-items: center; gap: 0.5rem; }
#user-chip  { display: none; align-items: center; gap: 0.5rem; }
html.cl-authed #signin-btn   { display: none !important; }
html.cl-authed #user-chip    { display: flex !important; }
html.cl-authed #account-link { display: inline !important; }
.cl-signin-btn {
  padding: 0.38rem 0.85rem;
  background: #4285f4;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.cl-signin-btn:hover { background: #357ae8; }
.cl-user-photo { width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.3); cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.cl-user-photo:hover { border-color: rgba(255,255,255,0.8); box-shadow: 0 0 0 2px rgba(255,255,255,0.25); }
.cl-user-name  { display: none; }
.cl-prem-badge {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.04em;
  background: var(--accent); color: #fff;
  padding: 0.12rem 0.4rem; border-radius: 4px;
}
.cl-vip-badge {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.04em;
  background: #b8860b; color: #fff;
  padding: 0.12rem 0.4rem; border-radius: 4px;
}
.cl-signout-btn {
  padding: 0.32rem 0.65rem;
  background: transparent;
  color: rgba(255,255,255,0.55);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.cl-signout-btn:hover { color: rgba(255,255,255,0.85); border-color: rgba(255,255,255,0.5); }

/* Hamburger — hidden on desktop */
.nav-links { display: contents; }
#nav-hamburger {
  display: none;
  background: none; border: none; cursor: pointer;
  color: #fff; font-size: 1.4rem; line-height: 1;
  padding: 0.25rem 0.4rem; border-radius: 6px;
  align-items: center; justify-content: center;
  transition: background 0.15s;
}
#nav-hamburger:hover { background: rgba(255,255,255,0.12); }

@media (max-width: 500px) {
  nav { gap: 1rem; padding: 0 1rem; position: relative; }
  .nav-links { display: none; }
  #nav-hamburger { display: flex; }

  nav.nav-open .nav-links {
    display: flex; flex-direction: column;
    position: absolute; top: 64px; left: 0; right: 0; z-index: 100;
    background: var(--nav-bg);
    padding: 0.5rem 1.5rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  }
  nav.nav-open .nav-links a {
    display: block;
    padding: 0.7rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 1rem;
  }
  nav.nav-open .nav-links a:last-child { border-bottom: none; }

  .referral { flex-direction: column; align-items: center; text-align: center; }
  .referral-links { justify-content: center; }
  .project-row { flex-direction: column; align-items: center; text-align: center; }
}

/* Dark mode: ghost buttons need a visible surface against the dark background */
html.dark .br-ver-btn:not(.active),
html.dark .br-opt-btn:not(.active),
html.dark .fvs-btn:not(.active) { background: rgba(255,255,255,0.08); }
}
