:root {
  color-scheme: dark;
  --bg: #0e1514;
  --panel: #17211b;
  --line: #344139;
  --ink: #eff1e7;
  --muted: #a6b0a8;
  --accent: #c0ef8c;
  font-family: Arial, Helvetica, sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}
header,
main,
footer {
  width: min(1320px, calc(100% - 64px));
  margin: auto;
}
header {
  height: 110px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
a {
  color: inherit;
  text-decoration: none;
}
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
}
.brand {
  font-size: 29px;
  font-weight: 900;
  letter-spacing: -1px;
}
.brand span {
  color: var(--accent);
  font-size: 25px;
  padding-left: 8px;
}
.tag,
.eyebrow,
.meta,
nav {
  font-family: monospace;
  letter-spacing: 2px;
  font-size: 12px;
  color: var(--muted);
}
main {
  padding: 26px 0 72px;
  min-height: calc(100vh - 205px);
}
nav {
  min-height: 23px;
  letter-spacing: 0;
}
nav a {
  color: var(--accent);
}
.intro {
  padding: 30px 0 34px;
}
.eyebrow {
  margin: 0 0 18px;
}
h1 {
  font-size: clamp(38px, 6vw, 72px);
  line-height: 1.05;
  letter-spacing: -3px;
  margin: 0 0 24px;
  font-weight: 750;
}
.intro > p:last-child {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
  margin-bottom: 0;
}
.items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
}
.card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
  transition:
    border-color 0.15s,
    transform 0.15s;
}
.card[href]:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}
.card .art {
  height: 220px;
  background: #070b09;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.card img {
  height: 100%;
  width: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}
.symbol {
  font-family: monospace;
  font-size: 90px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -9px;
}
.nes .symbol {
  color: #ed8e78;
}
.card-body {
  padding: 25px 27px;
}
.card h2 {
  font-size: 24px;
  letter-spacing: -0.5px;
  margin: 12px 0;
}
.card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.card .go {
  display: block;
  margin-top: 30px;
  color: var(--accent);
  font-weight: 700;
}
.meta {
  font-size: 11px;
  letter-spacing: 1px;
}
.pending {
  opacity: 0.65;
}
.game-view {
  grid-column: 1/-1;
}
.game-view iframe {
  display: block;
  width: 100%;
  height: 85vh;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #000;
}
.game-view > a {
  display: inline-block;
  color: var(--accent);
  margin-bottom: 16px;
}
footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 30px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}
footer a {
  text-decoration: underline;
}
@media (max-width: 650px) {
  header,
  main,
  footer {
    width: calc(100% - 36px);
  }
  header {
    height: 80px;
  }
  .tag {
    display: none;
  }
  .intro {
    padding: 24px 0;
  }
  h1 {
    letter-spacing: -1.7px;
  }
  .items {
    grid-template-columns: 1fr;
  }
  .card .art {
    height: 190px;
  }
  footer {
    gap: 20px;
    flex-direction: column;
  }
  .game-view iframe {
    height: 82vh;
  }
}

/* Compact play view: one navigation row, then the actual player. */
body.playing > header {
  height: 52px;
  width: calc(100% - 32px);
}
.playing .brand {
  font-size: 20px;
}
.playing .brand span {
  font-size: 18px;
}
.playing .tag {
  display: none;
}
.playing main {
  width: calc(100% - 24px);
  padding: 6px 0 0;
  min-height: 0;
}
.playing #breadcrumbs {
  height: 32px;
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 12px;
  min-width: 0;
}
.playing #breadcrumbs span {
  color: var(--muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.playing .intro,
.playing > footer,
.playing .game-view > a {
  display: none;
}
.playing .items {
  display: block;
}
.playing .game-view iframe {
  height: calc(100dvh - 102px);
  border-radius: 5px;
}
@media (max-width: 650px) {
  body.playing > header {
    height: 44px;
  }
  .playing main {
    width: calc(100% - 12px);
  }
  .playing #breadcrumbs {
    height: 30px;
    font-size: 10px;
    gap: 12px;
  }
  .playing .game-view iframe {
    height: calc(100dvh - 86px);
  }
}

