/* ==========================================================================
   CS345 Presenter — the notes screen you hold while the projector mirrors.
   Campbellsville maroon, dark by default (lecture rooms are dim, and the iPad
   is six inches from your face for fifteen minutes). No build step.
   ========================================================================== */

:root {
  --maroon:      #851632;
  --maroon-lift: #a8324a;
  --pink:        #cd9ba8;

  --bg:      #16151a;
  --surface: #1e1d24;
  --raised:  #27262e;
  --line:    #35333d;
  --ink:     #f2f0f4;
  --ink-2:   #b9b5c2;
  --ink-3:   #837f8e;
  --accent:  #e8899e;

  --good: #4ade80;
  --warn: #fbbf24;
  --bad:  #f87171;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --notes-size: 26px;
  --bar-h: 54px;
  --tabs-h: 46px;
  --foot-h: 58px;
}

:root[data-theme="light"] {
  --bg:      #f7f6f4;
  --surface: #ffffff;
  --raised:  #f0eeeb;
  --line:    #dedbd6;
  --ink:     #1b1b1f;
  --ink-2:   #4a4a52;
  --ink-3:   #73737d;
  --accent:  #851632;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--accent); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ==========================================================================
   Deck picker (index.html)
   ========================================================================== */

.picker { max-width: 900px; margin: 0 auto; padding: 22px 18px 60px; }

.picker-head { padding: 12px 0 22px; }
.picker-head .eyebrow {
  margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--pink);
}
.picker-head h1 { margin: 6px 0 8px; font-size: 30px; letter-spacing: -.02em; }
.picker-head p { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.5; }

.week {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 14px;
  overflow: hidden;
}
.week-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.week-no {
  flex: none;
  width: 40px; height: 40px; border-radius: 9px;
  background: var(--maroon); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 17px;
}
.week-title { flex: 1; min-width: 0; }
.week-title strong { display: block; font-size: 17px; }
.week-title span { display: block; font-size: 13px; color: var(--ink-3); margin-top: 1px; }

