:root {
  color-scheme: light dark;
  --bg-top: #f7f2e8;
  --bg-bottom: #e7ddd0;
  --card: rgba(255, 251, 245, 0.9);
  --panel: rgba(255, 255, 255, 0.52);
  --panel-strong: rgba(255, 253, 249, 0.92);
  --overlay: rgba(35, 26, 17, 0.28);
  --border: rgba(54, 45, 34, 0.14);
  --text: #231a11;
  --muted: #6e6254;
  --board: #f8f1e6;
  --snake: #22614b;
  --snake-head: #153b2f;
  --food: #c44a33;
  --obstacle: #887264;
  --obstacle-dynamic: #a8874a;
  --accent: #2a6f58;
  --accent-soft: rgba(34, 97, 75, 0.12);
  --status-panel: rgba(255, 255, 255, 0.6);
  --cell-base: rgba(34, 97, 75, 0.06);
  --shadow: 0 18px 42px rgba(54, 45, 34, 0.12);
  --radius: 26px;
  --surface-blur: 8px;
  --hero-preview-width: 404px;
  --hero-preview-column-max: 420px;
  --hero-preview-gap: 4px;
  --site-hero-title-max: 10ch;
  --home-title-max: 13ch;
  font-family: "SF Pro Display", "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

h1,
h2,
h3,
p,
figure {
  margin: 0;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-size: clamp(15px, 0.3vw + 14px, 18px);
  color: var(--text);
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.7), transparent 32%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

body[data-theme="dark"] {
  --bg-top: #121715;
  --bg-bottom: #18211d;
  --card: rgba(18, 24, 22, 0.9);
  --panel: rgba(29, 38, 35, 0.72);
  --panel-strong: rgba(33, 44, 40, 0.94);
  --overlay: rgba(2, 4, 3, 0.56);
  --border: rgba(201, 223, 214, 0.12);
  --text: #eef4f0;
  --muted: #a8b8b0;
  --board: #101816;
  --snake: #59b18a;
  --snake-head: #86d1ad;
  --food: #ff8e68;
  --obstacle: #6f6257;
  --obstacle-dynamic: #c39a5a;
  --accent: #5cb892;
  --accent-soft: rgba(92, 184, 146, 0.18);
  --status-panel: rgba(20, 26, 24, 0.72);
  --cell-base: rgba(92, 184, 146, 0.08);
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

body[data-theme="light"][data-clarity="sharp"] {
  --card: rgba(255, 251, 245, 0.96);
  --panel: rgba(255, 255, 255, 0.65);
  --panel-strong: rgba(255, 253, 249, 0.98);
  --surface-blur: 3px;
  --shadow: 0 14px 32px rgba(54, 45, 34, 0.1);
}

body[data-theme="light"][data-clarity="performance"] {
  --card: rgba(255, 251, 245, 0.95);
  --panel: rgba(255, 255, 255, 0.7);
  --panel-strong: rgba(255, 253, 249, 1);
  --surface-blur: 0px;
  --shadow: 0 10px 22px rgba(54, 45, 34, 0.08);
}

body[data-theme="dark"][data-clarity="sharp"] {
  --card: rgba(16, 22, 20, 0.96);
  --panel: rgba(31, 42, 38, 0.82);
  --panel-strong: rgba(36, 48, 44, 0.98);
  --surface-blur: 3px;
  --shadow: 0 14px 32px rgba(0, 0, 0, 0.24);
}

body[data-theme="dark"][data-clarity="performance"] {
  --card: rgba(17, 22, 21, 0.98);
  --panel: rgba(29, 38, 35, 0.9);
  --panel-strong: rgba(33, 44, 40, 1);
  --surface-blur: 0px;
  --shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
}

body[data-language-density="compact"] {
  --hero-preview-width: 428px;
  --hero-preview-column-max: 434px;
  --hero-preview-gap: 5px;
  --site-hero-title-max: 9ch;
  --home-title-max: 12ch;
}

body[data-language-density="expanded"] {
  --hero-preview-width: 372px;
  --hero-preview-column-max: 388px;
  --hero-preview-gap: 3px;
  --site-hero-title-max: 11.5ch;
  --home-title-max: 15ch;
}

.site-header,
.site-hero,
.site-band,
.experience-shell {
  width: min(1200px, calc(100% - 40px));
  margin-inline: auto;
}

.site-shell {
  display: grid;
  gap: 40px;
  padding-top: 20px;
  padding-bottom: 48px;
}

.site-header {
  position: sticky;
  top: 16px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.78);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 30px rgba(54, 45, 34, 0.08);
}

body[data-theme="dark"] .site-header {
  background: rgba(18, 24, 22, 0.82);
  border-color: rgba(201, 223, 214, 0.1);
}

.brand-button,
.site-nav-button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.site-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 18px;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-size: 0.94rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-copy small {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.brand-mark--image {
  overflow: hidden;
  padding: 0;
  background: linear-gradient(135deg, rgba(34, 97, 75, 0.95), rgba(21, 59, 47, 1));
}

.brand-mark--image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.site-nav {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.site-nav-button {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 500;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    transform 180ms ease;
}

.site-nav-button:hover,
.site-nav-button:focus-visible,
.brand-button:hover,
.brand-button:focus-visible {
  color: var(--text);
  transform: translateY(-1px);
}

.site-nav-button:hover,
.site-nav-button:focus-visible {
  background: rgba(255, 255, 255, 0.52);
}

.site-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.site-header,
.hero-preview-button,
.site-hero-copy > *,
.game-app {
  transition:
    opacity 320ms ease,
    transform 640ms cubic-bezier(0.22, 0.8, 0.22, 1),
    filter 640ms ease;
}

.site-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, var(--hero-preview-column-max));
  align-items: center;
  gap: clamp(32px, 4vw, 64px);
  min-height: calc(100svh - 156px);
  padding: clamp(48px, 8vw, 96px) 0 22px;
  transition:
    opacity 420ms ease,
    transform 620ms ease,
    max-height 620ms ease,
    padding 620ms ease,
    margin 620ms ease;
}

.site-hero::before {
  content: "";
  position: absolute;
  inset: 0 -18px auto;
  height: calc(100% - 8px);
  border-radius: 40px;
  background:
    radial-gradient(circle at top left, rgba(244, 185, 64, 0.24), transparent 22%),
    radial-gradient(circle at bottom right, rgba(34, 97, 75, 0.16), transparent 26%),
    linear-gradient(135deg, rgba(255, 251, 245, 0.96) 0%, rgba(248, 243, 232, 0.98) 54%, rgba(232, 243, 230, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow);
  z-index: -2;
  transition:
    opacity 640ms ease,
    transform 760ms cubic-bezier(0.22, 0.8, 0.22, 1);
}

.site-hero::after {
  content: "";
  position: absolute;
  inset: 0 -18px auto;
  height: calc(100% - 8px);
  border-radius: 40px;
  background-image:
    linear-gradient(rgba(34, 97, 75, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 97, 75, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black 58%, transparent 100%);
  z-index: -1;
  transition:
    opacity 640ms ease,
    transform 760ms cubic-bezier(0.22, 0.8, 0.22, 1);
}

body[data-theme="dark"] .site-hero::before {
  background:
    radial-gradient(circle at top left, rgba(255, 142, 104, 0.18), transparent 22%),
    radial-gradient(circle at bottom right, rgba(92, 184, 146, 0.2), transparent 26%),
    linear-gradient(135deg, rgba(18, 24, 22, 0.96) 0%, rgba(24, 33, 29, 0.98) 52%, rgba(19, 39, 31, 0.96) 100%);
  border-color: rgba(201, 223, 214, 0.08);
}

body[data-theme="dark"] .site-hero::after {
  background-image:
    linear-gradient(rgba(92, 184, 146, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 184, 146, 0.1) 1px, transparent 1px);
}

.site-hero-copy,
.site-story-copy,
.site-section-heading {
  display: grid;
  gap: 16px;
}

.site-section-heading {
  max-width: 46rem;
}

.site-hero-title {
  margin: 0;
  max-width: var(--site-hero-title-max);
  font-size: clamp(3.5rem, 6.6vw, 6.4rem);
  line-height: 0.94;
  letter-spacing: -0.04em;
}

.site-hero-summary {
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.72;
}

.runtime-status {
  display: grid;
  gap: 8px;
  max-width: 32rem;
  padding: 16px 18px;
  border: 1px solid rgba(34, 97, 75, 0.18);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 16px 34px rgba(54, 45, 34, 0.08);
}

body[data-theme="dark"] .runtime-status {
  border-color: rgba(92, 184, 146, 0.18);
  background: rgba(23, 33, 30, 0.72);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22);
}

.runtime-status strong {
  font-size: 1rem;
  line-height: 1.28;
}

.runtime-status p {
  color: var(--muted);
  line-height: 1.62;
}

.site-hero-facts {
  margin-top: 8px;
}

.hero-preview-button {
  justify-self: end;
  width: min(100%, var(--hero-preview-width));
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.hero-preview-shell {
  position: relative;
  display: grid;
  align-items: end;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 34px;
  background:
    linear-gradient(180deg, rgba(255, 253, 249, 0.94), rgba(246, 240, 231, 0.96));
  box-shadow: 0 20px 44px rgba(54, 45, 34, 0.14);
  transition:
    transform 260ms ease,
    box-shadow 260ms ease,
    border-color 260ms ease;
}

body[data-theme="dark"] .hero-preview-shell {
  background:
    linear-gradient(180deg, rgba(20, 27, 24, 0.96), rgba(17, 22, 20, 0.98));
  border-color: rgba(201, 223, 214, 0.1);
}

.hero-preview-button:hover .hero-preview-shell,
.hero-preview-button:focus-visible .hero-preview-shell {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 24px 52px rgba(54, 45, 34, 0.18);
  border-color: rgba(34, 97, 75, 0.28);
}

.hero-preview-button:disabled {
  cursor: not-allowed;
}

.hero-preview-button:disabled .hero-preview-shell {
  transform: none;
  box-shadow: 0 16px 34px rgba(54, 45, 34, 0.12);
  border-color: rgba(54, 45, 34, 0.12);
}

.hero-preview-button:disabled .hero-preview-grid {
  filter: saturate(0.82);
}

.hero-preview-grid {
  display: grid;
  grid-template-columns: repeat(var(--preview-columns), minmax(0, 1fr));
  gap: var(--hero-preview-gap);
  aspect-ratio: 10 / 7;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.44);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.hero-preview-cell {
  border-radius: 9px;
  background: rgba(34, 97, 75, 0.08);
}

.hero-preview-cell--snake {
  background: rgba(34, 97, 75, 0.62);
}

.hero-preview-cell--head {
  background: var(--snake-head);
}

.hero-preview-cell--food {
  background: var(--food);
}

.hero-preview-copy {
  display: grid;
  gap: 6px;
  padding: 6px 4px 2px;
  border-radius: 18px;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

body[data-theme="dark"] .hero-preview-copy {
  background: transparent;
}

.hero-preview-copy strong {
  font-size: 1.05rem;
}

.hero-preview-copy small {
  color: var(--muted);
  line-height: 1.45;
}

.experience-shell {
  display: grid;
  gap: 24px;
  transition:
    opacity 420ms ease,
    transform 620ms ease,
    max-height 620ms ease,
    margin 620ms ease;
}

body[data-home-visible="true"] .experience-shell {
  opacity: 0;
  pointer-events: none;
  transform: translateY(42px) scale(0.985);
  max-height: 0;
  overflow: clip;
  margin-top: -8px;
}

body[data-home-visible="false"] .site-hero {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-26px) scale(0.985);
  max-height: 0;
  overflow: clip;
  margin-bottom: -10px;
  padding-top: 0;
  padding-bottom: 0;
}

body[data-hero-transitioning="true"][data-home-visible="true"] .site-header {
  opacity: 0.24;
  transform: translateY(-16px);
  filter: blur(12px);
}

body[data-hero-transitioning="true"][data-home-visible="true"] .site-hero-copy > * {
  opacity: 0;
  transform: translateY(-26px);
  filter: blur(18px);
}

body[data-hero-transitioning="true"][data-home-visible="true"] .site-hero::before,
body[data-hero-transitioning="true"][data-home-visible="true"] .site-hero::after {
  opacity: 0.72;
  transform: scale(1.03);
}

body[data-hero-transitioning="true"][data-home-visible="true"] .hero-preview-button {
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  filter: blur(8px);
}

body[data-home-visible="false"][data-hero-transitioning="true"] .game-app {
  opacity: 0.72;
  transform: translateY(26px) scale(0.988);
  filter: blur(8px);
}

.site-band {
  display: grid;
  gap: 24px;
  padding: clamp(30px, 4vw, 54px) 0 0;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.site-story-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(0, 1.05fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
}

.site-shot-frame {
  overflow: hidden;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 32px;
  background: var(--panel);
  box-shadow: 0 24px 56px rgba(54, 45, 34, 0.12);
}

.site-shot-frame img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 22px;
}

.site-story-copy p,
.site-feature-card p {
  color: var(--muted);
  line-height: 1.72;
}

.showcase-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.showcase-card {
  display: grid;
  gap: 16px;
}

.showcase-frame {
  padding: 14px;
}

.showcase-copy {
  display: grid;
  gap: 10px;
  padding-inline: 6px;
}

.showcase-copy h3 {
  font-size: 1.08rem;
  line-height: 1.3;
}

.showcase-copy p {
  color: var(--muted);
  line-height: 1.72;
}

.site-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.site-feature-card {
  display: grid;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: 0 12px 34px rgba(54, 45, 34, 0.08);
}

.site-feature-index {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.platform-links--wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hero-transition-surface {
  position: fixed;
  inset: 0;
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 240ms ease;
}

.hero-transition-surface.is-visible {
  opacity: 1;
}

.hero-transition-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top center, rgba(248, 206, 140, 0.2), transparent 26%),
    radial-gradient(circle at bottom center, rgba(34, 97, 75, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(255, 251, 245, 0.4), rgba(244, 238, 227, 0.7));
  opacity: 0;
  transition: opacity 860ms cubic-bezier(0.22, 0.8, 0.22, 1);
}

body[data-theme="dark"] .hero-transition-backdrop {
  background:
    radial-gradient(circle at top center, rgba(255, 167, 116, 0.14), transparent 28%),
    radial-gradient(circle at bottom center, rgba(71, 157, 122, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(12, 17, 16, 0.42), rgba(15, 22, 20, 0.82));
}

.hero-transition-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  transition:
    top 920ms cubic-bezier(0.22, 0.8, 0.22, 1),
    left 920ms cubic-bezier(0.22, 0.8, 0.22, 1),
    width 920ms cubic-bezier(0.22, 0.8, 0.22, 1),
    height 920ms cubic-bezier(0.22, 0.8, 0.22, 1),
    filter 320ms ease;
}

.hero-transition-surface.is-expanding .hero-transition-backdrop {
  opacity: 1;
}

.hero-preview-shell--transition {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(180px, 1fr) auto;
  gap: clamp(14px, 2vw, 24px);
  padding: clamp(16px, 2.6vw, 28px);
  border-radius: 34px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.46);
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.94), rgba(245, 239, 230, 0.96));
  box-shadow: 0 32px 96px rgba(54, 45, 34, 0.22);
  backdrop-filter: blur(18px);
  transition:
    border-radius 860ms cubic-bezier(0.22, 0.8, 0.22, 1),
    box-shadow 860ms cubic-bezier(0.22, 0.8, 0.22, 1),
    background 240ms ease;
}

