/* Xiaolai (小赖字体) by LXGW, SIL OFL 1.1 — subset to the glyphs this site uses. */
@font-face {
  font-family: "Xiaolai";
  src: url(fonts/xiaolai-subset.woff2) format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --sky: #4381ef;
  --paper: #fbfaf6;
  --ink: #26354d;
  --ink-soft: #6a7488;
  --line: rgba(38, 53, 77, .55);
  --font: "Xiaolai", "PingFang SC", "Microsoft YaHei", "Hiragino Sans", "Malgun Gothic", sans-serif;
  /* a hand-drawn stroke, used for underlines */
  --scribble: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'%3E%3Cpath d='M1 5.5C18 3 34 6.5 52 4.2S83 2.8 99 4.6' fill='none' stroke='%2326354d' stroke-width='1.6' stroke-linecap='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --scribble-white: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'%3E%3Cpath d='M1 5.5C18 3 34 6.5 52 4.2S83 2.8 99 4.6' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 17px; line-height: 1.7; background: var(--paper); }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 1.5px dashed currentColor; outline-offset: 4px; border-radius: 4px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 20; padding: 6px 12px; background: var(--paper); }
.skip:focus { top: 12px; }

/* ---- Header: game icon, community links, languages ----
   Transparent with white handwriting over the poster; once past it, it
   turns into a strip of paper with ink writing and a pencil line below. */
.site-head {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: center; gap: 8px clamp(12px, 2.4vw, 32px);
  padding: max(10px, env(safe-area-inset-top)) clamp(14px, 3vw, 40px) 10px;
  color: #fff; text-shadow: 0 1px 4px rgba(15, 30, 70, .55);
  transition: background-color .35s ease, color .35s ease, text-shadow .35s ease;
}
.site-head::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 8px; opacity: 0;
  background: var(--scribble) center / 100% 8px no-repeat; transition: opacity .35s ease;
}
/* over the poster: a soft shade from the top so white writing stays readable on the white hair */
.site-head { background: linear-gradient(rgba(22, 44, 100, .5), rgba(22, 44, 100, .22) 65%, rgba(22, 44, 100, 0)); }
.site-head.solid { background: rgba(251, 250, 246, .94); color: var(--ink); text-shadow: none; }
.site-head.solid::after { opacity: .7; }
@supports (backdrop-filter: blur(6px)) { .site-head.solid { background: rgba(251, 250, 246, .82); backdrop-filter: blur(6px); } }

.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand img { width: 40px; height: 40px; border-radius: 11px; }
.brand-name { font-size: 20px; letter-spacing: .06em; white-space: nowrap; }

.head-links { display: flex; align-items: center; gap: 8px 10px; }

/* icon + label buttons with a wobbly, hand-drawn outline */
.hbtn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 13px 2px 10px;
  font: inherit; font-size: 16px; color: inherit; text-shadow: inherit; cursor: pointer; white-space: nowrap;
  background: none; border: 1.5px solid currentColor;
  border-radius: 14px 180px 12px 160px / 160px 14px 180px 12px;
  transition: background-color .2s ease, transform .2s ease;
}
.hbtn:nth-child(2) { border-radius: 160px 12px 180px 14px / 12px 170px 14px 150px; }
.hbtn:nth-child(3) { border-radius: 12px 150px 16px 170px / 170px 16px 150px 12px; }
.hbtn:hover { background: rgba(255, 255, 255, .14); transform: rotate(-1.2deg); }
.site-head.solid .hbtn { border-color: var(--line); }
.site-head.solid .hbtn:hover { background: rgba(38, 53, 77, .06); }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 2px rgba(15, 30, 70, .25)); }
.site-head.solid .ic { filter: none; }
.ic .dot { fill: currentColor; stroke: none; }

