:root {
  color-scheme: light;
  --paper: #f2eee4;
  --paper-deep: #e7e0d2;
  --ink: #171713;
  --muted: #66645d;
  --acid: #c5352b;
  --lime: #c8ff43;
  --line: rgba(23, 23, 19, 0.24);
  --header-height: 78px;
  font-family: Inter, "Helvetica Neue", Arial, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100svh; background: var(--paper); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.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;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 12px 18px;
  background: var(--ink);
  color: white;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 clamp(18px, 4vw, 64px);
  border-bottom: 1px solid var(--ink);
  background: rgba(242, 238, 228, 0.94);
}

.brand {
  display: inline-flex;
  gap: 4px;
  align-items: baseline;
  color: var(--ink);
  font-size: clamp(1rem, 1.8vw, 1.45rem);
  font-weight: 950;
  letter-spacing: -0.07em;
  text-decoration: none;
}
.brand-slash { color: var(--acid); }
.header-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.12em;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #33c767; box-shadow: 0 0 0 4px rgba(51, 199, 103, 0.12); }

.hero {
  position: relative;
  min-height: calc(100svh - var(--header-height));
  isolation: isolate;
  overflow: hidden;
  background: #1c2b3a;
  color: white;
}
.hero-image {
  position: absolute;
  z-index: -3;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 34%;
  filter: saturate(0.78) contrast(1.07);
  transform: scale(1.035);
  animation: hero-breathe 14s ease-in-out infinite alternate;
}
.hero-scrim {
  position: absolute;
  z-index: -2;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(10, 14, 19, 0.94) 0%, rgba(10, 14, 19, 0.64) 39%, rgba(10, 14, 19, 0.08) 74%),
    linear-gradient(0deg, rgba(10, 14, 19, 0.45), transparent 45%);
}
.hero::after {
  content: "PLAY";
  position: absolute;
  z-index: -1;
  right: -0.04em;
  bottom: -0.18em;
  color: rgba(255, 255, 255, 0.1);
  font-size: clamp(9rem, 26vw, 28rem);
  font-weight: 950;
  letter-spacing: -0.09em;
  line-height: 1;
}
.hero-copy {
  width: min(720px, 88vw);
  padding: clamp(92px, 16vh, 180px) 0 72px clamp(22px, 7vw, 110px);
  animation: hero-enter 700ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.eyebrow, .section-number {
  margin: 0 0 20px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.hero .eyebrow { color: var(--lime); }
.hero h1 {
  margin: 0;
  max-width: 700px;
  font-size: clamp(3.4rem, 8vw, 8.6rem);
  font-weight: 950;
  letter-spacing: -0.08em;
  line-height: 0.86;
  text-wrap: balance;
}
.hero-description {
  max-width: 430px;
  margin: 28px 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1.55;
}
.hero-index {
  position: absolute;
  right: clamp(20px, 4vw, 64px);
  top: clamp(24px, 5vh, 56px);
  font-size: clamp(2rem, 4vw, 4.8rem);
  font-weight: 950;
  letter-spacing: -0.08em;
}
.hero-index span { font-size: 0.3em; opacity: 0.55; letter-spacing: 0; }

.button {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: 0 22px;
  border: 1px solid currentColor;
  border-radius: 0;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}
.button:hover { transform: translateY(-3px); }
.button-primary { border-color: var(--acid); background: var(--acid); color: white; }
.button-primary:hover { background: white; color: var(--ink); }
.button-secondary { background: transparent; color: currentColor; }

.catalog-section { min-height: 100svh; padding: clamp(72px, 8vw, 120px) clamp(18px, 4vw, 64px); }
.catalog-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 48px;
  align-items: end;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--ink);
}
.catalog-head h2, .manifest-story h2, .detail-lower h2 {
  margin: 0;
  font-size: clamp(2.8rem, 6.6vw, 7rem);
  font-weight: 950;
  letter-spacing: -0.075em;
  line-height: 0.9;
}
.catalog-note { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.6; }

