:root {
  color-scheme: light;
  --paper: #f3f1ea;
  --paper-deep: #e9e6db;
  --ink: #171918;
  --muted: #666963;
  --coral: #bd3d2e;
  --on-coral: #ffffff;
  --lime: #b8e84e;
  --blue: #67c7e8;
  --yellow: #f5ca52;
  --line: rgba(23, 25, 24, 0.16);
  --panel: #faf9f4;
  --soft-shadow: rgba(23, 25, 24, 0.16);
  --header-h: 74px;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --paper: #121513;
  --paper-deep: #1a1f1c;
  --ink: #f4f3ec;
  --muted: #aeb5af;
  --line: rgba(244, 243, 236, 0.17);
  --panel: #191e1b;
  --soft-shadow: rgba(0, 0, 0, 0.34);
  --coral: #ff7b66;
  --on-coral: #171918;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "Pretendard", "Noto Sans KR", "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  transition: background-color 280ms ease, color 280ms ease;
}
button, select { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-header {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-h);
  padding: 0 clamp(20px, 4vw, 64px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 900; letter-spacing: 0.12em; }
.brand img { width: 42px; height: 42px; border-radius: 9px; object-fit: contain; }
.site-header nav { display: flex; gap: 32px; font-size: 13px; font-weight: 700; }
.site-header nav a { position: relative; }
.site-header nav a::after { content: ""; position: absolute; left: 0; bottom: -8px; width: 100%; height: 2px; background: var(--coral); transform: scaleX(0); transition: transform 180ms ease; }
.site-header nav a:hover::after, .site-header nav a.is-active::after { transform: scaleX(1); }
.site-header nav a.admin-entry { color: var(--coral); }
.site-header nav a.admin-entry::before { content: "↗"; margin-right: 5px; font-size: 11px; }
.header-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.theme-toggle { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: 6px; background: transparent; font-size: 18px; cursor: pointer; transition: transform 180ms ease, background-color 180ms ease, color 180ms ease; }
.theme-toggle:hover { transform: translateY(-2px); background: var(--ink); color: var(--paper); }
.language-picker select { width: 96px; height: 36px; border: 1px solid var(--ink); border-radius: 6px; background: transparent; color: var(--ink); padding: 0 22px 0 9px; font-size: 12px; font-weight: 800; cursor: pointer; }

.play-hero {
  position: relative;
  min-height: min(1020px, 100svh);
  padding: calc(var(--header-h) + 22px) clamp(20px, 5vw, 76px) 48px;
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(520px, 1.35fr);
  align-items: center;
  gap: clamp(30px, 5vw, 88px);
  overflow: hidden;
  background:
    linear-gradient(rgba(23,25,24,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23,25,24,.045) 1px, transparent 1px),
    var(--paper);
  background-size: 42px 42px;
}
.play-hero::before {
  content: "";
  position: absolute;
  width: 28vw;
  height: 28vw;
  min-width: 260px;
  min-height: 260px;
  left: -8vw;
  bottom: -10vw;
  background: var(--scene-accent, var(--lime));
  clip-path: polygon(0 44%, 61% 44%, 61% 18%, 100% 50%, 61% 82%, 61% 56%, 0 56%);
  opacity: .9;
  transition: background-color 300ms ease, transform 500ms cubic-bezier(.2,.8,.2,1);
}
.hero-copy { position: relative; z-index: 2; align-self: center; }
.eyebrow, .section-kicker { color: var(--coral); font-size: 12px; line-height: 1.3; font-weight: 900; text-transform: uppercase; letter-spacing: .14em; }
.hero-copy h1 { margin: 12px 0 16px; font-size: 92px; line-height: .82; text-transform: uppercase; }
.hero-copy h1 span { display: block; white-space: nowrap; }
.hero-subtitle { max-width: 390px; margin: 0; color: var(--muted); font-size: 19px; line-height: 1.55; }
.hero-actions { display: flex; align-items: center; gap: 12px; margin-top: 30px; }
.primary-action, .secondary-action { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 16px; border: 1px solid var(--ink); border-radius: 6px; padding: 0 18px; font-size: 12px; font-weight: 900; text-transform: uppercase; transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease; }
.primary-action { background: var(--ink); color: var(--paper); }
.primary-action b { font-size: 16px; }
.secondary-action { background: color-mix(in srgb, var(--paper) 70%, transparent); }
.primary-action:hover, .secondary-action:hover { transform: translateY(-3px); box-shadow: 0 8px 0 var(--soft-shadow); }

.game-shell {
  position: relative;
  z-index: 2;
  min-width: 0;
  justify-self: stretch;
  width: 100%;
  max-width: 860px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 32px 72px var(--soft-shadow), 12px 12px 0 var(--ink);
  overflow: hidden;
  transition: background-color 280ms ease, box-shadow 280ms ease, transform 280ms ease;
}
.game-shell:hover { transform: translateY(-4px); }
.game-toolbar { height: 58px; padding: 0 16px 0 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--ink); }
.level-readout { display: flex; align-items: baseline; gap: 8px; text-transform: uppercase; font-size: 11px; font-weight: 800; }
.level-readout strong { font-size: 18px; }
.demo-controls { display: flex; align-items: center; gap: 9px; }
.loop-badge { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.loop-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 4px color-mix(in srgb, var(--coral) 16%, transparent); animation: loop-pulse 1.8s ease-in-out infinite; }
.video-toggle { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: 6px; background: transparent; cursor: pointer; transition: background-color 160ms ease, color 160ms ease, transform 160ms ease; }
.video-toggle:hover { transform: translateY(-2px); background: var(--ink); color: var(--paper); }
.video-toggle span { display: block; font-size: 12px; line-height: 1; }
.board-wrap { position: relative; width: 100%; aspect-ratio: 9 / 6.6; min-height: 390px; overflow: hidden; }
#game-demo { display: block; width: 100%; height: 100%; object-fit: cover; background: #faf9f4; }
.play-again { margin-top: 10px; border: 2px solid var(--ink); background: var(--coral); color: var(--on-coral); padding: 13px 22px; font-weight: 900; text-transform: uppercase; cursor: pointer; box-shadow: 5px 5px 0 var(--ink); }
.game-instruction { min-height: 44px; margin: 0; display: grid; place-items: center; padding: 10px 18px; border-top: 1px solid var(--ink); color: var(--muted); text-align: center; font-size: 12px; }
.scroll-cue { position: absolute; z-index: 3; left: clamp(20px, 5vw, 76px); bottom: 34px; display: flex; align-items: center; gap: 12px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.scroll-cue b { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--ink); border-radius: 50%; transition: transform 180ms ease, background-color 180ms ease; }
.scroll-cue:hover b { transform: translateY(3px); background: var(--ink); color: var(--paper); }

