:root {
  --ink: #211f2b;
  --muted-ink: #62606f;
  --paper: #fffaf1;
  --panel: #ffffff;
  --soft-panel: #fff3d8;
  --line: #ded7c6;
  --red: #e43d30;
  --gold: #f6b333;
  --green: #2f9d74;
  --teal: #228ea0;
  --violet: #7d4bc2;
  --shadow: 0 18px 45px rgba(39, 34, 24, 0.13);
  --radius: 8px;
  --content: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.98), rgba(250, 243, 230, 0.98)),
    repeating-linear-gradient(90deg, rgba(228, 61, 48, 0.05) 0 1px, transparent 1px 34px);
  font-family: Inter, "Segoe UI", Arial, "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

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

a {
  color: #126f83;
  text-decoration: none;
}

a:hover {
  color: var(--red);
}

:focus-visible {
  outline: 3px solid rgba(246, 179, 51, 0.85);
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 14px max(22px, calc((100vw - var(--content)) / 2));
  background: rgba(255, 250, 241, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--ink);
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  color: #fff;
  background: linear-gradient(135deg, var(--red), var(--gold) 52%, var(--green));
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 0.9rem;
  line-height: 1;
}

.nav-toggle {
  display: none;
  min-height: 42px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--gold);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

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

.site-nav a,
.language-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 12px;
  color: var(--ink);
  border-radius: var(--radius);
  font-weight: 700;
}

.site-nav a:hover {
  background: #fff0c4;
  color: var(--ink);
}

.language-link {
  background: var(--ink);
  color: #fff !important;
}

main {
  overflow: hidden;
}

