:root {
  --ink: #29372c;
  --muted: #617064;
  --paper: #fff8e7;
  --paper-deep: #e9ead5;
  --white: #fff;
  --mint: #65b96e;
  --mint-dark: #28733e;
  --coral: #ee695f;
  --yellow: #ffc84b;
  --blue: #4f9dcc;
  --border: 2px solid var(--ink);
  --shadow: 5px 5px 0 var(--ink);
  color-scheme: light;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  font-synthesis: none;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html {
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
}

body { margin: 0; min-width: 320px; overflow-x: hidden; }

button, a { -webkit-tap-highlight-color: transparent; }

a { color: inherit; text-underline-offset: 0.22em; }

button { font: inherit; }

img { display: block; max-width: 100%; }

.shell {
  width: min(1160px, calc(100% - 40px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 100;
  left: 16px;
  top: 10px;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--white);
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.site-header {
  min-height: 68px;
  padding-block: 10px;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  border-bottom: var(--border);
  background: rgba(255, 248, 231, 0.97);
  position: relative;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  line-height: 1;
}

.brand small {
  display: block;
  margin-top: 3px;
  font-family: "Avenir Next", Avenir, sans-serif;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-mark {
  width: 29px;
  aspect-ratio: 1;
  background: var(--coral);
  border: 3px solid var(--ink);
  clip-path: polygon(25% 7%, 75% 7%, 100% 50%, 75% 93%, 25% 93%, 0 50%);
  flex: none;
}

.site-header nav { display: flex; align-items: center; gap: 4px; }

.site-header nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

.site-header nav a:hover,
.site-header nav a[aria-current="page"] { border-color: var(--coral); }

.privacy-trigger {
  justify-self: end;
  min-height: 44px;
  padding: 7px 0 7px 14px;
  color: var(--ink);
  border: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.play-intro {
  padding: 22px 0 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
}

.title-lockup { display: flex; align-items: baseline; gap: 18px; }

.title-lockup span,
.eyebrow,
.label,
.game-kicker {
  margin: 0;
  color: var(--mint-dark);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

h1, h2 { font-family: Georgia, "Times New Roman", serif; }

.title-lockup h1 {
  margin: 0;
  font-size: 66px;
  line-height: 0.96;
  font-weight: 700;
}

.play-intro > p { width: min(430px, 45%); margin: 0; color: var(--muted); font-size: 15px; }

.play-grid {
  padding-bottom: 42px;
}

.game-stage { width: 100%; min-width: 0; margin-inline: auto; border: var(--border); box-shadow: var(--shadow); }

.game-toolbar {
  min-height: 56px;
  padding: 6px 8px 6px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #fff3cd;
  color: var(--ink);
  border-bottom: var(--border);
}

.game-state { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; }
.status-dot { width: 9px; aspect-ratio: 1; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 4px rgba(255, 200, 75, 0.24); }
[data-game-shell][data-status="playing"] .status-dot { background: var(--mint); }
[data-game-shell][data-status="sunshine-select"] .status-dot { background: var(--yellow); }
[data-game-shell][data-status="paused"] .status-dot { background: var(--blue); }
[data-game-shell][data-status="game-over"] .status-dot { background: var(--coral); }
.game-actions { display: flex; gap: 5px; }

.icon-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #a89561;
  border-radius: 4px;
  background: #fffdf4;
  color: var(--ink);
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
}
.icon-button:hover { background: #ffe5a4; }
.icon-button:disabled { color: #89908c; cursor: not-allowed; opacity: 0.7; }

.game-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  isolation: isolate;
  background: #a9ddf4;
  touch-action: manipulation;
}
.game-frame-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
.game-frame-wrap::after { content: ""; position: absolute; inset: 0; z-index: 7; background: #fff8c7; opacity: 0; pointer-events: none; }
[data-game-shell][data-entrance="true"] .game-frame-wrap::after { animation: entrance-flash 520ms ease-out both; }
@keyframes entrance-flash { 0% { opacity: 0.85; } 100% { opacity: 0; } }
.game-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.game-overlay {
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  color: var(--ink);
  background: rgba(255, 248, 225, 0.89);
  backdrop-filter: blur(5px);
}
.game-overlay h2 { max-width: 520px; margin: 8px 0; font-size: 44px; line-height: 1.04; }
.game-overlay > p:not(.game-kicker) { max-width: 480px; margin: 0 0 18px; color: #526359; }
.game-overlay .game-kicker { color: var(--coral); }

.game-hud {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(74px, 1fr));
  gap: 2px;
  color: var(--ink);
  pointer-events: none;
}
.game-hud > div { min-width: 82px; padding: 8px 11px; background: rgba(255, 253, 244, 0.9); border-top: 3px solid var(--coral); box-shadow: 0 2px 0 rgba(41, 55, 44, 0.18); }
.game-hud span, .queue-label { display: block; color: #69776c; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.game-hud strong { display: block; margin-top: 1px; font-size: 17px; line-height: 1.1; }
.game-hud > div[data-urgent="true"] { color: #a82e2e; background: #fff0df; animation: urgent-pulse 700ms ease-in-out infinite alternate; }

.game-orders {
  position: absolute;
  z-index: 3;
  top: 77px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  color: var(--ink);
  background: rgba(255, 253, 244, 0.92);
  box-shadow: 0 2px 0 rgba(41, 55, 44, 0.18);
}
.game-orders > span { color: #69776c; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.game-orders > div { min-width: 54px; display: flex; align-items: center; gap: 6px; padding: 3px 7px; border: 1px solid #d1bd86; background: #fff8e7; }
.game-orders > div[data-complete="true"] { background: #dff0d9; border-color: #65a65f; }
.game-orders i { width: 22px; height: 22px; flex: none; filter: drop-shadow(0 2px 1px rgba(41, 55, 44, 0.22)); }
.game-orders .special-order[hidden] { display: none; }
.game-orders .special-order i { display: grid; place-items: center; color: #b86713; background: #fff0a5; border-radius: 50%; font-style: normal; font-size: 15px; filter: none; }
.game-orders strong { font-size: 12px; }

.game-spectacle {
  position: absolute;
  z-index: 6;
  top: 31%;
  left: 50%;
  width: min(90%, 760px);
  transform: translate(-50%, -50%) scale(0.35) rotate(-3deg);
  opacity: 0;
  color: #fff;
  font-family: "Arial Black", "Avenir Next", sans-serif;
  font-size: 64px;
  font-weight: 900;
  line-height: 0.95;
  text-align: center;
  text-shadow: 0 5px 0 #29372c, 4px 0 0 #29372c, -4px 0 0 #29372c;
  pointer-events: none;
}
.game-spectacle[data-tone="score"] { color: #fff3a1; }
.game-spectacle[data-tone="combo"] { color: #ff8ea0; }
.game-spectacle[data-tone="order"] { color: #a8f0a9; }
.game-spectacle[data-tone="win"] { color: #ffe06d; }
.game-spectacle[data-active="true"] { animation: spectacle-slam 760ms cubic-bezier(0.16, 1.35, 0.35, 1) both; }

@keyframes spectacle-slam {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(2.8) rotate(-7deg); }
  23% { opacity: 1; transform: translate(-50%, -50%) scale(0.9) rotate(2deg); }
  55% { opacity: 1; transform: translate(-50%, -60%) scale(1) rotate(-1deg); }
  100% { opacity: 0; transform: translate(-50%, -110%) scale(0.86) rotate(1deg); }
}
@keyframes urgent-pulse { to { box-shadow: inset 0 0 0 3px #ee695f; } }

.game-queue {
  position: absolute;
  z-index: 4;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  background: rgba(255, 253, 244, 0.9);
  box-shadow: 0 2px 0 rgba(41, 55, 44, 0.18);
}
.game-queue > i,
.game-queue button span { width: 29px; height: 29px; display: block; filter: drop-shadow(0 2px 1px rgba(41, 55, 44, 0.22)); }
.game-queue > i:first-of-type { width: 33px; height: 33px; }
.game-queue button { width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border: 1px solid #9e916e; background: #fff6dd; cursor: pointer; }
.game-queue button span { outline: 1px solid #9e916e; outline-offset: -2px; }
.game-queue button span[data-empty="true"] { border-radius: 50%; background: #e4dfce !important; }
.game-debug { position: absolute; z-index: 4; right: 10px; bottom: 8px; padding: 4px 7px; color: #29372c; background: rgba(255, 253, 244, 0.8); font: 700 10px/1.2 ui-monospace, monospace; }
body:not([data-debug="true"]) .game-debug { display: none; }

.game-controls {
  min-height: 86px;
  display: grid;
  grid-template-columns: auto 90px minmax(180px, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: #fff3cd;
}
.control-button,
.sunshine-control {
  height: 54px;
  border: 1px solid #a89561;
  border-radius: 4px;
  color: var(--ink);
  background: #fffdf4;
  cursor: pointer;
}
.control-button { font-size: 24px; }
.control-button:hover, .sunshine-control:hover:not(:disabled) { background: #ffe5a4; border-color: #d55b54; }
.place-button { background: var(--coral); color: #fff; border-color: #a83d38; }
.text-control { font-size: 13px; font-weight: 800; text-transform: uppercase; }
.direction-pad { display: grid; grid-template-columns: repeat(3, 54px); gap: 4px; }
.direction-pad .control-button { width: 54px; height: 54px; }
.sunshine-control { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 0 15px; overflow: hidden; }
.sunshine-control:disabled { opacity: 0.62; cursor: not-allowed; }
.sunshine-control b { font-size: 12px; text-transform: uppercase; }
.sunshine-track { height: 10px; overflow: hidden; background: #e4dfce; border: 1px solid #a89561; }
.sunshine-track i { display: block; width: 0; height: 100%; background: var(--yellow); transition: width 240ms ease; }

.primary-button,
.secondary-button {
  min-height: 46px;
  padding: 10px 18px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button { background: var(--yellow); color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.secondary-button { background: var(--white); color: var(--ink); }
.primary-button:hover { background: #ffcf55; transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.primary-button:disabled { opacity: 0.58; cursor: progress; transform: none; box-shadow: 3px 3px 0 var(--ink); }

[hidden] { display: none !important; }

.editorial-band { padding: 72px 0; background: var(--white); border-block: var(--border); }

.editorial-grid { display: grid; grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr); gap: 70px; align-items: start; }

.editorial-image { position: sticky; top: 24px; }
.editorial-image img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border: var(--border); box-shadow: var(--shadow); }

.editorial-copy section + section { margin-top: 50px; }
.editorial-copy h2 { margin: 0 0 14px; font-size: 46px; line-height: 1.05; }
.editorial-copy p { margin: 0 0 14px; color: #404944; font-size: 17px; }

.guide-links { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 30px; }
.guide-links a { padding: 11px 14px; border: var(--border); text-decoration: none; font-weight: 800; }
.guide-links a:first-child { background: var(--mint); }
.guide-links a:last-child { background: var(--yellow); }

.article-shell { padding: 74px 0 92px; }

.article-header {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 70px;
  align-items: center;
  padding-bottom: 64px;
  border-bottom: var(--border);
}

.article-header h1 { max-width: 720px; margin: 12px 0 20px; font-size: 80px; line-height: 0.98; }
.lede { max-width: 660px; margin: 0; color: var(--muted); font-size: 24px; line-height: 1.45; }
.article-header figure { margin: 0; }
.article-header img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border: var(--border); box-shadow: var(--shadow); }
.article-header figcaption { margin-top: 10px; color: var(--muted); font-size: 11px; }

.article-body { width: min(860px, 100%); margin: 0 auto; padding-top: 30px; }
.article-body section { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 24px; padding: 38px 0; border-bottom: 1px solid #c6c9be; }
.section-number { color: var(--coral); font-family: Georgia, serif; font-size: 18px; font-weight: 700; }
.article-body h2 { margin: 0 0 13px; font-size: 36px; line-height: 1.15; }
.article-body p { margin: 0 0 14px; color: #3d4641; font-size: 17px; }

.site-footer { padding: 58px 0 max(30px, env(safe-area-inset-bottom)); background: var(--ink); color: var(--white); }
.footer-grid { display: flex; justify-content: space-between; gap: 40px; }
.footer-brand { color: var(--white); }
.footer-grid > div > p { max-width: 390px; color: #bcc3be; }
.footer-grid nav { display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 12px 28px; }
.footer-grid nav a { min-height: 44px; display: flex; align-items: center; }
.legal-line { margin-top: 38px; padding-top: 20px; border-top: 1px solid #4a534e; }
.legal-line p { margin: 6px 0; color: #aeb5b0; font-size: 12px; }

.consent-dialog {
  width: min(520px, calc(100% - 28px));
  padding: 0;
  border: var(--border);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
}

.game-reset-dialog {
  width: min(500px, calc(100% - 28px));
  padding: 0;
  border: var(--border);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
}

.game-reset-dialog::backdrop { background: rgba(27, 35, 32, 0.68); }
.game-reset-dialog form { padding: 26px; }
.game-reset-dialog h2 { margin: 8px 0 10px; font-size: 32px; }
.game-reset-dialog p:not(.game-kicker) { margin: 0; color: var(--muted); }
.game-reset-dialog .game-kicker { margin: 0; color: var(--coral); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.reset-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

.consent-dialog::backdrop { background: rgba(27, 35, 32, 0.58); }
.consent-dialog form { padding: 26px; }
.consent-dialog h2 { margin: 8px 0 10px; font-size: 32px; }
.consent-dialog p:not(.eyebrow) { color: var(--muted); }
.consent-dialog > form > a { display: inline-block; margin-top: 16px; font-size: 13px; }
.consent-actions { display: flex; gap: 12px; margin-top: 22px; }

@media (max-width: 1120px) {
  .play-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .site-header { grid-template-columns: 1fr auto; }
  .site-header nav { grid-column: 1 / -1; order: 3; overflow-x: auto; border-top: 1px solid var(--paper-deep); }
  .privacy-trigger { grid-column: 2; grid-row: 1; }
  .editorial-grid, .article-header { gap: 42px; }
}

@media (max-width: 700px) {
  .shell { width: min(1160px, calc(100% - 28px - env(safe-area-inset-left) - env(safe-area-inset-right))); }
  .site-header {
    padding-top: 9px;
    padding-bottom: 0;
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
    gap: 7px;
  }
  .site-header nav { margin-inline: -14px; padding: 0 8px; }
  .site-header nav a { flex: 1 0 auto; justify-content: center; padding-inline: 12px; }
  .play-intro { padding: 12px 0 6px; display: block; }
  .title-lockup { display: block; }
  .title-lockup h1 { margin-top: 3px; font-size: 41px; }
  .play-intro > p { width: 100%; margin-top: 8px; font-size: 14px; }
  .play-grid {
    width: calc(100% - env(safe-area-inset-left) - env(safe-area-inset-right));
    gap: 14px;
    padding-bottom: 34px;
  }
  .game-stage { border-inline: 0; box-shadow: none; }
  .game-frame-wrap { aspect-ratio: 4 / 3; }
  .game-overlay { padding: 18px; }
  .game-overlay h2 { font-size: 27px; }
  .game-overlay > p:not(.game-kicker) { font-size: 13px; margin-bottom: 12px; }
  .game-reset-dialog form { padding: 20px; }
  .game-reset-dialog h2 { font-size: 27px; }
  .reset-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .game-hud { top: 8px; left: 8px; grid-template-columns: repeat(2, minmax(74px, 1fr)); }
  .game-hud > div { min-width: 74px; padding: 5px 8px; }
  .game-hud strong { font-size: 14px; }
  .game-orders { top: 94px; left: 8px; padding: 4px; }
  .game-orders > span { display: none; }
  .game-orders > div { min-width: 48px; padding: 2px 5px; }
  .game-spectacle { top: 37%; font-size: 38px; }
  .game-queue { top: 8px; right: 8px; gap: 4px; padding: 5px; }
  .game-queue .queue-label { display: none; }
  .game-queue > i { width: 18px; height: 18px; }
  .game-queue > i:first-of-type { width: 24px; height: 24px; }
  .game-queue button { width: 32px; height: 32px; }
  .game-queue button span { width: 20px; height: 20px; }
  .game-controls { grid-template-columns: auto 64px minmax(100px, 1fr); gap: 5px; padding: 6px; }
  .direction-pad { grid-template-columns: repeat(3, 42px); }
  .direction-pad .control-button { width: 42px; height: 54px; }
  .game-controls > .text-control, .sunshine-control { height: 72px; }
  .sunshine-control { gap: 6px; padding-inline: 8px; }
  .editorial-band { padding: 48px 0; }
  .editorial-grid { grid-template-columns: 1fr; gap: 40px; }
  .editorial-image { position: static; }
  .editorial-copy p { font-size: 16px; }
  .article-shell { padding: 45px 0 70px; }
  .article-header { grid-template-columns: 1fr; gap: 36px; padding-bottom: 42px; }
  .article-header h1 { font-size: 46px; }
  .lede { font-size: 19px; }
  .editorial-copy h2 { font-size: 34px; }
  .article-body h2 { font-size: 28px; }
  .article-header figure { order: -1; }
  .article-header figure img { max-height: 260px; }
  .article-body section { grid-template-columns: 38px minmax(0, 1fr); gap: 10px; padding: 30px 0; }
  .footer-grid { display: grid; }
}

@media (max-width: 380px) {
  .brand { font-size: 16px; gap: 7px; }
  .brand-mark { width: 25px; }
  .privacy-trigger { font-size: 12px; }
  .game-toolbar { min-height: 52px; padding-left: 10px; }
  .game-state { font-size: 12px; }
  .game-overlay h2 { font-size: 23px; }
  .game-overlay .game-kicker { display: none; }
  .game-frame-wrap { aspect-ratio: 1 / 1; }
  .game-hud > div:nth-child(3), .game-hud > div:nth-child(4) { display: none; }
  .game-orders { top: 55px; }
  .game-spectacle { font-size: 30px; }
  .game-controls { grid-template-columns: auto 54px minmax(76px, 1fr); }
  .direction-pad { grid-template-columns: repeat(3, 37px); }
  .direction-pad .control-button { width: 37px; }
  .control-button { font-size: 20px; }
  .sunshine-control b { font-size: 10px; }
  .consent-actions { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