body[data-theme="dark"] .hero-preview-shell--transition {
  border-color: rgba(201, 223, 214, 0.1);
  background:
    linear-gradient(180deg, rgba(20, 27, 24, 0.96), rgba(16, 22, 20, 0.98));
}

.hero-transition-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: clamp(12px, 1.4vw, 20px);
  border-radius: clamp(22px, 3vw, 32px);
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(254, 251, 246, 0.82), rgba(237, 245, 239, 0.9));
}

body[data-theme="dark"] .hero-transition-stage {
  background:
    linear-gradient(160deg, rgba(19, 26, 24, 0.9), rgba(19, 35, 29, 0.92));
}

.hero-transition-stage::before {
  content: "";
  position: absolute;
  inset: -18%;
  background:
    radial-gradient(circle at 22% 24%, rgba(255, 214, 154, 0.28), transparent 24%),
    radial-gradient(circle at 82% 74%, rgba(34, 97, 75, 0.24), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0));
}

.hero-transition-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(34, 97, 75, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 97, 75, 0.08) 1px, transparent 1px);
  background-size: 42px 42px;
  opacity: 0.45;
  mask-image: radial-gradient(circle at center, black 62%, transparent 100%);
}

body[data-theme="dark"] .hero-transition-stage::after {
  background-image:
    linear-gradient(rgba(92, 184, 146, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 184, 146, 0.1) 1px, transparent 1px);
}

