/* The emulator's page: the FM-1's (index.html) and the SMK-37's (smk37/index.html) */
:root { --room: #18191b; --ink: #e9e6de; --dim: #8c8a85; --amber: #f2a33a;
        --well: #232427; --line: #3a3b3f; --rule: #2a2b2e; --card: #1e1f22; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--room); color: var(--ink); font: 14px/1.5 -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; }
html { scroll-padding-top: 12px; }
main { max-width: 1280px; margin: 0 auto; padding-block: 16px 24px; padding-inline: 16px; display: grid; gap: 12px; }
header { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; justify-content: space-between; }
h1 { font-size: 18px; font-weight: 600; margin: 0; }
#status { color: var(--dim); font-variant-numeric: tabular-nums; }
.runs { flex-basis: 100%; margin: -6px 0 0; color: var(--dim); }
.stage { position: relative; }
/* the whole synth in view on a laptop: as wide as the room allows below the bar (--above,
   --aspect: set by main.js), never narrower than 560px */
canvas { display: block; width: 100%; height: auto; touch-action: none; user-select: none; margin: 0 auto;
         max-width: max(560px, calc((100svh - var(--above, 140px) - 52px) * var(--aspect, 1.56))); }
#start { position: absolute; inset: 0; margin: auto; width: clamp(110px, 30%, 220px); height: clamp(36px, 9vw, 56px);
         border: 0; border-radius: 28px; background: var(--amber); color: #2a1a03; font-size: clamp(14px, 3.5vw, 17px);
         font-weight: 600; cursor: pointer; }
.rotate { display: none; color: var(--dim); font-size: 13px; margin: 0; }
/* a phone upright: the panel is small; say that sideways gives bigger keys */
@media (orientation: portrait) and (max-width: 600px) { .rotate { display: block; } }
/* a phone on its side: the panel fits the screen's height, the page around it shrinks */
@media (orientation: landscape) and (max-height: 560px) {
  main { padding-block: 8px 16px; gap: 8px; }
  canvas { width: auto; max-width: 100%; height: calc(100svh - 12px); margin: 0 auto; }
}
#start:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
#start[disabled] { opacity: .7; cursor: wait; }
.bar { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.bar label { display: flex; gap: 8px; align-items: center; color: var(--dim); }
select { font: inherit; color: var(--ink); background: var(--well); border: 1px solid var(--line); border-radius: 6px;
         padding: 5px 8px; max-width: 100%; }
select:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
#about { color: var(--dim); flex: 1 1 320px; min-width: 0; }
.dim { color: var(--dim); }
.file { cursor: pointer; color: var(--ink) !important; background: var(--well); border: 1px solid var(--line);
        border-radius: 6px; padding: 5px 10px; }
.file:focus-within { outline: 2px solid var(--amber); outline-offset: 1px; }
.file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
#about b { color: var(--ink); font-weight: 600; }
/* the device can't keep up: what happens and the fix, between the controls and the synth */
#perfwarn { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between;
            border: 1px solid var(--amber); border-radius: 10px; background: #2a2116; padding: 9px 12px; }
#perfwarn[hidden] { display: none; }
#perfwarn p { margin: 0; flex: 1 1 320px; min-width: 0; }
#perfwarn .acts { display: flex; gap: 8px; align-items: center; }
#perfwarn button { font: inherit; color: var(--ink); background: var(--well); border: 1px solid var(--line);
                   border-radius: 6px; padding: 5px 10px; cursor: pointer; }
#perfwarn button.primary { background: var(--amber); border-color: var(--amber); color: #2a1a03; font-weight: 600; }
#perfwarn button[hidden] { display: none; }
a { color: var(--ink); }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
#midiact { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
#midiact.on { background: var(--amber); }
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--ink); }
kbd { display: inline-block; min-width: 1.7em; padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px;
      border-radius: 4px; background: var(--well); color: var(--ink); font: 600 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      text-align: center; }

/* under the synth: one line of the essentials, then the way into the guide */
.hint { margin: 0; color: var(--dim); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.hint span { white-space: nowrap; }
.hint .more { margin-left: auto; }
.touch { display: none; }
@media (hover: none) and (pointer: coarse) { .hint .keyb { display: none; } .touch { display: inline; } }

/* the guide */
.guide { margin-top: 20px; border-top: 1px solid var(--rule); padding-top: 20px; display: grid; gap: 28px 40px;
         grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); }