.catalog-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 30px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}
.search-box {
  width: min(420px, 100%);
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--ink);
}
.search-box > span { font-size: 1.4rem; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 0.92rem; }
.search-box input::placeholder { color: #8b887f; }
.search-box input::-webkit-search-cancel-button { filter: grayscale(1) contrast(2); opacity: 0.65; }
.genre-filters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.filter-button {
  flex: 0 0 auto;
  white-space: nowrap;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 0.76rem;
  font-weight: 850;
  cursor: pointer;
}
.filter-button:hover, .filter-button:focus-visible { border-color: var(--ink); }
.filter-button.is-active { background: var(--ink); color: white; }

.game-grid { border-bottom: 1px solid var(--ink); }
.game-item { border-top: 1px solid var(--ink); overflow: hidden; }
.game-item:first-child { border-top: 0; }
.game-link {
  width: 100%;
  min-height: 210px;
  display: grid;
  grid-template-columns: 68px minmax(190px, 30vw) minmax(0, 1fr) 70px;
  align-items: center;
  gap: clamp(18px, 3vw, 50px);
  padding: 24px 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.game-order { align-self: start; padding-top: 4px; font-size: 0.72rem; font-weight: 900; }
.game-media { height: 170px; overflow: hidden; background: var(--paper-deep); }
.game-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms cubic-bezier(0.2, 0.8, 0.2, 1), filter 300ms ease; }
.game-merge-restaurant .game-media img, .game-mystic-candy-shop .game-media img { object-position: center 16%; }
.game-link:hover .game-media img, .game-link:focus-visible .game-media img { transform: scale(1.065); filter: saturate(1.08); }
.game-copy { display: flex; flex-direction: column; gap: 9px; }
.game-kicker { color: var(--muted); font-size: 0.68rem; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; }
.game-copy strong { font-size: clamp(1.8rem, 4vw, 4.6rem); font-weight: 950; letter-spacing: -0.065em; line-height: 0.94; }
.game-copy > span:last-child { max-width: 520px; color: var(--muted); font-size: 0.88rem; line-height: 1.5; }
.game-arrow { display: grid; place-items: center; width: 56px; height: 56px; border: 1px solid var(--ink); border-radius: 50%; font-size: 1.3rem; transition: background 180ms ease, color 180ms ease, transform 180ms ease; }
.game-link:hover .game-arrow { background: var(--acid); color: white; transform: rotate(45deg); }
.empty-state { padding: 90px 0; text-align: center; border-bottom: 1px solid var(--ink); }
.empty-mark { display: block; color: var(--acid); font-size: 5rem; line-height: 1; }
.empty-state h3 { margin: 12px 0; font-size: 2rem; }
.empty-state p { color: var(--muted); }
.text-button { border: 0; border-bottom: 1px solid currentColor; background: transparent; font-weight: 850; cursor: pointer; }

.manifest-story {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(0, 1.35fr);
  gap: clamp(50px, 9vw, 140px);
  padding: clamp(72px, 10vw, 150px) clamp(18px, 4vw, 64px);
  background: var(--ink);
  color: white;
}
.manifest-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid rgba(255,255,255,0.45); }
.manifest-list li { display: grid; grid-template-columns: 48px 130px 1fr; gap: 20px; padding: 26px 0; border-bottom: 1px solid rgba(255,255,255,0.25); }
.manifest-list span { color: var(--acid); font-size: 0.72rem; font-weight: 900; }
.manifest-list strong { font-size: 1rem; }
.manifest-list p { margin: 0; color: rgba(255,255,255,0.64); font-size: 0.88rem; line-height: 1.6; }