.hero-transition-glow {
  position: absolute;
  inset: auto 15% 10%;
  height: 30%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(34, 97, 75, 0.2), transparent 72%);
  filter: blur(18px);
  opacity: 0.72;
  transform: translateY(24%);
  transition:
    transform 860ms cubic-bezier(0.22, 0.8, 0.22, 1),
    opacity 320ms ease;
}

.hero-preview-grid--transition {
  position: relative;
  z-index: 1;
  width: min(100%, 720px);
  gap: clamp(4px, 0.8vw, 10px);
  transform: scale(0.92);
  transition:
    transform 860ms cubic-bezier(0.22, 0.8, 0.22, 1),
    opacity 320ms ease,
    filter 320ms ease;
}

.hero-transition-copy {
  position: relative;
  z-index: 2;
  width: min(420px, 100%);
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 14px 32px rgba(54, 45, 34, 0.14);
  transition:
    opacity 320ms ease,
    transform 320ms ease,
    background 240ms ease;
}

body[data-theme="dark"] .hero-transition-copy {
  background: rgba(23, 33, 30, 0.76);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
}

.hero-transition-copy strong {
  font-size: clamp(1.12rem, 2.2vw, 1.78rem);
  line-height: 1.06;
}

.hero-transition-copy small {
  color: var(--muted);
  line-height: 1.5;
}

