/* LessonTimer web app. Site palette for the chrome, the desktop app's dark
   display panel for the timer itself. System fonts only, so it looks right
   offline (no web-font fetch). */
:root {
  --ink: #14171A; --ink-soft: #5B6067; --paper: #FAFAF9; --paper-soft: #F1F1EE;
  --paper-line: #E1E1DC; --accent: #26567F; --accent-bright: #336F9F;
  --disp: #111; --disp-flash: #fc8181; --clock: #9ad; --next: #778;
  --cd-normal: #fff; --cd-warn: #f6ad55; --cd-over: #fc8181; --cd-idle: #444;
  --shadow: 0 1px 2px rgba(20,23,26,.05), 0 10px 28px -10px rgba(20,23,26,.16);
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #EDEDEA; --ink-soft: #A7ACB2; --paper: #0E1012; --paper-soft: #17191C;
    --paper-line: #282B2E; --accent: #5B93C0; --accent-bright: #7BA9D0;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 14px 34px -14px rgba(0,0,0,.6);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); }
body { -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }

.app { max-width: 960px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }

/* ---- banners */
.banner { display: block; width: 100%; border: 0; text-align: center; padding: 10px 16px; font-weight: 600; font-size: 14px; cursor: pointer; }
.banner[hidden] { display: none; }
/* Fixed, not in the flow: it disappears on the first pointerdown, and if it
   took up space the page would jump mid-click and that click would be lost. */
.banner-sound { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #fff4d6; color: #6b4b00; box-shadow: 0 -2px 10px rgba(0,0,0,.15); }
.banner-trial { background: #fde8e6; color: #7a1f16; border-bottom: 1px solid #e0a39c; }
.banner-warn { background: #fde8e6; color: #7a1f16; cursor: default; }

/* ---- display panel (the projected part) */
.display { background: var(--disp); border-radius: 8px; padding: 14px 18px 18px; color: #ccd; display: flex; flex-direction: column; min-height: 300px; transition: background .15s; }
.display.flash { background: var(--disp-flash); transition: none; }
.display-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.display-top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.clock { color: var(--clock); font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.next { color: var(--next); font-size: 14px; }
.ghost-btn { color: #fff; background: transparent; border: 1px solid #556; border-radius: 4px; padding: 4px 10px; font-weight: 600; cursor: pointer; }
.ghost-btn:hover { background: #223; }
.timer-label { text-align: center; font-size: 20px; margin-top: 10px; color: #ccd; min-height: 1.3em; }
.countdown { text-align: center; font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.05;
  font-size: clamp(64px, 14vw, 150px); color: var(--cd-normal); flex: 1; display: flex; align-items: center; justify-content: center; }
.countdown.idle { color: var(--cd-idle); }
.countdown.warn { color: var(--cd-warn); }
.countdown.over { color: var(--cd-over); }
.reset-row { text-align: center; min-height: 36px; }
.reset-btn { color: #111; background: #fff; border: 0; border-radius: 6px; padding: 6px 22px; font-weight: 700; font-size: 14px; cursor: pointer; }
.reset-btn:hover { background: #e2e2e2; }
.reset-btn:active { background: #c8c8c8; }
.secondary { text-align: center; color: #889; font-size: 16px; min-height: 1.3em; margin-top: 6px; }

/* Projection mode (F6): digit height >= 25% of the screen. */
.display:fullscreen { border-radius: 0; padding: 2.5vh 3vw; min-height: 100vh; }
.display:fullscreen .clock { font-size: 5vh; }
.display:fullscreen .next { font-size: 2.6vh; }
.display:fullscreen .timer-label { font-size: 5vh; }
.display:fullscreen .countdown { font-size: 38vh; }
.display:fullscreen .secondary { font-size: 3.5vh; }

/* ---- groups */
.group { border: 1px solid var(--paper-line); border-radius: 8px; padding: 12px 14px; background: var(--paper); }
.group h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin: 0 0 10px; font-weight: 700; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.toolbar .spacer { flex: 1; }
.toolbar button, .dlg button, .presets button, .more-menu button, .more-menu a {
  background: var(--paper-soft); border: 1px solid var(--paper-line); border-radius: 5px; padding: 6px 12px; cursor: pointer; text-decoration: none; }
.toolbar button:hover, .dlg button:hover, .presets button:hover { border-color: var(--accent); }
button:focus-visible, input:focus-visible, select:focus-visible, .banner:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.inline { display: inline-flex; align-items: center; gap: 6px; }
select, input[type=number], input[type=time], input:not([type]) {
  background: var(--paper-soft); border: 1px solid var(--paper-line); border-radius: 5px; padding: 5px 8px; }
input[type=number] { width: 5.5em; }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.hint { color: var(--ink-soft); font-size: 12.5px; margin: 6px 0; }

/* ---- quick timers */
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.preset { position: relative; }
.preset .start { min-width: 110px; min-height: 52px; line-height: 1.25; padding-right: 26px; }
.preset .start small { display: block; color: var(--ink-soft); }
.preset .del { position: absolute; top: 2px; right: 2px; border: 0; background: transparent; padding: 2px 6px; color: var(--ink-soft); font-size: 15px; line-height: 1; }
.preset .del:hover { color: #b0453d; }
.presets .add { min-height: 52px; }

/* ---- schedule table */
.table-wrap { overflow-x: auto; border: 1px solid var(--paper-line); border-radius: 6px; }
.schedule { width: 100%; border-collapse: collapse; font-size: 14px; }
.schedule th { text-align: left; background: var(--paper-soft); font-weight: 600; padding: 6px 10px; border-bottom: 1px solid var(--paper-line); white-space: nowrap; }
.schedule td { padding: 7px 10px; border-bottom: 1px solid var(--paper-line); font-variant-numeric: tabular-nums; white-space: nowrap; }
.schedule td:nth-child(2) { width: 100%; white-space: normal; min-width: 8em; }
.schedule tbody tr { cursor: pointer; }
.schedule tbody tr:hover { background: var(--paper-soft); }
.schedule tbody tr.selected { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.schedule tbody tr:last-child td { border-bottom: 0; }
.empty { padding: 12px; margin: 0; color: var(--ink-soft); font-size: 14px; }

.more-menu { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-bottom: 4px; }
.more-menu[hidden] { display: none; }

/* ---- dialogs */
dialog { border: 1px solid var(--paper-line); border-radius: 10px; padding: 0; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); max-width: min(560px, calc(100vw - 32px)); width: 100%; }
dialog::backdrop { background: rgba(10,12,14,.45); }
.dlg { padding: 18px 20px; }
.dlg-small { max-width: 420px; }
.dlg h3 { margin: 0 0 12px; font-size: 18px; }
.grid { display: grid; grid-template-columns: max-content 1fr; gap: 8px 12px; align-items: center; }
.grid > label { font-size: 14px; color: var(--ink-soft); }
.pair { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.days { border: 1px solid var(--paper-line); border-radius: 6px; margin: 10px 0; padding: 6px 10px 8px; }
.days > div { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.days label { display: inline-flex; gap: 4px; align-items: center; }
.cues { border: 1px solid var(--paper-line); border-radius: 6px; margin: 10px 0; padding: 6px 10px 10px; }
.cue-row { display: flex; gap: 6px; align-items: center; margin: 6px 0; flex-wrap: wrap; }
.cue-row input.cue-label { flex: 1; min-width: 120px; }
.dlg-buttons { display: flex; flex-direction: row-reverse; justify-content: flex-start; gap: 8px; margin-top: 14px; }
.dlg .primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.dlg .primary:hover { background: var(--accent-bright); }
#askInput { width: 100%; margin-top: 4px; }
#askInput[hidden] { display: none; }
#askText { margin: 0 0 8px; line-height: 1.5; white-space: pre-line; }

/* ---- toast (the desktop's tray notification) */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #1d2228; color: #fff; padding: 10px 16px;
  border-radius: 8px; box-shadow: var(--shadow); font-size: 14px; max-width: calc(100vw - 32px); z-index: 10; }
.toast[hidden] { display: none; }

@media (max-width: 600px) {
  .app { padding: 10px; }
  .display { min-height: 240px; padding: 12px; }
  .clock { font-size: 22px; }
  .grid { grid-template-columns: 1fr; }
}
