/* Shared look of the two app sites: the apps' dex window (DESIGN.md tokens), one light look on purpose. */
@font-face { font-family: "Galmuri11"; src: url("fonts/galmuri11.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Galmuri11"; font-weight: 700; src: url("fonts/galmuri11-bold.woff2") format("woff2"); font-display: swap; }
/* Galmuri11 Bold has no kana or kanji: bold Japanese uses the regular cut */
@font-face { font-family: "Galmuri11"; font-weight: 700; src: url("fonts/galmuri11.woff2") format("woff2"); font-display: swap; unicode-range: U+3000-30FF, U+4E00-9FFF, U+FF00-FFEF; }
:root {
  --ink: #1a1c17; --paper: #f1ecde; --cream: #fcf8ee; --wash: #efe9d8; --inset: #e8e1d0;
  --field: #2f6b4f; --field-light: #36755a; --gold: #c29435; --sky: #5f9cc0; --holo: #8f7ad8; --sea: #dce5e8;
  --muted: rgba(26,28,23,.70); --line: rgba(26,28,23,.12);
  --pixel: "Galmuri11", "Apple SD Gothic Neo", "Hiragino Sans", "Noto Sans KR", sans-serif;
  --bounce: cubic-bezier(.34,1.56,.64,1);
  --bar: 56px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-padding-top: var(--bar); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.7 var(--pixel); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { margin: 0; text-wrap: balance; font-weight: 700; }
p { margin: 0; }
a { color: inherit; }
img.pix, .pix img, canvas.pix { image-rendering: pixelated; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* the apps' window: cream fill, ink edge with notched corners, green inner line */
.win { background: var(--cream); border: 2px solid var(--ink); box-shadow: inset 0 0 0 2px var(--cream), inset 0 0 0 4px var(--field);
  clip-path: polygon(4px 0, calc(100% - 4px) 0, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 0 calc(100% - 4px), 0 4px); padding: 16px 18px; }
.win > .band { margin: -16px -18px 12px; background: var(--field); color: var(--cream); padding: 5px 18px; font-weight: 700; font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; font-size: 14px; border: 2px solid var(--ink); background: var(--field); color: var(--cream);
  padding: 8px 14px; min-height: 44px; cursor: pointer; text-decoration: none; box-shadow: 0 3px 0 var(--ink); transition: transform .18s var(--bounce), box-shadow .18s; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 0 var(--ink); }
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.btn.ghost { background: var(--cream); color: var(--ink); }
.btn.gold { background: var(--gold); color: var(--ink); }
.btn[aria-disabled="true"] { background: var(--inset); color: var(--muted); box-shadow: 0 3px 0 var(--line); cursor: default; }
.btn[aria-disabled="true"]:hover { transform: none; }
.btn.small { min-height: 44px; padding: 4px 10px; font-size: 12px; }

/* top bar */
.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50; height: var(--bar); background: var(--cream); border-bottom: 2px solid var(--ink);
  display: flex; align-items: center; gap: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 60; background: var(--cream); }
.bar .me { position: relative; display: flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; min-width: 0; }
.bar .me img { width: 32px; height: 32px; border: 2px solid var(--ink); flex: none; }
.bar .me span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .gap { flex: 1; }
.langs { display: flex; border: 2px solid var(--ink); flex: none; }
.langs button { position: relative; border: 0; background: var(--cream); font-size: 11px; padding: 0 7px; min-height: 32px; min-width: 32px; cursor: pointer; }
/* drawn small, tapped at 44px */
.result .again { position: relative; }
.langs button::before, .bar .me::before, .result .again::before { content: ""; position: absolute; inset: -6px; }
.langs button[aria-pressed="true"] { background: var(--field); color: var(--cream); }
.bar .stores { display: flex; gap: 6px; flex: none; }
@media (max-width: 520px) { .bar .stores .btn:not(:first-child) { display: none; } .bar .me span { display: none; } }

/* hero */
.hero { position: relative; }
.stage { position: relative; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; background: var(--field); }
.hero .stage { height: clamp(560px, calc(100svh - var(--bar)), 860px); }
.hint { position: absolute; left: 0; right: 0; text-align: center; font-size: 14px; color: var(--cream); text-shadow: 0 2px 0 rgba(0,0,0,.4); pointer-events: none; padding: 0 16px; transition: opacity .3s; }
.toast { position: absolute; left: 50%; top: 18%; transform: translate(-50%, 0); background: var(--cream); border: 2px solid var(--ink); padding: 4px 12px; font-size: 13px; opacity: 0; transition: opacity .2s, transform .3s var(--bounce); pointer-events: none; white-space: nowrap; z-index: 5; }
.toast.on { opacity: 1; transform: translate(-50%, -6px); }
.result { position: absolute; left: 12px; right: 12px; bottom: 12px; display: grid; gap: 10px; transform: translateY(130%); transition: transform .6s var(--bounce); z-index: 6; max-width: 440px; margin: 0 auto; }
.result.on { transform: none; }
.result .lead { font-size: 14px; }
.result .stores { display: flex; flex-wrap: wrap; gap: 8px; }
.bridge { display: flex; gap: 12px; align-items: center; font-size: 13px; border-top: 2px dashed var(--line); padding-top: 10px; text-decoration: none; }
.bridge img { width: 44px; height: 44px; border: 2px solid var(--ink); flex: none; }
.bridge b { color: var(--field); }
.bridge:hover b { text-decoration: underline; }

/* cards (same face as the game's card) */
.card { aspect-ratio: 5/7; position: relative; transform-style: preserve-3d; transition: transform .5s var(--bounce); cursor: pointer; }
.card .face, .card .back { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 2px solid var(--ink); }
.card .back { background: var(--field) repeating-linear-gradient(45deg, transparent 0 5px, rgba(252,248,238,.08) 5px 7px); display: grid; place-items: center; }
.card .back::after { content: ""; width: 40%; aspect-ratio: 1; background: var(--cream); border: 2px solid var(--gold); }
.card .face { transform: rotateY(180deg); background: var(--cream); box-shadow: inset 0 0 0 2px var(--cream), inset 0 0 0 3px var(--tier, var(--field)); display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
.card .face .no { background: var(--field); color: var(--cream); font-size: 9px; padding: 1px 4px; white-space: nowrap; overflow: hidden; }
.card .face img { width: 100%; align-self: center; }
.card .face .nm { font-size: 9px; text-align: center; padding: 0 2px 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.flip { transform: rotateY(180deg); }
.card.rare .face::after { content: ""; position: absolute; inset: 0; mix-blend-mode: color-dodge; opacity: .6; pointer-events: none;
  background: linear-gradient(115deg, transparent 20%, rgba(143,122,216,.8) 38%, rgba(255,230,189,.9) 50%, rgba(95,156,192,.8) 62%, transparent 80%); background-size: 250% 250%; background-position: var(--gx, 50%) var(--gy, 50%); }
.card.big .face .no, .card.big .face .nm { font-size: 15px; }
.deal { animation: deal .5s var(--bounce) both; }
@keyframes deal { from { transform: translateY(160%) scale(.6); } }

/* dex slots */
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot { aspect-ratio: 1; background: var(--inset); border: 2px dashed var(--line); display: grid; place-items: center; position: relative; }
.slot img { width: 80%; filter: brightness(0) opacity(.18); }
.slot.got { border: 2px solid var(--ink); background: var(--cream); }
.slot.got img { filter: none; animation: pop .45s var(--bounce); }
.slot .st { position: absolute; right: -6px; top: -9px; background: var(--gold); color: var(--ink); font-size: 10px; padding: 0 4px; border: 2px solid var(--ink); transform: rotate(8deg); display: none; }
.slot.got .st { display: block; }
@keyframes pop { from { transform: scale(.3); } }

/* desktop (wide screens): the hero sits in a dex window on a striped green desk */
[hidden] { display: none !important; }
.hero .desk { display: none; }
@media (min-width: 900px) {
  .hero { background: var(--field) repeating-linear-gradient(45deg, transparent 0 6px, rgba(252,248,238,.06) 6px 8px); height: clamp(640px, calc(100svh - var(--bar)), 920px); overflow: hidden; }
  .hero > .main { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc((100svh - var(--bar) - 80px) * .6)); padding: 10px; z-index: 3; }
  .hero > .main > .band { margin: -10px -10px 10px; }
  .hero > .main .stage { height: auto; aspect-ratio: 400/700; }
  .hero .desk { display: block; }
  .hero .icons.desk { display: grid; }
  .hero .taskbar.desk { display: flex; }
}
.icons { position: absolute; left: 28px; top: 28px; display: grid; gap: 18px; z-index: 2; }
.ico { display: grid; justify-items: center; gap: 4px; width: 84px; color: var(--cream); font-size: 12px; background: none; border: 0; cursor: pointer; padding: 4px; text-align: center; text-decoration: none; line-height: 1.3; text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.ico .pic { width: 56px; height: 56px; background: var(--cream); border: 2px solid var(--ink); display: grid; place-items: center; transition: transform .2s var(--bounce); box-shadow: 0 3px 0 var(--ink); }
.ico:hover .pic { transform: translateY(-4px) rotate(-3deg); }
.ico:active .pic { transform: translateY(2px); }
.ico .pic img { width: 44px; height: 44px; }
.ico .pic b { font-size: 24px; color: var(--ink); text-shadow: none; }
.dwin { position: absolute; width: 300px; padding: 12px 14px; z-index: 4; touch-action: none; }
.dwin.open { animation: winin .4s var(--bounce); }
.dwin > .band { margin: -12px -14px 10px; padding: 4px 6px 4px 14px; cursor: grab; }
.dwin > .band button { position: relative; background: var(--cream); color: var(--ink); border: 2px solid var(--ink); width: 26px; height: 26px; line-height: 1; cursor: pointer; padding: 0; font-weight: 700; }
.dwin p { font-size: 13px; }
.dwin ul { margin: 0; padding-left: 1.1em; font-size: 13px; display: grid; gap: 4px; }
/* the close box draws at 26px but takes taps across 44px */
.dwin > .band button::before { content: ""; position: absolute; inset: -9px; }
@keyframes winin { from { transform: scale(.6); opacity: 0; } }
.mini { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.mini > div { aspect-ratio: 1; background: var(--inset); border: 2px solid var(--ink); display: grid; place-items: center; }
.mini img { width: 90%; }
.mini .no img { filter: brightness(0) opacity(.2); }
.taskbar { position: absolute; left: 0; right: 0; bottom: 0; background: var(--ink); color: var(--cream); font-size: 12px; padding: 6px 16px; display: flex; justify-content: space-between; z-index: 2; }

/* scroll story */
.story { position: relative; height: 460svh; }
.story .scene { position: sticky; top: var(--bar); height: calc(100svh - var(--bar)); overflow: hidden; background: var(--field); }
.story .layer { position: absolute; inset: -12% -30%; background: center/cover no-repeat; will-change: transform; image-rendering: pixelated; }
.story .cap { position: absolute; left: 50%; top: 20px; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); z-index: 3; }
.story .cap h2 { font-size: 22px; line-height: 1.4; }
.story .cap p { font-size: 14px; color: var(--muted); margin-top: 4px; }
.story .cap .step { font-size: 11px; color: var(--field); letter-spacing: .06em; }
.story .actors { position: absolute; inset: 0; }
.story .end { position: absolute; left: 50%; bottom: 20px; transform: translate(-50%, 140%); width: min(460px, calc(100% - 24px)); transition: transform .6s var(--bounce); z-index: 4; display: grid; gap: 10px; }
.story .end.on { transform: translate(-50%, 0); }
.flyer { position: absolute; width: clamp(48px, 9vw, 96px); will-change: transform; }

/* footer */
.foot { background: var(--ink); color: var(--cream); padding-block: 40px 56px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.foot .in { max-width: 960px; margin: 0 auto; display: grid; gap: 28px; }
.foot .other { color: var(--ink); max-width: 560px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; }
.foot small { font-size: 11px; opacity: .7; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 899px) {
  .hero > .main { padding: 0; border: 0; box-shadow: none; clip-path: none; background: none; }
  .hero > .main > .band { display: none; }
}
