/* Drum School styles, part 1 of 6: colours and theme, type, buttons and fields, top bar, dialogs, small shared pieces.
   Loaded in order by index.html; a later file wins over an earlier one. */

/* the app's typeface (Atkinson Hyperlegible, SIL OFL, bundled in vendor/fonts: works offline) */
@font-face { font-family: 'Atkinson Hyperlegible'; src: url(../vendor/fonts/atkinson-hyperlegible-latin-400-normal.woff2) format('woff2'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'Atkinson Hyperlegible'; src: url(../vendor/fonts/atkinson-hyperlegible-latin-700-normal.woff2) format('woff2'); font-weight: 600 700; font-display: swap; }

/* "practice room" theme (#39): dark by default; [data-theme=light] on <html> for the light one.
   Maple is the only action colour; red only ever means missed / needs help. */
:root {
  --r-ctl: 8px;
  /* controls and small items: buttons, fields, chips, list rows */
  --r-card: 12px;
  /* containers: cards, panels, dialogs, the sheet-music area */
  color-scheme: dark;
  --bg: #121826;
  --panel: #1A2234;
  --panel-2: #232D45;
  --line: #2F3B57;
  --line-strong: #46557A;
  --hover: #2A3552;
  --text: #E9EDF5;
  --muted: #9AA6BF;
  --accent: #E0A84B;
  /* maple: buttons that do something */
  --accent-soft: rgba(224, 168, 75, 0.14);
  --on-accent: #1A1A1A;
  --accent-text: #E0A84B;
  /* maple as text (darker in the light theme, to read on white) */
  --focus: #8FB3FF;
  --bar: #0D1220;
  /* top bar */
  --stage: #0D1220;
  /* behind the falling notes and charts */
  --perfect: #34C38A;
  --good: #E59D3E;
  /* good, early / late */
  --miss: #EA5F62;
  --extra: #A98BFF;
  --playfor: #7C5CE0; /* "Scoring for <student>" banner (#94) */
  --on-playfor: #FFFFFF;
  --paper: #FFFEFB;
  /* sheet music is always on paper */
  --ink: #1E2A44;
  --ink-muted: #5B6478;
  --perfect-ink: #12945a;
  --good-ink: #b8740f;
  --chart: var(--accent);
  /* single data hue: maple, as on Home and Progress (#39) */
  --chart-1: #4A3A22;
  /* calendar ramp, low -> high */
  --chart-2: #8E6A33;
  --chart-3: #E0A84B;
  --st-good: var(--perfect);
  --st-warning: var(--good);
  --st-critical: var(--miss);
}
:root[data-theme=light] {
  color-scheme: light;
  --bg: #F5F7FA;
  --panel: #FFFFFF;
  --panel-2: #EEF1F6;
  --line: #DDE2EA;
  --line-strong: #B7C0D0;
  --hover: #E4E9F1;
  --text: #1E2A44;
  --muted: #5B6478;
  --accent-soft: #FBF1DF;
  --accent-text: #93611A;
  --bar: #1E2A44;
  --focus: #3D63D9;
  --perfect: #1E9A63;
  --good: #C9781F;
  --miss: #D64545;
  --chart: #B8822F;
  --chart-1: #F1DFC0;
  --chart-2: #D9AF6A;
  --chart-3: #B8822F;
  --playfor: #6A47D6;
  --on-playfor: #FFFFFF;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.45 'Atkinson Hyperlegible', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}
button, select, input { font: inherit; color: inherit; }

/* controls share one size: regular 36px, small 30px (buttons, fields and file pickers line up) */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s, filter 0.12s;
}
button:hover:not(:disabled), .btn:hover { border-color: var(--line-strong); background: var(--hover); }
button:focus-visible, .btn:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
button:disabled { opacity: 0.4; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
button.primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); filter: brightness(1.08); }
button.small, .btn.small { min-height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-ctl); }
select, input[type=text], input[type=number], input[type=password], input[type=search] {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  padding: 0 10px;
  min-height: 36px;
}
input[type=text] { width: 100%; }
.topbar {
  --text: #E9EDF5;
  --muted: #AEB8CC;
  --panel: #1A2234;
  --panel-2: #232D45;
  --line: #2F3B57;
  --line-strong: #46557A;
  --hover: #2A3552;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  min-height: 56px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  row-gap: 6px;
}
.top-nav { display: flex; gap: 4px; align-items: center; }
.top-nav button { background: none; border-color: transparent; min-height: 34px; padding: 0 12px; }
.top-nav button:hover:not(:disabled) { background: var(--panel-2); border-color: var(--line); }
.top-nav button.current { background: var(--panel-2); border-color: var(--line); color: var(--text); font-weight: 600; }
.user-menu { position: relative; }
.user-menu summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--panel-2);
  cursor: pointer;
  white-space: nowrap;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary::after { content: '▾'; color: var(--muted); font-size: 11px; }