.detail-view { min-height: 100svh; padding: 0 clamp(18px, 4vw, 64px) clamp(80px, 10vw, 150px); }
.detail-topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--ink); font-size: 0.7rem; font-weight: 900; letter-spacing: 0.08em; }
.back-button { padding: 10px 0; border: 0; background: transparent; font-size: 0.74rem; font-weight: 900; cursor: pointer; }
.back-button:hover { color: var(--acid); }
.detail-intro { max-width: 900px; padding: clamp(44px, 6vw, 80px) 0 42px; }
.detail-title-block h1 { margin: 0; font-size: clamp(4rem, 11vw, 11rem); font-weight: 950; letter-spacing: -0.085em; line-height: 0.82; }
.detail-title-block .eyebrow { color: var(--acid); }
.detail-description { max-width: 730px; margin: 34px 0 20px; color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.22rem); line-height: 1.7; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.detail-tags span { padding: 8px 12px; border: 1px solid var(--line); font-size: 0.72rem; font-weight: 800; }
.detail-facts { align-self: end; margin: 0; border-top: 1px solid var(--ink); }
.detail-facts div { display: flex; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.detail-facts dt { color: var(--muted); font-size: 0.64rem; font-weight: 900; letter-spacing: 0.12em; }
.detail-facts dd { margin: 0; font-size: 0.82rem; font-weight: 850; }

.player-shell { position: relative; min-height: min(70vw, 780px); overflow: hidden; background: #10100e; color: white; }
.mobile-player-close { display: none; }
.player-poster { position: absolute; inset: 0; }
.player-poster::after { content: ""; position: absolute; inset: 0; background: rgba(8, 8, 7, 0.42); }
.player-poster img { width: 100%; height: 100%; object-fit: cover; filter: saturate(0.82); }
.game-portrait .player-poster img { object-position: center 18%; }
.player-poster-copy { position: absolute; z-index: 2; inset: 0; display: grid; place-items: center; align-content: center; gap: 24px; }
.player-poster-copy > span { font-size: 0.7rem; font-weight: 900; letter-spacing: 0.18em; }
.play-disc { width: clamp(82px, 10vw, 124px); height: clamp(82px, 10vw, 124px); border: 0; border-radius: 50%; background: var(--acid); color: white; font-size: clamp(1.4rem, 2.5vw, 2rem); cursor: pointer; transition: transform 220ms ease, background 220ms ease, color 220ms ease; }
.play-disc:hover { transform: scale(1.08); background: var(--lime); color: var(--ink); }
.frame-host, .frame-host iframe { width: 100%; height: 100%; min-height: min(70vw, 780px); border: 0; background: #fff; }
.frame-host iframe { display: block; }
.player-status { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 30px; text-align: center; }
.loader { width: 44px; height: 44px; border: 4px solid rgba(255,255,255,0.25); border-top-color: var(--acid); border-radius: 50%; animation: spin 800ms linear infinite; }
.player-error strong { font-size: 1.5rem; }
.player-error p { color: rgba(255,255,255,0.66); }
.player-toolbar { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--ink); }
.player-toolbar p { margin: 0; color: var(--muted); font-size: 0.76rem; }
.player-toolbar > div { display: flex; }
.tool-button { min-height: 44px; padding: 0 14px; border: 0; background: transparent; font-size: 0.72rem; font-weight: 850; cursor: pointer; }
.tool-button:hover:not(:disabled) { color: var(--acid); }
.tool-button:disabled { opacity: 0.4; cursor: not-allowed; }

.detail-lower { max-width: 760px; padding-top: clamp(56px, 7vw, 100px); }
.detail-lower h2 { font-size: clamp(2.5rem, 5vw, 5rem); }
.controls-list { margin: 32px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--ink); }
.controls-list li { padding: 18px 0; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.source-list { margin: 32px 0 0; border-top: 1px solid var(--ink); }
.source-list div { display: grid; grid-template-columns: 90px 1fr; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.source-list dt { color: var(--muted); font-size: 0.7rem; font-weight: 850; }
.source-list dd { margin: 0; overflow-wrap: anywhere; font-size: 0.82rem; font-weight: 750; }
.source-list a { text-underline-offset: 4px; }

.not-found { min-height: calc(100svh - var(--header-height)); display: grid; place-content: center; justify-items: start; padding: 40px clamp(18px, 7vw, 110px); background: var(--acid); color: white; }
.not-found > span { color: var(--lime); font-size: clamp(8rem, 28vw, 28rem); font-weight: 950; letter-spacing: -0.1em; line-height: 0.7; }
.not-found h1 { margin: 40px 0 12px; font-size: clamp(2.5rem, 6vw, 6rem); letter-spacing: -0.06em; }
.not-found p { max-width: 520px; line-height: 1.6; }
.not-found .button { margin-top: 18px; border-color: white; background: white; color: var(--ink); }

.site-footer { min-height: 150px; display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; padding: 40px clamp(18px, 4vw, 64px); border-top: 1px solid var(--ink); background: var(--paper); }
.site-footer > span { font-size: clamp(2rem, 7vw, 7rem); font-weight: 950; letter-spacing: -0.085em; line-height: 0.75; }
.site-footer p { margin: 0; color: var(--muted); font-size: 0.7rem; }

@keyframes hero-enter { from { opacity: 0; transform: translateY(35px); } to { opacity: 1; transform: translateY(0); } }
@keyframes hero-breathe { from { transform: scale(1.035); } to { transform: scale(1.09); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 800px) {
  :root { --header-height: 62px; }
  .header-meta { display: none; }
  .hero { min-height: calc(100svh - var(--header-height)); }
  .hero-image { object-position: 62% center; }
  .hero-scrim { background: linear-gradient(0deg, rgba(10,14,19,0.9) 0%, rgba(10,14,19,0.58) 58%, rgba(10,14,19,0.2)); }
  .hero-copy { width: 100%; padding: 34svh 20px 42px; }
  .hero h1 { font-size: clamp(3.35rem, 17vw, 5.8rem); }
  .hero-index { top: 20px; right: 18px; }
  .catalog-section { padding-top: 44px; }
  .catalog-head { grid-template-columns: 1fr; gap: 24px; padding-bottom: 32px; }
  .catalog-head h2 { font-size: clamp(3.2rem, 14vw, 5rem); }
  .catalog-tools { align-items: stretch; flex-direction: column; gap: 18px; }
  .search-box { width: 100%; }
  .genre-filters { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .game-link { min-height: auto; grid-template-columns: 32px minmax(0, 1fr) 42px; gap: 14px; padding: 20px 0 28px; }
  .game-order { grid-row: 1; grid-column: 1; }
  .game-media { grid-row: 1; grid-column: 2 / 4; height: 46vw; min-height: 170px; max-height: 270px; }
  .game-copy { grid-row: 2; grid-column: 2; }
  .game-copy strong { font-size: clamp(2.1rem, 9vw, 3.5rem); }
  .game-arrow { grid-row: 2; grid-column: 3; width: 42px; height: 42px; }
  .manifest-story { grid-template-columns: 1fr; }
  .manifest-story h2 { font-size: clamp(3.5rem, 15vw, 5.5rem); }
  .manifest-list li { grid-template-columns: 35px 80px 1fr; gap: 12px; }
  .detail-intro { padding: 32px 0 28px; }
  .detail-title-block h1 { font-size: clamp(4.5rem, 20vw, 7.5rem); }
  .detail-facts { margin-top: 10px; }
  .player-shell, .frame-host, .frame-host iframe { min-height: 72svh; }
  .player-toolbar { align-items: flex-start; flex-direction: column; padding: 16px 0; }
  .controls-list li { padding: 18px 0; font-size: 0.98rem; line-height: 1.55; }
  .site-footer { min-height: 125px; align-items: flex-start; flex-direction: column; }
}

@media (max-width: 480px) {
  .catalog-section { padding: 34px 14px 64px; }
  .catalog-head { gap: 0; padding-bottom: 28px; }
  .catalog-head h2 { max-width: 100%; font-size: clamp(2.9rem, 13vw, 3.35rem); text-wrap: balance; }
  .catalog-tools { padding: 18px 0; gap: 12px; }
  .detail-view { padding-inline: 14px; }
  .detail-topbar { height: 58px; }
  .detail-intro { padding: 24px 0; }
  .detail-title-block h1 { font-size: clamp(3.15rem, 16vw, 4.6rem); line-height: 0.88; }
  .detail-description { margin: 20px 0 0; font-size: 0.96rem; line-height: 1.6; }
  .player-shell[data-state="idle"] { min-height: 52svh; }
  .player-shell, .frame-host, .frame-host iframe { min-height: 79svh; }
  .player-shell[data-orientation="portrait"]:not([data-state="idle"]),
  .player-shell[data-orientation="portrait"]:not([data-state="idle"]) .frame-host,
  .player-shell[data-orientation="portrait"]:not([data-state="idle"]) .frame-host iframe {
    min-height: calc((100vw - 28px) * 844 / 390);
  }
  .player-toolbar { min-height: 60px; padding: 10px 0; gap: 8px; }
  .player-toolbar p { font-size: 0.7rem; }
  .detail-lower { padding-top: 52px; }
}

@media (max-width: 800px), (pointer: coarse) {
  body.mobile-play-active { overflow: hidden; }
  .player-shell.is-mobile-play {
    position: fixed;
    z-index: 1000;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    min-height: 100dvh;
    background: #10100e;
  }
  .player-shell.is-mobile-play .frame-host,
  .player-shell.is-mobile-play .frame-host iframe {
    width: 100vw;
    height: 100dvh;
    min-height: 100dvh;
  }
  .player-shell.is-mobile-play .mobile-player-close {
    position: absolute;
    z-index: 20;
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 50%;
    background: rgba(10, 10, 9, 0.72);
    color: white;
    font-size: 1.65rem;
    line-height: 1;
    backdrop-filter: blur(8px);
    cursor: pointer;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