.manifesto { position: relative; padding: 110px clamp(22px, 8vw, 132px); border-top: 2px solid var(--ink); background: var(--ink); color: var(--paper); }
.manifesto .section-kicker { color: var(--lime); }
.manifesto h2 { margin: 24px 0 80px; max-width: 1060px; font-size: 72px; line-height: 1.02; }
.stat-line { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid rgba(255,255,255,.28); }
.stat-line div { padding: 34px 24px 4px 0; display: flex; flex-direction: column; gap: 6px; border-right: 1px solid rgba(255,255,255,.28); }
.stat-line div + div { padding-left: 34px; }
.stat-line div:last-child { border-right: 0; }
.stat-line strong { color: var(--yellow); font-size: 56px; }
.stat-line span { color: #aeadab; font-size: 13px; text-transform: uppercase; }

.showcase { min-height: 820px; padding: 90px clamp(22px, 8vw, 132px); display: grid; grid-template-columns: .8fr 1.2fr; align-items: center; gap: clamp(30px, 8vw, 130px); overflow: hidden; }
.showcase-copy h2, .modes h2, .download h2 { margin: 14px 0 22px; font-size: 64px; line-height: .98; text-transform: uppercase; }
.showcase-copy p, .modes p, .download p { max-width: 520px; color: var(--muted); font-size: 17px; line-height: 1.65; }
.phone-stage { position: relative; height: 690px; display: grid; grid-template-rows: auto auto 1fr; gap: 8px; }
.screen-tabs { justify-self: center; display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-deep); }
.screen-tab { min-width: 88px; height: 34px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; cursor: pointer; transition: background-color 180ms ease, color 180ms ease, transform 180ms ease; }
.screen-tab:hover { color: var(--ink); }
.screen-tab.is-active { background: var(--ink); color: var(--paper); }
.screen-note { min-height: 17px; margin: 0; color: var(--muted); text-align: center; font-size: 11px; line-height: 1.5; }
.phone-stack { position: relative; min-height: 0; perspective: 1200px; }
.phone { position: absolute; z-index: 1; top: 14px; height: 590px; width: auto; border: 7px solid var(--ink); border-radius: 26px; box-shadow: 0 24px 48px var(--soft-shadow); opacity: .82; transition: opacity 320ms ease, transform 480ms cubic-bezier(.2,.8,.2,1), filter 320ms ease; pointer-events: none; filter: saturate(.9); }
#shot-home { left: 39%; transform: translateX(-50%) translateY(22px) rotate(-6deg) scale(.9); }
#shot-daily { left: 61%; transform: translateX(-50%) translateY(22px) rotate(6deg) scale(.9); }
.phone.is-active { z-index: 2; opacity: 1; filter: saturate(1); pointer-events: auto; }
#shot-home.is-active { transform: translateX(-50%) translateY(0) rotate(-2deg) scale(1); }
#shot-daily.is-active { transform: translateX(-50%) translateY(0) rotate(2deg) scale(1); }
.phone-stack::before, .phone-stack::after { content: ""; position: absolute; z-index: 0; top: 70px; width: 36%; height: 70%; border: 1px solid var(--line); background: var(--paper-deep); opacity: .5; }
.phone-stack::before { left: 1%; transform: rotate(-5deg); }
.phone-stack::after { right: 1%; transform: rotate(5deg); }