.hero-transition-surface.is-expanding .hero-preview-shell--transition {
  border-radius: 40px;
  box-shadow: 0 48px 140px rgba(54, 45, 34, 0.24);
}

.hero-transition-surface.is-expanding .hero-transition-glow {
  transform: translateY(0);
  opacity: 1;
}

.hero-transition-surface.is-expanding .hero-preview-grid--transition {
  transform: scale(1.12);
}

.hero-transition-surface.is-settling .hero-transition-panel {
  filter: blur(4px);
}

.hero-transition-surface.is-settling .hero-preview-grid--transition {
  transform: scale(1.28);
  opacity: 0.3;
  filter: blur(12px);
}

.hero-transition-surface.is-settling .hero-transition-copy {
  opacity: 0;
  transform: translateY(22px);
}

button,
select,
input {
  font: inherit;
}

a {
  color: inherit;
}

h1,
h2,
p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(12px, 2vw, 24px);
  overflow: visible;
  overscroll-behavior-y: auto;
}

body[data-home-visible="false"][data-settings-open="false"] .app-shell {
  overscroll-behavior: contain;
}

.game-app {
  width: min(100%, 1120px);
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.app-bar,
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-stack,
.section-copy,
.settings-stack,
.tilt-card {
  display: grid;
  gap: 8px;
}

.section-copy h3 {
  font-size: 1rem;
  line-height: 1.28;
  letter-spacing: -0.02em;
}

.eyebrow,
.status-label,
.fact-label,
.panel-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.site-hero .eyebrow,
.site-section-heading .eyebrow,
.hero-preview-copy .eyebrow,
.platform-copy .eyebrow {
  color: var(--accent);
}

#game-title {
  font-size: clamp(2rem, 1.8vw + 1.4rem, 3rem);
  line-height: 1;
}

