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

:root {
  --bg: #05060f;
  --surface: #0d0f1e;
  --surface2: #111326;
  --border: rgba(139, 92, 246, 0.15);
  --border2: rgba(139, 92, 246, 0.3);
  --purple: #8b5cf6;
  --blue: #60a5fa;
  --teal: #2dd4bf;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --dim: #475569;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.7;
  overflow-x: hidden;
}

/* ── Stars ── */
#stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.nebula {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.nebula-1 { width:500px; height:500px; background:rgba(139,92,246,0.06); top:-150px; right:-100px; }
.nebula-2 { width:400px; height:400px; background:rgba(45,212,191,0.04); bottom:10%; left:-100px; }

/* ── Top nav ── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(5, 6, 15, 0.8);
  border-bottom: 1px solid var(--border);
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 24px;
}

.nav-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  white-space: nowrap;
}

.nav-divider {
  color: var(--dim);
  font-size: 0.85rem;
}

.nav-page-title {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ── Layout ── */
.page-layout {
  display: flex;
  min-height: 100vh;
  padding-top: 56px;
  position: relative;
  z-index: 1;
}

/* ── Sidebar ── */
.sidebar {
  width: 216px;
  flex-shrink: 0;
  position: fixed;
  top: 56px;
  bottom: 0;
  left: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 28px 0;
  z-index: 100;
}

.sidebar-section {
  padding: 0 16px;
  margin-bottom: 6px;
}

.sidebar-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 0 12px;
  margin-bottom: 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 2px;
}

.sidebar-link:hover {
  background: rgba(139, 92, 246, 0.08);
  color: var(--text);
}

.sidebar-link.active {
  background: rgba(139, 92, 246, 0.14);
  color: var(--text);
}

.sidebar-link.active .sidebar-icon { color: var(--purple); }

.sidebar-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-link.active .sidebar-icon { opacity: 1; }

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 16px;
}

/* ── Main content ── */
.main {
  margin-left: 216px;
  flex: 1;
  padding: 52px 52px 80px;
  max-width: calc(100% - 216px);
}

.page-header {
  margin-bottom: 40px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.page-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--purple);
  margin-bottom: 8px;
}

.page-title {
  font-family: 'Inter', sans-serif;
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.page-desc {
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 500px;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: border-color 0.2s;
}

.card:hover { border-color: var(--border2); }

.card-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.card-meta {
  font-size: 0.78rem;
  color: var(--dim);
  margin-bottom: 10px;
}

.card-body {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .main { padding: 32px 24px 60px; }
}

/* ── Section heading ── */
.section-heading {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 14px;
  margin-top: 36px;
}

.section-heading:first-of-type { margin-top: 0; }

/* ── Empty state ── */
.empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 48px 32px;
  text-align: center;
  color: var(--dim);
  font-size: 0.875rem;
}

.empty-icon { font-size: 1.4rem; margin-bottom: 10px; }

/* ── Tag ── */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(139, 92, 246, 0.05);
}

/* ── Mobile sidebar toggle ── */
.sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  background: var(--purple);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; max-width: 100%; }
  .sidebar-toggle { display: flex; }
}

/* ── Theme toggle button ── */
.theme-toggle {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 34px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Noto Serif JP', 'Songti SC', 'STSong', serif;
  font-size: 14px;
  line-height: 1;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.theme-toggle:hover {
  border-color: var(--border2);
  color: var(--text);
}

/* ── Light mode — 日式米色·和风 ── */
:root[data-theme="light"] {
  --bg: #f5f1e8;
  --surface: #ede6d3;
  --surface2: #e3d9bf;
  --border: rgba(139, 111, 71, 0.22);
  --border2: rgba(139, 111, 71, 0.45);
  --purple: #8b6f47;
  --blue: #a68b5b;
  --teal: #6b5d3f;
  --text: #2c2a26;
  --muted: #6b6458;
  --dim: #9c9383;
}

[data-theme="light"] nav {
  background: rgba(245, 241, 232, 0.85);
}

[data-theme="light"] #stars,
[data-theme="light"] .nebula {
  display: none !important;
}

[data-theme="light"] .sidebar-link:hover {
  background: rgba(139, 111, 71, 0.08);
}
[data-theme="light"] .sidebar-link.active {
  background: rgba(139, 111, 71, 0.16);
}
[data-theme="light"] .tag {
  background: rgba(139, 111, 71, 0.06);
}
[data-theme="light"] .sidebar-toggle {
  box-shadow: 0 4px 20px rgba(139, 111, 71, 0.35);
}

