:root {
  color-scheme: light;
  font-family: system-ui, "Segoe UI", sans-serif;
  background: #f8f7f2;
  color: #172523;
  --muted: #4b5a55;
  --line: #deded4;
  --mono: "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid #916014; outline-offset: 4px; }
.shell { width: min(1272px, calc(100% - 100px)); margin-inline: auto; }

.site-header { position: absolute; z-index: 5; inset: 0 0 auto; color: #f7f8ee; background: #0a1a20b8; border-bottom: 1px solid #beddd32e; }
.header-inner { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.25rem; letter-spacing: -.045em; font-weight: 750; }
.brand-mark { width: 32px; height: 32px; display: inline-flex; align-items: end; justify-content: center; gap: 2px; padding: 7px; border-radius: 8px; background: #223931; }
.brand-mark i { width: 4px; border-radius: 1px; background: #f2bd6d; }
.brand-mark i:nth-child(1) { height: 6px; opacity: .7; }
.brand-mark i:nth-child(2) { height: 11px; opacity: .85; }
.brand-mark i:nth-child(3) { height: 16px; }
nav { display: flex; align-items: center; gap: clamp(17px, 3vw, 38px); font-size: .875rem; font-weight: 650; }
nav a:hover, figcaption a:hover { text-decoration: underline; text-underline-offset: 3px; }
nav span { margin-left: .2em; }
.account-link { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 14px; border-radius: 8px; background: #9ff0d7; color: #102723; font-weight: 750; white-space: nowrap; }
.account-link:hover { background: #c2fae8; text-decoration: none; }

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: center;
  min-height: max(700px, 100svh);
  overflow: hidden;
  overflow: clip;
  color: #f5f8ed;
  background: #0b1c1f;
}
.intro { position: relative; z-index: 2; padding-bottom: 9vh; pointer-events: none; }
h1 { margin: 0; max-width: 13ch; font-size: clamp(3.55rem, 5.6vw, 6.3rem); line-height: 1; letter-spacing: -.052em; font-weight: 760; }
h1 em { color: #9ff0d7; font-style: normal; }
.intro > p { margin: 24px 0 0; max-width: 39ch; color: #e0ede5; font-size: clamp(1rem, 1.4vw, 1.15rem); line-height: 1.6; }
.intro strong { color: #fff9e8; white-space: nowrap; }
.sample-download { margin-top: 27px; }
.sample-download a { pointer-events: auto; }

.preview { position: absolute; inset: 0; color: #edece1; }
.stage { position: absolute; inset: 0; overflow: hidden; background: #11262b url('./assets/cinderfall-relay.webp') 64% 50% / cover no-repeat; }
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, #07171ce0 0%, #08181c9c 28%, #081b2044 45%, transparent 63%),
    linear-gradient(0deg, #051318 1%, #07161b94 16%, transparent 38%);
}
.checkerboard { background: conic-gradient(#e0e3d9 25%, #f4f4ec 0 50%, #e0e3d9 0 75%, #f4f4ec 0) 0 0 / 24px 24px; }
.stage[data-view="cutout"] { background: conic-gradient(#263941 25%, #31494c 0 50%, #263941 0 75%, #31494c 0) 0 0 / 32px 32px; }
.stage[data-view="cutout"]::after { background: linear-gradient(90deg,#08171bea 1%,#091a20b0 30%, transparent 63%), linear-gradient(0deg,#07171b,transparent 32%); }
#game { position: absolute; inset: 0; }
#game:focus-visible { outline: 2px solid #fbc87a; outline-offset: -3px; }
#game canvas { display: block; }
#status { position: absolute; z-index: 1; top: 82px; right: 16px; width: fit-content; max-width: calc(100% - 32px); margin: 0; padding: .5rem .7rem; border-radius: 6px; color: #f3ecdf; background: #222c35; }
#status:empty { visibility: hidden; }

.game-console {
  position: absolute;
  inset: 92px max(50px, calc((100% - 1272px) / 2)) auto auto;
  width: 570px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px 16px;
  padding: 10px 12px;
  background: #0b1c23e8;
  border: 1px solid #8dbfb461;
  border-radius: 12px;
  box-shadow: 0 14px 30px #04111688, inset 0 1px 0 #afd2cd20;
}
.level-info { display: flex; align-items: baseline; gap: 12px; }
.level-info h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: .9rem; font-weight: 740; color: #f3faef; }
.preview-dot { width: 6px; height: 6px; border-radius: 50%; background: #6b8076; }
.preview[data-action] .preview-dot { background: #a2ecd0; box-shadow: 0 0 10px #9addb899; }
.playback { color: #b9d4cd; font: .72rem var(--mono); white-space: nowrap; }
.views { display: flex; justify-self: end; gap: 2px; padding: 2px; border: 1px solid #5c807e; border-radius: 7px; }
button { font-family: inherit; cursor: pointer; }
button:disabled { opacity: .5; cursor: wait; }
.views button { padding: 4px 10px; min-height: 34px; background: transparent; color: #d5e1df; border: 0; border-radius: 4px; font-size: .78rem; font-weight: 700; }
.views button[aria-pressed="true"] { color: #effff3; background: #32524e; }
.preview button:focus-visible, .hero a:focus-visible, .site-header a:focus-visible { outline-color: #fbc87a; outline-offset: 3px; }
.game-controls { grid-area: 2 / 1 / auto / -1; display: flex; gap: 10px; min-width: 0; }
.movement, .controls { display: grid; gap: 6px; }
.movement { grid-template-columns: repeat(2,minmax(37px,1fr)); touch-action: pan-y pinch-zoom; user-select: none; }
.controls { grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 1.22fr) repeat(2, minmax(0, 1fr)); flex: 1; min-width: 0; }
.game-controls button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 44px;
  min-width: 0;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid #5b7c7b;
  background: #1b333a;
  color: #e9f1eb;
  font-size: .88rem;
  font-weight: 700;
}
.movement button { padding: 0; font-size: 1.06rem; }
.game-controls button:not(:disabled):hover { border-color: #bbae7d; }
.movement button[data-held], .controls button[aria-pressed="true"] { background: #f5c780; border-color: #f5c780; color: #392916; }
kbd { display: inline-grid; flex: none; place-items: center; min-width: 20px; min-height: 20px; padding-inline: 3px; border: 1px solid currentColor; border-radius: 4px; opacity: .7; font: .68rem var(--mono); }

.download { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 53px; padding: 0 18px; border-radius: 9px; background: #f5c780; border: 1px solid #e6b668; box-shadow: 0 2px 0 #dfb16b; color: #2e281c; font-size: .92rem; font-weight: 780; }
.download:hover { background: #ffd997; }
.download-icon { position: relative; width: 14px; height: 11px; border: 1.5px solid currentColor; border-top: 0; border-radius: 0 0 3px 3px; }
.download-icon::before { content: ""; position: absolute; left: 5px; top: -5px; height: 9px; width: 1.5px; background: currentColor; }
.download-icon::after { content: ""; position: absolute; left: 3.25px; top: 0; width: 4px; height: 4px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.sample-download p { margin: 13px 0 0; color: #c6d9d1; font-size: .83rem; }

.actions { padding-block: clamp(36px, 4.8vw, 70px); }
.export, .faq { border-top: 1px solid var(--line); padding-block: clamp(34px, 4.8vw, 70px); }
main h2:not(#preview-title) { margin: 0; font-size: clamp(2rem, 3.7vw, 3.45rem); line-height: 1.04; letter-spacing: -.05em; }
.section-intro p, .export p { color: var(--muted); margin: 14px 0 0; max-width: 56ch; line-height: 1.65; }
.action-gallery { list-style: none; padding: 0; margin: 25px 0 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(9px, 1.5vw, 19px); }
.action-card { display: block; border: 1px solid #d6dbce; background: #fbfaf6; border-radius: 11px; overflow: hidden; }
.action-card:hover { border-color: #729389; }
.action-art { display: block; background: radial-gradient(ellipse at 50% 48%, #f7f7ed, #dfe7de); }
.action-gallery li:nth-child(2) .action-art { background: radial-gradient(ellipse at 50% 48%, #fff4df, #e9dbc6); }
.action-gallery li:nth-child(3) .action-art { background: radial-gradient(ellipse at 50% 48%, #f0eff9, #dadceb); }
.action-gallery li:nth-child(4) .action-art { background: radial-gradient(ellipse at 50% 48%, #ffedda, #ecd5bf); }
.action-gallery li:nth-child(5) .action-art { background: radial-gradient(ellipse at 50% 48%, #faeeea, #ead9da); }
.action-art img { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.action-caption { padding: 11px 13px 13px; display: grid; gap: 5px; }
.action-caption strong { display: flex; justify-content: space-between; }
.action-caption strong span { color: #46665a; }
.action-caption small { color: var(--muted); font: .72rem var(--mono); }

.quality { padding: clamp(22px, 4.4vw, 58px); background: #e8ede4; border: 1px solid #d8dfd3; border-radius: 18px; margin-bottom: clamp(42px, 5.8vw, 85px); }
.comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(8px, 2vw, 24px); margin-top: 25px; }
.detail-card { margin: 0; min-width: 0; border: 1px solid #cbd5c8; border-radius: 11px; background: #f9faf4; overflow: hidden; }
.detail-crop { position: relative; overflow: hidden; aspect-ratio: 210 / 136; }
.detail-crop img { position: absolute; width: 213.333%; height: auto; left: -64.29%; top: -66.18%; }
.detail-card figcaption { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 5px 12px; padding: 11px 13px; color: #365248; font: .77rem var(--mono); }
.detail-card strong { color: #244136; }
figcaption a { text-decoration: underline; text-underline-offset: 3px; }
.quality-note { margin: 17px 0 0; color: #3d5548; font-size: .88rem; line-height: 1.55; }

.export { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 5fr); align-items: start; gap: clamp(24px, 5.6vw, 84px); }
.export p { max-width: 48ch; }
.pack-details { margin: 25px 0 0; font-size: .88rem; max-width: 490px; }
.pack-details div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.pack-details dt { font-weight: 720; }
.pack-details dd { margin: 0; text-align: right; color: var(--muted); }
.code-card { min-width: 0; border-radius: 13px; overflow: hidden; background: #202e34; color: #f0f3e8; border: 1px solid #35464a; }
.code-bar { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px 9px 18px; border-bottom: 1px solid #465658; font-size: .82rem; font-weight: 650; }
.code-card button { padding: 6px 11px; border: 1px solid #69817d; border-radius: 5px; background: #304544; color: #eff5eb; font-weight: 650; }
.code-card button:hover { background: #3e5653; }
.code-card :focus-visible { outline-color: #fbc87a; outline-offset: -2px; }
.code-card pre { margin: 0; padding: 16px 18px; overflow-x: auto; font: .77rem/1.55 var(--mono); }
.code-card code { font: inherit; }
.syntax { color: #f5c780; }
.code-status:not(:empty) { display: block; padding: 0 18px 12px; color: #bce7d1; font-size: .8rem; }

.faq { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 5fr); gap: clamp(18px, 5.6vw, 84px); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { padding: 12px 0; min-height: 44px; cursor: pointer; font-weight: 700; }
.faq p { color: var(--muted); line-height: 1.6; margin: 2px 0 14px; }
.site-footer { border-top: 1px solid var(--line); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 68px; color: #365248; font-size: .85rem; font-weight: 650; }
.footer-inner a:hover { text-decoration: underline; }

@media (max-width: 1080px) {
  .shell { width: calc(100% - 56px); }
  kbd { display: none; }
  .game-console { right: 28px; width: 420px; }
  .game-controls { gap: 7px; }
  .controls { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (min-width: 751px) and (max-width: 1080px) and (max-height: 810px) {
  .intro { padding-top: 112px; }
}
@media (max-width: 750px) {
  .shell { width: calc(100% - 32px); }
  .header-inner { min-height: 58px; }
  .hero { min-height: max(680px, 100svh); align-items: start; }
  .intro { padding: 110px 0 0; }
  h1 { max-width: 12.5ch; font-size: clamp(2.55rem, 10vw, 4.2rem); }
  .intro > p { margin-top: 15px; max-width: 35ch; }
  .sample-download { margin-top: 18px; }
  .sample-download p { margin-top: 10px; }
  .stage { background-position: 72% 50%; }
  .stage::after, .stage[data-view="cutout"]::after {
    background: linear-gradient(180deg,#07181de0, #07181da8 36%, transparent 60%, #051318 99%);
  }
  .game-console { inset: auto 16px 16px; width: auto; padding: 8px; }
  .level-info { display: grid; gap: 3px; padding-left: 3px; }
  .level-info h2 { font-size: .84rem; }
  .playback { padding-left: 14px; font-size: .65rem; }
  .views button { min-height: 29px; }
  .movement { grid-template-columns: repeat(2, minmax(32px, 1fr)); }
  .action-gallery { grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); }
  .export, .faq { grid-template-columns: minmax(0, 1fr); }
  .comparison { margin-top: 16px; }
  .detail-card figcaption { padding: 8px; }
  .quality { margin-inline: -3px; }
  nav a[href="#quality"] { display: none; }
}
@media (max-width: 480px) {
  nav a[href="#export"] { display: none; }
}
@media (max-width: 390px) {
  nav { gap: 13px; font-size: .78rem; }
  .brand { font-size: 1.12rem; gap: 7px; }
  .brand-mark { width: 28px; height: 28px; padding: 6px; }
  .game-controls, .movement, .controls { gap: 4px; }
  .game-controls button { padding-inline: 0; font-size: .75rem; }
  .movement button { font-size: 1rem; }
  .movement { grid-template-columns: repeat(2, 30px); }
}
@media (max-width: 350px) {
  h1 { max-width: 100%; font-size: 2.14rem; }
  nav a[href="#preview"] { display: none; }
  .game-console { inset-inline: 10px; }
}
@media (max-width: 750px) and (max-height: 740px) {
  .intro { padding-top: 92px; }
}