.user-menu[open] summary { border-color: var(--line-strong); }
.user-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  display: grid;
  gap: 6px;
  min-width: 170px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
}
@media (max-width: 1100px) { .topbar { flex-wrap: wrap; } .status { margin-left: 0; } }
.brand { font-weight: 700; font-size: 18px; white-space: nowrap; display: flex; align-items: center; gap: 9px; }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; vertical-align: middle; }
#midiStatus { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 12px; }
.pill.ok { border-color: var(--perfect); color: var(--perfect); }
.hint { color: var(--muted); font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.row input[type=range] { flex: 1; }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent-text); font-size: 12px; text-decoration: underline; }
button.link:hover:not(:disabled) { background: none; }
button.link:disabled { color: var(--muted); text-decoration: none; }
.check { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
.file-btn {
  display: block;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--r-ctl);
  padding: 8px;
  cursor: pointer;
  color: var(--muted);
}
.file-btn:hover { border-color: var(--line-strong); color: var(--text); }
.file-btn input { display: none; }
.live { display: flex; gap: 20px; font-size: 18px; }
.canvas-wrap { position: relative; flex: 1; min-height: 300px; border-radius: var(--r-card); overflow: hidden; background: var(--stage); border: 1px solid var(--line); }
.countin {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 120px;
  font-weight: 900;
  color: rgba(255,255,255,0.85);
  pointer-events: none;
}
.c-perfect { color: var(--perfect); }
.c-good { color: var(--good); }
.c-miss { color: var(--miss); }
.c-extra { color: var(--extra); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.65); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 16; }

