:root {
  --lcd: #e0f8cf;
  --lcd-light: #f3ffe5;
  --lime: #8bac0f;
  --leaf: #86c06c;
  --moss: #306850;
  --ink: #071821;
  --muted: #426753;
  --line: rgba(7, 24, 33, .18);
  --scene-sky: #a6d785;
  --scene-ground: #c8e7ae;
  --scene-ground-light: #d4edbb;
  --scene-hill: #91c878;
  --scene-river: #527b61;
  --scene-sun: #f0d65c;
  --pixel: "Press Start 2P", "Lucida Console", monospace;
  --mono: "Space Mono", "Courier New", monospace;
  --arabic: "Noto Sans Arabic", system-ui, sans-serif;
  --shadow-pixel: 7px 7px 0 var(--ink);
}
:root[data-palette="amber"] {
  --lcd: #f3e3c2; --lcd-light: #fff4dc; --lime: #d78a35; --leaf: #d9b66d; --moss: #76512e;
  --ink: #302116; --muted: #71583d; --line: rgba(48, 33, 22, .2);
  --scene-sky: #e4bd79; --scene-ground: #f0d6a1; --scene-ground-light: #f7e2b6;
  --scene-hill: #c59b56; --scene-river: #9a713c; --scene-sun: #ed8a42;
}
:root[data-palette="night"] {
  --lcd: #d2e4ec; --lcd-light: #edf7ff; --lime: #5da5fa; --leaf: #79a9cf; --moss: #345b80;
  --ink: #112137; --muted: #4e6781; --line: rgba(17, 33, 55, .2);
  --scene-sky: #8eb3d2; --scene-ground: #d9e9f3; --scene-ground-light: #e8f3fa;
  --scene-hill: #7398bb; --scene-river: #456b8e; --scene-sun: #f5cf6e;
}
* { box-sizing: border-box; }
.hidden { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body { margin: 0; background: var(--lcd); color: var(--ink); font-family: var(--mono); overflow-x: hidden; }
body[dir="rtl"] { font-family: var(--arabic), var(--mono); }
button, a { color: inherit; font: inherit; }
a { text-decoration: none; }
button { cursor: pointer; }
::selection { color: var(--lcd); background: var(--ink); }
.scanlines { position: fixed; inset: 0; z-index: 10; pointer-events: none; opacity: .06; background: repeating-linear-gradient(0deg, transparent 0 3px, var(--ink) 4px); mix-blend-mode: multiply; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 22px; width: 100%; padding: 15px clamp(20px, 5vw, 76px); border-bottom: 2px solid var(--ink); background: var(--lcd); backdrop-filter: blur(12px); }
.brand { display: inline-flex; gap: 10px; align-items: center; font: 700 13px var(--pixel); letter-spacing: -1px; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; background: var(--ink); color: var(--lcd); font: 700 14px var(--pixel); box-shadow: 3px 3px 0 var(--moss); }
.brand-dot { color: var(--lime); }
.main-nav { display: flex; gap: clamp(14px, 3vw, 38px); margin-inline: auto; }
.main-nav a, .owner-link, .language-toggle { font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.main-nav a { position: relative; padding: 9px 0; transition: color .2s; }
.main-nav a::after { position: absolute; right: 0; bottom: 3px; left: 0; height: 2px; background: var(--lime); content: ""; transform: scaleX(0); transform-origin: left; transition: transform .2s; }
.main-nav a:hover { color: var(--moss); }
.main-nav a:hover::after { transform: scaleX(1); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.settings-toggle { position: relative; z-index: 1; display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 1px solid var(--ink); background: transparent; color: var(--ink); font-size: 18px; touch-action: manipulation; pointer-events: auto; transition: transform .2s, background .2s, color .2s; }
.settings-toggle:hover, .settings-toggle[aria-expanded="true"] { transform: rotate(35deg); background: var(--ink); color: var(--lcd); }
.settings-panel { position: absolute; z-index: 80; pointer-events: auto; top: calc(100% + 9px); right: clamp(20px, 5vw, 76px); width: min(295px, calc(100vw - 28px)); padding: 15px; border: 2px solid var(--ink); background: var(--lcd-light); box-shadow: 6px 6px 0 var(--moss); animation: settings-in .18s both; }
.settings-panel-heading { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; min-height: 40px; margin-bottom: 14px; font-size: 10px; }
.settings-panel-heading b { flex: 1; font-family: var(--pixel); font-size: 7px; line-height: 1.7; }
.settings-spark { color: var(--lime); font-size: 15px; }
.settings-close { position: relative; z-index: 2; display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; margin: -2px; padding: 0; border: 1px solid var(--ink); background: var(--lcd); color: var(--ink); font-size: 24px; line-height: 1; cursor: pointer; touch-action: manipulation; pointer-events: auto; }
.settings-close:hover { background: var(--ink); color: var(--lcd); }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 37px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 9px; }
.settings-row select, .sound-toggle { max-width: 155px; min-height: 29px; padding: 5px 7px; border: 1px solid var(--ink); border-radius: 0; background: var(--lcd); color: var(--ink); font: 9px var(--mono); }
.settings-row select:focus, .sound-toggle:focus-visible, .settings-toggle:focus-visible, .settings-close:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.sound-toggle { min-width: 90px; cursor: pointer; font-weight: 700; }
[dir="rtl"] .settings-panel { right: auto; left: clamp(20px, 5vw, 76px); }
.language-toggle { min-width: 58px; padding: 8px 10px; border: 1px solid var(--ink); background: transparent; font-size: 10px; transition: background .2s, color .2s, transform .2s; }
.language-toggle:hover { background: var(--ink); color: var(--lcd); transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--lime); }
.owner-link { padding: 9px 12px; background: var(--ink); color: var(--lcd); font-size: 10px; box-shadow: 3px 3px 0 var(--moss); transition: transform .2s, box-shadow .2s; }
.owner-link:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--moss); }
.section-wrap { width: min(1160px, calc(100% - 48px)); margin-inline: auto; }
.hero { position: relative; display: grid; grid-template-columns: minmax(0, .95fr) minmax(420px, 1.05fr); align-items: center; gap: clamp(40px, 8vw, 110px); min-height: 650px; padding-block: 78px 96px; }
.hero::before { position: absolute; z-index: -1; top: 16%; left: 39%; width: 290px; height: 290px; border: 1px solid rgba(48, 104, 80, .12); border-radius: 50%; content: ""; box-shadow: 0 0 0 34px rgba(48, 104, 80, .035), 0 0 0 72px rgba(48, 104, 80, .025); }
.hero-copy { position: relative; z-index: 2; padding-block: 20px; animation: arrive .7s both; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: var(--moss); font: 700 9px var(--pixel); letter-spacing: .02em; line-height: 1.8; }
.status-pixel { width: 9px; height: 9px; background: var(--lime); box-shadow: 3px 3px 0 var(--moss); animation: blink 1.5s steps(2, jump-none) infinite; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 20px; margin-top: 26px; font: 400 clamp(29px, 4vw, 48px)/1.7 var(--pixel); letter-spacing: -.065em; }
h1 strong { display: inline-block; color: var(--moss); font-size: clamp(40px, 6vw, 70px); letter-spacing: -.11em; text-shadow: 4px 4px 0 var(--leaf); animation: title-pop .65s .14s both; }
.hero-lead { max-width: 440px; margin-bottom: 30px; color: var(--ink); font-size: clamp(15px, 1.6vw, 18px); font-weight: 700; line-height: 1.8; }
.hero-buttons { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.pixel-button { display: inline-flex; align-items: center; justify-content: center; gap: 18px; min-height: 50px; padding: 0 18px; border: 2px solid var(--ink); border-radius: 0; font: 700 10px var(--pixel); line-height: 1.7; transition: transform .18s, box-shadow .18s, color .18s, background .18s; }
.primary-button { background: var(--ink); color: var(--lcd); box-shadow: 5px 5px 0 var(--moss); }
.primary-button:hover { background: var(--moss); transform: translate(-3px, -3px); box-shadow: 8px 8px 0 var(--ink); }
.text-link { display: inline-flex; align-items: center; gap: 12px; padding-block: 8px; border-bottom: 1px solid var(--moss); color: var(--moss); font-size: 11px; font-weight: 700; }
.text-link span:last-child { transition: transform .2s; }
.text-link:hover span:last-child { transform: translate(3px, 3px); }
.hero-meta { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 50px; color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.hero-meta span { display: flex; align-items: center; gap: 7px; }
.meta-spark { color: var(--lime); font-size: 15px; font-style: normal; }
.hero-art { position: relative; padding: 17px; background: var(--ink); color: var(--lcd); box-shadow: 12px 12px 0 var(--moss); transform: perspective(1100px) rotateY(-5deg) rotateX(2deg); transform-style: preserve-3d; animation: scene-enter .85s .1s both; transition: transform .35s; }
.hero-art:hover { transform: perspective(1100px) rotateY(-1deg) rotateX(0deg) translateY(-4px); }
.art-topline, .art-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; font: 700 8px var(--pixel); letter-spacing: .08em; }
.art-topline { padding: 0 2px 15px; }
.live-dot { display: flex; align-items: center; gap: 7px; color: var(--lime); }
.live-dot i { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 9px var(--lime); animation: blink 1.2s infinite; }
.hero-canvas-frame { position: relative; overflow: hidden; border: 2px solid var(--moss); background: var(--scene-sky); }
.hero-canvas-frame::after { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(243, 255, 229, .04), rgba(7, 24, 33, .1)); content: ""; }
#heroCanvas { display: block; width: 100%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; }
.canvas-corner { position: absolute; z-index: 1; width: 11px; height: 11px; border: 2px solid var(--lcd); }
.corner-one { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.corner-two { right: 10px; bottom: 10px; border-top: 0; border-left: 0; }
.art-footer { padding: 14px 3px 1px; color: #b4d19d; font: 700 8px var(--mono); letter-spacing: .04em; }
.pixel-arrows { color: var(--lime); font-size: 11px; letter-spacing: 6px; }
.floating-tag { position: absolute; display: flex; align-items: center; gap: 8px; border: 2px solid var(--ink); background: var(--lcd); color: var(--ink); padding: 9px 12px; box-shadow: 4px 4px 0 var(--moss); font: 700 7px var(--pixel); }
.tag-top { top: 16%; right: -29px; transform: translateZ(45px); }
.tag-top span:first-child { display: grid; place-items: center; width: 22px; height: 22px; background: var(--lime); }
.tag-bottom { bottom: 9%; left: -38px; transform: translateZ(36px); }
.tag-star { color: var(--lime); font-size: 18px; }
.scroll-cue { position: absolute; right: 50%; bottom: 25px; display: grid; place-items: center; width: 24px; height: 38px; border: 1px solid var(--moss); border-radius: 20px; transform: translateX(50%); }
.scroll-cue span { width: 4px; height: 7px; background: var(--moss); animation: scroll 1.5s infinite; }
.game-section { padding-block: 95px 112px; border-top: 1px dashed rgba(7, 24, 33, .3); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 40px; margin-bottom: 28px; }
.section-heading h2, .about-copy h2 { margin: 15px 0 0; font: 400 clamp(24px, 3vw, 34px)/1.6 var(--pixel); letter-spacing: -.07em; }
.section-heading > p { max-width: 335px; margin-bottom: 4px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.eyebrow-index { display: inline-grid; place-items: center; width: 23px; height: 23px; border: 1px solid var(--moss); color: var(--ink); }
.game-shell { background: var(--ink); color: var(--lcd); box-shadow: var(--shadow-pixel); }
.pixel-border { border: 3px solid var(--ink); outline: 1px dashed var(--lcd); outline-offset: -8px; }
.game-topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 58px; padding: 12px 19px; border-bottom: 1px solid rgba(224,248,207,.25); }
.game-label { display: flex; align-items: center; gap: 11px; font: 700 8px var(--pixel); }
.tiny-cartridge { color: var(--lime); font-size: 14px; }
.game-stats { display: flex; align-items: center; gap: 24px; }
.game-stats > span { display: flex; flex-direction: column; gap: 5px; }
.game-stats small { color: var(--leaf); font: 700 7px var(--pixel); }
.game-stats b { font: 700 12px var(--pixel); }
.game-stats .game-state { flex-direction: row; align-items: center; gap: 7px; padding: 9px 10px; border: 1px solid rgba(224,248,207,.3); }
.game-state b { font-size: 7px; }
.game-state i { width: 7px; height: 7px; background: var(--lime); }
.game-state i.running { background: var(--scene-sun); animation: blink .7s infinite; }
.game-state i.won { background: var(--leaf); }
.game-stage { position: relative; width: min(100%, 900px); margin: 0 auto; background: var(--scene-sky); }
#gameCanvas { display: block; width: 100%; aspect-ratio: 8 / 5; object-fit: contain; image-rendering: pixelated; image-rendering: crisp-edges; }
.game-overlay, .win-overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 22px; background: rgba(7, 24, 33, .66); transition: opacity .2s, visibility .2s; }
.game-overlay.hidden, .win-overlay.hidden { visibility: hidden; opacity: 0; pointer-events: none; }
.overlay-card { display: flex; align-items: center; flex-direction: column; max-width: 340px; padding: 24px 26px; border: 2px solid var(--ink); background: var(--lcd); color: var(--ink); text-align: center; box-shadow: 5px 5px 0 var(--lime); }
.overlay-icon { margin-bottom: 14px; color: var(--lime); font-size: 28px; text-shadow: 2px 2px 0 var(--ink); }
.overlay-card strong { font: 400 12px/1.8 var(--pixel); }
.overlay-card p { margin: 12px 0 18px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.overlay-card .pixel-button { min-height: 42px; font-size: 8px; }
.overlay-card #secret-level-button, .overlay-card #frontier-button { margin-bottom: 9px; }
.dark-game-button { background: var(--lcd); color: var(--ink); box-shadow: 3px 3px 0 var(--moss); }
.dark-game-button:hover { background: var(--leaf); }
.game-bottom { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 14px 18px; border-top: 1px solid rgba(224,248,207,.25); }
.controls-hint { display: flex; align-items: center; gap: 4px; color: var(--lcd); font-size: 9px; }
.key-cap { display: inline-grid; place-items: center; min-width: 19px; height: 20px; padding: 0 4px; border: 1px solid rgba(224,248,207,.52); color: var(--lcd); font-size: 9px; box-shadow: 0 2px 0 var(--moss); }
.key-letter { min-width: 17px; }
.hint-or { padding-inline: 4px; color: var(--leaf); }
.game-hint { color: var(--lcd); font-size: 9px; }
.mobile-pad { display: none; }
.about-section { position: relative; display: grid; grid-template-columns: 104px 1fr minmax(250px, .8fr); align-items: center; gap: clamp(28px, 5vw, 67px); padding-block: 95px 105px; border-top: 1px dashed rgba(7, 24, 33, .3); border-bottom: 1px dashed rgba(7, 24, 33, .3); }
.about-stamp { display: flex; align-items: center; flex-direction: column; justify-content: center; gap: 9px; width: 92px; height: 114px; border: 2px solid var(--ink); outline: 1px dashed var(--ink); outline-offset: -7px; background: var(--lime); font: 700 7px var(--pixel); transform: rotate(-5deg); box-shadow: 4px 4px 0 var(--moss); }
.about-stamp b { display: grid; place-items: center; width: 40px; height: 40px; background: var(--ink); color: var(--lcd); font-size: 13px; }
.about-copy { max-width: 500px; }
.about-main { margin: 20px 0; color: var(--ink); font-size: 14px; line-height: 1.9; }
.about-note { display: flex; gap: 12px; margin: 24px 0; padding: 15px 17px; border-left: 3px solid var(--lime); background: rgba(134, 192, 108, .18); }
.about-note p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.8; }
.note-icon { color: var(--lime); }
.dark-link { margin-top: 3px; }
.about-art { position: relative; min-height: 225px; overflow: hidden; border: 2px solid var(--ink); background: linear-gradient(180deg, var(--scene-sky) 0 49%, var(--leaf) 49%); box-shadow: 7px 7px 0 var(--ink); image-rendering: pixelated; }
.about-art::after { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, transparent 0 6px, rgba(7,24,33,.09) 7px); content: ""; }
.pixel-sun { position: absolute; top: 26px; right: 36px; width: 43px; height: 43px; background: var(--scene-sun); box-shadow: 0 0 0 7px color-mix(in srgb, var(--scene-sun) 22%, transparent); }
.mesa { position: absolute; bottom: 40px; width: 135px; height: 82px; clip-path: polygon(0 100%, 0 54%, 22% 54%, 22% 25%, 47% 25%, 47% 0, 75% 0, 75% 17%, 100% 17%, 100% 100%); }
.mesa-back { left: 25px; background: var(--moss); }
.mesa-front { right: -15px; bottom: 13px; width: 175px; height: 89px; background: var(--moss); opacity: .8; }
.pixel-horse { position: absolute; z-index: 2; bottom: 38px; left: 41%; width: 64px; height: 28px; background: var(--ink); box-shadow: 13px 19px 0 -6px var(--ink), 45px 19px 0 -6px var(--ink); animation: horse-bob 1s steps(2) infinite; }
.pixel-horse::before { position: absolute; top: -20px; right: 0; width: 27px; height: 24px; background: var(--ink); clip-path: polygon(0 24%, 53% 24%, 70% 0, 92% 9%, 100% 65%, 72% 100%, 0 100%); content: ""; }
.pixel-horse::after { position: absolute; top: -29px; right: 2px; width: 32px; height: 8px; background: var(--moss); border-top: 4px solid var(--ink); content: ""; }
.pixel-horse i { position: absolute; top: -16px; left: 26px; width: 7px; height: 22px; background: var(--scene-sky); }
.about-art-label { position: absolute; right: 10px; bottom: 7px; z-index: 3; color: var(--lcd); font: 700 7px var(--pixel); }
.links-section { padding-block: 94px 105px; }
.links-heading { margin-bottom: 28px; }
.social-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.social-card { display: flex; align-items: center; gap: 12px; min-height: 82px; padding: 15px; border: 1px solid var(--ink); background: rgba(243,255,229,.5); box-shadow: 3px 3px 0 rgba(7,24,33,.22); transition: transform .2s, box-shadow .2s, background .2s; }
.social-card:hover { transform: translate(-3px, -3px); box-shadow: 6px 6px 0 var(--ink); background: var(--lcd-light); }
.social-icon { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border: 1px solid var(--ink); background: var(--leaf); }
.social-icon svg { width: 23px; height: 23px; fill: none; stroke: var(--ink); stroke-width: 1.7; }
.social-icon .icon-fill, .ps-icon svg, .discord-icon svg { fill: var(--ink); stroke: none; }
.social-card > span:nth-child(2) { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.custom-social-copy { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.social-card b { font: 700 8px var(--pixel); }
.social-card small { color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; }
.social-arrow { margin-inline-start: auto; color: var(--moss); font-size: 16px; }
.custom-links { display: contents; }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px clamp(20px, 5vw, 76px); border-top: 2px solid var(--ink); background: var(--scene-ground); }
.footer-brand { font-size: 9px; }
.footer-brand .brand-mark { width: 26px; height: 26px; font-size: 11px; }
.site-footer p { margin: 0; color: var(--muted); font-size: 10px; }
.back-top { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--ink); font-size: 15px; transition: background .2s, color .2s; }
.back-top:hover { background: var(--ink); color: var(--lcd); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: min(380px, calc(100% - 48px)); padding: 12px 16px; border: 2px solid var(--ink); background: var(--lcd-light); color: var(--ink); font-size: 11px; line-height: 1.6; box-shadow: 4px 4px 0 var(--ink); opacity: 0; transform: translateY(16px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
[dir="rtl"] .toast { right: auto; left: 24px; }
.rtl-inline { direction: rtl; }
[dir="rtl"] .eyebrow { font-family: var(--arabic), var(--mono); font-size: 10px; }
[dir="rtl"] .main-nav a, [dir="rtl"] .owner-link, [dir="rtl"] .language-toggle { font-family: var(--arabic), var(--mono); }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] .overlay-card strong { font-family: var(--arabic), var(--pixel); letter-spacing: 0; font-weight: 800; }
[dir="rtl"] .hero-meta { letter-spacing: 0; }
[dir="rtl"] .pixel-button, [dir="rtl"] .brand, [dir="rtl"] .art-topline, [dir="rtl"] .game-label, [dir="rtl"] .game-stats small { font-family: var(--arabic), var(--mono); letter-spacing: 0; }
[dir="rtl"] .about-note { border-right: 3px solid var(--lime); border-left: 0; }
[dir="rtl"] .social-card { text-align: right; }
[dir="rtl"] .social-arrow { margin-inline-start: 0; margin-inline-end: auto; }
[dir="rtl"] .tag-top { right: auto; left: -29px; }
[dir="rtl"] .tag-bottom { right: -38px; left: auto; }
[dir="rtl"] .hero-art { transform: perspective(1100px) rotateY(5deg) rotateX(2deg); }
[dir="rtl"] .hero-art:hover { transform: perspective(1100px) rotateY(1deg) rotateX(0deg) translateY(-4px); }
@keyframes arrive { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes settings-in { from { opacity: 0; transform: translateY(-5px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes scene-enter { from { opacity: 0; transform: perspective(1100px) rotateY(-12deg) translateY(14px); } to { opacity: 1; transform: perspective(1100px) rotateY(-5deg) rotateX(2deg); } }
@keyframes title-pop { from { opacity: 0; transform: translateY(10px) scale(.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes blink { 50% { opacity: .35; } }
@keyframes scroll { 0% { opacity: 0; transform: translateY(-4px); } 35% { opacity: 1; } 100% { opacity: 0; transform: translateY(6px); } }
@keyframes horse-bob { 50% { transform: translateY(-2px); } }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr 1fr; gap: 32px; min-height: 570px; }
  .hero-art { padding: 13px; }
  .tag-top { right: -13px; }
  .tag-bottom { left: -20px; }
  .about-section { grid-template-columns: 78px 1fr minmax(190px, .7fr); gap: 22px; }
  .about-stamp { width: 74px; height: 98px; font-size: 6px; }
}
@media (max-width: 680px) {
  html { scroll-padding-top: 80px; }
  .topbar { min-height: 66px; padding: 11px 16px; gap: 10px; }
  .brand { gap: 7px; font-size: 10px; }
  .brand-mark { width: 27px; height: 27px; font-size: 11px; }
  .main-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 30; justify-content: space-around; gap: 6px; margin: 0; padding: 13px 9px calc(12px + env(safe-area-inset-bottom)); border-top: 2px solid var(--ink); background: var(--lcd); box-shadow: 0 -5px 0 rgba(7,24,33,.08); }
  .main-nav a { font-size: 9px; }
  .top-actions { gap: 7px; }
  .settings-toggle { flex-basis: 40px; width: 40px; height: 40px; font-size: 16px; }
  .settings-panel { top: calc(100% + 7px); right: 10px; }
  [dir="rtl"] .settings-panel { right: auto; left: 10px; }
  .language-toggle, .owner-link { padding: 7px 8px; font-size: 9px; }
  .section-wrap { width: min(100% - 32px, 520px); }
  .hero { grid-template-columns: 1fr; gap: 32px; min-height: unset; padding-block: 56px 67px; }
  .hero::before { top: 6%; left: 30%; width: 230px; height: 230px; }
  .hero-copy { padding: 0; }
  .eyebrow { font-size: 7px; }
  h1 { margin-top: 21px; font-size: clamp(24px, 7vw, 37px); }
  h1 strong { font-size: clamp(36px, 11vw, 55px); }
  .hero-lead { font-size: 14px; }
  .pixel-button { min-height: 46px; gap: 10px; padding-inline: 12px; font-size: 8px; }
  .hero-meta { margin-top: 28px; font-size: 8px; }
  .hero-art { width: calc(100% - 11px); max-width: 460px; margin: 0 auto 10px; transform: none; }
  .hero-art:hover { transform: translateY(-3px); }
  .floating-tag { padding: 7px 8px; font-size: 6px; }
  .tag-top { top: 17%; right: -14px; }
  .tag-bottom { bottom: 7%; left: -17px; }
  .scroll-cue { display: none; }
  .game-section, .links-section { padding-block: 65px 74px; }
  .section-heading { align-items: start; flex-direction: column; gap: 10px; margin-bottom: 21px; }
  .section-heading h2, .about-copy h2 { font-size: 22px; }
  .section-heading > p { max-width: 440px; margin: 0; font-size: 11px; }
  .game-topbar { align-items: start; flex-direction: column; gap: 13px; padding: 13px 14px; }
  .game-stats { width: 100%; justify-content: space-between; gap: 10px; }
  .game-stats small { font-size: 6px; }
  .game-stats b { font-size: 10px; }
  .game-stats .game-state { padding: 6px 7px; }
  .game-stage { min-height: 200px; }
  #gameCanvas { min-height: 200px; object-fit: cover; }
  .overlay-card { max-width: 280px; padding: 16px; }
  .overlay-card strong { font-size: 10px; }
  .overlay-card p { margin-block: 10px 14px; font-size: 10px; }
  .game-bottom { flex-wrap: wrap; justify-content: center; padding: 11px; }
  .controls-hint { display: none; }
  .mobile-pad { display: flex; align-items: center; gap: 7px; }
  .mobile-pad div { display: flex; gap: 5px; }
  .mobile-pad button { display: grid; place-items: center; width: 34px; height: 32px; border: 1px solid var(--lcd); background: transparent; color: var(--lcd); font-size: 17px; box-shadow: 0 2px 0 var(--moss); touch-action: manipulation; }
  .mobile-pad button:active { background: var(--moss); transform: translateY(2px); box-shadow: none; }
  .game-hint { width: 100%; text-align: center; }
  .about-section { grid-template-columns: 1fr; gap: 23px; padding-block: 66px 72px; }
  .about-stamp { position: absolute; top: 65px; right: 0; width: 62px; height: 78px; gap: 5px; font-size: 5px; }
  .about-stamp b { width: 28px; height: 28px; font-size: 10px; }
  .about-copy { padding-right: 1px; }
  [dir="rtl"] .about-stamp { right: auto; left: 0; }
  .about-main { max-width: 480px; font-size: 13px; }
  .about-art { width: min(100%, 420px); min-height: 210px; margin: 0 auto; }
  .social-grid { grid-template-columns: 1fr; gap: 10px; }
  .social-card { min-height: 70px; }
  .site-footer { margin-bottom: 51px; padding: 15px 17px; }
  .site-footer p { font-size: 9px; }
  .footer-brand { font-size: 8px; }
  .toast { right: 12px; bottom: 74px; }
  [dir="rtl"] .toast { right: auto; left: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


/* JIElIl mobile game fix: expose reliable, finger-sized controls on touch devices. */
@media (hover: none), (pointer: coarse) {
  .mobile-pad {
    display: flex !important;
    align-items: center;
    gap: 8px;
    touch-action: none;
  }

  .mobile-pad div {
    display: flex;
    gap: 7px;
  }

  .mobile-pad button {
    width: 48px;
    height: 48px;
    min-width: 48px;
    font-size: 21px;
    border-radius: 8px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
  }

  .controls-hint {
    display: none !important;
  }

  .game-bottom {
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }

  .game-hint {
    flex-basis: 100%;
    text-align: center;
  }
}


/* JIElIl mobile header visibility fix */
@media (max-width: 680px) {
  .topbar {
    gap: 6px;
    padding-inline: 8px;
  }

  .brand {
    flex: 0 0 auto;
  }

  .top-actions {
    display: flex !important;
    flex: 0 0 auto;
    margin-inline-start: auto;
    gap: 5px;
    position: relative;
    z-index: 25;
    visibility: visible !important;
  }

  .top-actions .settings-toggle,
  .top-actions .language-toggle,
  .top-actions .owner-link {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    visibility: visible !important;
    opacity: 1 !important;
    white-space: nowrap;
  }

  .top-actions .settings-toggle {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .top-actions .language-toggle,
  .top-actions .owner-link {
    min-height: 36px;
    padding: 6px 7px;
    font-size: 8px !important;
  }
}

@media (max-width: 360px) {
  .topbar {
    gap: 4px;
    padding-inline: 6px;
  }

  .brand {
    gap: 4px;
    font-size: 8px;
  }

  .brand-mark {
    width: 23px;
    height: 23px;
  }

  .top-actions {
    gap: 4px;
  }

  .top-actions .settings-toggle {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .top-actions .language-toggle,
  .top-actions .owner-link {
    min-height: 32px;
    padding-inline: 5px;
    font-size: 7px !important;
  }
}


/* JIElIl mobile controls visibility fix */
@media (max-width: 680px) {
  .topbar {
    position: sticky !important;
    isolation: isolate;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center;
    gap: 8px;
    min-height: 66px;
    padding: 10px 12px;
    overflow: visible;
    z-index: 100;
  }

  .brand {
    grid-column: 1;
    min-width: 0;
  }

  .top-actions {
    grid-column: 2;
    justify-self: end;
    position: relative;
    z-index: 101;
    display: flex !important;
    align-items: center;
    flex-wrap: nowrap;
    flex: 0 0 auto;
    gap: 5px;
    min-width: max-content;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto;
  }

  .settings-toggle {
    display: grid !important;
    place-items: center;
    flex: 0 0 38px;
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    touch-action: manipulation;
  }

  .language-toggle,
  .owner-link {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 38px;
    padding: 7px 9px;
    line-height: 1.2;
    white-space: nowrap;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto;
    touch-action: manipulation;
  }

  .language-toggle { min-width: 54px; }
  .owner-link { min-width: 56px; }

  .settings-panel {
    top: calc(100% + 7px);
    right: 12px;
    z-index: 120;
    width: min(295px, calc(100vw - 24px));
  }

  [dir="rtl"] .settings-panel {
    right: auto;
    left: 12px;
  }
}

@media (max-width: 360px) {
  .topbar { padding-inline: 10px; gap: 6px; }
  .brand { gap: 5px; font-size: 9px; }
  .brand-mark { width: 25px; height: 25px; flex-basis: 25px; }
  .top-actions { gap: 4px; }
  .settings-toggle {
    flex-basis: 36px;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
  }
  .language-toggle,
  .owner-link {
    min-height: 36px;
    padding-inline: 6px;
    font-size: 8px;
  }
  .language-toggle { min-width: 48px; }
  .owner-link { min-width: 50px; }
}


/* JIElIl mobile separated action row fix 20260926 */
@media (max-width: 680px) {
  .topbar {
    position: sticky !important;
    isolation: isolate;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: "brand" "actions";
    align-items: center;
    justify-content: stretch;
    gap: 8px;
    min-height: 0;
    padding: 10px 12px;
    overflow: visible;
    z-index: 100;
  }

  .topbar > .brand {
    grid-area: brand;
    grid-column: 1;
    justify-self: start;
    min-width: 0;
  }

  .topbar > .top-actions {
    grid-area: actions;
    grid-column: 1;
    justify-self: stretch;
    position: relative;
    z-index: 101;
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
    min-width: 0;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto;
  }

  .topbar .settings-toggle {
    display: grid !important;
    place-items: center;
    flex: 0 0 42px;
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    touch-action: manipulation;
  }

  .topbar .language-toggle,
  .topbar .owner-link {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 42px;
    padding: 7px 12px;
    white-space: nowrap;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto;
    touch-action: manipulation;
  }

  .settings-panel {
    top: calc(100% + 7px);
    right: 12px;
    z-index: 120;
    width: min(295px, calc(100vw - 24px));
  }

  [dir="rtl"] .settings-panel {
    right: auto;
    left: 12px;
  }
}

@media (max-width: 360px) {
  .topbar { padding-inline: 10px; gap: 7px; }
  .topbar > .top-actions { gap: 6px; }

  .topbar .settings-toggle {
    flex-basis: 38px;
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
  }

  .topbar .language-toggle,
  .topbar .owner-link {
    min-height: 38px;
    padding-inline: 9px;
    font-size: 8px;
  }
}

/* Mobile header rows: keep navigation separate from action buttons */
@media (max-width: 680px) {
  .topbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: "brand" "actions" "nav" !important;
    align-items: center;
    gap: 8px;
    height: auto;
    min-height: 0;
    padding: 10px 12px;
    overflow: visible;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  .topbar > .brand {
    grid-area: brand;
    grid-column: 1;
    justify-self: start;
    min-width: 0;
  }

  .topbar > .top-actions {
    grid-area: actions;
    grid-column: 1;
    position: relative;
    z-index: 101;
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
    min-width: 0;
  }

  .topbar .settings-toggle {
    display: grid !important;
    flex: 0 0 42px;
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    touch-action: manipulation;
  }

  .topbar .language-toggle,
  .topbar .owner-link {
    display: inline-flex !important;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 7px 10px;
    white-space: nowrap;
    touch-action: manipulation;
  }

  .topbar > nav.main-nav {
    grid-area: nav;
    grid-column: 1;
    position: static !important;
    inset: auto !important;
    display: flex !important;
    justify-content: space-around;
    align-items: center;
    gap: 4px;
    width: 100%;
    margin: 0 !important;
    padding: 7px 0 2px !important;
    border-top: 1px dashed var(--line);
    background: transparent !important;
    box-shadow: none !important;
  }

  .topbar > nav.main-nav a {
    flex: 1 1 0;
    padding: 6px 1px;
    text-align: center;
    white-space: nowrap;
    font-size: 8px;
  }

  .topbar.owner-topbar {
    grid-template-areas: "brand" "actions" !important;
  }

  .owner-topbar > .owner-top-title {
    display: none !important;
  }

  .settings-panel {
    z-index: 120;
    width: min(295px, calc(100vw - 24px));
  }
}

@media (max-width: 360px) {
  .topbar { padding-inline: 10px; gap: 6px; }
  .topbar > .top-actions { gap: 6px; }
  .topbar .settings-toggle {
    flex-basis: 38px;
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
  }
  .topbar .language-toggle,
  .topbar .owner-link {
    min-height: 38px;
    padding-inline: 8px;
    font-size: 8px;
  }
}

/* JIElIl_GAMEBOY_LOGO_20260926 */
.brand-mark, .footer-brand .brand-mark {
  display:inline-grid;place-items:center;flex:none;width:34px;height:39px;
  background:transparent;box-shadow:none;line-height:1;
  animation:gb-logo-bob 2.8s steps(8,end) infinite;
}
.brand-mark svg {
  display:block;width:100%;height:100%;overflow:visible;
  filter:drop-shadow(2px 2px 0 var(--moss));
}
.brand-mark .gb-sprite-a {animation:gb-logo-a 1.2s steps(1,end) infinite;}
.brand-mark .gb-sprite-b {opacity:0;animation:gb-logo-b 1.2s steps(1,end) infinite;}
.brand:hover .brand-mark {animation-duration:.9s;}
.footer-brand .brand-mark {width:28px;height:32px;}
@keyframes gb-logo-bob {
  0%,100%{transform:translateY(0)}
  50%{transform:translateY(-3px)}
}
@keyframes gb-logo-a {
  0%,49%{opacity:1}
  50%,100%{opacity:0}
}
@keyframes gb-logo-b {
  0%,49%{opacity:0}
  50%,100%{opacity:1}
}
@media(max-width:680px){
  .topbar .brand-mark {width:30px;height:35px;}
}
@media(prefers-reduced-motion:reduce){
  .brand-mark,.brand-mark .gb-sprite-a,.brand-mark .gb-sprite-b {animation:none!important}
  .brand-mark .gb-sprite-a {opacity:1}
  .brand-mark .gb-sprite-b {opacity:0}
}
