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

:root {
  --bg:       #111009;
  --text:     #ede8dc;
  --muted:    #9c9489;
  --border:   #2e2b22;
  --accent:   #d4894a;
  --tag-bg:   #1a1814;
  --live:     #4e9a6a;
  --wip:      #5e5a54;
}

html { font-size: 16px; }

/* hide native cursor everywhere */
* { cursor: none !important; }

/* terminal block cursor overlay */
#terminal-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 10px;
  height: 18px;
  background: var(--accent);
  pointer-events: none;
  z-index: 99999;
  animation: cur-blink 1s step-start infinite;
  mix-blend-mode: difference;
}

@keyframes cur-blink {
  0%, 70%  { opacity: 1; }
  71%, 100% { opacity: 0; }
}

/* terminal-style text selection */
::selection {
  background: var(--accent);
  color: var(--bg);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 300;
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── STATUS BAR ── */
.statusbar {
  background: #1a1814;
  color: var(--muted);
  font-size: 0.68rem;
  padding: 0.35rem 2.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  letter-spacing: 0.04em;
  opacity: 0.88;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4e9a6a;
  flex-shrink: 0;
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── NAV ── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem 2.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
}

.nav-name {
  font-size: 1.05rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  gap: 1.75rem;
}

.nav-link {
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
}

/* ── SECTIONS ── */
.section {
  display: none;
  flex: 1;
  animation: appear 0.2s ease;
}

.section.active { display: block; }

@keyframes appear {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 4.5rem 2rem 6rem;
}

.section-label {
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}

.section-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 3rem;
  font-style: italic;
}

/* ── HERO ── */
.hero-name {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 1.25rem;
}

.hero-divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}

.hero-tagline {
  font-size: 1.55rem;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.025em;
  max-width: 560px;
}

.currently-block {
  margin: 0.5rem 0;
}

.currently-label {
  font-size: 0.75rem;
  color: var(--muted);
  display: block;
  margin-bottom: 0.65rem;
}

.currently-lines {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border);
}

.currently-line {
  font-size: 0.82rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cl-key  { color: var(--text); }
.cl-sep  { color: var(--muted); }
.cl-val  { color: var(--muted); font-style: italic; }

.hero-links {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  font-size: 0.78rem;
  margin-top: 0.5rem;
}

.hero-links a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
  transition: border-color 0.15s;
}

.hero-links a:hover { border-color: var(--accent); }
.hero-links span { color: var(--border); }

/* ── CHANGELOG ── */
.cl-entries {
  display: flex;
  flex-direction: column;
}

.cl-entry {
  display: grid;
  grid-template-columns: 1fr;
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
}

.cl-entry:first-child { padding-top: 0; }

.cl-entry-header {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  margin-bottom: 0.4rem;
}

.version {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.cl-date {
  font-size: 0.72rem;
  color: var(--muted);
}

.cl-role {
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 400;
  margin-bottom: 0.55rem;
}

.cl-note {
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.65;
  font-style: italic;
  margin-bottom: 0.9rem;
}

.cl-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cl-stack span {
  font-size: 0.68rem;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  color: #777;
  letter-spacing: 0.02em;
}

/* ── MODULES ── */
.modules-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.module-card {
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
}

.module-card:first-child { padding-top: 0; }

.module-wip { opacity: 0.45; }

/* MODULES — 3-column equal layout */
.modules-container {
  max-width: 1000px;
  padding-left: 2rem;
  padding-right: 2rem;
}

.modules-three-col {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-top: 1.5rem;
}

.modules-three-col > * {
  flex: 1 1 0;
  min-width: 0;
}

/* SNAKE EMBED */
.snake-embed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.snake-meta {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.snake-score-val { color: var(--accent); font-weight: 500; }

.snake-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
}

#game-canvas,
#gb-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(180, 170, 150, 0.18);
  image-rendering: pixelated;
}

.mod-mid, .mod-right {
  border-top: none;
  padding-top: 0;
}

.snake-overlay {
  position: absolute;
  inset: 0;
  background: rgba(17,16,9,0.93);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border: 1px solid var(--border);
}