/* above the full screens (library, dashboards) */
.modal.hidden { display: none; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px 24px; width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto; }
.modal-card.wide { max-width: 860px; }
.modal-card h2 { margin-top: 0; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.sheet-view .countin { color: var(--accent-text); text-shadow: 0 2px 16px rgba(0,0,0,0.25); }

/* ---------- accounts ---------- */
body.server-mode .practice-only, body.practice-mode .server-only { display: none !important; }
body:not(.server-mode):not(.practice-mode) .server-only { display: none !important; }
.playing-as { padding: 8px 10px; background: var(--panel-2); border-radius: var(--r-ctl); }
.small-print { font-size: 12px; text-align: center; }
.form-msg { margin: 0; padding: 8px 10px; border-radius: var(--r-ctl); background: rgba(61,220,151,0.12); color: var(--perfect); font-size: 13px; }
.form-msg.error { background: rgba(255,93,93,0.12); color: var(--miss); }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
#pwForm { display: grid; gap: 10px; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-ctl); max-height: 42vh; overflow-y: auto; }

/* ---------- progress dashboards ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px 16px; min-width: 0; }
.panel.empty { text-align: center; padding: 40px 16px; }
.panel-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.panel-head h3 { margin: 0; font-size: 16px; }
.lb-score { font-variant-numeric: tabular-nums; margin: 0 6px; }
.bars { display: grid; gap: 8px; }
@media (max-width: 800px) {
  .chart-grid { grid-template-columns: minmax(0, 1fr); }
}
button.danger { border-color: var(--st-critical); color: var(--st-critical); }

/* ---------- free round ---------- */
.num-input { width: 80px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 6px 8px; color: var(--text); }
button.big { font-size: 17px; padding: 12px 22px; }
@keyframes fpflash { from { background: var(--lane); } to { background: var(--panel); } }
@keyframes fppulse { from { transform: scale(1.25); } to { transform: scale(1); } }
.file-btn.small {
  display: inline-flex;
  align-items: center;
  width: auto;
  margin: 0;
  min-height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
  border: 1px solid var(--line);
  border-style: solid;
  border-radius: var(--r-ctl);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 500;
}
.file-btn.small:hover { background: var(--hover); }

/* import lessons */
button.file-btn { width: 100%; background: none; font: inherit; }
.loop-info { font-size: 13px; font-weight: 600; color: var(--accent-text); border: 1px solid var(--accent); padding: 2px 8px; border-radius: var(--r-ctl); white-space: nowrap; }
.loop-info:empty { display: none; }
#pauseBtn.paused { border-color: var(--good); color: var(--good); }
.fcount { font-size: 11px; color: var(--muted); font-weight: 400; }

/* a part of the app did not load */
.load-error {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: #5c1d1d;
  color: #fff;
  border-bottom: 2px solid var(--miss);
  font-size: 15px;
}
.load-error button { margin-left: auto; background: #fff; color: #5c1d1d; font-weight: 700; }
.update-bar { background: #1d3b5c; border-bottom-color: #4d8cff; }
.update-bar button { color: #1d3b5c; }
.page-modal .modal-card { max-width: none; max-height: none; overflow: visible; background: none; border: 0; padding: 4px 0 24px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.page-head h2 { margin: 0; }
.page-head .page-back, .people-head .page-back { margin-left: auto; }
.page-modal .table-scroll { max-height: none; }

/* groove editor (#29) */
#grMsg:empty { display: none; }
@media print {
  body.print-groove * { visibility: hidden; }
  body.print-groove .gr-sheet, body.print-groove .gr-sheet * { visibility: visible; }
  body.print-groove .gr-sheet { position: absolute; left: 0; top: 0; width: 100%; }
}

/* focus mode (#30) */
#fmExit { margin-left: auto; }

/* courses (#27) */
#crMsg:empty { display: none; }
.linkish { background: none; border: 0; padding: 0; min-height: 0; color: var(--text); text-decoration: underline; cursor: pointer; }
.school-name { font-weight: 500; color: var(--muted); font-size: 14px; }

/* top bar with every menu item (owner): tighter, and two rows rather than cut off */
@media (max-width: 1400px) {
  .top-nav button { padding: 0 7px; font-size: 13.5px; }
}
@media print {
  body.print-batch * { visibility: hidden; }
  body.print-batch .batch-table, body.print-batch .batch-table * { visibility: visible; color: #000; }
  body.print-batch .batch-table { position: absolute; left: 0; top: 0; }
}

/* theme switch in the name menu (#39) */
.theme-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.theme-row button { min-height: 28px; padding: 0 10px; font-size: 13px; }
.theme-row button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }

/* top bar (#39): grouped menus and the kit pill */
.menu-group, .kit-menu { position: relative; }
.menu-group > summary, .kit-menu > summary { list-style: none; cursor: pointer; }
.menu-group > summary::-webkit-details-marker, .kit-menu > summary::-webkit-details-marker { display: none; }
.menu-group > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: var(--r-ctl); border: 1px solid transparent; font-weight: 500; }
.menu-group > summary::after { content: ''; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--muted); }
.menu-group > summary:hover, .menu-group[open] > summary { background: var(--panel-2); border-color: var(--line); }
.menu-group:has(button.current) > summary { background: var(--panel-2); border-color: var(--line); font-weight: 700; }
.menu-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  min-width: 200px;
  display: grid;
  gap: 2px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.menu-list > button { justify-content: flex-start; background: none; border-color: transparent; min-height: 36px; }
.menu-list > button:hover:not(:disabled) { background: var(--hover); border-color: transparent; }
.menu-list > button.current { background: var(--accent-soft); color: var(--text); font-weight: 700; }
.kit-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 13.5px; }
.kit-pill:hover, .kit-menu[open] .kit-pill { border-color: var(--line-strong); }
.tr-sep { width: 1px; align-self: stretch; background: var(--line); margin: 6px 0; }
.tr-group { display: grid; gap: 3px; }
.tr-label { font-size: 12px; color: var(--muted); }
.k.ok { background: var(--perfect); }
.k.part { background: var(--good); }
.k.help { background: var(--miss); }
.today-tag { font-size: 12px; font-weight: 700; color: var(--accent-text); }
.none-day { font-size: 13px; }
.tag.help { background: rgba(234, 95, 98, 0.16); color: var(--miss); border: 0; }
.tag.idle { background: rgba(229, 157, 62, 0.16); color: var(--good); border: 0; }
.also > div { display: flex; gap: 10px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); }
.also > div > span:first-child { flex: 1; }

/* every kind of text box looks the same */
input[type=url], input[type=date], input[type=time], input[type=email], input[type=tel], textarea { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 0 10px; min-height: 36px; color: var(--text); font: inherit; }
textarea { padding: 8px 10px; }
input[type=file] { font: inherit; font-size: 13px; color: var(--muted); }
input[type=file]::file-selector-button { font: inherit; font-size: 13px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 6px 12px; margin-right: 8px; cursor: pointer; }
.school-logo { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; flex: none; }
.tag.came { color: var(--perfect); border-color: transparent; }

/* also above the login screen */

/* Phone tap targets (#124): bigger hit areas only, same look */
@media (max-width: 800px), (pointer: coarse) {
  #authSwitch { min-height: 44px; display: inline-flex; align-items: center; }
  .theme-row button { min-height: 44px; }
  #drawerClose, #settingsClose { min-height: 44px; min-width: 44px; }
  .top-nav button, .menu-group > summary, .menu-list > button { min-height: 44px; }
  .kit-pill { min-height: 44px; }
  .mapping button { min-height: 44px; }
  html #calibrateBtn { min-height: 44px; }
}
