/* Layout: one screen. The classroom canvas fills the window; menus are paper slips laid over it.
   Single dark look by choice: a chalkboard surround so the classroom reads as the lit stage. */
:root {
  --board: #13251f;
  --paper: #fff4cf;
  --ink: #22212b;
  --ink-dim: #6b6658;
  --hi: #ffd84a;
  --slip: #ff8fa3;
  --line: #d9c98f;
  --display: Bangers, 'Comic Sans MS', 'Chalkboard SE', cursive;
  --body: 'Patrick Hand', 'Comic Sans MS', 'Chalkboard SE', system-ui, sans-serif;
  color-scheme: dark;
}
html, body { height: 100%; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--board);
  color: var(--paper);
  font-family: var(--body);
  font-size: 18px;
  overflow: hidden;
  padding-block: 6px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#app { position: relative; width: 100%; height: 100%; }
#game { width: 100%; height: 100%; }
#game canvas { touch-action: none; display: block; border-radius: 6px; }
#ui {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 6px;
  background: rgba(19, 37, 31, 0.45);
}
.panel {
  background: var(--paper); color: var(--ink);
  width: min(880px, 100%); max-height: 100%; overflow: auto;
  padding: 14px 22px 18px;
  border-radius: 4px; border-top: 10px solid var(--slip);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
  display: flex; flex-direction: column; gap: 12px;
  -webkit-user-select: text; user-select: text;
}
.panel.small { width: min(460px, 100%); }
.panel.wide { width: min(760px, 100%); }
h1, h2 { font-family: var(--display); font-weight: 400; margin: 0; letter-spacing: 0.03em; line-height: 1; text-wrap: balance; }
h1 { font-size: 52px; }
h2 { font-size: 40px; }
.tag { margin: 2px 0 0; color: var(--ink-dim); }
.top { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; align-items: flex-start; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px 28px; }
.cols > * { min-width: 0; }
.form { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; }
.form label, .lbl { color: var(--ink-dim); margin: 0; }
input:not([type]) {
  font: inherit; color: var(--ink); background: #fffdf2;
  border: 2px solid var(--ink); border-radius: 6px; padding: 4px 8px; width: 100%; min-width: 0;
}
.seg, .row, .stack { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack { flex-direction: column; align-items: stretch; }
.chip {
  font: inherit; color: var(--ink); background: #fffdf2;
  border: 2px solid var(--ink); border-radius: 999px; padding: 3px 12px; cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--hi); }
.chip[disabled] { opacity: 0.4; cursor: default; }
.go {
  font-family: var(--display); font-size: 28px; letter-spacing: 0.04em; color: var(--ink);
  background: var(--hi); border: 3px solid var(--ink); border-radius: 10px; padding: 6px 26px;
  cursor: pointer; box-shadow: 0 4px 0 var(--ink);
}
.go:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
button:focus-visible, input:focus-visible, .file:focus-within { outline: 3px solid #2f6fd0; outline-offset: 2px; }
.how { margin: 0; padding-left: 20px; line-height: 1.3; }
.how li { margin-bottom: 4px; }
#facePrev canvas { display: block; }
.rows .r { display: flex; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--line); padding: 2px 0; font-size: 20px; }
.rows .r span:first-child { color: var(--ink-dim); }
.rows .r span:last-child { font-variant-numeric: tabular-nums; }
.call { display: flex; flex-direction: column; gap: 10px; }
.who { display: flex; gap: 12px; align-items: center; }
.who p { margin: 0; font-size: 20px; }
.tune { display: grid; grid-template-columns: 1fr minmax(110px, 220px) 3.2em; gap: 6px 12px; align-items: center; }
.tune output { font-variant-numeric: tabular-nums; text-align: right; }
.snd { display: grid; grid-template-columns: auto 1fr auto auto auto; gap: 6px 10px; align-items: center; }
.fname { color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.file { position: relative; overflow: hidden; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
#rotate {
  display: none; position: absolute; inset: 0; z-index: 5;
  background: var(--board); color: var(--paper);
  align-items: center; justify-content: center; text-align: center; padding: 24px;
  font-family: var(--display); font-size: 30px; letter-spacing: 0.03em;
}
@media (orientation: portrait) and (max-width: 640px) { #rotate { display: flex; } }
@media (max-height: 480px) {
  body { font-size: 16px; }
  h1 { font-size: 36px; } h2 { font-size: 30px; }
  .panel { padding: 8px 16px 12px; gap: 8px; }
  .go { font-size: 22px; padding: 4px 20px; }
}
@media (max-width: 560px) {
  .snd { grid-template-columns: 1fr auto auto auto; }
  .snd .fname { display: none; }
  .tune { grid-template-columns: 1fr 3.2em; }
  .tune label { grid-column: 1 / -1; }
}

/* dtm.lol frame: the way home shows only while a menu is up, so it never covers the classroom. */
.back-link {
  position: absolute; top: 8px; left: 10px; z-index: 4;
  font-family: var(--display); font-size: 22px; letter-spacing: 0.06em;
  color: var(--hi); text-decoration: none; text-shadow: 0 2px 0 var(--ink);
}
.back-link span { color: var(--slip); }
.back-link:hover { color: var(--paper); }
#ui[hidden] ~ .back-link { display: none; }
.seo-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