.guide > * { min-width: 0; }
.span { grid-column: 1 / -1; }
nav.toc { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; font-size: 13px; }
nav.toc a { color: var(--dim); text-decoration: none; border: 1px solid var(--rule); border-radius: 14px; padding: 2px 10px; }
nav.toc a:hover { color: var(--ink); border-color: var(--line); }
section h2 { margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--amber); }
section h3 { margin: 16px 0 6px; font-size: 14px; font-weight: 600; }
section p, section li { color: #bdbab3; max-width: 72ch; }
section p { margin: 0 0 10px; }
section b, section strong { color: var(--ink); font-weight: 600; }
section ul, section ol { margin: 0 0 10px; padding-left: 20px; }
section li { margin: 3px 0; }
.lead { font-size: 15.5px; line-height: 1.55; color: var(--ink) !important; max-width: 80ch !important; }
.steps { list-style: none; padding: 0 !important; margin: 14px 0 0 !important; display: grid; gap: 12px;
         grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); counter-reset: step; }
.steps li { margin: 0; background: var(--card); border: 1px solid var(--rule); border-radius: 10px; padding: 12px 14px 12px 50px;
            position: relative; counter-increment: step; max-width: none; }
.steps li::before { content: counter(step); position: absolute; left: 14px; top: 12px; width: 24px; height: 24px; border-radius: 50%;
                    background: var(--amber); color: #2a1a03; font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.steps b { display: block; margin-bottom: 2px; }

/* the computer keyboard as a piano: 11 white keys, the black ones between */
.piano { display: grid; grid-template-columns: repeat(22, 1fr); gap: 3px; max-width: 460px; margin: 4px 0 12px; }
.piano span { display: grid; place-items: center; border-radius: 0 0 5px 5px; padding: 4px 0 3px; line-height: 1.15;
              font: 600 13px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-align: center; }
.piano i { display: block; font: 10.5px/1.2 -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; color: var(--dim); }
.piano .w { grid-row: 2; grid-column-end: span 2; background: #2c2d31; border: 1px solid #44454a; color: var(--ink); }
.piano .b { grid-row: 1; grid-column-end: span 2; margin: 0 3px; background: #0f1011; border: 1px solid #36373b; color: var(--ink); }
.map { list-style: none; padding: 0 !important; display: grid; gap: 6px 10px; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.map li { margin: 0; white-space: nowrap; color: var(--ink); font-size: 13px; }
.map kbd { margin-right: 4px; }

.note { border-left: 3px solid var(--amber); background: var(--card); padding: 8px 12px; border-radius: 0 8px 8px 0; }

/* the firmware list (built by main.js from firmwares.json) */
.cards { list-style: none; padding: 0 !important; margin: 12px 0 0 !important; display: grid; gap: 10px;
         grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.cards li { margin: 0; max-width: none; background: var(--card); border: 1px solid var(--rule); border-radius: 10px;
            padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.cards li.on { border-color: var(--amber); }
.cards .head { display: flex; gap: 8px; align-items: baseline; }
.cards .head b { font-size: 14.5px; }
.cards .head button { margin-left: auto; font: inherit; font-size: 12.5px; color: var(--ink); background: var(--well);
                      border: 1px solid var(--line); border-radius: 14px; padding: 2px 11px; cursor: pointer; }
.cards .head button:hover { border-color: var(--amber); }
.cards li.on .head button { background: var(--amber); border-color: var(--amber); color: #2a1a03; }
.cards .by { color: var(--dim); font-size: 12.5px; }
.cards .what { margin: 2px 0; font-size: 13px; overflow-wrap: anywhere; }
.cards .midi { font-size: 12.5px; color: var(--amber); }
.cards .links { margin-top: auto; padding-top: 4px; font-size: 12.5px; color: var(--dim); display: flex; flex-wrap: wrap; gap: 2px 12px; }

details { border: 1px solid var(--rule); border-radius: 10px; background: var(--card); padding: 0 14px; margin: 0 0 10px; }
details[open] { padding-bottom: 4px; }
summary { cursor: pointer; padding: 10px 0; font-weight: 600; color: var(--ink); }
footer { margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--rule); color: var(--dim); font-size: 12.5px; }
@media (max-width: 600px) { .guide { gap: 24px; } .hint .more { margin-left: 0; } }

/* the device switch in the header */
.devices { display: flex; gap: 6px; align-items: center; color: var(--dim); }
.devices a, .devices span { padding: 2px 10px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--ink); }
.devices [aria-current] { background: var(--amber); border-color: var(--amber); color: #2a1a03; }

/* ?embed=1 (main.js): the device and its controls only, for a window on another site */
.embed-only { display: none; }
[data-embed] .embed-only { display: inline; font-size: 13px; }
[data-embed] #title, [data-embed] .runs, [data-embed] .devices, [data-embed] #fwlabel, [data-embed] .bar .file,
[data-embed] #bankname, [data-embed] #about, [data-embed] .hint, [data-embed] .guide, [data-embed] footer { display: none; }
[data-embed] main { padding-block: 8px; gap: 8px; }

/* (an element the page hides stays hidden whatever its display rule) */
[hidden] { display: none !important; }
