/* Device check — layout and play areas. Plain CSS, no dependencies. */
:root {
  --bg: #12161d; --panel: #1d2430; --line: #2f3a4b; --ink: #eef2f7; --quiet: #9fb0c6;
  --accent: #ffb547; --ok: #46c37b; --warn: #ff6b5b;
  --white-key: #f4f1ea; --black-key: #1b1b1f; --key-down: #ffb547;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-text-size-adjust: 100%;
}
h1 { font-size: 22px; margin: 4px 0 8px; }
h2 { font-size: 17px; margin: 0 0 8px; }
p { margin: 6px 0; }
.small { font-size: 14px; color: var(--quiet); }
button, .btnlink {
  font: inherit; color: var(--ink); background: #2b3546; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; min-height: 44px; text-decoration: none; display: inline-block;
}
button:active, .btnlink:active { background: #3a475d; }
button.big { background: var(--accent); color: #1a1a1a; border: 0; font-weight: 600; padding: 12px 20px; }
button.smallbtn { min-height: 36px; padding: 6px 10px; font-size: 14px; }
.answer, .pair, .seg { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.answer button.chosen, .seg button.on { background: var(--ok); color: #0d1a12; border-color: var(--ok); }

.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); padding: 6px 12px; }
.title { font-weight: 600; margin-bottom: 6px; }
.badge { font-size: 13px; font-weight: 500; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; margin-left: 8px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; }
.tabs button { min-height: 40px; padding: 6px 12px; }
.tabs button.on { background: var(--accent); color: #1a1a1a; border-color: var(--accent); }

main { padding: 10px 12px 24px; }
.tab { display: none; }
.tab.on { display: block; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; flex: 1 1 300px; min-width: 280px; }
.status { color: var(--quiet); }
.status.warn { color: var(--warn); font-weight: 600; }
details.guide { margin: 6px 0 10px; }
details.guide summary { cursor: pointer; color: var(--accent); min-height: 32px; }
.readout { background: #0d1117; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 13px; white-space: pre-wrap; max-height: 260px; overflow: auto; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.form label { font-size: 14px; color: var(--quiet); display: flex; flex-direction: column; gap: 4px; }
.form input { font: inherit; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: #0d1117; color: var(--ink); }
textarea.results { width: 100%; height: 55vh; font: 13px/1.35 ui-monospace, Menlo, monospace; background: #0d1117; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }

/* Play areas: no scrolling, zooming, selection or callouts. */
.strip, .pad {
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.strip { position: relative; width: 100%; height: 300px; margin: 8px 0; border-radius: 10px; overflow: hidden; background: #000; }
.strip:not(.interactive) { height: 180px; opacity: 0.9; }
.key { position: absolute; top: 0; border: 1px solid #555; border-radius: 0 0 6px 6px; }
.key.white { background: var(--white-key); height: 100%; z-index: 1; }
.key.black { background: var(--black-key); height: 62%; z-index: 2; border-color: #000; }
.key.down { background: var(--key-down); }
.key .lbl { position: absolute; bottom: 6px; width: 100%; text-align: center; font-size: 12px; color: #555; }
.touch-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline; justify-content: space-between; }
.counters { display: flex; flex-wrap: wrap; gap: 14px; font-size: 15px; }
.counters b { font-size: 20px; color: var(--accent); margin-left: 4px; }
#clearState { font-weight: 600; padding: 2px 10px; border-radius: 999px; }
#clearState.ok { background: var(--ok); color: #0d1a12; }
#clearState.busy { background: #3a475d; }
#clearState.bad { background: var(--warn); color: #1a0d0d; }
.row.bottom { justify-content: space-between; align-items: center; }
.legend { margin: 2px 0 0; }

.pad {
  flex: 1 1 420px; min-height: 420px; border-radius: 16px; background: #3a475d; display: flex; flex-direction: column; gap: 6px;
  align-items: center; justify-content: center; text-align: center; font-size: 28px; font-weight: 600;
}
.pad.flash { background: #f4f1ea; color: #1a1a1a; }

.portrait-note { display: none; background: var(--warn); color: #1a0d0d; padding: 8px 12px; font-weight: 600; text-align: center; }
@media (orientation: portrait) { .portrait-note { display: block; } }

/* Reads the safe-area insets so the page can report them. */
.safe-probe {
  position: absolute; visibility: hidden; pointer-events: none; width: 0; height: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