.game-app > section,
.settings-modal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--surface-blur));
}

.home-panel,
.platform-panel,
.playfield-shell,
.settings-modal {
  padding: clamp(16px, 2vw, 24px);
}

.home-panel {
  display: grid;
  gap: 18px;
  touch-action: pan-y;
}

.platform-panel,
.platform-copy,
.platform-card {
  display: grid;
  gap: 12px;
}

.platform-panel {
  padding: 0;
  gap: 20px;
}

.platform-grid,
.platform-links {
  display: grid;
  gap: 16px;
}

.platform-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.platform-links {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.platform-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: 0 12px 34px rgba(54, 45, 34, 0.08);
}

.platform-card p {
  color: var(--muted);
  line-height: 1.72;
}

.site-feature-card h3,
.home-entry .fact-label,
.platform-card .fact-label {
  color: var(--text);
}

.site-feature-card h3 {
  font-size: clamp(1.12rem, 1vw + 0.94rem, 1.42rem);
  line-height: 1.22;
  letter-spacing: -0.02em;
}

.home-title {
  max-width: var(--home-title-max);
  font-size: clamp(2rem, 2.2vw, 3rem);
  color: var(--text);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.home-summary,
.section-copy p,
.tilt-card p,
.settings-hint,
.setting-field small,
.setting-toggle small {
  color: var(--muted);
  line-height: 1.68;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.game-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.home-entry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.home-entry {
  display: grid;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: 0 12px 34px rgba(54, 45, 34, 0.08);
}

.home-entry--guide {
  align-content: start;
}

.home-guide-copy {
  color: var(--muted);
  line-height: 1.72;
}

.hero-facts,
.status-strip,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.fact-pill,
.status-pill,
.tilt-card,
.setting-toggle,
.control-view,
.mode-card {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel);
}

.fact-pill,
.status-pill {
  padding: 14px 16px;
}

.fact-pill strong,
.status-pill strong {
  display: block;
  margin-top: 6px;
  font-size: 1.08rem;
}

.playfield-shell,
.controls-panel {
  display: grid;
  gap: 16px;
}

.playfield-stage {
  display: grid;
  gap: 16px;
  justify-items: center;
  align-items: start;
  min-height: 0;
}

.playfield-shell,
.settings-panels {
  overflow: auto;
  overscroll-behavior: contain;
}

.board-frame {
  position: relative;
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  overflow: auto;
  padding: 2px;
}

.board {
  display: grid;
  grid-template-columns: repeat(var(--board-columns), var(--cell-size));
  grid-auto-rows: var(--cell-size);
  gap: 4px;
  width: max-content;
  margin: 0 auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.54), transparent),
    var(--board);
}