.play-hero,
.listing-page,
.detail-page,
.article-page,
.breadcrumb {
  width: min(var(--content), calc(100% - 44px));
  margin: 0 auto;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-top: 18px;
  color: var(--muted-ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.breadcrumb a {
  color: var(--teal);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb a::after {
  content: "/";
  margin-left: 8px;
  color: var(--muted-ink);
}

.play-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  align-items: center;
  gap: 34px;
  min-height: calc(100vh - 72px);
  padding: 48px 0;
}

.hero-copy {
  max-width: 660px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2.25rem, 6vw, 4.9rem);
}

h2 {
  font-size: clamp(1.55rem, 3vw, 2.35rem);
}

h3 {
  font-size: 1.18rem;
}

.hero-copy p:not(.eyebrow),
.lead {
  margin: 18px 0 0;
  color: var(--muted-ink);
  font-size: 1.08rem;
}

.mini-game-panel {
  padding: 18px;
  background: var(--panel);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 10px 10px 0 rgba(33, 31, 43, 0.9);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-title h2 {
  font-size: 1.25rem;
}

#mini-game-score {
  display: grid;
  place-items: center;
  min-width: 58px;
  height: 42px;
  padding: 0 12px;
  color: #fff;
  background: var(--red);
  border-radius: var(--radius);
  font-weight: 900;
}

.mini-game-panel p {
  margin: 12px 0 16px;
  color: var(--muted-ink);
}

#mini-game {
  width: 100%;
  aspect-ratio: 13 / 8;
  height: auto;
  touch-action: none;
  background: #16252a;
  border: 2px solid var(--ink);
  border-radius: 6px;
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.game-actions button {
  min-height: 42px;
  padding: 8px 14px;
  color: var(--ink);
  background: var(--gold);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.game-actions button:last-child {
  background: #dceef1;
}

.playable-panel {
  display: grid;
  gap: 16px;
  margin: 30px auto 0;
  padding: 18px;
  background: var(--panel);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 10px 10px 0 rgba(33, 31, 43, 0.9);
}

.playable-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.playable-header h2 {
  font-size: 1.45rem;
}

.playable-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  min-height: 40px;
  padding: 7px 12px;
  color: #fff;
  background: var(--teal);
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 900;
  text-align: center;
}

.playable-surface {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 340px;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  background: #18272f;
  border: 2px solid var(--ink);
  border-radius: 6px;
}

.playable-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.playable-controls button {
  min-height: 42px;
  padding: 8px 14px;
  color: var(--ink);
  background: var(--gold);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.playable-controls button:last-child {
  background: #dceef1;
}

.playable-hint {
  margin: 0;
  color: var(--muted-ink);
  font-size: 0.95rem;
}

.play-board,
.playable-board {
  display: grid;
  gap: 8px;
  width: min(100%, 520px);
  aspect-ratio: 1 / 1;
  touch-action: none;
}

.play-cell,
.playable-tile,
.playable-2048-tile,
.playable-mine,
.playable-piece,
.playable-block-cell,
.tile-2048,
.snake-cell,
.memory-card,
.mine-cell,
.block-piece {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  border-radius: 6px;
  font-weight: 900;
}

.play-cell {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.play-canvas,
.playable-canvas {
  width: 100%;
  height: 100%;
  touch-action: none;
}

.tile-2048,
.playable-2048-tile {
  background: #f4d27a;
  color: var(--ink);
  border: 2px solid rgba(33, 31, 43, 0.22);
  font-size: clamp(1rem, 5vw, 2.1rem);
}

.snake-cell {
  border-radius: 3px;
}

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

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

.memory-card,
.mine-cell {
  min-height: 44px;
  background: #f8f5e8;
  color: var(--ink);
  border: 2px solid rgba(33, 31, 43, 0.28);
}

.memory-card {
  cursor: pointer;
}

.memory-card.is-hidden {
  background: var(--violet);
  color: #fff;
}

.mine-cell {
  cursor: pointer;
}

.mine-cell.is-open {
  background: #e8f6f2;
}

.block-piece,
.playable-piece,
.playable-block-cell {
  background: var(--gold);
  border: 2px solid rgba(33, 31, 43, 0.35);
  cursor: grab;
  touch-action: none;
}

.playable-block-tray {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.content-band {
  padding: 58px max(22px, calc((100vw - var(--content)) / 2));
}

.content-band.muted {
  background: rgba(255, 243, 216, 0.78);
  border-block: 1px solid rgba(222, 215, 198, 0.8);
}

.content-band.inline {
  width: 100%;
  padding: 36px 0 0;
  background: transparent;
  border: 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.section-heading a {
  flex: 0 0 auto;
  color: var(--red);
  font-weight: 900;
}

.card-grid,
.text-grid,
.category-grid {
  display: grid;
  gap: 18px;
}

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

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

.game-card,
.text-card,
.category-pill {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.game-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-art {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  min-height: 170px;
  padding: 18px;
  background: linear-gradient(135deg, #ffe082, #f5f6f0 48%, #bce6dd);
}

.game-card:nth-child(3n + 2) .card-art {
  background: linear-gradient(135deg, #ffc0b6, #f8f5e8 52%, #c7e1ff);
}

.game-card:nth-child(3n) .card-art {
  background: linear-gradient(135deg, #d7c7ff, #fff3d8 52%, #bde7b9);
}

.card-art img {
  width: min(82%, 220px);
  height: 132px;
  object-fit: contain;
}

.card-body,
.text-card,
.category-pill {
  padding: 18px;
}

.card-body {
  flex: 1;
}

.card-body p,
.text-card p,
.category-pill span {
  margin: 10px 0 0;
  color: var(--muted-ink);
}

.editorial-band {
  padding-bottom: 20px;
}

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

.editorial-grid .text-card {
  min-height: 100%;
}

.editorial-grid ul {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--muted-ink);
}

.editorial-grid li + li {
  margin-top: 6px;
}

.category-pill {
  display: block;
  border-left: 6px solid var(--green);
}

.category-pill:nth-child(2) {
  border-left-color: var(--teal);
}

.category-pill:nth-child(3) {
  border-left-color: var(--red);
}

.category-pill:nth-child(4) {
  border-left-color: var(--violet);
}

.category-pill strong,
.category-pill span {
  display: block;
}

.listing-page {
  padding: 54px 0 64px;
}

.listing-page > header,
.article-page > .article-body,
.detail-header {
  margin-top: 30px;
}

.listing-page > header {
  max-width: 820px;
}

.detail-page,
.article-page {
  padding-bottom: 64px;
}

.detail-header {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 30px;
  align-items: start;
}

.detail-header > img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  padding: 20px;
  background: var(--panel);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
}

.fact-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0 0;
}

.fact-list div {
  min-width: 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.fact-list dt {
  color: var(--muted-ink);
  font-size: 0.8rem;
  font-weight: 800;
}

.fact-list dd {
  margin: 4px 0 0;
  font-weight: 800;
}

.tag-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag-links a {
  padding: 7px 10px;
  color: var(--ink);
  background: #fff7dc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
}

.prev-next {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: min(840px, 100%);
  margin: 28px auto 0;
}

.prev-next a {
  min-width: 0;
  padding: 16px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
}

.prev-next a:last-child {
  text-align: right;
}

.prev-next span {
  display: block;
  color: var(--muted-ink);
  font-size: 0.82rem;
  font-weight: 800;
}

.prev-next strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.article-body {
  max-width: 840px;
  margin-inline: auto;
}

.article-body h1 {
  font-size: clamp(2rem, 4.5vw, 3.8rem);
}

.article-body h2 {
  margin-top: 32px;
  font-size: 1.55rem;
}

.article-body p,
.article-body li {
  color: #464350;
}

.article-body ul,
.article-body ol {
  padding-left: 1.35rem;
}

.faq-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.faq-list details {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.faq-list summary {
  padding: 14px 16px;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.faq-list p {
  margin: 0;
  padding: 0 16px 16px;
}

.notice {
  padding: 16px 18px;
  background: #fff0c4;
  border: 1px solid #e7b84a;
  border-left: 6px solid var(--gold);
  border-radius: var(--radius);
  color: #4a3710;
}

.site-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.8fr);
  gap: 28px;
  padding: 36px max(22px, calc((100vw - var(--content)) / 2));
  color: #f9f5ea;
  background: #211f2b;
}

.site-footer p {
  margin: 8px 0 0;
  color: #d8d0bf;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 16px;
}

.site-footer a {
  color: #ffe082;
  font-weight: 800;
}

.tool-page main {
  overflow: visible;
}

.tool-nav {
  display: flex;
}

.tool-shell {
  width: min(var(--content), calc(100% - 44px));
  margin: 0 auto;
  padding: 42px 0 70px;
}

.tool-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.tool-hero h1 {
  font-size: clamp(2rem, 5vw, 3.6rem);
}

.tool-status {
  flex: 0 0 auto;
  max-width: 320px;
  padding: 10px 14px;
  color: #fff;
  background: var(--teal);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  font-weight: 900;
  text-align: center;
}

.benchmark-page .tool-hero {
  width: min(100% - 44px, 920px);
  margin: 34px auto 24px;
}

.benchmark-page .content-band.inline {
  width: min(100% - 44px, 920px);
  margin-inline: auto;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.tool-panel {
  min-width: 0;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.tool-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.tool-panel-heading h2 {
  font-size: 1.35rem;
}

.analytics-shell {
  width: min(1180px, calc(100% - 44px));
}

.analytics-controls {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(220px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
}

.analytics-controls label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--ink);
  font-weight: 900;
}

.analytics-controls span {
  font-size: 0.9rem;
}

.analytics-controls input,
.analytics-controls select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

.analytics-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.analytics-stat {
  display: grid;
  gap: 10px;
}

.analytics-stat span {
  color: var(--muted);
  font-weight: 900;
}

.analytics-stat strong {
  color: var(--ink);
  font-size: 2rem;
  line-height: 1;
}

.analytics-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.analytics-bars,
.analytics-list {
  display: grid;
  gap: 10px;
}

.analytics-bar-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 54px;
  gap: 12px;
  align-items: center;
}

.analytics-bar-row span,
.analytics-bar-row strong {
  font-size: 0.92rem;
}

.analytics-bar-row div {
  height: 12px;
  overflow: hidden;
  background: #eef2f2;
  border-radius: 999px;
}

.analytics-bar-row i,
.analytics-list-row i {
  display: block;
  height: 100%;
  background: var(--teal);
  border-radius: inherit;
}

.analytics-list-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(11, 18, 32, 0.08);
}

.analytics-list-label {
  overflow: hidden;
  color: var(--ink);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-list-row strong {
  color: var(--ink);
}

.analytics-list-row i {
  grid-column: 1 / -1;
  height: 8px;
  background: var(--yellow);
}

.analytics-empty {
  padding: 14px;
  color: var(--muted);
  background: #f6f7f7;
  border-radius: 6px;
  font-weight: 800;
}

.analytics-table-wrap {
  overflow-x: auto;
}

.analytics-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.analytics-table th,
.analytics-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(11, 18, 32, 0.08);
  color: var(--ink);
  font-size: 0.92rem;
  text-align: left;
  vertical-align: top;
}

.analytics-table th {
  color: var(--muted);
  font-weight: 900;
}

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

.field-grid label,
.full-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--ink);
  font-weight: 900;
}

.full-field {
  margin-top: 14px;
}

.field-grid span,
.full-field span,
.checkbox-row span {
  font-size: 0.9rem;
}

.field-grid input,
.field-grid select,
.full-field input,
.full-field textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

.full-field textarea {
  min-height: 238px;
  resize: vertical;
  line-height: 1.5;
  font-family: "Cascadia Mono", Consolas, monospace;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  font-weight: 900;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.tool-button {
  min-height: 42px;
  padding: 8px 14px;
  color: var(--ink);
  background: var(--gold);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.tool-button.secondary {
  background: #dceef1;
}

.is-tool-busy .tool-button,
.is-tool-busy input,
.is-tool-busy select,
.is-tool-busy textarea {
  opacity: 0.72;
}

.output-box {
  min-height: 150px;
  max-height: 340px;
  margin-top: 16px;
  padding: 12px;
  overflow: auto;
  color: #f4f7f2;
  background: #18272f;
  border-radius: 6px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.88rem;
  white-space: pre-wrap;
}

.generated-panel {
  margin-top: 18px;
}

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

.generated-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.generated-item div,
.generated-item strong,
.generated-item span {
  min-width: 0;
}

.generated-item strong,
.generated-item span {
  display: block;
}

.generated-item span,
.muted-text {
  color: var(--muted-ink);
  font-size: 0.9rem;
}

.generated-item a {
  flex: 0 0 auto;
  font-weight: 900;
}

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

.benchmark-index {
  width: min(100% - 44px, 980px);
}

.benchmark-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
  min-width: 0;
  min-height: 210px;
  padding: 16px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.benchmark-card h3 {
  margin: 4px 0 8px;
  font-size: 1.25rem;
}

.benchmark-card p {
  margin: 0;
  color: var(--muted-ink);
}

.benchmark-shell {
  width: min(100% - 44px, 920px);
  margin: 28px auto;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.benchmark-header,
.benchmark-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.benchmark-header h2 {
  font-size: 1.45rem;
}

.benchmark-score {
  min-width: 108px;
  padding: 8px 12px;
  color: #fff;
  background: var(--ink);
  border-radius: 6px;
  font-weight: 900;
  text-align: center;
}

.benchmark-stage {
  position: relative;
  display: grid;
  place-items: center;
  gap: 12px;
  min-height: 420px;
  margin: 18px 0;
  padding: 18px;
  overflow: hidden;
  background: #eef7f4;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
}

.benchmark-stage.is-ready {
  color: #fff;
  background: var(--green);
}

.benchmark-grid {
  display: grid;
  grid-template-columns: repeat(var(--benchmark-columns, 4), minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 480px);
}

.benchmark-grid-four {
  width: min(100%, 360px);
}

.benchmark-schulte {
  width: min(100%, 520px);
}

.benchmark-tile,
.benchmark-clicker,
.benchmark-signal {
  min-width: 0;
  min-height: 56px;
  padding: 8px;
  color: var(--ink);
  background: #fff3d8;
  border: 2px solid var(--ink);
  border-radius: 6px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.benchmark-tile.is-lit,
.benchmark-signal.is-ready {
  color: #fff;
  background: var(--teal);
}

.benchmark-tile.is-hit {
  color: #fff;
  background: var(--green);
}

.benchmark-message,
.benchmark-prompt {
  max-width: 680px;
  margin: 0;
  color: var(--ink);
  font-weight: 800;
  text-align: center;
}

.benchmark-big-number,
.benchmark-color-word {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2.4rem, 8vw, 5rem);
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
}

.benchmark-input,
.benchmark-textarea {
  width: min(100%, 520px);
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fffdf8;
  border: 2px solid var(--ink);
  border-radius: 6px;
  font: inherit;
  font-weight: 800;
}

.benchmark-textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.5;
}

.benchmark-target {
  position: absolute;
  width: 58px;
  height: 58px;
  padding: 0;
  color: #fff;
  background: var(--red);
  border: 3px solid var(--ink);
  border-radius: 50%;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.benchmark-target.is-moving {
  animation: benchmark-slide 1.65s linear infinite alternate;
}

.benchmark-clicker,
.benchmark-signal {
  width: min(100%, 360px);
  min-height: 190px;
  font-size: clamp(2rem, 7vw, 4.5rem);
}

@keyframes benchmark-slide {
  from {
    left: 8%;
  }
  to {
    left: calc(92% - 58px);
  }
}

.local-fc-grid {
  grid-template-columns: minmax(320px, 0.86fr) minmax(0, 1.14fr);
}

.local-fc-search {
  margin-top: 0;
  margin-bottom: 14px;
}

.local-rom-list {
  display: grid;
  gap: 8px;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.local-rom-item {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 11px;
  color: var(--ink);
  text-align: left;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
}

.local-rom-item:hover,
.local-rom-item.is-selected {
  border-color: var(--red);
  box-shadow: inset 4px 0 0 var(--gold);
}

.local-rom-item strong,
.local-rom-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.local-rom-item strong {
  line-height: 1.35;
}

.local-rom-item span {
  color: var(--muted-ink);
  font-size: 0.84rem;
  line-height: 1.35;
}

.local-player-panel {
  position: sticky;
  top: 92px;
}

.local-player-screen {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #101923;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 6px 6px 0 rgba(33, 31, 43, 0.18);
}

#nes-screen {
  width: min(100%, 768px);
  aspect-ratio: 256 / 240;
  image-rendering: pixelated;
  background: #101923;
}

.local-controls {
  margin-top: 16px;
  padding: 14px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.local-controls h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.local-controls ul {
  margin: 0;
  padding-left: 20px;
}

.local-only-note {
  margin-top: 18px;
}

.local-only-note h2 {
  margin-bottom: 6px;
  font-size: 1.25rem;
}

.local-only-note p {
  color: var(--muted-ink);
}

@media (max-width: 980px) {
  .play-hero,
  .detail-header {
    grid-template-columns: 1fr;
  }

  .play-hero {
    min-height: 0;
  }

  .detail-header > img {
    width: min(260px, 100%);
  }

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

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

  .tool-grid,
  .local-fc-grid,
  .generated-list {
    grid-template-columns: 1fr;
  }

  .local-player-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 15px;
  }

  .site-header {
    position: static;
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding: 12px 18px;
  }

  .brand {
    justify-content: space-between;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
  }

  .site-nav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .site-nav.is-open,
  .site-header:focus-within .site-nav {
    display: flex;
  }

  .tool-page .tool-nav {
    display: flex;
  }

  .site-nav a {
    justify-content: center;
    width: 100%;
  }

  .play-hero,
  .listing-page,
  .detail-page,
  .article-page,
  .breadcrumb {
    width: min(100% - 28px, var(--content));
  }

  .play-hero {
    gap: 24px;
    padding: 30px 0 42px;
  }

  h1 {
    font-size: clamp(2rem, 13vw, 3.35rem);
  }

  .mini-game-panel {
    padding: 14px;
    box-shadow: 6px 6px 0 rgba(33, 31, 43, 0.9);
  }

  .panel-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  #mini-game {
    aspect-ratio: 4 / 3;
  }

  .content-band {
    padding: 38px 14px;
  }

  .content-band.inline {
    padding-top: 28px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .card-grid,
  .text-grid,
  .category-grid,
  .editorial-grid,
  .benchmark-card-grid,
  .fact-list,
  .prev-next {
    grid-template-columns: 1fr;
  }

  .prev-next a:last-child {
    text-align: left;
  }

  .benchmark-stage {
    min-height: 340px;
    padding: 12px;
  }

  .benchmark-header,
  .benchmark-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .card-art {
    min-height: 150px;
  }

  .card-art img {
    height: 116px;
  }

  .listing-page {
    padding: 32px 0 44px;
  }

  .site-footer {
    grid-template-columns: 1fr;
    padding: 30px 18px;
  }

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

  .tool-shell {
    width: min(100% - 28px, var(--content));
    padding: 28px 0 46px;
  }

  .benchmark-index,
  .benchmark-page .tool-hero,
  .benchmark-page .content-band.inline,
  .benchmark-shell {
    width: min(100% - 44px, var(--content));
  }

  .tool-hero,
  .tool-panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .tool-status {
    width: 100%;
    max-width: none;
  }

  .analytics-controls,
  .analytics-stat-grid,
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .analytics-bar-row {
    grid-template-columns: 86px minmax(0, 1fr) 44px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .game-actions {
    flex-direction: column;
  }

  .game-actions button {
    width: 100%;
  }

  .mini-game-panel,
  .game-card,
  .text-card,
  .category-pill,
  .tool-panel {
    border-radius: 6px;
  }

  .tool-actions,
  .tool-button {
    width: 100%;
  }
}