.overlay-title { font-size: 0.9rem; font-weight: 500; color: var(--text); }
.overlay-sub { font-size: 0.7rem; color: var(--muted); text-align: center; line-height: 1.5; }
.overlay-score { font-size: 1.5rem; color: var(--accent); font-weight: 500; }

.overlay-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 0.45rem 1.1rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  transition: opacity 0.15s;
}
.overlay-btn:hover { opacity: 0.8; }

.overlay-btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.4rem 1rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  transition: border-color 0.15s, color 0.15s;
}
.overlay-btn-ghost:hover { border-color: var(--muted); color: var(--text); }

.overlay-input {
  background: var(--tag-bg);
  border: 1px solid var(--border);
  padding: 0.45rem 0.75rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  color: var(--text);
  outline: none;
  width: 180px;
  text-align: center;
  transition: border-color 0.15s;
}
.overlay-input:focus { border-color: var(--accent); }
.overlay-input::placeholder { color: var(--muted); }

.name-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.snake-controls {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.5rem;
}


.snake-lb-label {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.snake-lb-list { display: flex; flex-direction: column; }

.lb-row {
  display: grid;
  grid-template-columns: 1.4rem 1fr auto;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
}
.lb-row:first-child { padding-top: 0; }
.lb-rank { color: var(--muted); font-size: 0.65rem; }
.lb-rank.top { color: var(--accent); }
.lb-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { color: var(--accent); font-weight: 500; white-space: nowrap; }
.lb-date-small { font-size: 0.62rem; color: var(--muted); }
.lb-empty { font-size: 0.75rem; color: var(--muted); font-style: italic; padding: 0.75rem 0; }
.lb-loading { font-size: 0.72rem; color: var(--muted); animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.module-name {
  font-size: 0.92rem;
  font-weight: 500;
  margin-right: 0.75rem;
}

.module-status {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.status-live { color: var(--live); }
.status-wip  { color: var(--wip); }

.module-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 1rem;
  line-height: 1;
  transition: color 0.15s;
}

.module-link:hover { color: var(--accent); }

.module-desc {
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 0.6rem;
  font-style: italic;
}

.module-infra {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.7rem;
}

.module-infra span {
  color: var(--text);
  font-style: italic;
}

.module-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.module-tags span {
  font-size: 0.68rem;
  border: 1px solid var(--border);
  padding: 0.12rem 0.5rem;
  color: var(--muted);
}

/* ── LOG ── */
.log-entries {
  display: flex;
  flex-direction: column;
}

.log-entry {
  display: flex;
  gap: 2.5rem;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--border);
  transition: opacity 0.15s;
  cursor: default;
}

.log-entry:first-child { padding-top: 0; }
.log-entry:hover { opacity: 0.6; }

.log-linked {
  text-decoration: none;
  color: inherit;
  display: flex;
}

.log-date {
  font-size: 0.7rem;
  color: var(--muted);
  min-width: 60px;
  flex-shrink: 0;
  padding-top: 0.2rem;
}

.log-title {
  font-size: 0.88rem;
  font-weight: 400;
  margin-bottom: 0.3rem;
  line-height: 1.5;
}

.log-excerpt {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.6;
  font-style: italic;
}

/* ── MERGED LOG / FEED ── */
.log-pinned-label {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.feed-entries {
  display: flex;
  flex-direction: column;
}

.feed-card {
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--border);
}

.feed-card:last-child { border-bottom: none; }

.feed-pinned {
  background: transparent;
}

.feed-link {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: opacity 0.15s;
}
.feed-link:hover { opacity: 0.65; }

.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.45rem;
}

.feed-left {
  display: flex;
  gap: 0.65rem;
  align-items: baseline;
}

.feed-type {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.8;
}

.feed-date {
  font-size: 0.7rem;
  color: var(--muted);
}

.feed-title {
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 0.35rem;
}

.feed-desc {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.7;
  font-style: italic;
}

/* ── GUESTBOOK GAME ── */
.gb-container {
  max-width: 900px;
}

.gb-layout {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
}

.gb-game-wrap {
  flex: 0 0 300px;
}