.cell {
  border-radius: 6px;
  background: var(--cell-base);
}

.cell.snake {
  background: var(--snake);
}

.cell.head {
  background: var(--snake-head);
}

.cell.food {
  background: var(--food);
}

.cell.obstacle {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--obstacle) 88%, white), var(--obstacle));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}

.cell.obstacle-dynamic {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--obstacle-dynamic) 78%, white), var(--obstacle-dynamic));
  animation: obstaclePulse 1.2s ease-in-out infinite;
}

@keyframes obstaclePulse {
  0%,
  100% {
    transform: scale(1);
    filter: saturate(0.96);
  }

  50% {
    transform: scale(0.94);
    filter: saturate(1.08);
  }
}

.banner {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  z-index: 1;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(21, 59, 47, 0.92);
  color: #fffdf9;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 600;
}

.banner.visible {
  display: flex;
}

.controls-panel {
  width: min(100%, var(--board-footprint, 360px));
  padding: 0;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.ghost-button,
.primary-button,
.secondary-button,
.game-actions button {
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.control-button,
.settings-tab,
.mode-card,
#tilt-panel-calibrate-button,
#motion-calibrate-button {
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--text);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.ghost-button,
.secondary-button,
.game-actions button,
.control-button,
.settings-tab,
#tilt-panel-calibrate-button,
#motion-calibrate-button {
  background: var(--panel-strong);
}

.primary-button {
  background: var(--accent);
  color: #fffdf9;
  border-color: transparent;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}