/* language: one word + a hand-drawn chevron; the list unfolds on a scrap of paper */
.lang { position: relative; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 4px 2px 8px;
  border: 0; background: none; font: inherit; font-size: 16px; color: inherit; text-shadow: inherit; cursor: pointer;
}
.lang-btn .lang-cur { padding-bottom: 4px; background: var(--scribble-white) center bottom / 100% 6px no-repeat; }
.site-head.solid .lang-btn .lang-cur { background-image: var(--scribble); }
.chev { width: 18px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.lang-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.lang-menu {
  position: absolute; right: -6px; top: calc(100% + 8px); margin: 0; padding: 8px 6px; list-style: none; min-width: 132px;
  background: var(--paper); color: var(--ink); text-shadow: none;
  border: 1.5px solid var(--line); border-radius: 14px 180px 12px 160px / 160px 14px 180px 12px;
  transform: rotate(.6deg);
}
.lang-menu[hidden] { display: none; }
.lang-menu button {
  display: block; width: 100%; padding: 6px 14px 8px; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 16px; color: var(--ink-soft); text-align: left;
}
.lang-menu button:hover, .lang-menu button:focus-visible { color: var(--ink); }
.lang-menu button[aria-pressed="true"] { color: var(--ink); }
.lang-menu button[aria-pressed="true"] span, .lang-menu button[aria-pressed="true"] { background: var(--scribble) left 14px bottom 3px / calc(100% - 28px) 6px no-repeat; }

.toast {
  position: fixed; left: 50%; top: 76px; z-index: 11; margin: 0; transform: translate(-50%, -6px);
  padding: 6px 16px 8px; background: var(--paper); color: var(--ink); font-size: 15px; white-space: nowrap;
  border: 1.4px solid var(--line); border-radius: 14px 120px 12px 110px / 110px 14px 120px 12px;
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Phones: icon + languages on the first row, community links on the second. */
@media (max-width: 720px) {
  .site-head { flex-wrap: wrap; padding-bottom: 8px; }
  .brand-name { display: none; }
  .brand img { width: 34px; height: 34px; border-radius: 9px; }
  .head-links { order: 3; width: 100%; justify-content: center; gap: 8px; }
  .hbtn { height: 32px; font-size: 14px; padding: 0 10px 2px 8px; }
  .ic { width: 18px; height: 18px; }
}

/* ---- Page 1: poster ---- */
.hero { position: relative; z-index: 1; height: 100vh; height: 100svh; min-height: 480px; overflow: hidden; }
main { overflow-x: clip; }
.hero-art {
  position: absolute; inset: 0;
  background: var(--sky) 0% 85% / cover no-repeat;
  background-image: image-set(url(img/poster-zh-1280.webp) 1x, url(img/poster-zh-1920.webp) 2x);
  /* let the bottom edge dissolve instead of ending in a hard line */
  /* a long, eased dissolve so there is no line where the poster ends */
  -webkit-mask-image: linear-gradient(#000 0, #000 78%, rgba(0,0,0,.92) 85%, rgba(0,0,0,.75) 90%, rgba(0,0,0,.45) 95%, rgba(0,0,0,.15) 98.5%, transparent 100%);
          mask-image: linear-gradient(#000 0, #000 78%, rgba(0,0,0,.92) 85%, rgba(0,0,0,.75) 90%, rgba(0,0,0,.45) 95%, rgba(0,0,0,.15) 98.5%, transparent 100%);
}
html:not([data-lang="zh"]) .hero-art { background-image: image-set(url(img/poster-en-1280.webp) 1x, url(img/poster-en-1920.webp) 2x); }
@media (min-width: 1400px) {
  .hero-art { background-image: url(img/poster-zh-1920.webp); }
  html:not([data-lang="zh"]) .hero-art { background-image: url(img/poster-en-1920.webp); }
}

/* The poster's colours keep seeping down: just the colours of its bottom
   edge (no shapes), blended into the paper under the first screen. */
.bleed { position: relative; height: 0; }
.bleed::before {
  content: ""; position: absolute; left: 0; right: 0; top: -24vh; height: 72vh;
  /* same width and left alignment as the poster (cover, anchored left) so colours line up */
  background: url(img/bleed.webp) left top / max(100vw, 177.78vh) 100% no-repeat;
  pointer-events: none;
}
.hero-titles { display: none; }
.down {
  position: absolute; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); margin-left: -24px;
  width: 48px; height: 40px; display: grid; place-items: center; color: #fff;
  filter: drop-shadow(0 1px 4px rgba(20, 40, 90, .35));
  animation: bob 2.6s ease-in-out infinite;
}
.down svg { width: 40px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@keyframes bob { 50% { transform: translateY(5px); } }

/* Portrait screens: crop of the girl's profile, line-art title over the sky. */
@media (max-aspect-ratio: 1/1) {
  .hero-art, html:not([data-lang="zh"]) .hero-art {
    inset: 0 0 auto 0; height: 64%;
    background-image: image-set(url(img/poster-portrait-520.webp) 1x, url(img/poster-portrait-780.webp) 2x);
    background-position: 72% top;
  }
  .hero { background: linear-gradient(var(--sky) 0, var(--sky) 74%, #a9c6f6 90%, #dce7f8 100%); }
  .hero-art, html:not([data-lang="zh"]) .hero-art { -webkit-mask-image: none; mask-image: none; }
  .hero-art::after { content: ""; position: absolute; inset: auto 0 -1px 0; height: 35%; background: linear-gradient(transparent, var(--sky)); }
  .bleed::before { top: 0; height: 40vh; background: linear-gradient(#dce7f8, var(--paper)); }
  .down { color: var(--ink); filter: none; }
  .hero-titles { display: block; position: absolute; left: 0; right: 0; top: 58%; padding: 0 24px; }
  .hero-titles img { width: min(100%, 520px); margin: 0 auto; display: none; }
  .hero-titles .sub { width: min(86%, 440px); margin-top: -5%; }
  html[data-lang="zh"] .hero-titles .t-zh,
  html:not([data-lang="zh"]) .hero-titles .t-en { display: block; }
}

/* ---- Page 2: paper ---- */
.play {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column;
  padding: 0 24px; text-align: center;
  word-break: keep-all; overflow-wrap: anywhere; /* break CJK at punctuation, not mid-phrase */
}
.play .inner { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: clamp(96px, 16vh, 180px) 0 24px; }

/* ---- Story ---- */
.lead {
  margin: 0; max-width: 21em; color: var(--ink-soft);
  font-size: clamp(17px, 1.45vw, 20px); line-height: 2.1; letter-spacing: .04em; text-wrap: balance;
  white-space: pre-line;
}
html[data-lang="zh"] .lead { max-width: 31em; font-size: clamp(16px, 1.25vw, 19px); } /* two lines: the journey, then the sea and the sky */
.motto {
  margin: clamp(48px, 8vh, 84px) 0 0; max-width: 12em;
  font-size: clamp(30px, 3.6vw, 46px); line-height: 1.55; letter-spacing: .08em; text-wrap: balance;
}
/* itch.io button: the one "call to action", drawn by hand like the rest */
.itch-btn {
  display: inline-flex; align-items: center; gap: 10px; margin-top: clamp(22px, 3.5vh, 34px);
  padding: 10px 20px 12px 16px; color: var(--ink); font-size: clamp(18px, 1.5vw, 21px); letter-spacing: .04em;
  border: 1.8px solid var(--ink); border-radius: 16px 220px 14px 200px / 200px 16px 220px 14px;
  background: rgba(67, 129, 239, .07);
  box-shadow: 3px 4px 0 -1px rgba(38, 53, 77, .18); /* a pencil shadow, offset like a second stroke */
  transition: transform .2s ease, background-color .2s ease, box-shadow .2s ease;
}
.itch-btn .ic { width: 26px; height: 26px; filter: none; }
.itch-btn .arrow { width: 24px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.itch-btn:hover { transform: rotate(-1.5deg) translateY(-1px); background: rgba(67, 129, 239, .13); box-shadow: 4px 6px 0 -1px rgba(38, 53, 77, .2); }
.itch-btn:hover .arrow { transform: translateX(4px); }
.itch-btn .soon-tag { display: none; font-size: 14px; color: var(--ink-soft); padding-left: 10px; border-left: 1.4px solid var(--line); }
/* no itch.io page yet: say so, and don't pretend to go anywhere */
.itch-btn[href="#itch"] { cursor: default; }
.itch-btn[href="#itch"] .soon-tag { display: inline; }
.itch-btn[href="#itch"] .arrow { display: none; }
.wave { display: block; width: 92px; height: 12px; margin: clamp(28px, 4vh, 40px) auto clamp(48px, 8vh, 80px); fill: none; stroke: var(--line); stroke-width: 1.6; stroke-linecap: round; }

/* Chinese & Japanese: the three lines read top-to-bottom, right-to-left,
   each column a little lower than the last, like something drifting. */
.poem {
  writing-mode: vertical-rl; display: flex; flex-direction: column; gap: clamp(28px, 4vw, 52px);
  color: var(--ink); font-size: clamp(18px, 1.5vw, 21px); line-height: 2.1; letter-spacing: .16em;
}
.poem p { margin: 0; white-space: pre-line; text-align: start; }
.poem p:nth-child(2) { padding-inline-start: 2.2em; }
.poem p:nth-child(3) { padding-inline-start: 4.4em; }
html[data-lang="en"] .poem, html[data-lang="ko"] .poem {
  writing-mode: horizontal-tb; flex-direction: column; gap: 6px; letter-spacing: .02em; line-height: 2;
  max-width: 26em; text-align: center;
}
html[data-lang="en"] .poem p, html[data-lang="ko"] .poem p { max-inline-size: none; padding: 0; text-align: center; text-wrap: balance; }
html[data-lang="en"] .motto { letter-spacing: .02em; max-width: 16em; }


.foot { text-align: center; padding: 12px 0 max(24px, env(safe-area-inset-bottom)); font-size: 14px; color: var(--ink-soft); }


/* ---- Page 3: the team, as taped-on cast cards ---- */
.team { position: relative; z-index: 1; padding: clamp(96px, 14vh, 160px) 24px clamp(64px, 10vh, 112px); text-align: center; }
.team h2 { margin: 0; font-weight: 400; font-size: clamp(30px, 3.6vw, 44px); letter-spacing: .1em; }
.cards { list-style: none; margin: clamp(48px, 7vh, 72px) auto 0; padding: 0; max-width: 1200px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 40px 30px; }
.card {
  position: relative; width: 200px; padding: 12px 12px 16px; background: #fff; text-align: left;
  border: 1.5px solid var(--line); border-radius: 6px 14px 8px 12px;
  box-shadow: 4px 5px 0 -1px rgba(38, 53, 77, .12);
  transition: transform .3s ease;
}
.card:nth-child(1) { transform: rotate(-2.5deg); }
.card:nth-child(2) { transform: rotate(1.8deg) translateY(14px); }
.card:nth-child(3) { transform: rotate(-1deg); }
.card:nth-child(4) { transform: rotate(2.6deg) translateY(10px); }
.card:nth-child(5) { transform: rotate(-1.8deg); }
.card:hover { transform: rotate(0) translateY(-4px); }
.card::before { /* a strip of tape */
  content: ""; position: absolute; left: 50%; top: -12px; width: 70px; height: 22px; margin-left: -35px;
  background: rgba(67, 129, 239, .22); transform: rotate(-3deg);
}
.card img { width: 100%; height: auto; aspect-ratio: 33 / 40; border-radius: 3px; image-rendering: pixelated; }
.card .as { margin: 10px 0 0; font-size: 14px; color: var(--ink-soft); }
.card .name { margin: 0; font-size: 22px; line-height: 1.3; }
.card .roles { margin: 4px 0 0; font-size: 14px; line-height: 1.5; color: var(--ink-soft); }
.thanks { margin: clamp(64px, 9vh, 96px) 0 0; font-size: clamp(22px, 2vw, 28px); letter-spacing: .06em; line-height: 1.6; }
.thanks .why { display: inline-block; margin-top: 6px; font-size: clamp(16px, 1.35vw, 19px); letter-spacing: .02em; color: var(--ink-soft); }
@media (max-width: 720px) {
  .cards { gap: 30px 16px; }
  .card { width: calc(50% - 10px); padding: 8px 8px 12px; }
  .card .name { font-size: 18px; }
  .card .roles, .card .as { font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Latin and Hangul run longer per line than CJK */
html[data-lang="en"] .lead, html[data-lang="ko"] .lead { max-width: 29em; }
html[data-lang="en"] .poem, html[data-lang="ko"] .poem { max-width: 32em; }

/* ---- Story: picture on the left, words on the right ---- */
.story { width: 100%; max-width: 1240px; display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(40px, 6vh, 64px); align-items: center; }
/* video on top, then the two screenshots, each a little smaller and
   nudged left / right like photos laid on a page */
.story-art {
  position: relative; margin: 0 auto; width: 100%; max-width: 720px;
  display: flex; flex-direction: column; gap: clamp(18px, 2.4vw, 32px);
}
.story-art .clip::before { /* a loose pencil frame, offset behind the video */
  content: ""; position: absolute; inset: 14px -14px -14px 14px; z-index: -1;
  border: 1.6px solid var(--line); border-radius: 12px 260px 10px 240px / 240px 12px 260px 10px;
}
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 1.4vw, 18px); }
.story-art .clip { position: relative; z-index: 1; margin: 0; }
.story-art video, .story-art .shot img {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: #2f6f73;
}
.story-art video { border-radius: 8px 12px 8px 14px; }
.story-art .shot { position: relative; z-index: 1; display: block; overflow: hidden; border-radius: 6px 10px 7px 12px; }
.story-art .shot img { transition: transform .5s ease; }
.story-art .shot:hover img { transform: scale(1.03); }
.playpause {
  position: absolute; right: 10px; bottom: 10px; width: 34px; height: 34px; border: 0; cursor: pointer;
  display: grid; place-items: center; color: #fff; background: none;
  filter: drop-shadow(0 1px 3px rgba(20, 40, 90, .6));
}
.playpause svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.playpause .i-play { display: none; }
.playpause[aria-pressed="true"] .i-play { display: block; }
.playpause[aria-pressed="true"] .i-pause { display: none; }
.pixel { image-rendering: pixelated; }
.story-text { display: flex; flex-direction: column; align-items: center; }

@media (min-width: 900px) {
  .story { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(56px, 6vw, 112px); align-items: center; }
  .story-text { align-items: flex-start; text-align: left; }
  .story-text .wave { margin-left: 0; }
  .story-text .motto { margin-top: clamp(36px, 5vh, 56px); }
  .story-text .wave { margin-bottom: clamp(36px, 5vh, 56px); }
  html[data-lang="en"] .poem p, html[data-lang="ko"] .poem p { text-align: left; }
  html[data-lang="en"] .poem, html[data-lang="ko"] .poem { text-align: left; }
}
@media (min-width: 900px) { html[data-lang="zh"] .story-text .poem, html[data-lang="ja"] .story-text .poem { width: fit-content; } }
