/* scene-driven colors transition smoothly */
@property --ph   { syntax: '<color>'; inherits: true; initial-value: #FF9FB2; }
@property --ac   { syntax: '<color>'; inherits: true; initial-value: #FFD27A; }
@property --bg2  { syntax: '<color>'; inherits: true; initial-value: #1E0A12; }
@property --line { syntax: '<color>'; inherits: true; initial-value: #5C2438; }
@property --t1   { syntax: '<color>'; inherits: true; initial-value: #ff5f8a; }
@property --t2   { syntax: '<color>'; inherits: true; initial-value: #8b5cf6; }

:root {
  --bg: #0d0d10;
  --fg: #f2f4f6;
  --mute: #8b95a1;
  --hair: rgba(255, 255, 255, 0.08);
  --brand: #3182f6;
  --gutter: clamp(16px, 4vw, 56px);
  --sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif;
  --pixel: 'Galmuri11', 'Galmuri9', var(--sans);
  --crt: 'VT323', 'Galmuri11', ui-monospace, monospace;
  transition: --ph 0.9s, --ac 0.9s, --bg2 0.9s, --line 0.9s, --t1 1.4s, --t2 1.4s;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  word-break: keep-all;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
img { display: block; }

/* grain */
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 60; opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.crt { font-family: var(--crt); font-size: 18px; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1; }

/* ───────── HERO ───────── */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  isolation: isolate;
}
/* drifting mood blobs, tinted by the active project */
.mood { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.mood i {
  position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%;
  filter: blur(90px); opacity: 0.22;
}
.mood i:nth-child(1) { background: var(--t1); right: -12vmax; top: -18vmax; animation: drift 22s ease-in-out infinite alternate; }
.mood i:nth-child(2) { background: var(--t2); right: 18vmax; bottom: -30vmax; opacity: 0.16; animation: drift 28s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate(-6vmax, 5vmax) scale(1.12); } }

.nav {
  position: relative; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px var(--gutter);
}
.brand { display: flex; align-items: baseline; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.brand small { color: var(--mute); font-weight: 400; font-size: 14px; }
.nav-cta {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 14px;
  padding: 9px 14px; border-radius: 10px;
  border: 1px solid var(--hair); background: rgba(255, 255, 255, 0.03);
  transition: background 0.25s, border-color 0.25s;
}
.nav-cta:hover { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.16); }

.main {
  display: grid;
  grid-template-columns: minmax(340px, 0.82fr) minmax(0, 1.18fr);
  grid-template-areas: 'intro stage' 'list stage';
  grid-template-rows: auto 1fr;
  column-gap: clamp(32px, 5vw, 88px);
  row-gap: 60px;
  padding: 2vh var(--gutter) 56px;
  align-items: start;
}

/* intro */
.intro { grid-area: intro; align-self: end; }
.intro { container-type: inline-size; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.site { display: flex; align-items: center; gap: 10px; margin: 0 0 20px; color: var(--mute); font-weight: 400; font-size: 21px; text-transform: none; }
.site .led-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--ph); box-shadow: 0 0 10px var(--ph); }
/* 큰 제목(앱 이름) — 가장 긴 이름('직장생활의 정석')이 한 줄에 들어가도록 칼럼 폭 기준으로 크기를 잡는다 */
.headline {
  display: block; width: fit-content;
  font-size: min(16.4cqi, 120px);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1.08;
  transition: color 0.3s;
}
.headline:hover { color: var(--ph); }
.headline:focus-visible { outline: 2px solid var(--ph); outline-offset: 6px; border-radius: 6px; }
.subline { margin: 16px 0 0; font-size: clamp(18px, 5.4cqi, 28px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.3; color: #d5dae0; }
/* 단어 슬롯 — 바뀐 단어만 슬롯 안에서 굴러 교체된다 (hero.js roller) */
.hl-l { display: block; white-space: nowrap; }
.roll em { font-style: normal; color: var(--ph); }
.roll .w { position: relative; display: inline-block; vertical-align: top; overflow: hidden; padding: 0.04em 0.03em 0.1em 0; margin: -0.04em -0.03em -0.1em 0; }
.roll .wi { display: inline-block; white-space: nowrap; }
.roll .c { display: inline-block; }
.tagline { text-wrap: pretty; margin: 26px 0 0; color: #b0b8c1; font-size: clamp(16px, 1.3vw, 19px); line-height: 1.6; max-width: 26em; letter-spacing: -0.01em; }
.tagline b { color: var(--fg); font-weight: 600; white-space: nowrap; }
.cta {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 26px; height: 48px; padding: 0 22px; border-radius: 12px;
  background: var(--brand); color: #fff; font-weight: 600; font-size: 15px;
  box-shadow: 0 10px 30px -12px rgba(49, 130, 246, 0.8);
  transition: transform 0.25s;
}
.cta:hover { transform: translateY(-2px); }
.cta .arr { transition: transform 0.3s; }
.cta:hover .arr { transform: translateX(4px); }

/* project list */
.list { grid-area: list; }
.list-head { display: flex; justify-content: space-between; color: var(--mute); padding: 0 4px 8px; font-size: 17px; }
.list-lead { margin: 0; padding: 0 4px 14px; border-bottom: 1px solid var(--hair); color: #b0b8c1; font-size: 15px; letter-spacing: -0.01em; }
.projects { list-style: none; margin: 0; padding: 0; }
.proj {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 10px 12px 8px;
  border-bottom: 1px solid var(--hair);
  transition: background 0.3s;
  outline: none;
}
.proj img { width: 44px; height: 44px; border-radius: 10px; image-rendering: pixelated; transition: transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1); }
.proj strong { display: block; font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.proj .pt span { display: block; margin-top: 3px; font-size: 13.5px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj .pn { display: flex; align-items: center; gap: 10px; color: var(--mute); font-size: 17px; }
.proj .pn b { font-weight: 400; color: #5d646d; transition: color 0.3s; }
.proj .go { font-family: var(--sans); font-size: 13px; opacity: 0; transform: translateX(-4px); transition: opacity 0.25s, transform 0.25s; color: var(--c); }
.proj .bar { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--c); transform: scaleX(0); transform-origin: left; }
.proj::before {
  content: ''; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 3px; border-radius: 3px;
  background: var(--c); transform: scaleY(0); transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.proj.on { background: linear-gradient(90deg, color-mix(in oklab, var(--c) 9%, transparent), transparent 80%); }
.proj.on::before { transform: scaleY(1); }
.proj.on img { transform: scale(1.08) rotate(-4deg); }
.proj.on .pn b { color: var(--c); }
.proj:hover .go, .proj:focus-visible .go { opacity: 1; transform: none; }
.proj:focus-visible { box-shadow: inset 0 0 0 2px var(--c); border-radius: 8px; }

/* ───────── STAGE ───────── */
.stage {
  grid-area: stage;
  align-self: center;
  position: relative;
  container-type: inline-size;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding-bottom: 32px;
}
.device {
  position: relative;
  flex: none;
  width: min(53cqw, calc(100svh - 190px), 540px);
  padding: 14px 14px 16px;
  border-radius: 26px;
  background: linear-gradient(160deg, color-mix(in oklab, var(--bg2) 88%, #fff 4%), var(--bg2));
  border: 1px solid color-mix(in oklab, var(--line) 80%, transparent);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.screen-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 6px 12px; color: color-mix(in oklab, var(--ph) 70%, #fff 0%); font-size: 17px; }
.screen-head .rec { display: inline-flex; align-items: center; gap: 7px; }
.screen-head .rec::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ph); box-shadow: 0 0 8px var(--ph); animation: rec 1.6s steps(2) infinite; }
@keyframes rec { 50% { opacity: 0.25; } }
.screen {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #07070a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), inset 0 0 60px rgba(0, 0, 0, 0.8);
}
.screen::after { /* CRT scanlines + vignette */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55));
}
.board {
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  aspect-ratio: 1;
  padding: 3.2%;
  cursor: crosshair;
  touch-action: manipulation;
}
.led { position: relative; padding: 9%; --h: 0; }
.led i {
  display: block; width: 100%; height: 100%;
  border-radius: 24%;
  background: #1a1a20;
  transform: scale(0.62);
  box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px;
}
.led::after { /* cursor flashlight */
  content: ''; position: absolute; inset: 14%; border-radius: 30%;
  background: #fff; opacity: calc(var(--h) * 0.28);
  mix-blend-mode: overlay; pointer-events: none;
  transition: opacity 0.25s;
}
.device-foot { display: flex; justify-content: space-between; padding: 12px 6px 0; color: color-mix(in oklab, var(--ph) 45%, #666); font-size: 16px; }

/* ───────── GAME CARD ───────── */
.gcard {
  position: relative;
  z-index: 3;
  flex: none;
  width: min(46cqw, 400px);
  margin-left: -1cqw;
  margin-bottom: -36px;
  min-height: 560px; /* 가장 긴 장면(직장생활) 기준 — 장면 전환 때 보드가 튀지 않게 */
  padding: 16px 16px 14px;
  border-radius: 16px;
  background: color-mix(in oklab, var(--bg2) 92%, #000);
  border: 2px solid var(--line);
  box-shadow: 6px 6px 0 color-mix(in oklab, var(--line) 70%, #000), 0 30px 60px -20px rgba(0, 0, 0, 0.8);
  font-family: var(--pixel);
  display: flex;
  flex-direction: column;
}
.gc-head { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding-bottom: 12px; border-bottom: 2px dashed color-mix(in oklab, var(--line) 80%, transparent); }
.gc-head img { width: 34px; height: 34px; border-radius: 8px; image-rendering: pixelated; }
.gc-name { display: block; font-size: 14px; color: var(--ph); }
.gc-tag { display: block; font-size: 11px; color: #9a9aa6; margin-top: 3px; }
.gc-round { color: var(--ac); font-size: 18px; }
.gc-body { flex: 1; display: flex; flex-direction: column; padding-top: 12px; min-height: 0; }
.gc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11px; }
.chip { padding: 4px 8px; border-radius: 6px; background: color-mix(in oklab, var(--ph) 16%, transparent); color: var(--ph); border: 1px solid color-mix(in oklab, var(--ph) 35%, transparent); }
.ctx { color: #8f8f9b; }
.gc-sit { margin: 12px 0 12px; font-size: 14px; line-height: 1.6; color: #f4eef0; min-height: 3.2em; }
.gc-sit .caret { display: inline-block; width: 0.5em; height: 1em; margin-left: 2px; vertical-align: -0.15em; background: var(--ph); animation: rec 0.9s steps(2) infinite; }
.poplabel { display: flex; justify-content: flex-start; font-size: 11px; color: #8f8f9b; height: 16px; opacity: 0; }
.choices { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 7px; }
.choice {
  position: relative;
  display: block;
  width: 100%;
  padding: 9px 44px 9px 36px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.45;
  color: #e8e3e6;
  background: rgba(255, 255, 255, 0.025);
  border: 1.5px solid color-mix(in oklab, var(--k) 28%, transparent);
  isolation: isolate;
  transition: border-color 0.3s, box-shadow 0.3s, opacity 0.4s, transform 0.2s;
}
.choice:hover { border-color: var(--k); }
.choice:active { transform: translate(2px, 2px); }
.choice .key {
  position: absolute; left: 8px; top: 8px;
  width: 20px; height: 20px; border-radius: 5px;
  display: grid; place-items: center;
  font-family: var(--crt); font-size: 17px; line-height: 1;
  background: var(--k); color: #111;
}
.choice .fill { position: absolute; inset: 0; width: 0; border-radius: 6px; background: color-mix(in oklab, var(--k) 18%, transparent); z-index: -1; }
.choice .txt { position: relative; }
.choice .pct { position: absolute; right: 9px; top: 50%; translate: 0 -50%; font-family: var(--crt); font-size: 18px; color: var(--k); opacity: 0; }
.choice .stamp {
  position: absolute; right: -8px; top: -10px; z-index: 2;
  padding: 1px 6px 2px; border-radius: 4px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
  font-family: var(--crt); font-size: 16px; line-height: 1.1;
  background: var(--vc); color: #111;
  transform: scale(0) rotate(-8deg);
}
.choices.picked .choice { opacity: 0.5; }
.choices.picked .choice.sel { opacity: 1; border-color: var(--k); box-shadow: 3px 3px 0 var(--k); }
.gc-verdict { margin: 10px 0 0; font-size: 12px; color: var(--vc, #ccc); min-height: 1.5em; }
.gc-foot { margin-top: auto; padding-top: 10px; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.principle { font-size: 12px; color: #cfc8cc; opacity: 0; line-height: 1.5; }
.principle b { font-weight: 400; color: var(--ac); margin-right: 6px; }
.play { flex: none; font-size: 11px; color: var(--ph); white-space: nowrap; border-bottom: 1px solid currentColor; padding-bottom: 1px; }

/* NamBTI specific */
.choices.two .choice { padding-right: 70px; }
.avs { position: absolute; right: 8px; top: 50%; translate: 0 -50%; display: flex; }
.av { width: 22px; height: 22px; margin-left: -6px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; border: 2px solid #1c1022; background: var(--avc); opacity: 0; }
.friends { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.friend { font-size: 10.5px; color: #cfc8d8; padding: 6px 6px; border-radius: 6px; border: 1px dashed color-mix(in oklab, var(--ph) 30%, transparent); text-align: center; opacity: 0.35; }
.friend.in { opacity: 1; border-style: solid; border-color: var(--avc); background: color-mix(in oklab, var(--avc) 20%, transparent); }
.lock { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: #a79bb8; }
.lock .meter { flex: 1; height: 6px; margin: 0 10px; border-radius: 3px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.lock .meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #8b64f5, #e26fb0, #ff7f5c); }
.lock b { font-family: var(--crt); font-weight: 400; font-size: 18px; color: var(--ac); }

.self { display: inline-flex; align-self: flex-start; gap: 6px; padding: 5px 9px; border-radius: 6px; background: #fef3c7; color: #b45309; font-size: 11.5px; }
.but { margin: 10px 0 2px; font-size: 12px; color: #e26fb0; }
.reveal { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; margin-top: 6px; }
.reveal .emo { grid-row: span 2; font-size: 46px; line-height: 1; }
.reveal .code { font-family: var(--crt); font-size: 44px; line-height: 0.9; letter-spacing: 0.04em; background: linear-gradient(90deg, #ffd790, #ff7f5c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.reveal .nick { font-size: 15px; color: #fff; }
.reveal p { grid-column: 1 / -1; margin: 10px 0 0; font-size: 12px; color: #d6cfe0; }
.letters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; perspective: 600px; }
.letter { padding: 8px 4px 7px; border-radius: 8px; text-align: center; background: rgba(255, 255, 255, 0.04); border: 1.5px solid rgba(255, 255, 255, 0.1); transform-style: preserve-3d; }
.letter b { display: block; font-family: var(--crt); font-weight: 400; font-size: 30px; line-height: 1; color: #fff; }
.letter span { display: block; margin-top: 3px; font-size: 9.5px; }
.letter.ok span { color: #4ade80; }
.letter.flip { border-color: #ec4899; background: rgba(236, 72, 153, 0.1); }
.letter.flip span { color: #f472b6; }
.gap { margin-top: 10px; font-size: 11px; color: #cdbfe0; line-height: 1.5; }
.gap b { font-family: var(--crt); font-weight: 400; font-size: 18px; color: var(--ac); }

.hint { position: absolute; left: 0; bottom: 0; color: #5d646d; font-family: var(--pixel); font-size: 11px; text-transform: none; letter-spacing: 0; }

/* pre-intro */
.js .nav > *, .js .site, .js .tagline, .js .cta, .js .list-head, .js .list-lead, .js .proj, .js .device, .js .gcard, .js .hint { opacity: 0; }
.js .roll:not(.split) { opacity: 0; }

/* ───────── RESPONSIVE ───────── */
@media (max-width: 1180px) {
  .main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'intro' 'stage' 'list';
    grid-template-rows: auto;
    row-gap: 40px;
  }
  .stage { flex-direction: column; align-items: center; padding-bottom: 0; }
  .device { width: min(100%, 520px); }
  .gcard { width: min(92%, 440px); margin: -64px 0 0 auto; min-height: 0; }
  .hint { display: none; }
}
@media (max-width: 1180px) and (min-width: 560px) {
  .gcard { margin-right: max(0px, calc((100% - 520px) / 2 - 20px)); }
}
@media (max-width: 520px) {
  .device { padding: 10px 10px 12px; border-radius: 20px; }
  .gcard { width: 100%; margin-top: -40px; }
  .device-foot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .mood i, .screen-head .rec::before, .gc-sit .caret { animation: none; }
}
