/* Shared arcade palette and components */
:root {
  color-scheme: dark;
  --ink: #101326;
  --panel: #1b2040;
  --line: #3d4365;
  --text: #f7f6ff;
  --muted: #b9bed7;
  --accent: #c0adff;
  --dodge: #ffac85;
  --snake: #79f1cd;
  --display: "Arial Black", "Microsoft YaHei", "PingFang SC", sans-serif;
  --body: system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
  --mono: "Cascadia Mono", Consolas, monospace;
  scrollbar-color: var(--line) var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--ink); color: var(--text); font: 1rem/1.6 var(--body); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.16; font-family: var(--display); font-weight: 900; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--text); outline-offset: 4px; }
.wrap { width: min(70rem, calc(100% - 3rem)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner { min-height: 4.5rem; display: flex; gap: 1rem; align-items: center; justify-content: space-between; }
.header-actions { display: flex; align-items: center; gap: 1rem; margin-inline-start: auto; }
.brand { display: inline-flex; gap: .75rem; align-items: center; text-decoration: none; font-weight: 900; letter-spacing: .09em; }
.brand:hover, .back:hover { color: var(--accent); }
.brand-mark, .console-cross {
  background: var(--accent);
  clip-path: polygon(33% 0, 67% 0, 67% 33%, 100% 33%, 100% 67%, 67% 67%, 67% 100%, 33% 100%, 33% 67%, 0 67%, 0 33%, 33% 33%);
}
.brand-mark { display: inline-block; width: 1.9rem; aspect-ratio: 1; }
.eyebrow { font: 700 .875rem/1.4 var(--mono); letter-spacing: .12em; }
.eyebrow { color: var(--accent); }
.button {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  padding: .5rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: .4rem;
  color: var(--text);
  background: var(--panel);
  font: 800 1rem/1.45 var(--body);
  text-decoration: none;
  cursor: pointer;
}
.button:hover { border-color: var(--accent); }
.button:active { transform: translateY(2px); }
.primary { color: var(--ink); background: var(--accent); border-color: var(--accent); }
.primary:hover { background: color-mix(in srgb, var(--accent), white 26%); }
.language-switch { display: inline-flex; gap: .25rem; }
.language-switch .language-option { min-width: 2.75rem; padding-inline: .45rem; font-size: .875rem; }
.language-option[aria-pressed="true"] { color: var(--ink); background: var(--accent); border-color: var(--accent); }
.dodge-theme { --accent: var(--dodge); }
.snake-theme { --accent: var(--snake); }

/* Lobby */
.lobby { padding-block: 2.5rem 3.5rem; }
.lobby > .button { margin-top: 1rem; }
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 19rem;
  border: 1px solid #545182;
  border-radius: 1rem;
  padding: clamp(1.4rem, 5vw, 3.75rem);
  overflow: hidden;
  background:
    linear-gradient(90deg, #211c49 24%, transparent 78%),
    repeating-linear-gradient(0deg, #ffffff0a 0 1px, transparent 1px 24px),
    repeating-linear-gradient(90deg, #ffffff12 0 1px, transparent 1px 24px),
    radial-gradient(ellipse at 77% 50%, #463884, #211c49 70%);
}
.hero-copy { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(2.5rem, 7.2vw, 5.4rem); letter-spacing: -.08em; margin-bottom: .85rem; }
.hero h1 .hero-period { color: var(--accent); }
.hero:lang(en) .hero-copy { max-width: 52%; }
.hero:lang(en) h1 { font-size: clamp(2.5rem, 6.3vw, 5.4rem); letter-spacing: -.06em; }
.hero p { color: var(--muted); }
.hero-art { position: absolute; inset: 0 0 0 40%; display: grid; place-items: center; }
.orbit {
  position: absolute;
  width: min(86%, 29rem);
  aspect-ratio: 2.1;
  border: 1px solid #b59aff75;
  border-radius: 50%;
  transform: rotate(-24deg);
}
.orbit-two { scale: .84; }
.orbit-three { scale: 1.16; }
.star { position: absolute; width: .5rem; aspect-ratio: 1; rotate: 45deg; background: #efccff; box-shadow: 0 0 15px #dfacff; }
.star-one { top: 26%; right: 19%; }
.star-two { bottom: 25%; left: 18%; }
.star-three { top: 24%; left: 27%; scale: .55; }
.hero-console {
  position: relative;
  width: min(62%, 16rem);
  aspect-ratio: 2.16;
  border: 2px solid #e0cfff;
  border-radius: 35% 35% 29% 29% / 52% 52% 44% 44%;
  background: linear-gradient(155deg, #d8c1ff, #8f74e1 48%, #6645a9);
  box-shadow: 0 .65rem #482b7a, 0 .76rem 1.9rem #140c39, inset 0 .3rem #ffffff42;
  transform: rotate(-17deg) translateY(-.3rem);
}
.console-cross { position: absolute; left: 16%; top: 28%; width: 22%; aspect-ratio: 1; background: #27204e; }
.console-buttons { position: absolute; right: 17%; top: 31%; width: 12%; aspect-ratio: 1; border-radius: 50%; background: var(--dodge); box-shadow: -1.45rem 1.2rem 0 var(--snake); }
.catalog { margin-top: 2.35rem; }
.section-heading { display: flex; align-items: center; gap: 1.1rem; margin-bottom: 1rem; }
.section-heading::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.section-heading h2 { font-size: 1.4rem; }
.game-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
.game-card { display: grid; grid-template-rows: auto 1fr; border: 1px solid var(--line); border-radius: .8rem; overflow: hidden; background: var(--panel); }
.game-card:focus-within, .game-card:hover { border-color: var(--accent); }
.card-copy { display: flex; flex-direction: column; align-items: start; gap: .6rem; padding: 1.25rem 1.4rem 1.4rem; }
.card-copy h3 { font-size: clamp(1.4rem, 3vw, 1.8rem); }
.card-copy p:not(.eyebrow) { color: var(--muted); margin-bottom: .35rem; }
.card-copy .button { margin-top: auto; }
.card-art { position: relative; height: clamp(7.5rem, 15vw, 10rem); overflow: hidden; border-bottom: 1px solid var(--line); }
.dodge-art {
  background: radial-gradient(ellipse at 64% 84%, #ac535b70, transparent 60%),
    repeating-linear-gradient(122deg, transparent 0 54px, #ffac8533 55px 56px),
    linear-gradient(145deg, #352240, #23182f 74%);
}
.art-meteor { position: absolute; top: 20%; left: 34%; width: 2.5rem; aspect-ratio: 1; background: #ffad8b; clip-path: polygon(30% 0, 85% 12%, 100% 65%, 72% 100%, 12% 92%, 0 32%); transform: rotate(24deg); }
.second-meteor { top: 52%; left: 25%; scale: .6; background: #c2768b; }
.art-ship { position: absolute; top: 21%; left: 57%; width: 5rem; aspect-ratio: 1.06; transform: rotate(28deg); background: linear-gradient(90deg, #ffe5d7 50%, #ffac85 50%); clip-path: polygon(50% 0, 92% 88%, 61% 74%, 50% 100%, 39% 74%, 8% 88%); }
.snake-art {
  background: repeating-linear-gradient(0deg, transparent 0 22px, #79f1cd16 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 22px, #79f1cd16 23px 24px),
    radial-gradient(ellipse at 55% 50%, #234959, #182638 75%);
}
.art-snake {
  position: absolute;
  top: 50%;
  left: 45%;
  width: 8.4rem;
  height: 5.8rem;
  transform: translate(-50%, -50%) rotate(-11deg);
  background: repeating-linear-gradient(90deg, #79f1cd 0 1.37rem, #64dbb9 1.37rem 1.55rem);
  clip-path: polygon(0 0, 53% 0, 53% 33%, 37% 33%, 37% 68%, 82% 68%, 82% 35%, 100% 35%, 100% 100%, 19% 100%, 19% 33%, 0 33%);
}
.art-food { position: absolute; top: 36%; left: 69%; width: 1.5rem; aspect-ratio: 1; rotate: 45deg; background: #ffb8ec; border: 3px solid #ffe5f8; box-shadow: 0 0 1rem #ffb8ecaa; }
.site-footer { display: flex; justify-content: space-between; gap: .4rem 1rem; flex-wrap: wrap; padding-block: 1rem 1.5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }

/* Game shell */
.back { min-height: 2.75rem; display: inline-flex; align-items: center; text-underline-offset: .24em; color: var(--muted); white-space: nowrap; }
.game-page { padding-block: 2rem 3rem; }
.game-layout { display: grid; grid-template-columns: minmax(14rem, .7fr) minmax(0, 1.3fr); gap: clamp(1.3rem, 4vw, 3rem); align-items: start; max-width: 58rem; margin-inline: auto; }
.game-intro h1 { font-size: clamp(2rem, 4.75vw, 3.1rem); margin-block: .5rem .7rem; }
.game-intro > p:not(.eyebrow), .how-to p { color: var(--muted); }
.how-to { margin-top: 1.65rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.how-to h2 { font-size: 1rem; margin-bottom: .55rem; }
.how-to p:not([hidden]) ~ p:not([hidden]) { margin-top: .55rem; }
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 1.55em; min-height: 1.55em; padding-inline: .22em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: .25rem; font: .9em var(--mono); background: var(--panel); color: var(--text); }
.machine { min-width: 0; max-width: 33rem; width: 100%; justify-self: center; padding: .8rem; background: var(--panel); border: 1px solid var(--line); border-radius: .85rem; }
.hud { display: grid; grid-template-columns: 1fr 1fr; margin: 0 0 .7rem; gap: .6rem; }
.hud div { padding: .35rem .75rem; border-radius: .35rem; background: var(--ink); }
.hud dt { font-size: .875rem; color: var(--muted); }
.hud dd { margin: 0; font: 800 1.5rem/1.3 var(--mono); color: var(--accent); }
.screen { position: relative; overflow: hidden; border-radius: .32rem; outline-offset: 3px; }
.screen canvas { display: block; width: 100%; height: auto; background: var(--ink); }
.snake-screen { touch-action: none; }
.dodge-screen { touch-action: pan-y; }
.screen-overlay { position: absolute; inset: 0; padding: .8rem; display: grid; place-content: center; justify-items: center; gap: .7rem; text-align: center; background: #101326d9; }
.screen-overlay h2 { font-size: clamp(1.35rem, 4vw, 2rem); }
.screen-overlay p { max-width: 22em; color: var(--muted); }
.game-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .7rem; }
.game-actions .button { flex: 1; }
.button:disabled { opacity: .62; cursor: default; }
.button:disabled:hover { border-color: var(--line); }
.button:disabled:active { transform: none; }
.direction-controls { display: flex; gap: .45rem; margin-top: .65rem; touch-action: manipulation; }
.direction-controls .button { flex: 1; min-width: 2.75rem; padding-inline: .35rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 44rem) {
  .wrap { width: calc(100% - 2rem); }
  .game-layout { grid-template-columns: 1fr; gap: 1.1rem; }
  .how-to { margin-top: .9rem; padding-top: .7rem; }
  .game-page { padding-top: 1.2rem; }
  .hero { min-height: 16rem; }
  .hero h1 { margin-bottom: .55rem; }
  .hero-art { inset: 8% -9% 0 46%; }
  .console-buttons { box-shadow: -.7rem .65rem 0 var(--snake); }
}
@media (max-width: 32rem) {
  .lobby { padding-block: 1.25rem 2rem; }
  .header-inner { min-height: 3.8rem; flex-wrap: wrap; gap: .35rem .5rem; padding-block: .35rem; }
  .header-actions { gap: .55rem; }
  .brand { font-size: .875rem; letter-spacing: 0; gap: .4rem; }
  .brand-mark { width: 1.35rem; }
  .back { font-size: .875rem; }
  .hero { align-items: flex-start; min-height: 17rem; }
  .hero:lang(en) .hero-copy { max-width: 100%; }
  .hero-art { inset: 42% -1% -1% 22%; }
  .hero-console { width: 43%; }
  .game-grid { grid-template-columns: 1fr; }
  .catalog { margin-top: 1.65rem; }
}
@media (forced-colors: active) {
  :root { scrollbar-color: auto; }
  .brand-mark { background: LinkText; forced-color-adjust: none; }
  .language-option[aria-pressed="true"] { outline: 2px solid Highlight; outline-offset: -3px; }
}
@media (prefers-reduced-motion: reduce) {
  .button:active { transform: none; }
}
