:root {
  --ink: #1f1d1a;
  --paper: #fffdf8;
  --muted: #6f685e;
  --title: 'Black Han Sans', 'Gowun Dodum', sans-serif;
  --body: 'Gowun Dodum', system-ui, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --col: min(560px, calc(100% - 96px));
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: #121117; color: #f2efe9; font-family: var(--body); line-height: 1.55; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button { font: inherit; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.home-link { position: absolute; top: 14px; left: 16px; color: #2c3e5a; text-decoration: none; font-size: 14px; z-index: 5; }

/* ---------- 지상 ---------- */
.surface { min-height: 100vh; display: grid; grid-template-rows: 1fr auto; background: linear-gradient(180deg, #a9d4f5 0%, #d8ecfa 70%, #eef6fb 100%); color: #1d2a3d; }
.sky { align-self: center; text-align: center; padding: 72px 16px 24px; }
.clock { display: inline-block; background: #1d2a3d; color: #fff; border-radius: 999px; padding: 4px 14px; font-size: 14px; margin-bottom: 18px; }
.sky h1 { font-family: var(--title); font-weight: 400; font-size: clamp(42px, 8vw, 80px); line-height: 1.02; }
.lead { margin-top: 18px; font-size: 18px; color: #34465f; }
.scroll-hint { font-size: 34px; margin-top: 28px; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(8px); } }
.street { height: 120px; background: linear-gradient(180deg, transparent 0 70%, #8c9096 70% 74%, #55585e 74%); position: relative; }
.entrance { position: absolute; left: 50%; bottom: 31%; transform: translateX(-50%); width: 150px; height: 70px; background: #e8e3d8; border: 3px solid #3b3f46; border-bottom: 0; border-radius: 10px 10px 0 0; display: grid; justify-items: center; }
.entrance-sign { margin-top: 6px; background: #1a5fb4; color: #fff; font-weight: 700; font-size: 13px; padding: 1px 10px; border-radius: 4px; }
.stairs { width: 90px; height: 34px; margin-top: 8px; background: repeating-linear-gradient(180deg, #4a4e56 0 5px, #6c7079 5px 8px); border-radius: 2px 2px 0 0; }

/* ---------- 땅속 ---------- */
.shaft { position: relative;
  background: linear-gradient(180deg,
    #55585e 0, #4a4c52 calc(var(--px) * 1.5),
    #7a5a40 calc(var(--px) * 1.5), #6a4c35 calc(var(--px) * 10),
    #4f3a2b calc(var(--px) * 22), #3a3233 calc(var(--px) * 35),
    #2c2a33 calc(var(--px) * 48), #1b1a22 calc(var(--px) * 62), #121117 100%); }
.shaft::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .25;
  background-image: radial-gradient(circle at 20% 30%, rgba(255,255,255,.18) 0 2px, transparent 3px), radial-gradient(circle at 70% 60%, rgba(0,0,0,.35) 0 3px, transparent 4px), radial-gradient(circle at 40% 80%, rgba(255,255,255,.12) 0 1.5px, transparent 2.5px);
  background-size: 140px 120px, 190px 170px, 90px 110px; }

.ruler { position: absolute; top: 0; bottom: 0; left: max(12px, calc(50% - var(--col) / 2 - 76px)); width: 60px; border-right: 2px solid rgba(255,255,255,.35); }
.tick { position: absolute; right: 0; width: 10px; border-top: 1px solid rgba(255,255,255,.35); }
.tick.major { width: 22px; border-top: 2px solid rgba(255,255,255,.75); }
.tick span { position: absolute; right: 28px; top: -11px; font-size: 13px; font-weight: 700; color: rgba(255,255,255,.85); white-space: nowrap; }

.markers { position: absolute; inset: 0; }
.depth-line { position: absolute; left: 0; right: 0; border-top: 1px dashed rgba(255,255,255,.28); }
.depth-line.station { border-top: 3px solid var(--c); box-shadow: 0 0 12px var(--c); }

.band { position: absolute; left: 0; right: 0; background: color-mix(in srgb, var(--c) 22%, transparent); border-top: 2px dashed color-mix(in srgb, var(--c) 80%, white); border-bottom: 2px dashed color-mix(in srgb, var(--c) 80%, white); }
.band-label { position: sticky; top: 40vh; margin-left: auto; width: min(240px, 34vw); margin-right: 16px; padding: 10px 12px; font-size: 13px; color: #f6eaf3; display: grid; gap: 4px; }
.band-label b { font-size: 15px; }

.card { position: absolute; left: calc(50% - var(--col) / 2); width: var(--col); background: rgba(18,17,23,.78); backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,.14); border-radius: 14px; padding: 14px 16px; color: #f2efe9; opacity: .35; transform: translateY(10px); transition: opacity .5s, transform .5s; z-index: 2; }
.card.seen { opacity: 1; transform: none; }
.card h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.card p { font-size: 15px; }
.depth-tag { font-size: 12px !important; color: #c9c3b8; letter-spacing: .03em; margin-bottom: 4px; }
.card.aside { background: rgba(40,48,80,.82); border-color: rgba(160,180,255,.3); }
.card.station { background: var(--paper); color: var(--ink); border: 0; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.card.station .depth-tag { color: var(--muted); }
.sign { display: flex; align-items: center; gap: 10px; border: 3px solid var(--c); border-radius: 999px; padding: 4px 16px 4px 4px; width: fit-content; margin-bottom: 10px; background: #fff; }
.badge { width: 34px; height: 34px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.sign .name { font-family: var(--title); font-size: 26px; line-height: 1; color: #222; }
.sign .city { font-size: 12px; color: var(--muted); border: 1px solid #ccc; border-radius: 4px; padding: 0 6px; }

/* ---------- 바닥 ---------- */
.bottom { background: #121117; padding: 80px 16px 48px; }
.bottom-card { max-width: 640px; margin: 0 auto; text-align: center; display: grid; gap: 16px; }
.eyebrow { color: #a59fb3; font-size: 14px; }
.bottom h2 { font-family: var(--title); font-weight: 400; font-size: clamp(26px, 4.6vw, 40px); line-height: 1.2; }
#summary { font-size: 17px; color: #d8d3cb; }
#summary b { color: #ffd66b; }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn { border-radius: 12px; padding: 12px 20px; font-weight: 700; border: 1.5px solid #f2efe9; color: #f2efe9; background: transparent; }
.btn.primary { background: #f2efe9; color: #121117; }
.btn:focus-visible, .sources summary:focus-visible { outline: 3px solid #7aa7ff; outline-offset: 2px; }
.sources { text-align: left; font-size: 13px; color: #a59fb3; border-top: 1px solid #2c2a33; padding-top: 12px; }
.sources summary { cursor: pointer; }
.sources ul { padding-left: 18px; }
.sources a { color: #c9d6ff; }
footer { font-size: 13px; font-weight: 700; color: #8b8597; margin-top: 16px; }

/* ---------- HUD ---------- */
.hud { position: fixed; right: 16px; bottom: 16px; z-index: 10; background: rgba(255,253,248,.95); color: var(--ink); border-radius: 16px; padding: 12px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.35); min-width: 210px; opacity: 0; transform: translateY(16px); transition: opacity .3s, transform .3s; pointer-events: none; }
.hud.visible { opacity: 1; transform: none; }
.hud-label { font-size: 12px; color: var(--muted); }
.hud-depth { font-family: var(--title); font-size: 32px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hud dl { margin: 6px 0 0; display: grid; gap: 2px; font-size: 13px; }
.hud dl div { display: flex; gap: 8px; }
.hud dt, .hud dd { margin: 0; }

@media (max-width: 640px) {
  :root { --col: calc(100% - 80px); }
  .ruler { left: 4px; width: 52px; }
  .tick span { right: 26px; font-size: 12px; }
  .card { left: 66px; }
  .band-label { position: static; width: auto; margin: 8px 8px 0 66px; background: rgba(18,17,23,.55); border-radius: 10px; }
  .hud { left: 12px; right: 12px; bottom: 12px; min-width: 0; display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 14px; padding: 10px 14px; }
  .hud-label { grid-column: 1; }
  .hud-depth { grid-column: 1; font-size: 24px; }
  .hud dl { grid-column: 2; grid-row: 1 / span 2; margin: 0; font-size: 12px; }
  .sky { padding-top: 56px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
