:root {
  --bg: #f4f2ee; --card: #ffffff; --ink: #1c1b1a; --muted: #6b665e; --line: #e2ddd4;
  --accent: #c8323c; --accent-ink: #ffffff; --ok: #2f7d4a; --warn: #a66300; --bad: #b42318;
  --gb-bg: #1d2a1f; --gb-ink: #b8e0a0; --gb-dim: #5f8a5a; --field: #faf9f6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141312; --card: #1e1d1b; --ink: #eeebe5; --muted: #a39d93; --line: #34312d;
    --accent: #e0545d; --ok: #5cbf7e; --warn: #e0a040; --bad: #f07066; --field: #191816;
  }
}
:root[data-theme="dark"] {
  --bg: #141312; --card: #1e1d1b; --ink: #eeebe5; --muted: #a39d93; --line: #34312d;
  --accent: #e0545d; --ok: #5cbf7e; --warn: #e0a040; --bad: #f07066; --field: #191816;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 Inter, system-ui, sans-serif; }
main { max-width: 920px; margin: 0 auto; padding: 32px 16px 48px; }
h1, .kicker, .num, .gbscreen { font-family: "Press Start 2P", monospace; }
.kicker { color: var(--accent); font-size: 12px; letter-spacing: .1em; margin: 0 0 8px; }
h1 { font-size: clamp(22px, 5vw, 34px); margin: 0 0 12px; line-height: 1.2; }
.lede { font-size: 18px; margin: 0 0 8px; max-width: 60ch; }
.privacy { color: var(--ok); font-weight: 600; font-style: italic; margin: 0 0 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 0 0 6px; display: flex; align-items: center; gap: 10px; }
.num { background: var(--accent); color: var(--accent-ink); font-size: 11px; border-radius: 6px; padding: 6px 7px 5px; }
.hint { color: var(--muted); margin: 0 0 14px; font-size: 14px; max-width: 70ch; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; flex: 1 1 200px; }
label small { font-weight: 400; color: var(--muted); }
input { font: inherit; font-weight: 400; color: var(--ink); background: var(--field); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; min-width: 0; }
input:focus-visible, button:focus-visible, .drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#title, #menu, .name { text-transform: uppercase; font-family: "Press Start 2P", monospace; font-size: 12px; }
button { font: inherit; font-weight: 600; border-radius: 8px; padding: 9px 16px; cursor: pointer; border: 1px solid var(--line);
  background: var(--field); color: var(--ink); }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); padding: 12px 22px; font-size: 17px; }
.ghost { background: none; border-color: transparent; color: var(--muted); }
.status { min-height: 1.5em; margin: 10px 0 0; font-size: 14px; }
.status.ok { color: var(--ok); } .status.bad { color: var(--bad); } .status.warn { color: var(--warn); }
.drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 2px dashed var(--line); border-radius: 12px; padding: 28px 16px; text-align: center; cursor: pointer; font-weight: 400; }
.drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop span { color: var(--muted); font-size: 14px; }
.loopbar { margin-top: 14px; }
.bpm { flex: 0 0 160px; }
.summary { flex: 1 1 240px; margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.tempo { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 12px; border-radius: 10px;
  border: 1px solid var(--line); margin-bottom: 8px; }
.tempo.need { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.tempo .bpm { flex: 0 1 320px; }
.rate { margin: 0 0 14px; font-size: 14px; color: var(--muted); max-width: 80ch; }
.rate strong { color: var(--ink); }
.rate .gba { display: block; margin-top: 4px; }
kbd { font: 12px ui-monospace, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; }
.emu { position: fixed; inset: 0; z-index: 10; background: rgb(0 0 0 / .7); display: grid; place-items: center; padding: 16px; }
.emu[hidden] { display: none; }
.emubox { width: min(720px, 100%); background: var(--card); border-radius: 14px; padding: 12px; }
.emuhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.emubox iframe { display: block; width: 100%; aspect-ratio: 10 / 9; max-height: 70vh; border: 0; border-radius: 8px; background: #111; }
.emubox .hint { margin: 8px 0 0; }
.tablewrap { margin-top: 12px; max-height: 520px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { position: sticky; top: 0; background: var(--card); text-align: left; font-size: 12px; color: var(--muted); font-weight: 600;
  padding: 8px; border-bottom: 1px solid var(--line); z-index: 1; }
td { padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.over td { opacity: .45; }
td.idx { color: var(--muted); font-variant-numeric: tabular-nums; width: 3em; }
td.file { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
td.len { white-space: nowrap; font-variant-numeric: tabular-nums; }
.name { width: 11em; padding: 6px 8px; }
.fit { font-size: 12px; white-space: nowrap; }
.fit.ok { color: var(--ok); } .fit.warn { color: var(--warn); } .fit.bad { color: var(--bad); }
td.act { white-space: nowrap; text-align: right; }
td.act button { padding: 4px 8px; font-size: 13px; margin-left: 2px; }
.screens { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px; }
.gb { flex: 0 1 auto; }
.gb p { margin: 6px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.gbscreen { background: var(--gb-bg); color: var(--gb-ink); font-size: 9px; line-height: 12px; padding: 10px; border-radius: 6px;
  white-space: pre; width: calc(20ch + 20px); max-width: 100%; overflow: hidden; }
.gbscreen .dim { color: var(--gb-dim); }
.progress { height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; margin-top: 14px; }
#bar { height: 100%; width: 0; background: var(--accent); transition: width .15s; }
footer { color: var(--muted); font-size: 13px; margin-top: 24px; }
footer a { color: inherit; }
@media (max-width: 600px) {
  td.file, th:nth-child(3), td.len, th:nth-child(4) { display: none; }
  .name { width: 9.5em; }
  .gbscreen { font-size: 7px; line-height: 10px; }
}