.modes { border-top: 2px solid var(--ink); background: var(--blue); overflow: hidden; }
.mode-strip { height: 64px; display: flex; align-items: center; gap: 28px; border-bottom: 2px solid var(--ink); white-space: nowrap; overflow: hidden; font-size: 14px; font-weight: 900; }
.mode-strip span { flex: 0 0 auto; }
.mode-strip i { flex: 0 0 28px; height: 12px; background: var(--ink); clip-path: polygon(0 36%, 61% 36%, 61% 0, 100% 50%, 61% 100%, 61% 64%, 0 64%); }
.mode-content { min-height: 760px; padding: 88px clamp(22px, 9vw, 150px); display: grid; grid-template-columns: minmax(260px, 460px) 1fr; align-items: center; gap: clamp(40px, 9vw, 150px); }
.mode-content img { justify-self: center; height: 610px; width: auto; border: 8px solid var(--ink); border-radius: 28px; transform: rotate(-3deg); box-shadow: 16px 18px 0 rgba(23,25,24,.18); }
.modes .section-kicker { color: var(--ink); }
.modes p { color: rgba(23,25,24,.72); }

.download { padding: 100px clamp(22px, 8vw, 132px); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 42px; border-top: 2px solid var(--ink); }
.download > img { border: 2px solid var(--ink); border-radius: 28px; box-shadow: 8px 8px 0 var(--lime); }
.download h2 { max-width: 800px; }
.play-again { white-space: nowrap; transition: transform 180ms ease, box-shadow 180ms ease; }
.play-again:hover { transform: translateY(-3px); box-shadow: 8px 10px 0 var(--ink); }

footer { min-height: 112px; padding: 28px clamp(22px, 5vw, 76px); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-top: 2px solid var(--ink); background: var(--paper-deep); font-size: 12px; }
footer p { color: var(--muted); }
footer nav { justify-self: end; display: flex; gap: 22px; }
footer nav a:hover { text-decoration: underline; }

