:root {
  --bg-dark: #0a0e1a;
  --bg-darker: #060912;
  --bg-card: #111827;
  --bg-card-hover: #1a2236;
  --accent-rgb: 56, 189, 248;
  --accent-2-rgb: 167, 139, 250;
  --accent: #38bdf8;
  --accent-dim: #0ea5e9;
  --accent-hover: #22d3ee;
  --accent-purple: #a78bfa;
  --coral: #f472b6;
  --blue: #60a5fa;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --text-muted: #64748b;
  --border: #1e293b;
  --header-bg: rgba(10, 14, 26, 0.8);
  --header-bg-scroll: rgba(10, 14, 26, 0.95);
  --shadow-heavy: rgba(0, 0, 0, 0.5);
  --subtle-bg: rgba(255, 255, 255, 0.02);
  --subtle-bg-hover: rgba(255, 255, 255, 0.03);
  --subtle-border: rgba(255, 255, 255, 0.04);
  --subtle-border-2: rgba(255, 255, 255, 0.06);
  --font-display: 'Crimson Pro', Georgia, serif;
  --font-body: 'Noto Sans SC', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="light"] {
  --bg-dark: #f8fafc;
  --bg-darker: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --coral: #db2777;
  --blue: #2563eb;
  --text: #0f172a;
  --text-dim: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --header-bg: rgba(248, 250, 252, 0.85);
  --header-bg-scroll: rgba(248, 250, 252, 0.95);
  --shadow-heavy: rgba(0, 0, 0, 0.1);
  --subtle-bg: rgba(0, 0, 0, 0.02);
  --subtle-bg-hover: rgba(0, 0, 0, 0.04);
  --subtle-border: rgba(0, 0, 0, 0.06);
  --subtle-border-2: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] { --accent: #0284c7; --accent-dim: #0369a1; --accent-hover: #0ea5e9; --accent-purple: #7c3aed; }
[data-theme="light"][data-color="gold"] { --accent: #a16207; --accent-dim: #854d0e; --accent-hover: #ca8a04; --accent-purple: #b45309; }
[data-theme="light"][data-color="violet"] { --accent: #7c3aed; --accent-dim: #6d28d9; --accent-hover: #8b5cf6; --accent-purple: #4f46e5; }
[data-theme="light"][data-color="rose"] { --accent: #e11d48; --accent-dim: #be123c; --accent-hover: #f43f5e; --accent-purple: #db2777; }
[data-theme="light"][data-color="emerald"] { --accent: #059669; --accent-dim: #047857; --accent-hover: #10b981; --accent-purple: #0d9488; }

[data-color="gold"] {
  --accent-rgb: 212, 168, 75;
  --accent-2-rgb: 234, 179, 8;
  --accent: #d4a84b;
  --accent-dim: #a67c32;
  --accent-hover: #e8bc5f;
  --accent-purple: #eab308;
}

[data-color="violet"] {
  --accent-rgb: 167, 139, 250;
  --accent-2-rgb: 129, 140, 248;
  --accent: #a78bfa;
  --accent-dim: #8b5cf6;
  --accent-hover: #c4b5fd;
  --accent-purple: #818cf8;
}

[data-color="rose"] {
  --accent-rgb: 251, 113, 133;
  --accent-2-rgb: 244, 114, 182;
  --accent: #fb7185;
  --accent-dim: #f43f5e;
  --accent-hover: #fda4af;
  --accent-purple: #f472b6;
}

[data-color="emerald"] {
  --accent-rgb: 52, 211, 153;
  --accent-2-rgb: 45, 212, 191;
  --accent: #34d399;
  --accent-dim: #10b981;
  --accent-hover: #6ee7b7;
  --accent-purple: #2dd4bf;
}

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 20px 0;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo img {
  width: 32px;
  height: 32px;
}

.logo span {
  background: linear-gradient(135deg, var(--accent), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

nav {
  display: flex;
  gap: 32px;
  align-items: center;
}

nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
  font-weight: 400;
}

nav a:hover { color: var(--text); }

.btn-header {
  background: var(--accent);
  color: var(--bg-dark);
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.btn-header:hover {
  background: var(--accent-dim);
  color: var(--bg-dark);
}

footer {
  padding: 64px 0;
  border-top: 1px solid var(--border);
}

footer .container {
  max-width: 1200px;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-logo img {
  width: 28px;
  height: 28px;
}

.footer-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

.footer-by {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  gap: 32px;
}

.footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--text); }

.theme-panel-wrap { position: relative; }

.theme-panel-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-dim);
  transition: color 0.2s, border-color 0.2s;
}

.theme-panel-btn:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.theme-panel {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  min-width: 200px;
  box-shadow: 0 12px 40px var(--shadow-heavy);
  z-index: 200;
  animation: panelIn 0.15s ease-out;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.theme-panel.open { display: block; }

.theme-panel-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.theme-mode-row { display: flex; gap: 6px; margin-bottom: 16px; }

.theme-mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: none;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}

.theme-mode-btn:hover { border-color: var(--text-muted); color: var(--text); }
.theme-mode-btn.active { background: rgba(var(--accent-rgb), 0.12); border-color: var(--accent); color: var(--accent); }

.theme-color-row { display: flex; gap: 10px; justify-content: center; }

.theme-color-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  position: relative;
}

.theme-color-dot:hover { transform: scale(1.15); }
.theme-color-dot.active { border-color: var(--text); }

.theme-color-dot.active::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

.theme-color-dot[data-c="cyan"] { background: #38bdf8; }
.theme-color-dot[data-c="gold"] { background: #d4a84b; }
.theme-color-dot[data-c="violet"] { background: #a78bfa; }
.theme-color-dot[data-c="rose"] { background: #fb7185; }
.theme-color-dot[data-c="emerald"] { background: #34d399; }

.theme-panel-backdrop { display: none; }

@media (max-width: 768px) {
  header { padding: 14px 0; }
  .logo { font-size: 1.35rem; }
  .logo img { width: 28px; height: 28px; }
  nav > a, nav > .btn-header { display: none; }
  nav { gap: 0; }
  .footer-content { flex-direction: column; gap: 20px; text-align: center; }
  .footer-brand { flex-direction: column; gap: 8px; }
  .footer-divider { width: 40px; height: 1px; }
  .footer-links { flex-wrap: wrap; gap: 16px; justify-content: center; }
  .footer-links a { font-size: 0.82rem; }
  .footer-logo { font-size: 1.25rem; justify-content: center; }
  .footer-logo img { width: 24px; height: 24px; }
  .theme-panel-wrap { position: static; }
  .theme-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 16px 16px 0 0;
    min-width: unset;
    padding: 24px 24px calc(24px + env(safe-area-inset-bottom));
    animation: panelSlideUp 0.2s ease-out;
  }

  @keyframes panelSlideUp {
    from { opacity: 0; transform: translateY(100%); }
    to { opacity: 1; transform: translateY(0); }
  }

  .theme-panel-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
  }

  .theme-panel-backdrop.open { display: block; }
}