:root {
  --bg: #05060a;
  --panel: #0d0f16;
  --line: #1c2030;
  --text: #c9cfdd;
  --dim: #5b6378;
  --accent: #9be04a;
  --mono: 'Menlo', 'SF Mono', 'Consolas', 'DejaVu Sans Mono', monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--mono); }
a { color: inherit; }

/* ---------------- viewer ---------------- */
.viewer { overflow: hidden; }
#layout { display: flex; flex-direction: column; height: 100vh; }
#stage { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden; }
#screen { display: block; image-rendering: auto; }
.with-code #stage { flex: 1 1 62%; }
.with-code #code { flex: 0 0 38%; }
.capture #stage { align-items: flex-start; justify-content: flex-start; }

#hud {
  position: fixed; left: 12px; bottom: 10px; display: flex; gap: 16px; align-items: center;
  font-size: 11px; color: var(--dim); background: #000a; padding: 6px 10px; border-radius: 6px;
}
#hud a { text-decoration: none; color: var(--text); }
#hud .keys { opacity: 0.7; }
.with-code #hud { display: none; }
#error { position: fixed; inset: 20px; color: #ff6b6b; white-space: pre-wrap; background: #120608; padding: 16px; margin: 0; }

/* ---------------- code panel ---------------- */
.codepanel { background: var(--panel); border-top: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.cp-head { display: flex; align-items: center; gap: 14px; padding: 8px 14px; font-size: 12px; border-bottom: 1px solid var(--line); }
.cp-dots i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: #ff5f57; }
.cp-dots i:nth-child(2) { background: #febc2e; }
.cp-dots i:nth-child(3) { background: #28c840; }
.cp-status { margin-left: auto; color: var(--dim); }
.cp-status b { color: #28c840; margin-right: 4px; font-weight: normal; }
.cp-fps { margin-left: 12px; }
.cp-body { overflow: hidden; flex: 1; }
.cp-body pre { margin: 0; font-size: 12px; line-height: 1.55; }
.cp-line { padding: 0 14px; white-space: pre; border-left: 2px solid transparent; }
.cp-line.on { background: #2a2210; border-left-color: #febc2e; }
.ln { display: inline-block; width: 3ch; margin-right: 14px; text-align: right; color: #3b4255; }
.k { color: #c792ea; } .f { color: #82aaff; } .n { color: #f78c6c; } .c { color: #5f6a80; font-style: italic; }

/* ---------------- gallery ---------------- */
.gallery { padding: 48px clamp(16px, 5vw, 64px); max-width: 1280px; margin: 0 auto; height: auto; }
/* each phase has its own accent: green 2D, blue 2.5D, violet 3D */
[data-phase="1"] { --ph: #9be04a; }
[data-phase="2"] { --ph: #82aaff; }
[data-phase="3"] { --ph: #c792ea; }

.g-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 56px; }
.g-head h1 { margin: 0 0 6px; font-size: 28px; letter-spacing: 0.04em; }
.g-head p { margin: 0; color: var(--dim); }
#phase-nav { display: flex; gap: 8px; }
#phase-nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 14px; text-decoration: none; font-size: 13px;
  border: 1px solid var(--line); border-radius: 999px; transition: border-color 0.2s, color 0.2s;
}
#phase-nav a b { color: var(--ph); font-weight: normal; }
#phase-nav a span { color: var(--dim); font-size: 11px; }
#phase-nav a:hover { border-color: var(--ph); }

.phase { margin-bottom: 64px; scroll-margin-top: 24px; }
.phase-head { display: flex; align-items: center; gap: 20px; padding-bottom: 16px; margin-bottom: 24px; border-bottom: 1px solid var(--line); position: relative; }
.phase-head::after { content: ''; position: absolute; left: 0; bottom: -1px; width: 72px; height: 1px; background: var(--ph); }
.phase-num { font-size: 44px; line-height: 1; color: transparent; -webkit-text-stroke: 1px var(--ph); opacity: 0.7; letter-spacing: -0.02em; }
.phase-title h2 { margin: 0 0 4px; font-size: 18px; font-weight: normal; letter-spacing: 0.03em; }
.phase-title h2 b { color: var(--ph); font-weight: normal; }
.phase-title p { margin: 0; font-size: 12px; color: var(--dim); }
.phase-count { margin-left: auto; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.12em; white-space: nowrap; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.card { display: block; text-decoration: none; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); transition: border-color 0.2s, transform 0.2s; }
.card:hover { border-color: var(--ph); transform: translateY(-2px); }
.thumb { aspect-ratio: 16 / 10; position: relative; background: #000; display: flex; align-items: center; justify-content: center; color: var(--dim); }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.meta { padding: 12px 14px 14px; }
.meta strong { display: block; font-size: 14px; font-weight: normal; margin-bottom: 4px; }
.meta p { margin: 0; font-size: 12px; line-height: 1.5; color: var(--dim); }

.soon {
  padding: 36px; text-align: center; font-size: 13px; color: var(--dim);
  border: 1px dashed var(--line); border-radius: 10px;
}
.soon span { color: var(--ph); }
.gallery footer { margin-top: 24px; color: var(--dim); font-size: 12px; }
kbd { border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
