:root {
  --tomato: #E4572E; --mustard: #F2B233; --clover: #4CA167; --cobalt: #2E6FD9; --plum: #8C5BC4;
  --cream: #F5EFE2; --charcoal: #2B2D3A; --stone: #8A8FA3; --sky: #9FD4F0;
  --bg: #0f1330; --bg2: #171c3d; --panel: #1b2148; --line: #2b3360;
  --text: #EEF0F7; --muted: #A9AFC6;
  --font: 'Noto Sans KR', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Jua', var(--font);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  line-height: 1.65; -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(circle at 20% 0%, rgba(46,111,217,.18), transparent 40%),
    radial-gradient(circle at 90% 30%, rgba(140,91,196,.14), transparent 40%);
}
a { color: var(--sky); }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: .01em; margin: 0 0 .4em; }
h2 { font-size: clamp(26px, 4vw, 38px); }
h3 { font-size: 20px; color: var(--mustard); }
p { margin: 0 0 1em; }
code { background: #0b0e22; padding: .1em .4em; border-radius: 4px; font-size: .92em; color: var(--sky); }

/* ── 노브 패턴 (배경 장식) ── */
.knobs {
  background-image: radial-gradient(rgba(255,255,255,.05) 2px, transparent 2.5px);
  background-size: 22px 22px;
}

/* ── 상단 내비 ── */
.nav {
  position: sticky; top: 0; z-index: 50; backdrop-filter: blur(10px);
  background: rgba(15,19,48,.82); border-bottom: 1px solid var(--line);
}
.nav-in { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.nav-logo { font-family: var(--display); font-size: 20px; color: var(--cream); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.nav-logo .b { display: inline-grid; grid-template-columns: repeat(2, 8px); gap: 2px; }
.nav-logo .b i { width: 8px; height: 8px; border-radius: 2px; }
.nav-links { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 13px; padding: 6px 10px; border-radius: 8px; }
.nav-links a:hover { background: var(--panel); color: var(--text); }
.nav-links a.cta { background: var(--tomato); color: #fff; font-weight: 700; }
@media (max-width: 720px) { .nav-links a:not(.cta) { display: none; } }

/* ── 히어로 ── */
.hero { position: relative; overflow: hidden; padding: 56px 16px 40px; }
.hero-bg { position: absolute; inset: 0; z-index: 0; opacity: .35; object-fit: cover; width: 100%; height: 100%; filter: saturate(1.1); mask-image: linear-gradient(to bottom, #000 30%, transparent); -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent); }
.hero-in { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: 1.1fr .9fr; gap: 32px; align-items: center; }
@media (max-width: 860px) { .hero-in { grid-template-columns: 1fr; } }
.hero-logo { width: min(360px, 80%); filter: drop-shadow(0 12px 30px rgba(0,0,0,.5)); }
.hero h1 { font-size: clamp(34px, 6vw, 60px); line-height: 1.1; margin: 16px 0 10px; }
.hero h1 .stack span { display: inline-block; padding: 0 .18em; border-radius: .18em; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.hero .lead { font-size: 18px; color: var(--muted); max-width: 520px; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 22px; }
.badge { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: rgba(27,33,72,.7); color: var(--muted); }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { display: inline-block; padding: 12px 20px; border-radius: 12px; font-weight: 700; text-decoration: none; border: 0; cursor: pointer; font-family: var(--font); font-size: 15px; transition: transform .1s; }
.btn:active { transform: translateY(2px); }
.btn-primary { background: var(--tomato); color: #fff; box-shadow: 0 5px 0 #a93b1c; }
.btn-ghost { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
.hero-visual { position: relative; }
.hero-visual img { border-radius: 18px; box-shadow: 0 24px 60px rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.08); }
.hero-visual .fallback { aspect-ratio: 3/2; border-radius: 18px; background: linear-gradient(135deg, var(--cobalt), var(--plum)); display: grid; place-items: center; color: #fff; font-family: var(--display); font-size: 22px; }

/* ── 섹션 공통 ── */
.section { padding: 64px 16px; }
.section.alt { background: rgba(23,28,61,.55); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.wrap { max-width: 1120px; margin: 0 auto; }
.eyebrow { font-size: 12px; letter-spacing: .18em; color: var(--mustard); text-transform: uppercase; font-weight: 700; margin-bottom: 8px; }
.sub { color: var(--muted); max-width: 720px; font-size: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } .grid4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .grid3 { grid-template-columns: 1fr; } .grid4 { grid-template-columns: 1fr; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; position: relative; overflow: hidden; }
.card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c, var(--cobalt)); }
.card h3 { margin-top: 0; }
.card .ico { font-size: 28px; margin-bottom: 6px; }
.card ul { margin: 0; padding-left: 18px; color: var(--muted); }
.card li { margin: 3px 0; }

.shot { border-radius: 22px; overflow: hidden; border: 6px solid #22284f; box-shadow: 0 24px 60px rgba(0,0,0,.5); background: #0b0e22; }
.shot img { width: 100%; }
.shot .fallback { aspect-ratio: 2/3; display: grid; place-items: center; color: var(--muted); }
.caption { font-size: 13px; color: var(--stone); text-align: center; margin-top: 10px; }

/* ── 코어 루프 ── */
.loop { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; align-items: stretch; margin-top: 24px; }
@media (max-width: 800px) { .loop { grid-template-columns: 1fr 1fr; } }
.loop .step { padding: 18px 16px; border: 1px solid var(--line); background: var(--panel); position: relative; }
.loop .step:first-child { border-radius: 14px 0 0 14px; }
.loop .step:last-child { border-radius: 0 14px 14px 0; }
.loop .n { font-family: var(--display); font-size: 30px; color: var(--c); line-height: 1; }
.loop .step b { display: block; font-size: 17px; margin: 6px 0 4px; }
.loop .step small { color: var(--muted); }
.loop .step::after { content: '▶'; position: absolute; right: -9px; top: 50%; transform: translateY(-50%); color: var(--mustard); font-size: 12px; z-index: 1; }
.loop .step:last-child::after { content: '↺'; right: 8px; top: 8px; transform: none; font-size: 18px; }

/* ── 층 상태 머신 ── */
.fsm { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0; font-size: 14px; }
.fsm .st { padding: 8px 14px; border-radius: 10px; background: #0b0e22; border: 1px solid var(--line); font-weight: 700; }
.fsm .ar { color: var(--stone); font-size: 12px; }

/* ── 팔레트 ── */
.pal { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
@media (max-width: 600px) { .pal { grid-template-columns: repeat(3, 1fr); } }
.sw { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #0b0e22; }
.sw .c { height: 54px; position: relative; }
.sw .c::before { content: ''; position: absolute; left: 50%; top: 10px; width: 26px; height: 12px; margin-left: -13px; border-radius: 4px; background: rgba(255,255,255,.28); }
.sw .c::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 10px; background: rgba(0,0,0,.25); }
.sw .t { padding: 6px 10px; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.sw .t b { color: var(--text); }

/* ── 브릭 vs 브릭 비교 ── */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.compare .box { background: #0b0e22; border: 1px dashed var(--line); border-radius: 12px; padding: 14px; text-align: center; }
.compare .box.ok { border-color: var(--clover); }
.compare .box.no { border-color: var(--tomato); opacity: .8; }
.compare svg { width: 100%; height: auto; max-width: 220px; }
.compare .lbl { font-size: 13px; margin-top: 8px; }

/* ── 재화 표 ── */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--mustard); font-weight: 700; }
td:first-child { font-weight: 700; white-space: nowrap; }

/* ── 게임 섹션 ── */
.game-area { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 32px; align-items: start; }
@media (max-width: 860px) { .game-area { grid-template-columns: 1fr; justify-items: center; } }
.phone { position: relative; width: 100%; max-width: 380px; aspect-ratio: 9/16; border-radius: 28px; background: #0b0e22; padding: 10px; border: 2px solid #2b3360; box-shadow: 0 30px 80px rgba(0,0,0,.6), inset 0 0 0 1px rgba(255,255,255,.05); }
.phone-in { position: relative; width: 100%; height: 100%; border-radius: 20px; overflow: hidden; display: grid; place-items: center; }
#pbh-game { display: block; }
.pbh-overlay { position: absolute; inset: 0; display: none; place-items: center; text-align: center; padding: 24px; background: rgba(10,12,32,.82); backdrop-filter: blur(4px); }
.pbh-overlay.show { display: grid; }
.pbh-overlay > * { align-self: center; }
.pbh-ov-title { font-family: var(--display); font-size: 34px; color: var(--mustard); }
.pbh-ov-msg { color: var(--text); white-space: pre-line; margin: 8px 0 18px; font-size: 14px; line-height: 1.6; }
.pbh-ov-btn { padding: 12px 26px; border-radius: 12px; border: 0; background: var(--tomato); color: #fff; font-weight: 700; font-size: 16px; cursor: pointer; box-shadow: 0 5px 0 #a93b1c; font-family: var(--font); }
.howto li { margin: 6px 0; color: var(--muted); }
.howto b { color: var(--text); }

/* ── 원작 iframe ── */
.orig-box { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: grid; grid-template-columns: 1fr minmax(280px, 360px); gap: 22px; align-items: start; }
@media (max-width: 860px) { .orig-box { grid-template-columns: 1fr; } }
.orig-frame { width: 100%; max-width: 360px; aspect-ratio: 9/16; border-radius: 20px; overflow: hidden; background: #000; border: 2px solid var(--line); display: grid; place-items: center; margin: 0 auto; }
.orig-frame iframe { width: 100%; height: 100%; border: 0; }

/* ── 로드맵 ── */
.timeline { display: grid; gap: 10px; }
.ms { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: start; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.ms .tag { font-family: var(--display); font-size: 22px; color: var(--c); }
.ms b { display: block; }
.ms small { color: var(--muted); }

/* ── 미결 사항 ── */
.open li { margin: 8px 0; }
.open b { color: var(--clover); }

footer { padding: 40px 16px 60px; color: var(--stone); font-size: 13px; text-align: center; border-top: 1px solid var(--line); }
footer a { color: var(--muted); }

/* ── 히어로 안 게임 ── */
.hero-in { grid-template-columns: 1fr minmax(300px, 380px); }
.hero-visual { justify-self: center; width: 100%; max-width: 380px; }
.hero-hint { margin-top: 18px; font-size: 14px; color: var(--muted); }
@media (max-width: 860px) { .hero-in { grid-template-columns: 1fr; } .hero-hint { display: none; } }
.game-area { grid-template-columns: 1.1fr .9fr; }
@media (max-width: 860px) { .game-area { grid-template-columns: 1fr; } }

/* ── 모바일 가로 넘침 방지 ── */
body { overflow-x: hidden; }
.hero-in > *, .grid2 > *, .game-area > *, .orig-box > * { min-width: 0; }
#pbh-game { max-width: 100%; height: auto; }
.phone { max-width: min(380px, 100%); }

/* ── 2분할 데모 ── */
.hero-in { grid-template-columns: 1fr; }
.hero-text { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.hero-text .hero-logo { width: 260px; }
@media (max-width: 760px) { .hero-text { grid-template-columns: 1fr; } .hero-text .hero-logo { width: min(300px, 80%); } }
.demo { position: relative; z-index: 1; max-width: 1120px; margin: 34px auto 0; display: grid; grid-template-columns: minmax(280px, 360px) minmax(150px, 200px) minmax(280px, 360px); gap: 18px; justify-content: center; align-items: start; }
.demo-col { display: grid; gap: 8px; justify-items: center; }
.demo-label { font-family: var(--display); font-size: 17px; color: var(--cream); }
.demo-link { align-self: center; display: grid; gap: 10px; text-align: center; padding: 16px 10px; background: rgba(27,33,72,.75); border: 1px solid var(--line); border-radius: 16px; font-size: 13px; color: var(--muted); }
.demo-link .dl-step b { display: block; font-family: var(--display); font-size: 20px; color: var(--mustard); }
.demo-link .dl-arrow { font-size: 20px; color: var(--tomato); }
.demo-link .dl-reset { font-size: 12px; padding: 8px 10px; margin-top: 6px; }
@media (max-width: 900px) { .demo { grid-template-columns: 1fr; } .demo-link { order: 2; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; } .demo-link .dl-reset { grid-column: 1 / -1; } .demo-col:last-child { order: 3; } }
.hero .caption { position: relative; z-index: 1; margin-top: 14px; }

/* ── 레벨 메뉴 ── */
.pbh-overlay { overflow-y: auto; align-content: center; }
.pbh-ov-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pbh-ov-btn.ghost { background: rgba(255,255,255,.12); box-shadow: none; border: 1px solid rgba(255,255,255,.25); }
.pbh-lv-label { margin-top: 16px; font-size: 12px; letter-spacing: .12em; color: var(--muted); }
.pbh-lv-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 8px; width: 100%; max-width: 300px; }
.pbh-lv { border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: var(--text); border-radius: 10px; padding: 6px 2px; cursor: pointer; display: grid; gap: 2px; font-family: var(--font); }
.pbh-lv b { font-size: 16px; } .pbh-lv small { font-size: 10px; color: var(--muted); }
.pbh-lv.done { border-color: var(--clover); } .pbh-lv.cur { border-color: var(--mustard); background: rgba(242,178,51,.18); }
.pbh-lv:hover { background: rgba(255,255,255,.18); }

/* ── 데모 폰 크기: 실제 폰에 가깝게 (화면 높이 기준) ── */
.demo { max-width: 1480px; grid-template-columns: auto minmax(160px, 220px) auto; gap: 24px; }
.demo .phone { height: min(88vh, 940px); width: auto; aspect-ratio: 9 / 16; max-width: none; padding: 12px; border-radius: 34px; }
.demo .phone-in { border-radius: 24px; }
.demo-label { font-size: 19px; }
@media (max-width: 1100px) { .demo { grid-template-columns: 1fr; } .demo .phone { height: min(82vh, 820px); max-width: 100%; } }
@media (max-width: 600px) { .demo .phone { height: auto; width: 100%; } }

/* ── 오디오 설정 ── */
.nav-links a.audio-btn { font-size: 16px; padding: 4px 8px; display: inline-block !important; }
.pbh-audio-panel { display: none; position: absolute; right: 0; top: 40px; width: 240px; padding: 12px; background: #1b2148; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.5); z-index: 60; }
.pbh-audio-panel.show { display: grid; gap: 8px; }
.pbh-audio-panel label { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.pbh-audio-panel input[type=range] { width: 100%; accent-color: var(--mustard); }
.pbh-audio-panel .pbh-mute { background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 6px; font-size: 12px; cursor: pointer; font-family: var(--font); }
.pbh-audio-panel small { color: var(--stone); font-size: 10px; }

/* ── 가운데 패널 보유 코인 ── */
.dl-wallet { position: relative; display: grid; justify-items: center; gap: 2px; padding: 10px 6px 12px; margin-bottom: 4px; border-radius: 12px; background: rgba(255,194,26,.10); border: 1px solid rgba(255,194,26,.35); }
.dl-wallet b { font-family: var(--display); font-size: 34px; color: #FFD166; line-height: 1; }
.dl-wallet small { font-size: 11px; color: var(--muted); }
.dl-coin { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #FFF3C4 0 14%, #FFC21A 16% 62%, #E0A010 64%); box-shadow: 0 3px 0 #B87E15; }
.dl-wallet.up { animation: dlUp .45s ease; } .dl-wallet.down { animation: dlDown .45s ease; }
@keyframes dlUp { 40% { transform: scale(1.15); } } @keyframes dlDown { 30% { transform: translateX(-4px); } 60% { transform: translateX(4px); } }
.dl-delta { position: absolute; right: 8px; top: 6px; font-weight: 700; font-size: 15px; animation: dlFloat 1.1s ease forwards; }
.dl-delta.up { color: #7CFC9A; } .dl-delta.down { color: #FF8A7A; }
@keyframes dlFloat { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-26px); } }
@media (max-width: 1100px) { .dl-wallet { grid-column: 1 / -1; } }

/* ── 사업 로드맵 ── */
.ms .now { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--clover); color: #0f1330; font-size: 11px; vertical-align: middle; }
.gantt { display: grid; gap: 8px; --months: 24; }
.g-row { display: grid; grid-template-columns: 76px 1fr; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.g-row i { display: block; height: 14px; border-radius: 7px; background: var(--c); margin-left: calc(var(--s) / var(--months) * 100%); width: calc(var(--w) / var(--months) * 100%); box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.g-axis { display: flex; justify-content: space-between; margin-left: 84px; font-size: 10px; color: var(--stone); border-top: 1px solid var(--line); padding-top: 4px; }

/* ── 가이드 대사창 ── */
.pbh-guide { position: absolute; left: 8px; right: 8px; bottom: 10px; z-index: 5; display: none; gap: 10px; align-items: flex-end; padding: 10px 12px 12px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,251,240,.97), rgba(255,243,214,.97)); border: 3px solid #FFC21A; box-shadow: 0 10px 30px rgba(0,0,0,.45); color: #2B2D3A; cursor: pointer; }
.pbh-guide.show { display: flex; animation: pgIn .28s ease; }
.pbh-guide.top { top: 42px; bottom: auto; }
@keyframes pgIn { from { transform: translateY(14px); opacity: 0; } }
.pg-face { flex: 0 0 72px; height: 72px; margin-top: -26px; border-radius: 14px; background: radial-gradient(circle at 50% 35%, #9FE3D2, #3FB8A0); border: 3px solid #fff; box-shadow: 0 4px 10px rgba(0,0,0,.25); overflow: hidden; display: grid; place-items: end center; }
.pg-face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; }
.pg-face.noimg::after { content: '🙂'; font-size: 42px; align-self: center; }
.pg-body { flex: 1; min-width: 0; }
.pg-name { font-family: var(--display); font-size: 14px; color: #E4572E; }
.pg-text { font-size: 13.5px; line-height: 1.55; min-height: 42px; font-weight: 700; word-break: keep-all; }
.pg-next { display: none; text-align: right; font-size: 11px; color: #B87E15; margin-top: 2px; animation: pgBlink 1s infinite; }
.pbh-guide.block .pg-next { display: block; }
@keyframes pgBlink { 50% { opacity: .35; } }