.card-actions {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}
.card-actions a {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 18px;
  color: var(--accent);
  font-weight: 700;
}
.card-actions .play-link {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
#breadcrumbs {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.view-tabs {
  display: flex;
  gap: 5px;
  margin-left: auto;
}
.view-tabs a {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.view-tabs .active {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--accent);
}
.learning header {
  height: 66px;
}
.learning .tag {
  display: none;
}
.learning .intro {
  padding: 24px 0;
}
.learning h1 {
  font-size: 38px;
  letter-spacing: -1px;
  margin-bottom: 14px;
}
.learn-view {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 36px;
  grid-column: 1/-1;
}
.chapters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: start;
  position: sticky;
  top: 20px;
  letter-spacing: 0;
  line-height: 1.5;
}
.chapters a {
  padding: 10px 12px;
  border-left: 2px solid var(--line);
}
.chapters a[aria-current] {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--panel);
}
.prose {
  min-width: 0;
  max-width: 920px;
  font-size: 16px;
  line-height: 1.75;
  color: var(--muted);
}
.prose h2,
.prose h3,
.prose h4 {
  color: var(--ink);
  line-height: 1.3;
  letter-spacing: -0.5px;
  margin-top: 32px;
}
.prose h2:first-child {
  margin-top: 0;
}
.prose a {
  color: var(--accent);
  text-decoration: underline;
}
.prose code {
  font-family: monospace;
  font-size: 0.9em;
  background: #090e0d;
  padding: 2px 4px;
  border-radius: 3px;
}
.prose pre {
  padding: 20px;
  background: #090e0d;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: auto;
  line-height: 1.6;
}
.prose pre code {
  padding: 0;
  background: none;
}
.prose details {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}
.prose summary {
  color: var(--accent);
  cursor: pointer;
}
.prose .table-scroll {
  overflow: auto;
}
.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
.prose td,
.prose th {
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
  vertical-align: top;
}
.prose strong {
  color: var(--ink);
}
.playing #breadcrumbs {
  flex-wrap: nowrap;
}
.playing #breadcrumbs > span:not(.view-tabs) {
  flex: 1;
  min-width: 0;
}
.playing .view-tabs {
  flex-shrink: 0;
}
.playing .view-tabs a {
  font-size: 11px;
  padding: 5px 9px;
}
@media (max-width: 700px) {
  .learn-view {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .chapters {
    position: static;
    flex-direction: row;
    overflow: auto;
    flex-wrap: nowrap;
  }
  .chapters a {
    white-space: nowrap;
  }
  .learning h1 {
    font-size: 30px;
  }
  .prose {
    font-size: 15px;
  }
  .playing #breadcrumbs > a:first-child,
  .playing #breadcrumbs > span:not(.view-tabs) {
    display: none;
  }
  .playing .view-tabs {
    margin-left: auto;
  }
  .playing #breadcrumbs {
    gap: 8px;
  }
  .prose pre {
    padding: 12px;
  }
}

.code-explorer {
  min-width: 0;
  line-height: 1.6;
}
.study-label {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 7px;
  color: var(--accent);
  font-size: 11px;
}
.code-explorer > p {
  color: var(--muted);
  font-size: 14px;
  max-width: 840px;
}
.code-explorer label {
  display: block;
  margin: 24px 0 18px;
  color: var(--accent);
  font-family: monospace;
  font-size: 13px;
}
.code-explorer input {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 9px 12px;
  border-radius: 5px;
  width: 150px;
  font: inherit;
}
.code-layout {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 20px;
}
.instruction-list {
  max-height: 65vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #090e0d;
}
.instruction-list button {
  display: block;
  border: 0;
  border-bottom: 1px solid #1b2820;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font: 12px/1.6 monospace;
  padding: 9px 12px;
  width: 100%;
  cursor: pointer;
}
.instruction-list button[aria-pressed='true'] {
  background: var(--panel);
  color: var(--accent);
}
.code-layout > div {
  min-width: 0;
}
.code-layout p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 0;
}
.code-layout pre {
  overflow: auto;
  font: 12px/1.7 monospace;
  padding: 18px;
  background: #090e0d;
  border: 1px solid var(--line);
  border-radius: 6px;
  white-space: pre;
}
.code-layout pre:first-of-type {
  color: var(--accent);
}
@media (max-width: 850px) {
  .code-layout {
    grid-template-columns: 1fr;
  }
  .instruction-list {
    max-height: 220px;
  }
}

/* ROM Desk media identification (/desk). */
.identify {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  max-width: 900px;
}
.identify input[type='file'] {
  display: block;
  margin-top: 8px;
  max-width: 100%;
}
.identify-results {
  margin: 0;
  padding-left: 18px;
  overflow-wrap: anywhere;
}
.identify-results li {
  margin: 6px 0;
}
.identify details li {
  overflow-wrap: anywhere;
  font-size: 13px;
}