body[data-theme="dark"] .manifesto { background: #090c0a; color: #f4f3ec; border-top-color: rgba(244,243,236,.3); }
body[data-theme="dark"] .manifesto h2 { color: #f4f3ec; }
body[data-theme="dark"] .manifesto .stat-line { border-color: rgba(255,255,255,.24); }
body[data-theme="dark"] .manifesto .stat-line div { border-color: rgba(255,255,255,.24); }
body[data-theme="dark"] .manifesto .stat-line span { color: #aeadab; }

[data-reveal] { opacity: 0; transform: translateY(34px); transition: opacity 600ms ease, transform 600ms cubic-bezier(.2,.8,.2,1); }
[data-reveal].is-visible { opacity: 1; transform: translateY(0); }

@keyframes loop-pulse {
  0%, 100% { opacity: .6; transform: scale(.82); }
  50% { opacity: 1; transform: scale(1); }
}

@keyframes hero-enter {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero-copy > * { animation: hero-enter 560ms both; }
.hero-copy > :nth-child(2) { animation-delay: 70ms; }
.hero-copy > :nth-child(3) { animation-delay: 140ms; }
.hero-copy > :nth-child(4) { animation-delay: 210ms; }
.game-shell { animation: hero-enter 650ms 120ms both; }

@media (max-width: 900px) {
  :root { --header-h: 62px; }
  .site-header { grid-template-columns: 1fr auto; }
  .site-header nav { display: none; }
  .brand { font-size: 11px; }
  .brand img { width: 36px; height: 36px; }
  .play-hero { min-height: auto; padding-top: calc(var(--header-h) + 38px); padding-bottom: 84px; grid-template-columns: 1fr; gap: 34px; }
  .hero-copy h1 { font-size: 76px; }
  .manifesto h2 { font-size: 56px; }
  .showcase-copy h2, .modes h2, .download h2 { font-size: 52px; }
  .game-shell { box-shadow: 9px 9px 0 var(--ink); }
  .board-wrap { min-height: 310px; }
  .scroll-cue { display: none; }
  .manifesto { padding-top: 76px; padding-bottom: 76px; }
  .manifesto h2 { margin-bottom: 56px; }
  .showcase { grid-template-columns: 1fr; padding-top: 72px; }
  .phone-stage { height: 620px; }
  .phone { height: 530px; }
  #shot-home { left: 42%; }
  #shot-daily { left: 58%; }
  .mode-content { grid-template-columns: 1fr; }
  .mode-content img { height: 540px; }
  .download { grid-template-columns: auto 1fr; }
  .download .play-again { grid-column: 1 / -1; justify-self: start; }
}

@media (max-width: 560px) {
  .play-hero { padding-left: 14px; padding-right: 14px; }
  .hero-copy { padding: 0 8px; }
  .hero-copy h1 { font-size: 58px; }
  .hero-subtitle { font-size: 15px; }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .primary-action, .secondary-action { width: 100%; }
  .game-shell { width: calc(100% - 2px); }
  .game-toolbar { height: 52px; padding-left: 12px; padding-right: 8px; }
  .level-readout span { display: none; }
  .level-readout strong { font-size: 20px; }
  .board-wrap { min-height: 280px; }
  .game-instruction { font-size: 11px; }
  .manifesto { padding-left: 22px; padding-right: 22px; }
  .manifesto h2 { font-size: 36px; }
  .stat-line { grid-template-columns: 1fr; }
  .stat-line div, .stat-line div + div { padding: 22px 0; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.28); }
  .showcase { padding-left: 22px; padding-right: 22px; }
  .phone-stage { height: 540px; margin: 0 -12px; }
  .phone { height: 455px; border-width: 6px; border-radius: 21px; }
  #shot-home { left: 43%; }
  #shot-daily { left: 57%; }
  .screen-tab { min-width: 78px; }
  .mode-content { padding: 68px 22px; }
  .mode-content img { height: 470px; border-width: 6px; border-radius: 21px; }
  .download { grid-template-columns: 1fr; padding: 74px 22px; }
  .download > img { width: 110px; height: 110px; }
  footer { grid-template-columns: 1fr; gap: 18px; }
  footer p { margin: 0; }
  footer nav { justify-self: start; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  [data-reveal] { opacity: 1; transform: none; }
}
