:root {
  --ink: #f6f5f2;
  --graphite: #1f2937;
  --slate: #6b7280;
  --mist: #e7e5e4;
  --accent: #64748b;
  --card: #ffffff;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.theme-dark {
  --ink: #0f172a;
  --graphite: #e5e7eb;
  --slate: #cbd5f5;
  --mist: #1f2937;
  --accent: #94a3b8;
  --card: #0b1220;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Inter", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  margin: 0;
  line-height: 1.6;
  background: var(--ink);
  color: var(--graphite);
}

.bg-ink {
  background: var(--ink);
}

.text-graphite {
  color: var(--graphite);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--ink) 94%, transparent);
  border-bottom: 1px solid var(--mist);
}

.nav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-shrink: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-decoration: none;
  color: var(--graphite);
  line-height: 1;
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: flex-end;
  margin-left: auto;
}

.theme-toggle {
  position: relative;
  width: 64px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--mist);
  background: linear-gradient(120deg, #fcd34d 0%, #f8fafc 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  padding: 0 10px;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.theme-toggle .icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.theme-toggle .sun {
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #fff8e1 34%, #f59e0b 72%);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16), 0 0 18px rgba(245, 158, 11, 0.6);
}

.theme-toggle .sun::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  box-shadow: 0 -11px 0 0 rgba(245, 158, 11, 0.35), 0 11px 0 0 rgba(245, 158, 11, 0.35),
    11px 0 0 0 rgba(245, 158, 11, 0.35), -11px 0 0 0 rgba(245, 158, 11, 0.35),
    8px 8px 0 0 rgba(245, 158, 11, 0.28), -8px -8px 0 0 rgba(245, 158, 11, 0.28),
    8px -8px 0 0 rgba(245, 158, 11, 0.28), -8px 8px 0 0 rgba(245, 158, 11, 0.28);
}

.theme-toggle .cloud {
  width: 22px;
  height: 12px;
  border-radius: 999px;
  background: #e2e8f0;
  box-shadow: -12px 6px 0 0 #e2e8f0;
  transform: translateY(3px);
}

.theme-toggle .moon {
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 38%, #cbd5f5 72%);
  box-shadow: -9px 0 0 -2px #0b1220;
  opacity: 0;
}

.theme-toggle .stars {
  width: 20px;
  height: 20px;
  background: radial-gradient(circle at 30% 30%, #e5e7eb 24%, transparent 32%),
    radial-gradient(circle at 70% 60%, #e5e7eb 20%, transparent 32%),
    radial-gradient(circle at 55% 20%, #e5e7eb 16%, transparent 26%),
    radial-gradient(circle at 80% 32%, #e5e7eb 12%, transparent 24%);
  opacity: 0;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.theme-toggle:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.16);
}

.theme-dark .theme-toggle {
  background: linear-gradient(140deg, #0b1220 0%, #1f2937 100%);
  border-color: #1f2937;
}

.theme-dark .theme-toggle .sun,
.theme-dark .theme-toggle .cloud {
  opacity: 0;
  transform: translateY(-4px) scale(0.8);
}

.theme-dark .theme-toggle .moon,
.theme-dark .theme-toggle .stars {
  opacity: 1;
  transform: translateY(0);
}

.theme-dark .btn.primary {
  background: #111827;
  border-color: #111827;
  color: #e5e7eb;
}

.theme-dark .btn.primary:hover {
  background: #0b1220;
  border-color: #0b1220;
}

.theme-dark .btn.ghost {
  border-color: #e5e7eb;
  color: #e5e7eb;
}

.theme-dark .btn.ghost:hover {
  background: #e5e7eb;
  color: #0b1220;
}

.theme-dark #visitChart {
  background: #0b1220;
  border: 1px solid #1f2937;
}

.theme-dark .comment-item {
  background: #0b1220;
  border-color: #1f2937;
  color: #e5e7eb;
}

.theme-dark .comment-input {
  background: #0b1220;
  color: #e5e7eb;
  border-color: #1f2937;
}

.nav-link {
  text-decoration: none;
  color: var(--graphite);
  font-size: 0.95rem;
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 38px;
  line-height: normal;
}

.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 2px;
  background: var(--accent);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 24px;
  gap: 6px;
  flex-direction: column;
  justify-content: center;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--graphite);
  border-radius: 2px;
  transition: transform 0.2s ease;
}

.nav-dropdown {
  position: relative;
}

.dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font: inherit;
  height: 38px;
  line-height: normal;
  vertical-align: middle;
}

.chevron {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  background: var(--card);
  border: 1px solid var(--mist);
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-width: 180px;
  padding: 12px;
  display: grid;
  gap: 6px;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.dropdown-panel a {
  text-decoration: none;
  color: var(--graphite);
  padding: 6px 8px;
  border-radius: 8px;
}

.dropdown-panel a:hover {
  background: var(--mist);
}

.nav-dropdown.open .dropdown-panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

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

.hero {
  padding: 80px 0 40px;
}

.hero-header {
  display: flex;
  align-items: center;
  gap: 20px;
}

.avatar {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--mist);
  flex-shrink: 0;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--slate);
}