.ghost-button {
  background: transparent;
  border-color: rgba(29, 29, 31, 0.12);
}

.ghost-button,
.primary-button,
.secondary-button,
.game-actions button {
  min-height: 44px;
  padding: 12px 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

a.ghost-button,
a.primary-button,
a.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.mode-card {
  padding: 16px;
  text-align: left;
  display: grid;
  gap: 6px;
}

.mode-card.is-active,
.settings-tab.is-active {
  border-color: rgba(34, 97, 75, 0.34);
  background: var(--accent-soft);
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: start center;
  padding: clamp(10px, 2vw, 24px);
  background: var(--overlay);
  overflow: auto;
  touch-action: pan-y;
}

.settings-modal {
  width: min(100%, 1080px);
  max-height: min(94vh, 920px);
  max-height: min(94dvh, 920px);
  display: grid;
  gap: 18px;
}

.settings-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  min-height: 0;
}

.settings-nav {
  display: grid;
  gap: 10px;
  align-content: start;
}

.settings-tab {
  padding: 12px 14px;
  text-align: left;
}

.settings-panels {
  min-height: 0;
  padding-right: 4px;
  touch-action: pan-y;
}

.settings-panel {
  display: grid;
  gap: 16px;
}

.settings-stack {
  gap: 16px;
}

.setting-field,
.mini-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.setting-field--full {
  grid-column: 1 / -1;
}

.setting-field select,
.setting-field input[type="number"],
.setting-field input[type="range"],
.mini-field input[type="number"] {
  width: 100%;
}

.setting-field select,
.setting-field input[type="number"],
.mini-field input[type="number"] {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-strong);
  color: var(--text);
}

.custom-grid-inputs,
.mode-grid {
  display: grid;
  gap: 12px;
}

.custom-grid-inputs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mode-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.setting-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
}

.setting-toggle-copy {
  min-width: 0;
}

.setting-toggle-label {
  display: block;
  color: var(--text);
  font-size: 0.96rem;
}

.policy-link-card {
  align-content: start;
}

.control-surfaces {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.policy-page {
  min-height: 100vh;
  min-height: 100dvh;
}

.policy-shell {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: clamp(12px, 2vw, 24px);
  display: grid;
  gap: 16px;
}

.policy-header,
.policy-section {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.policy-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(18px, 2vw, 28px);
}

.policy-heading {
  display: grid;
  gap: 10px;
}

.policy-sections {
  display: grid;
  gap: 12px;
}

.policy-section {
  display: grid;
  gap: 10px;
  padding: clamp(18px, 2vw, 24px);
}

.policy-section h2 {
  font-size: 1.02rem;
}

.policy-section p {
  color: var(--muted);
  line-height: 1.65;
}

.control-view {
  padding: 18px;
  background: rgba(255, 251, 245, 0.84);
  backdrop-filter: blur(6px);
  box-shadow: 0 12px 30px rgba(54, 45, 34, 0.12);
}

body[data-theme="dark"] .control-view {
  background: rgba(24, 31, 29, 0.92);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

.joystick-panel {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.joystick-actions {
  width: min(100%, 320px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.joystick {
  position: relative;
  width: clamp(150px, 24vw, 220px);
  aspect-ratio: 1;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.5), rgba(216, 204, 183, 0.54));
  border: 1px solid var(--border);
  touch-action: none;
  user-select: none;
}

body[data-platform-variant="web"] .joystick {
  cursor: grab;
}

body[data-platform-variant="web"] .joystick:active {
  cursor: grabbing;
}

.joystick-ring,
.joystick-thumb {
  position: absolute;
  border-radius: 999px;
}

.joystick-ring {
  inset: 14%;
  border: 1px dashed rgba(54, 45, 34, 0.18);
}

.joystick-thumb {
  left: 50%;
  top: 50%;
  width: 34%;
  aspect-ratio: 1;
  background: rgba(34, 97, 75, 0.92);
  box-shadow: 0 10px 20px rgba(21, 59, 47, 0.18);
  transform: translate(-50%, -50%);
}

.tap-controls {
  display: grid;
  justify-items: center;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(64px, 84px));
  gap: 10px;
}

.control-button {
  min-height: 56px;
  touch-action: manipulation;
}

body[data-platform-variant="web"] .control-button {
  position: relative;
  color: transparent;
  font-size: 0;
  line-height: 0;
}

body[data-platform-variant="web"] .control-button::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
}

body[data-platform-variant="web"] .control-button[data-direction="up"]::before {
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 14px solid var(--text);
  transform: translate(-50%, -58%);
}

body[data-platform-variant="web"] .control-button[data-direction="down"]::before {
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 14px solid var(--text);
  transform: translate(-50%, -42%);
}

body[data-platform-variant="web"] .control-button[data-direction="left"]::before {
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 14px solid var(--text);
  transform: translate(-58%, -50%);
}

body[data-platform-variant="web"] .control-button[data-direction="right"]::before {
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 14px solid var(--text);
  transform: translate(-42%, -50%);
}

.tilt-card {
  padding: 18px;
}

#joystick-view,
#buttons-view,
#tilt-view {
  width: max-content;
  max-width: min(100%, 340px);
}