.dl {
  flex: none; padding: 8px 13px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--raised);
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  white-space: nowrap;
}
.dl[data-state="cached"] { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.dl[data-state="busy"] { color: var(--pink); }

.decks { list-style: none; margin: 0; padding: 0; }
.decks li + li { border-top: 1px solid var(--line); }
.decks a {
  display: flex; align-items: center; gap: 13px;
  padding: 14px 16px; text-decoration: none; color: inherit;
}
.decks a:active { background: var(--raised); }
.day {
  flex: none; width: 30px; height: 30px; border-radius: 7px;
  display: grid; place-items: center;
  background: var(--raised); border: 1px solid var(--line);
  font-size: 13px; font-weight: 700; color: var(--pink);
}
.day[data-day="—"] { color: var(--ink-3); font-size: 15px; }
.deck-name { flex: 1; min-width: 0; font-size: 16px; }
.deck-meta { flex: none; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.picker-foot {
  margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line);
  color: var(--ink-3); font-size: 13px; line-height: 1.6;
}
.picker-foot code { font-family: var(--font-mono); font-size: 12px; }

/* ==========================================================================
   Presenter shell (present.html)
   ========================================================================== */

.present {
  display: flex; flex-direction: column;
  height: 100dvh; overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.bar {
  flex: none; height: var(--bar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 8px 0 4px;
  background: var(--maroon); color: #fff;
}
.bar .back {
  width: 40px; height: 40px; border-radius: 8px;
  font-size: 26px; line-height: 1; display: grid; place-items: center;
}
.bar .where { flex: 1; min-width: 0; line-height: 1.15; }
.bar .wk {
  display: block; font-size: 11px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--pink);
}
.bar .deck {
  display: block; font-size: 15px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.pill {
  flex: none; height: 36px; padding: 0 12px; border-radius: 8px;
  background: rgba(255,255,255,.13);
  display: flex; align-items: center; gap: 3px;
  font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.pill.timer[data-state="over"]  { background: var(--warn); color: #3b2600; }
.pill.timer[data-state="late"]  { background: var(--bad);  color: #340c0c; }
.pill.timer[data-state="idle"]  { opacity: .6; }
.pill .of { opacity: .6; font-weight: 500; }

.sync-dot {
  flex: none; width: 9px; height: 9px; border-radius: 50%;
  background: var(--good); margin-left: -4px;
}
.sync-dot[hidden] { display: none; }

.tabs {
  flex: none; height: var(--tabs-h);
  display: flex; align-items: stretch;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.tabs button {
  flex: 1; font-size: 14px; font-weight: 600; color: var(--ink-3);
  border-bottom: 3px solid transparent;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--maroon-lift); }
.tabs button[hidden] { display: none; }

main { flex: 1; min-height: 0; position: relative; }

.tab {
  position: absolute; inset: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 14px 20px 30px;
}
.tab[hidden] { display: none; }

/* -- Notes tab ------------------------------------------------------------ */

.slide-head {
  display: flex; gap: 14px; align-items: flex-start;
  padding-bottom: 12px; margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.slide-head img {
  flex: none; width: 168px; aspect-ratio: 16 / 9;
  object-fit: cover; border-radius: 6px;
  border: 1px solid var(--line); background: var(--raised);
}
.slide-head h1 {
  margin: 2px 0 0; font-size: 19px; line-height: 1.25;
  letter-spacing: .01em; text-transform: none;
}
.slide-head .kind { font-size: 12px; color: var(--ink-3); margin-top: 5px; }

.notes { font-size: var(--notes-size); line-height: 1.44; }
.notes p { margin: 0 0 .62em; }
.notes strong { color: var(--ink); font-weight: 700; }
.notes .say { color: #fff; }
:root[data-theme="light"] .notes .say { color: #000; }

.notes .cue {
  position: relative;
  padding-left: .78em; margin-left: -.1em;
  border-left: 3px solid var(--maroon-lift);
  color: var(--ink);
}
.notes .cue::after {
  content: "⚑"; color: var(--maroon-lift);
  font-size: .62em; margin-left: .4em; vertical-align: .18em;
}

.notes .quiz {
  padding-left: .78em; margin-left: -.1em;
  border-left: 3px solid var(--pink);
  color: var(--ink);
}
.notes .quiz::after {
  content: "◆"; color: var(--pink);
  font-size: .5em; margin-left: .45em; vertical-align: .28em;
}

.no-notes { color: var(--ink-3); font-style: italic; font-size: 18px; }

.slide-body {
  margin-top: 22px; padding-top: 14px; border-top: 1px dashed var(--line);
  color: var(--ink-3); font-size: 15px; line-height: 1.45;
  white-space: pre-wrap;
}
.slide-body summary {
  cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: .1em;
  white-space: normal;
}
.slide-body[open] summary { margin-bottom: 10px; }

/* -- Guide tabs (board / ask / sheet) ------------------------------------- */

.prose { font-size: 17px; line-height: 1.55; color: var(--ink-2); }
.prose h2 { font-size: 19px; color: var(--ink); margin: 22px 0 10px; }
.prose h3 { font-size: 16px; color: var(--ink); margin: 20px 0 8px; }
.prose strong { color: var(--ink); }
.prose p { margin: 0 0 .8em; }
.prose ol, .prose ul { margin: 0 0 1em; padding-left: 1.35em; }
.prose li { margin-bottom: .5em; }
.prose code {
  font-family: var(--font-mono); font-size: .87em;
  background: var(--raised); border: 1px solid var(--line);
  border-radius: 4px; padding: .08em .34em;
}
.prose pre {
  background: var(--raised); border: 1px solid var(--line);
  border-radius: 8px; padding: 12px 14px; overflow-x: auto;
}
.prose pre code { background: none; border: 0; padding: 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 1em; font-size: 15px; }
.prose th, .prose td {
  text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.prose th { color: var(--ink); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.prose blockquote {
  margin: 0 0 1em; padding-left: 14px;
  border-left: 3px solid var(--maroon-lift); color: var(--ink-2);
}

.day-picker { display: flex; gap: 8px; margin-bottom: 18px; }
.day-picker button {
  flex: 1; padding: 9px; border-radius: 8px;
  background: var(--raised); border: 1px solid var(--line);
  font-size: 14px; font-weight: 600; color: var(--ink-3);
}
.day-picker button[aria-pressed="true"] {
  background: var(--maroon); border-color: var(--maroon); color: #fff;
}

.filter {
  width: 100%; padding: 11px 13px; margin-bottom: 14px;
  border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 16px;
}
.filter::placeholder { color: var(--ink-3); }

details.qa {
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); margin-bottom: 9px;
}
details.qa[hidden] { display: none; }
details.qa > summary {
  padding: 13px 15px; cursor: pointer; list-style: none;
  font-size: 16px; font-weight: 600; color: var(--ink);
}
details.qa > summary::-webkit-details-marker { display: none; }
details.qa > summary::before {
  content: "＋"; color: var(--pink); margin-right: 9px; font-weight: 400;
}
details.qa[open] > summary::before { content: "－"; }
details.qa .a { padding: 0 15px 13px; font-size: 16px; line-height: 1.5; color: var(--ink-2); }
details.qa .a p:last-child { margin-bottom: 0; }

.err {
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); padding: 13px 15px; margin-bottom: 9px;
}
.err[hidden] { display: none; }
.err .sym { font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.err dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 15px; }
.err dt {
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); padding-top: 3px;
}
.err dd { margin: 0; color: var(--ink-2); }

.section-label {
  font-size: 12px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--pink);
  margin: 26px 0 10px;
}
.section-label:first-child { margin-top: 4px; }

.tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.tools a {
  padding: 9px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 14px; text-decoration: none; color: var(--ink-2);
}

.empty { color: var(--ink-3); font-size: 16px; line-height: 1.5; padding: 30px 0; }

/* Cheat-sheet HTML comes from the print stylesheet, so it is re-skinned here. */
.sheet { font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.sheet section { margin-bottom: 22px; }
.sheet h2 {
  font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--pink); margin: 0 0 8px; padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}
.sheet table { width: 100%; border-collapse: collapse; margin: 0 0 10px; font-size: 14px; }
.sheet th, .sheet td { padding: 5px 7px; border-bottom: 1px solid var(--line); text-align: left; }
.sheet th { color: var(--ink); font-size: 12px; }
.sheet .mono, .sheet code { font-family: var(--font-mono); font-size: .9em; }
.sheet .key, .sheet .callout {
  background: var(--raised); border-left: 3px solid var(--maroon-lift);
  border-radius: 0 8px 8px 0; padding: 11px 13px; margin: 0 0 12px;
}
.sheet .chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.sheet .chip {
  background: var(--raised); border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 8px; font-family: var(--font-mono); font-size: 13px;
}
.sheet .tiny { font-size: 13px; color: var(--ink-3); }
.sheet strong { color: var(--ink); }

/* -- Footer controls ------------------------------------------------------ */

.controls {
  flex: none; height: var(--foot-h);
  display: flex; align-items: center; gap: 6px;
  padding: 0 10px;
  background: var(--surface); border-top: 1px solid var(--line);
}
.controls button {
  height: 40px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--raised);
  color: var(--ink-2); font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.controls .step { flex: 1; }
.controls .step:disabled { opacity: .3; }
.controls .sizer { width: 46px; font-size: 17px; }
.controls .gap { flex: none; width: 6px; }

/* -- Tap zones ------------------------------------------------------------ */

.zone-hint {
  position: absolute; top: 0; bottom: 0; width: 28%;
  pointer-events: none; opacity: 0;
  transition: opacity .12s ease;
  background: linear-gradient(90deg, rgba(168,50,74,.30), transparent);
}
.zone-hint.right { left: auto; right: 0; width: 72%;
  background: linear-gradient(270deg, rgba(168,50,74,.30), transparent); }
.zone-hint.on { opacity: 1; }

/* -- Slide grid overlay ---------------------------------------------------- */

.grid {
  position: fixed; inset: 0; z-index: 40;
  background: var(--bg);
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.grid[hidden] { display: none; }
.grid-bar {
  flex: none; height: var(--bar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--maroon); color: #fff;
}
.grid-bar strong { flex: 1; font-size: 16px; }
.grid-bar button { font-size: 15px; font-weight: 600; padding: 8px 12px; }
.grid-scroll {
  flex: 1; overflow-y: auto; padding: 14px;
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  align-content: start;
}
.grid-item { border: 0; padding: 0; text-align: left; }
.grid-item img {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  border-radius: 7px; border: 2px solid var(--line); background: var(--raised);
  display: block;
}
.grid-item[aria-current="true"] img { border-color: var(--maroon-lift); }
.grid-item span {
  display: block; margin-top: 5px; font-size: 13px; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.grid-item[aria-current="true"] span { color: var(--ink); font-weight: 600; }

/* -- Settings sheet -------------------------------------------------------- */

.settings {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.5);
  display: flex; align-items: flex-end; justify-content: center;
}
.settings[hidden] { display: none; }
.settings-card {
  width: 100%; max-width: 520px;
  background: var(--surface); border-radius: 16px 16px 0 0;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  border: 1px solid var(--line); border-bottom: 0;
}
.settings-card h2 { margin: 0 0 4px; font-size: 19px; }
.settings-card .hint { margin: 0 0 18px; font-size: 14px; color: var(--ink-3); line-height: 1.5; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.row label { flex: 1; font-size: 16px; }
.row label small { display: block; color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.row input[type="text"] {
  width: 150px; padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--raised);
  color: var(--ink); font-size: 15px; font-family: var(--font-mono);
}
.row .toggle {
  width: 54px; height: 32px; border-radius: 999px; flex: none;
  background: var(--line); position: relative; transition: background .15s;
}
.row .toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 26px; height: 26px; border-radius: 50%;
  background: #fff; transition: transform .15s;
}
.row .toggle[aria-pressed="true"] { background: var(--maroon-lift); }
.row .toggle[aria-pressed="true"]::after { transform: translateX(22px); }
.settings .close {
  width: 100%; margin-top: 18px; padding: 13px;
  border-radius: 10px; background: var(--maroon); color: #fff;
  font-size: 16px; font-weight: 600;
}

/* -- Toast ----------------------------------------------------------------- */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--foot-h) + 18px);
  transform: translateX(-50%);
  z-index: 60; padding: 11px 18px; border-radius: 999px;
  background: var(--raised); border: 1px solid var(--line);
  color: var(--ink); font-size: 15px; box-shadow: 0 8px 24px rgba(0,0,0,.4);
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.toast.on { opacity: 1; }

@media (max-width: 560px) {
  .slide-head img { width: 124px; }
  .slide-head h1 { font-size: 17px; }
  .tab { padding: 12px 16px 26px; }
}