.hero-title {
  font-size: clamp(2.4rem, 4vw, 3.6rem);
  margin: 12px 0;
}

.hero-subtitle {
  color: var(--slate);
  max-width: 520px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  margin-top: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.btn.primary {
  background: var(--graphite);
  color: #fff;
}

.btn.ghost {
  border-color: var(--graphite);
  color: var(--graphite);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(31, 41, 55, 0.12);
}

.btn.primary:hover {
  background: #111827;
  border-color: #111827;
}

.btn.ghost:hover {
  background: var(--graphite);
  color: #fff;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 4px 10px rgba(31, 41, 55, 0.12);
}

.grid {
  display: grid;
  gap: 24px;
  margin-top: 40px;
}

.grid.three {
  grid-template-columns: repeat(2, 1fr);
}

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin-top: 0;
}

.text-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.back-button {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--mist);
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease;
}

.back-button:hover {
  background: var(--mist);
}

.back-button:active {
  transform: scale(0.96);
}

.split {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  align-items: start;
  margin-top: 56px;
}

.accordion {
  display: grid;
  gap: 12px;
}

.accordion-header {
  width: 100%;
  padding: 12px 16px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--mist);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 500;
}

.accordion-body {
  padding: 0 16px 16px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  background: var(--card);
  border-radius: 0 0 12px 12px;
  border: 1px solid var(--mist);
  border-top: none;
}

.accordion-item.open + .accordion-body,
.accordion-body.open {
  max-height: 180px;
  opacity: 1;
}

.section-title {
  margin: 40px 0 16px;
}

.timeline {
  display: grid;
  gap: 20px;
}

.timeline-item {
  padding: 20px;
  border-left: 2px solid var(--mist);
  background: var(--card);
  border-radius: 12px;
}

.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--mist);
  font-size: 0.75rem;
  color: var(--slate);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.filter-btn {
  border: 1px solid var(--mist);
  background: var(--card);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  color: var(--slate);
}

.filter-btn.active {
  background: var(--graphite);
  color: #fff;
  border-color: var(--graphite);
}

.resource-card {
  padding: 18px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--mist);
}

.resource-card h4 {
  margin: 6px 0 8px;
}

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

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 32px;
}

.resource-split {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}

.gallery-item {
  margin: 0;
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--mist);
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.gallery-wide {
  grid-template-columns: repeat(2, 1fr);
  max-width: 960px;
  margin: 0 auto;
}

.gallery-w4de .gallery-item img {
  width: 70%;
  display: block;
  margin: 0 auto;
  height: 500px;
}

.gallery-item figcaption {
  padding: 12px 16px;
  color: var(--slate);
  font-size: 0.9rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 48px;
}

.comment-form {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.comment-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--mist);
  padding: 12px 14px;
  font-size: 0.95rem;
  background: #fff;
  resize: vertical;
}

.comment-list {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.comment-item {
  background: #fff;
  border: 1px solid var(--mist);
  border-radius: 12px;
  padding: 12px 14px;
}

.comment-text {
  margin: 0 0 8px;
  color: var(--graphite);
}

.comment-time {
  font-size: 0.75rem;
  color: var(--slate);
}

.visit-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 16px;
}

.visit-count {
  font-size: 1.8rem;
  font-weight: 600;
}

#visitChart {
  width: 100%;
  height: 180px;
  border-radius: 12px;
  background: #f8fafc;
}

.particle-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

main,
header,
footer {
  position: relative;
  z-index: 1;
}

.dino-section {
  margin-top: 40px;
}

.dino-wrapper {
  margin-top: 16px;
  border-radius: 16px;
  background: #f8fafc;
  padding: 12px;
}

#dino-canvas {
  width: 100%;
  height: 180px;
  display: block;
}

.game-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0 32px;
}

.game-card {
  padding: 20px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--mist);
}

.comments iframe {
  width: 100%;
}

.game-wrapper {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr 1fr;
  align-items: start;
}

#game-board {
  width: 360px;
  height: 360px;
  background: #e5e7eb;
  border-radius: 16px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.tile {
  background: #f8fafc;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--graphite);
  transition: transform 0.15s ease, background 0.15s ease;
}

.tile-0 {
  color: transparent;
  background: #f3f4f6;
}

.footer {
  text-align: center;
  padding: 40px 20px;
  color: var(--slate);
  border-top: 1px solid var(--mist);
}

@media (max-width: 960px) {
  .grid.three {
    grid-template-columns: 1fr;
  }

  .split {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .resource-split {
    grid-template-columns: 1fr;
  }

  .game-wrapper {
    grid-template-columns: 1fr;
  }

  #game-board {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
  }
}

@media (max-width: 720px) {
  .nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 38px;
    gap: 6px;
    flex-direction: column;
    justify-content: center;
  }

  .nav-links {
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--mist);
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  .nav-links.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .dropdown-panel {
    position: static;
    box-shadow: none;
    border: none;
    padding: 8px 0 0 0;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .gallery-wide {
    grid-template-columns: 1fr;
  }

  .hero-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .avatar {
    width: 72px;
    height: 72px;
  }
}