.gb-side {
  flex: 1;
  min-width: 0;
}

@media (max-width: 700px) {
  .gb-layout { flex-direction: column; }
  .gb-game-wrap { flex: none; width: 100%; }
}

.gb-msg-input {
  height: auto;
  resize: none;
  line-height: 1.5;
  width: 180px;
}

/* ── GUESTBOOK ── */
.guestbook-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 3rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  background: var(--tag-bg);
}

/* HIGHLIGHTS */
.hl-feed { display: flex; flex-direction: column; }

.hl-card {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}
.hl-card:first-child { padding-top: 0; }

.hl-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.hl-date {
  font-size: 0.72rem;
  color: var(--muted);
}

.hl-link {
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.hl-link:hover { color: var(--accent); }

.hl-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.hl-desc {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.hl-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.hl-tags span {
  font-size: 0.7rem;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.1rem 0.45rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-row label {
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.guestbook-form input,
.guestbook-form textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.6rem 0.75rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--text);
  outline: none;
  resize: none;
  transition: border-color 0.15s;
  width: 100%;
}

.guestbook-form input::placeholder,
.guestbook-form textarea::placeholder { color: #ccc; }

.guestbook-form input:focus,
.guestbook-form textarea:focus { border-color: var(--accent); }

.guestbook-form button {
  align-self: flex-start;
  background: var(--accent);
  color: #111009;
  border: none;
  padding: 0.55rem 1.1rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.76rem;
  cursor: pointer;
  transition: opacity 0.15s;
  letter-spacing: 0.04em;
}

.guestbook-form button:hover { opacity: 0.72; }

.guest-entry {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  animation: appear 0.2s ease;
}

.guest-entry:first-child { border-top: 1px solid var(--border); }

.guest-meta {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
}

.guest-rank { color: var(--accent); font-size: 0.72rem; min-width: 2rem; }
.guest-name { font-weight: 500; }
.guest-score { color: var(--accent); font-size: 0.72rem; }
.guest-sep  { color: var(--border); }
.guest-date { color: var(--muted); font-size: 0.7rem; }

.guest-entry p {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.65;
  font-style: italic;
}

/* ── FOOTER ── */
footer {
  padding: 1.25rem 2.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--muted);
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.footer-sep { color: var(--border); }

footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

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

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  /* 3-col → single column stack */
  .modules-three-col {
    flex-direction: column;
    gap: 2.5rem;
  }

  .modules-container {
    padding-left: 1.4rem;
    padding-right: 1.4rem;
  }

  /* snake canvas fills full width */
  .snake-canvas-wrap { width: 100%; }

  .snake-meta { width: 100%; }

  /* snake leaderboard inline row on tablet */
  .snake-lb-list .lb-row { font-size: 0.72rem; }

  /* highlights */
  .hl-card-header { flex-direction: column; gap: 0.3rem; align-items: flex-start; }

  /* about meta */
  .meta-row { flex-direction: column; gap: 0.15rem; }
}

@media (max-width: 600px) {
  .statusbar { padding: 0.35rem 1.4rem; }

  nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1.2rem 1.4rem;
  }

  .nav-links { flex-wrap: wrap; gap: 0.8rem 1.2rem; }

  .container { padding: 2.5rem 1.4rem 5rem; }

  .modules-container { padding-left: 1.4rem; padding-right: 1.4rem; }

  .hero-tagline { font-size: 1.2rem; }

  /* hero currently block stacks */
  .currently-line { flex-wrap: wrap; gap: 0.2rem; }

  /* changelog */
  .cl-entry-header { flex-direction: column; gap: 0.2rem; }
  .cl-stack { gap: 0.3rem; }

  /* work */
  .work-item-header { flex-direction: column; gap: 0.15rem; }

  /* log */
  .log-entry { flex-direction: column; gap: 0.35rem; }

  /* highlights */
  .hl-tags { gap: 0.3rem; }

  /* guestbook */
  .guestbook-form { padding: 1rem; }

  /* snake overlay inputs */
  .overlay-input { width: 90%; }

  footer { padding: 1.2rem 1.4rem; font-size: 0.68rem; }
}
