/* Final Fantasy VI Ultimate: the wiki site. The "In 1.0 / Now" boxes borrow the game's own
   blue menu windows. Opens from a folder with no server, so nothing here loads from the web. */
:root {
  --bg: #eef0f6;
  --panel: #ffffff;
  --ink: #1a1c24;
  --muted: #5b6072;
  --line: #d6d9e4;
  --accent: #2f4bb0;
  --accent-soft: #e3e8fb;
  --win-top: #4a63d6;
  --win-bot: #1a2574;
  --win-ink: #ffffff;
  --win-edge: #eef1ff;
  --win-label: #c8d2ff;
  --mark: #fff3b0;
  --series-old: #eb6834;
  --series-new: #2a78d6;
  --del-bg: #fde3e1;
  --del-ink: #8a1f17;
  --ins-bg: #d9f2df;
  --ins-ink: #14532d;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f121a;
    --panel: #171b27;
    --ink: #e8eaf2;
    --muted: #9aa1b5;
    --line: #2a3042;
    --accent: #9fb2ff;
    --accent-soft: #232b45;
    --win-top: #3b52bf;
    --win-bot: #141c5a;
    --win-edge: #c9d1f5;
    --mark: #4a4320;
    --series-old: #d95926;
    --series-new: #3987e5;
    --del-bg: #4a1f1d;
    --del-ink: #ffc9c3;
    --ins-bg: #173d25;
    --ins-ink: #bff0cc;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { scroll-padding-top: 8rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr minmax(12rem, 22rem);
  gap: .5rem 1rem;
  align-items: center;
  padding: .7rem 1rem .5rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand a { color: var(--ink); font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.brand .ver { color: var(--muted); font-size: .85rem; margin-left: .35rem; }
.top nav { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-size: .92rem; }
.top nav a { text-decoration: none; padding: .1rem 0; border-bottom: 2px solid transparent; }
.top nav a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }

.search { position: relative; }
.search input {
  width: 100%;
  padding: .45rem .7rem;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
#hits {
  position: absolute;
  right: 0;
  left: 0;
  top: calc(100% + 4px);
  max-height: 60vh;
  overflow: auto;
  margin: 0;
  padding: .3rem;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
#hits li a { display: block; padding: .35rem .5rem; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: .9rem; }
#hits li a:hover, #hits li a.sel { background: var(--accent-soft); }
#hits .n { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: .4rem; }
#hits .none { padding: .4rem .5rem; color: var(--muted); font-size: .9rem; }

main { max-width: 70rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
h1 { font-size: 1.9rem; line-height: 1.2; margin: .5rem 0 .75rem; }
h2 { font-size: 1.3rem; margin: 2.2rem 0 .8rem; padding-top: .3rem; border-top: 1px solid var(--line); }
.count {
  display: inline-block;
  min-width: 2.2em;
  padding: 0 .45em;
  font-size: .75em;
  font-weight: 600;
  text-align: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  vertical-align: middle;
}
.intro { font-size: 1.08rem; color: var(--muted); }

.toc ul { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 1rem 0; list-style: none; }
.toc li { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .3rem .6rem; font-size: .92rem; }
.toc a { text-decoration: none; }

.entry {
  margin: 0 0 1rem;
  padding: .9rem .75rem .6rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.entry:target { outline: 3px solid var(--accent); outline-offset: 2px; }
.entry h3 { font-size: 1.02rem; line-height: 1.4; margin: 0 0 .6rem; font-weight: 600; }
.entry .num { color: var(--muted); text-decoration: none; font-variant-numeric: tabular-nums; margin-right: .25rem; }
.credit { margin: .5rem 0 0; font-size: .85rem; color: var(--muted); }

/* the game's menu window */
.window {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .35rem .9rem;
  margin: 0;
  padding: .7rem .9rem;
  color: var(--win-ink);
  background: linear-gradient(180deg, var(--win-top), var(--win-bot));
  border: 2px solid var(--win-edge);
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(0, 0, 0, .25);
}
.window dt { color: var(--win-label); font-weight: 700; font-size: .85rem; letter-spacing: .03em; padding-top: .1rem; }
.window dd { margin: 0; }

/* quoted lines of a script edit: 1.0 beside now, the words that changed marked */
.lines { margin: .8rem 0 0; }
.line + .line, .lines details { margin-top: .7rem; }
.line .kind { margin: 0 0 .25rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.pair > div { padding: .5rem .7rem; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.pair .lab { display: block; font-size: .75rem; font-weight: 700; color: var(--muted); margin-bottom: .15rem; }
.pair p { margin: 0; font-size: .93rem; }
.pair del { background: var(--del-bg); color: var(--del-ink); text-decoration: line-through; border-radius: 3px; }
.pair ins { background: var(--ins-bg); color: var(--ins-ink); text-decoration: none; border-radius: 3px; }
.lines summary { cursor: pointer; color: var(--accent); font-size: .9rem; }

/* Pictures are shown at an exact multiple of their native size, never in between (Anton,
   2026-09-26): 2x, 1x on a phone, and 4x in the lightbox on a click. Each img carries its
   native size as --w and --h. Pictures stay inside their entry's box (Anton, 2026-09-26: the
   earlier grid ran wider than the box and looked wrong). The column is wide enough for two 2x
   screens side by side; a third wraps to the next row. */
.media {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: .8rem .5rem;
  margin: .8rem 0 0;
}
.media figure { margin: 0; text-align: center; }
/* a 1.0/now pair merged into one box: one frame round both, a label under each */
.media .twin { padding: .25rem .25rem .3rem; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.twin .pics { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: .4rem 2px; }
.twin .pics > div { display: flex; flex-direction: column; align-items: center; }
.twin .pics img { border-radius: 0; border: 0; }
.twin .lab { font-size: .75rem; font-weight: 700; color: var(--muted); margin-top: .2rem; }
.twin figcaption { margin-top: .15rem; }
.media img, .media video {
  display: block;
  margin: 0 auto;
  width: calc(var(--w) * 2px);
  height: calc(var(--h) * 2px);
  image-rendering: pixelated;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #000;
  cursor: zoom-in;
}
.media video { width: min(44rem, calc(100vw - 6rem)); height: auto; cursor: default; }
.media figcaption { font-size: .82rem; color: var(--muted); margin-top: .25rem; text-align: center; }
@media (max-width: 36rem) {
  .media img { width: calc(var(--w) * 1px); height: calc(var(--h) * 1px); }
}

/* the lightbox: the clicked picture at 4x (1024x896 for a screen), or the largest whole
   multiple that fits the window */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: 1rem;
  background: rgba(0, 0, 0, .86);
  cursor: zoom-out;
}
.lightbox img { display: block; image-rendering: pixelated; background: #000; }
.lightbox .lb-row { display: flex; gap: 4px; align-items: flex-end; }
.lightbox .lb-row > div { display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.lightbox .lb-row span { color: #e8eaf2; font-size: .85rem; font-weight: 700; }
.lightbox p { margin: 0; color: #e8eaf2; font-size: .9rem; text-align: center; }

/* front page: a 256-pixel screenshot at 1x tops each card, so a card is never narrower */
.cards { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem; margin: 1.5rem 0; }
.cards .card { width: 16.375rem; }
.card {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: .9rem 1rem;
  color: var(--ink);
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.card:hover { border-color: var(--accent); }
.card.pic { padding: 0 0 .9rem; overflow: hidden; }
.card.pic > :not(img) { margin-left: 1rem; margin-right: 1rem; }
.card img {
  display: block;
  align-self: center;
  width: 256px;
  height: 224px;
  margin: 0 0 .4rem;
  image-rendering: pixelated;
  background: #000;
}
.card strong { font-size: 1.05rem; }
.card span:last-child { font-size: .88rem; color: var(--muted); }
.card .count { align-self: flex-start; }

/* the Performance page: headline number, dot-pair chart (1.0 against now), table view */
.hero {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin: 1rem 0 1.2rem;
  padding: 1rem 1.2rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.hero .big { font-size: 2.8rem; font-weight: 700; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.hero span:last-child { color: var(--muted); }
.legend { display: flex; align-items: center; gap: .4rem; font-size: .9rem; color: var(--muted); }
.legend .key { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; margin-left: .6rem; }
.legend .key:first-child { margin-left: 0; }
.key.old { background: var(--series-old); }
.key.new { background: var(--series-new); }
.chart { width: 100%; height: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .6rem; }
.chart text { font: 12px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; fill: var(--muted); }
.chart .n { text-anchor: end; fill: var(--ink); }
.chart .g { font-weight: 700; fill: var(--ink); }
.chart .a { text-anchor: middle; }
.chart .v { font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .link { stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.chart circle { stroke: var(--panel); stroke-width: 2; }
.chart circle.old { fill: var(--series-old); }
.chart circle.new { fill: var(--series-new); }
details { margin: .8rem 0; }

/* the ROM-hacker note under an entry, closed until opened */
.tech { margin: .7rem 0 0; font-size: .9rem; }
.tech summary { cursor: pointer; color: var(--accent); font-size: .88rem; }
.tech .basis { margin-left: .4rem; padding: 0 .4rem; font-size: .75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; }
.tech[open] { padding: .1rem .75rem .5rem; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.tech p { margin: .5rem 0; }
.tech code { font-family: ui-monospace, Consolas, monospace; font-size: .86em; }
.tech pre { margin: .5rem 0; padding: .5rem .7rem; overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; line-height: 1.35; }
.tech .how { font-size: .8rem; }
/* the front page's ROM-hacker introduction, closed until opened */
.names { columns: 3 11rem; column-gap: 2rem; list-style: none; padding: 0; margin: .4rem 0 1.6rem; }
.names li { break-inside: avoid; padding: .15rem 0; }
.hackers { margin: 2.2rem 0 0; border-top: 1px solid var(--line); }
.hackers summary { cursor: pointer; list-style: none; }
.hackers summary::-webkit-details-marker { display: none; }
.hackers summary h2 { display: inline; margin: 0; padding: 0; border: 0; color: var(--accent); }
.hackers summary::before { content: "\25B8"; display: inline-block; width: 1.2rem; color: var(--accent); font-size: 1.1rem; }
.hackers[open] summary::before { content: "\25BE"; }
.hackers summary { padding: .5rem 0 .8rem; }
table.data { border-collapse: collapse; margin-top: .5rem; font-size: .92rem; }
table.data th, table.data td { padding: .3rem .8rem; border-bottom: 1px solid var(--line); text-align: right; }
table.data th:first-child, table.data td:first-child { text-align: left; }
.panel { padding: .9rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.panel.front { margin: 0 0 1rem; padding: .3rem 1.2rem; }
.video { margin: 0; text-align: center; }
.video video { width: 100%; max-width: 44rem; display: block; margin: 0 auto; background: #000; border-radius: 6px; }
.video figcaption { max-width: 44rem; margin: .5rem auto 0; font-size: .9rem; color: var(--muted); }

footer { max-width: 70rem; margin: 0 auto; padding: 0 1rem 2rem; color: var(--muted); font-size: .82rem; }

@media (max-width: 40rem) {
  html { scroll-padding-top: 1rem; }
  .top { grid-template-columns: 1fr; position: static; }
  .top nav { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; padding-bottom: .2rem; }
  .hero { flex-direction: column; align-items: flex-start; }
  .pair { grid-template-columns: 1fr; }
  .window { grid-template-columns: 1fr; gap: .1rem; }
  .window dd + dt { margin-top: .4rem; }
}
.unsolved ol { margin: .2rem 0 .8rem; padding-left: 1.4rem; }
.unsolved li { margin: 0 0 .7rem; }
.unsolved li p { margin: .15rem 0 0; }