.tilt-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.tilt-action {
  justify-content: end;
}

button:hover,
select:hover,
input:hover,
.mode-card:hover,
.settings-tab:hover {
  border-color: rgba(34, 97, 75, 0.24);
}

button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  transform: none;
}

button:disabled:hover,
button:disabled:focus-visible {
  border-color: var(--border);
  transform: none;
}

input[type="range"] {
  accent-color: var(--accent);
}

body[data-handheld="true"][data-viewport-orientation="landscape"] .app-shell {
  padding: 10px;
}

body[data-handheld="true"][data-viewport-orientation="landscape"] .game-app {
  gap: 12px;
}

body[data-handheld="true"][data-viewport-orientation="landscape"] .playfield-stage {
  grid-template-columns: minmax(0, 1fr) auto;
  justify-content: center;
  align-items: end;
}

body[data-handheld="true"][data-viewport-orientation="landscape"] .controls-panel {
  width: auto;
}

@media (max-width: 960px) {
  .site-header,
  .site-hero,
  .site-band,
  .experience-shell {
    width: min(1120px, calc(100% - 20px));
  }

  .site-header,
  .site-hero,
  .site-story-layout {
    grid-template-columns: 1fr;
  }

  .site-header {
    border-radius: 28px;
    align-items: start;
    justify-content: start;
  }

  .site-nav,
  .site-actions {
    justify-content: flex-start;
  }

  .hero-preview-button {
    justify-self: stretch;
    width: 100%;
  }

  .hero-preview-shell--transition {
    border-radius: 28px;
  }

  .hero-preview-grid--transition {
    width: min(100%, 90%);
  }

  .hero-transition-copy {
    width: 100%;
  }

  .site-feature-grid,
  .showcase-grid,
  .platform-grid,
  .home-entry-grid,
  .hero-facts,
  .status-strip,
  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .site-header,
  .site-actions,
  .site-nav {
    display: grid;
    width: 100%;
  }

  .site-header {
    gap: 12px;
  }

  .site-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-entry-grid,
  .hero-actions,
  .game-actions,
  .platform-grid,
  .platform-links,
  .platform-links--wide,
  .site-feature-grid,
  .showcase-grid,
  .hero-facts,
  .status-strip,
  .settings-grid,
  .custom-grid-inputs,
  .mode-grid {
    grid-template-columns: 1fr;
  }

  .app-bar,
  .settings-header,
  .tilt-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-surfaces {
    justify-content: center;
  }

  .playfield-stage {
    min-height: auto;
  }

  .controls-panel {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 10px;
  }

  .site-hero-title {
    font-size: clamp(2.4rem, 11vw, 3.8rem);
  }

  .controls-grid {
    grid-template-columns: repeat(3, minmax(56px, 72px));
    gap: 8px;
  }

  .control-button {
    min-height: 50px;
  }
}

@media (max-width: 640px) {
  .policy-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  .policy-header .ghost-button {
    width: 100%;
  }
}
