/* Notes Vault styles. Dark and easy on the eyes.
   Every size and color comes from the list below, so the whole app stays even:
   the same spacing, corners, control height and colors everywhere. Change one here, it changes everywhere. */
:root {
  --bg: #15171c;          /* page */
  --surface: #1e2128;     /* cards, sidebar */
  --surface-2: #252932;   /* hover, inputs' neighbors */
  --input: #13151a;       /* text boxes */
  --border: #2c3039;
  --border-2: #3a3f4b;
  --text: #e8e8ea;
  --muted: #9aa0aa;
  --accent: #4f7cff;
  --accent-hover: #3d68e8;
  --good: #7fd1a0;
  --bad: #ff8a80;
  --gap: 16px;            /* the one spacing step; bigger gaps are 1.5× or 2× this */
  --radius: 12px;         /* cards */
  --radius-sm: 8px;       /* buttons, inputs */
  --control: 44px;        /* height of every input, select and normal button */
  --side: 280px;          /* sidebar width (the top bar's left side matches it) */
  --topbar: 76px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
h1, h2, h3 { line-height: 1.25; }
h2 { margin: 0 0 var(--gap); font-size: 1.2rem; }
h3 { font-size: 1rem; margin: calc(var(--gap) * 1.5) 0 calc(var(--gap) / 2); }
.muted { color: var(--muted); font-size: 0.9rem; }
small { color: var(--good); font-size: 0.8rem; }
.ok { color: var(--good); }
.bad { color: var(--bad); }

/* ---------- the two-column frame: sidebar | content, the same in the top bar and below ---------- */
.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 calc(var(--gap) * 1.5);
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  column-gap: calc(var(--gap) * 1.5);
}

/* ---------- top bar ---------- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(21, 23, 28, 0.96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
#topbar .shell { min-height: var(--topbar); align-items: center; }
.brand h1 { margin: 0; font-size: 1.35rem; }
.brand .sub { margin: 0; color: var(--muted); font-size: 0.8rem; }
#toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 30%) auto auto auto; gap: calc(var(--gap) * 0.75); align-items: center; }

/* ---------- inputs and buttons: one height, one corner ---------- */
textarea, input, select {
  width: 100%;
  min-height: var(--control);
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: var(--input);
  color: var(--text);
  font: inherit;
}
textarea { padding: 10px 12px; resize: vertical; }
select { cursor: pointer; }
input:focus, select:focus, textarea:focus, button:focus-visible, .file-btn:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
#search { font-size: 1.02rem; }
label { display: block; font-size: 0.9rem; color: #b8bdc6; margin: 12px 0 6px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: calc(var(--gap) * 0.75); }

button, .file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--control);
  margin: var(--gap) 8px 0 0;
  padding: 0 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: white;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}
button:hover, .file-btn:hover { background: var(--accent-hover); }
button.ghost { background: var(--border-2); }
button.ghost:hover { background: #4a505d; }
button.small { min-height: 32px; margin: 0; padding: 0 12px; font-size: 0.85rem; }
.file-btn { width: auto; }
.file-btn input { display: none; }
#message, #backup-message, #profile-message { min-height: 1.5em; margin: 8px 0 0; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: calc(var(--gap) * 1.25);
  margin-bottom: calc(var(--gap) * 1.25);
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: var(--gap); flex-wrap: wrap; margin-bottom: calc(var(--gap) / 2); }
.card-head h2 { margin: 0; }
.card-head-tools { display: flex; align-items: center; gap: 8px; }
.card-head-tools .muted { margin-right: 4px; }

/* ---------- content column ---------- */
#layout { padding-top: calc(var(--gap) * 1.5); padding-bottom: calc(var(--gap) * 3); align-items: start; }
main { min-width: 0; }

/* backup reminder banner */
.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  flex-wrap: wrap;
  padding: 12px var(--gap);
  margin-bottom: calc(var(--gap) * 1.25);
  border: 1px solid #6b5420;
  border-left: 4px solid #ffb454;
  border-radius: var(--radius);
  background: #2a2416;
  color: #f3e3c2;
}
.banner-buttons { display: flex; gap: 8px; }
.dot { display: inline-block; width: 8px; height: 8px; margin-left: 8px; border-radius: 50%; background: #ffb454; vertical-align: middle; }
.dot[hidden], .banner[hidden] { display: none; }

/* three equal panel buttons */
#panel-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: calc(var(--gap) * 0.75); margin-bottom: calc(var(--gap) * 1.25); }
.panel-tab {
  margin: 0;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
}
.panel-tab:hover { background: var(--surface-2); }
.panel-tab.active { background: var(--accent); border-color: var(--accent); color: white; }

/* ---------- sidebar ---------- */
#sidebar {
  position: sticky;
  top: calc(var(--topbar) + var(--gap) * 1.5);
  max-height: calc(100vh - var(--topbar) - var(--gap) * 3);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--gap) calc(var(--gap) * 0.75);
}
#browse-toggle { display: none; width: 100%; margin: 0; }
.side-title { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; padding: 0 8px 8px; }
.side-class { border-left: 3px solid var(--class-color, var(--border-2)); margin: 0 0 6px; border-radius: 4px; }
.side-class > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.side-class > summary::-webkit-details-marker { display: none; }
.side-class > summary:hover { background: var(--surface-2); }
.side-name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-count { color: var(--muted); font-size: 0.75rem; flex: none; font-variant-numeric: tabular-nums; }
.side-count.all-done { color: var(--good); }
.side-week {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 34px;
  margin: 0;
  padding: 0 8px 0 22px;
  background: transparent;
  color: #c9ced6;
  font-size: 0.88rem;
  border-radius: 6px;
}
.side-week:hover { background: var(--surface-2); }
.side-week.current { background: var(--accent); color: white; }
.side-week.current .side-count { color: white; }

/* ---------- note cards (each one opens and closes) ---------- */
.note {
  border-left: 4px solid var(--class-color, var(--border-2));
  border-radius: 6px;
  margin-bottom: 6px;
  background: transparent;
}
.note-head {
  display: flex;
  justify-content: flex-start;
  white-space: normal;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 12px;
  border-radius: 0 6px 6px 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font-size: 1rem;
}
.note-head:hover { background: var(--surface-2); }
.note.open > .note-head { background: #232731; }
.arrow { color: #7f8ba3; width: 1em; flex: none; padding-top: 1.4em; }
.note-head-text { min-width: 0; }
.note-meta { color: var(--muted); font-size: 0.85rem; }
.note-title { font-weight: 600; margin-top: 2px; }
.snippet { color: #b3b9c4; font-size: 0.88rem; margin-top: 4px; overflow-wrap: anywhere; }
.note-inside { padding: 4px 12px 16px 34px; }
.note-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; align-items: center; }
.tab { min-height: 32px; margin: 0; padding: 0 12px; font-size: 0.85rem; background: var(--border); }
.tab.active { background: var(--accent); }
button.delete { margin-left: auto; background: var(--border-2); }
button.delete:hover { background: #c0392b; }
.watch {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: #c0392b;
  color: white;
  text-decoration: none;
  font-size: 0.85rem;
  white-space: nowrap;   /* keep the label on one line */
}
.watch:hover { background: #a93226; }
.watch.is-lesson, .watch.is-link { background: #2e7d5b; }   /* lessons and links green, only videos red */
.watch.is-lesson:hover, .watch.is-link:hover { background: #256a4c; }
/* white-space: pre-wrap keeps your line breaks and spaces exactly as pasted */
.note-text { white-space: pre-wrap; margin: 12px 0 0; overflow-wrap: anywhere; }
.note-text.refined { border-left: 3px solid var(--good); padding-left: 12px; }
mark { background: #ffd54a; color: var(--bg); border-radius: 3px; padding: 0 2px; }

/* code boxes */
.code-box { white-space: normal; margin: 8px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: #0f1115; }
.code-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 10px; background: #23262e; color: var(--muted); font-size: 0.8rem; }
.copy-btn { min-height: 26px; margin: 0; padding: 0 10px; font-size: 0.8rem; background: var(--border-2); }
.copy-btn:hover { background: var(--accent); }
.code-box pre { margin: 0; padding: 12px; overflow-x: auto; }
.code-box code { font-family: Consolas, "Cascadia Code", "Courier New", monospace; font-size: 0.9rem; color: #d7e3ff; white-space: pre; }

/* ---------- paste preview ---------- */
#preview-list { padding-left: 20px; }
#preview-list li { margin-bottom: 6px; }
#preview-list .first-line { color: var(--muted); font-size: 0.85rem; }

/* ---------- Profile & classes ---------- */
.class-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.class-row input[type=color] { width: var(--control); height: var(--control); padding: 3px; flex: none; cursor: pointer; }
.class-text { flex: 1; min-width: 0; }
.class-name { min-height: 34px; padding: 0 8px; font-weight: 600; background: transparent; border-color: transparent; }
.class-name:hover { border-color: var(--border-2); }
.class-name:focus { background: var(--input); }
.class-info { font-size: 0.82rem; padding-left: 9px; }
.class-status { width: 150px; flex: none; font-size: 0.85rem; }

/* ---------- Week page ---------- */
#week-view { border-top: 4px solid var(--class-color, var(--accent)); }
.week-head h2 { margin: 0; }
.week-head .muted { margin-top: 2px; }
.progress { height: 8px; background: var(--input); border-radius: 99px; overflow: hidden; margin: var(--gap) 0 6px; }
.progress > div { height: 100%; background: var(--good); transition: width 0.2s; }
.week-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 var(--gap); }
.lesson { border-top: 1px solid var(--border); padding: var(--gap) 0; }
.lesson-top { display: flex; align-items: center; gap: 10px; }
.lesson-top input[type=checkbox] { width: 20px; min-height: 20px; height: 20px; flex: none; accent-color: var(--good); cursor: pointer; }
.lesson-title { margin: 0; font-size: 1rem; font-weight: 600; color: var(--text); cursor: pointer; }
.lesson.reviewed .lesson-title { color: var(--good); }
.lesson-summary { white-space: pre-wrap; color: #c9ced6; margin: 8px 0 10px 30px; }
.lesson > button { margin-left: 30px; }
.lesson-top label { flex: 1; }
.lesson .note { margin: 12px 0 0 30px; }
.tag { font-size: 0.72rem; padding: 2px 8px; border-radius: 99px; background: #4a3a1a; color: #ffd54a; flex: none; }

/* ---------- Share panel ---------- */
#share-message { min-height: 1.5em; margin: 8px 0 0; }
.share-options { display: flex; align-items: flex-end; }
label.check { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; cursor: pointer; }
label.check input, .share-row input { width: 18px; min-height: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.share-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: var(--gap) 0 4px; }
.share-tools .muted { margin-left: 4px; }
.share-row { display: flex; align-items: center; gap: 10px; margin: 0; padding: 8px 4px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 0.95rem; cursor: pointer; }
.share-row.blocked { color: var(--muted); cursor: default; }
.share-name { flex: 1; min-width: 0; }
.tag.warn { background: #3a2a16; color: #ffb454; }
#share-steps { margin: var(--gap) 0 0; padding-left: 0; list-style: none; display: grid; gap: 8px; }
#share-steps li { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
#share-steps li button { margin: 0; }
#share-steps.highlight li:not(:first-child) { border-color: var(--accent); }
#share-steps a { color: #8fb0ff; }
button.lock.on { background: #3a2a16; color: #ffb454; }

/* ---------- Compare ---------- */
#compare-view { border-top: 4px solid var(--class-color, var(--accent)); }
#compare-message { min-height: 1.2em; margin: 4px 0 0; }
.side-compare { color: #8fd3ff; font-weight: 600; }
.file-btn.small-file { min-height: 32px; margin: 0; padding: 0 12px; font-size: 0.85rem; }
.missing-box { margin: 0 0 var(--gap); padding: 10px 12px; border-radius: var(--radius-sm); background: #2a2416; border: 1px solid #6b5420; color: #f3e3c2; }
.compare-head {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 0; margin: 0; padding: 4px 0;
  background: transparent; color: inherit; text-align: left; justify-content: flex-start; white-space: normal;
}
.compare-head:hover:not(:disabled) { background: transparent; }
.compare-head:hover:not(:disabled) .lesson-title { text-decoration: underline; }
.compare-head:disabled { cursor: default; opacity: 0.7; }
.compare-head .lesson-title { flex: 1; min-width: 0; }
.compare-row > .compare-head { margin-left: 0; }   /* not indented like Week page buttons */
.compare-head .muted { flex: none; min-width: 7.5em; text-align: right; }
.compare-row.not-mine .lesson-title { color: #ffb454; }
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); margin-top: 12px; }
.compare-col { min-width: 0; background: var(--input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.compare-col-head { font-weight: 600; min-height: var(--control); display: flex; align-items: center; margin-bottom: 8px; }
.compare-tabs { display: flex; gap: 8px; margin-bottom: 8px; }
.new-lines { margin: 0; padding-left: 18px; white-space: normal; }
.new-lines li { margin-bottom: 4px; }
@media (max-width: 900px) { .compare-grid { grid-template-columns: 1fr; } }

/* ---------- group headings (Compare page: one heading per week or unit) ---------- */
.group-week { margin: calc(var(--gap) * 1.5) 0 0; padding-bottom: 6px; border-bottom: 1px solid var(--border-2); color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; }
.tag.done { background: #1d3a2a; color: var(--good); }
.tag.shared { background: #1f2d4a; color: #8fb4ff; }

/* ---------- smaller screens: one column, sidebar folds under a button ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); row-gap: 12px; padding: 0 var(--gap); }
  #topbar .shell { padding-top: 12px; padding-bottom: 12px; }
  #sidebar { position: static; max-height: none; }
  #browse-toggle { display: flex; }
  #sidebar.collapsed .side-title, #sidebar.collapsed #sidebar-tree { display: none; }
  #sidebar:not(.collapsed) #browse-toggle { margin-bottom: 12px; }
  #topbar { position: static; }          /* on a phone, don't let the top bar cover the notes */
  .brand .sub { display: none; }
  #panel-tabs { grid-template-columns: repeat(3, 1fr); }
  #panel-tabs .panel-tab { padding: 0 8px; font-size: 0.85rem; white-space: normal; line-height: 1.2; }
}
@media (max-width: 560px) {
  #toolbar { grid-template-columns: 1fr 1fr 1fr; }
  #search, #class-filter { grid-column: 1 / -1; }
  .card-head-tools .muted { width: 100%; }
}

/* Library panel */
#library-message { min-height: 1.5em; margin: 8px 0 0; }
#library-list { display: grid; gap: 10px; margin-top: 8px; }
.library-class { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.library-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.library-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.library-buttons button { margin: 0; }
.library-lessons { margin-top: 10px; display: grid; gap: 6px; }
.library-lesson summary { cursor: pointer; padding: 4px 0; }
.library-by { margin: 8px 0 4px; }

/* Ask my notes: the answer box above the results */
#ask-box[hidden], #scoreboard-download[hidden] { display: none; }
#ask-box { border: 1px solid var(--border-2); border-radius: var(--radius); padding: var(--gap); margin-bottom: var(--gap); background: var(--surface-2); }
.ask-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: calc(var(--gap) / 2); }
.ask-line { border-left: 3px solid var(--accent); padding: 6px 0 6px 12px; margin: 10px 0; }
.ask-line.is-fix { border-left-color: var(--good); }
.ask-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.ask-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.ask-foot button { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-card-bar { padding: 0 12px 10px 40px; }

/* See also: related notes under an open note */
.see-also { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: var(--gap); padding-top: 12px; border-top: 1px solid var(--border); }
.see-also-title { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; width: 100%; }
.see-also-link { display: inline-flex; flex-direction: column; align-items: flex-start; height: auto; min-height: 32px; padding: 6px 12px; border-left: 3px solid var(--class-color, var(--border-2)); text-align: left; max-width: 100%; }
.see-also-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.see-also-why { color: var(--muted); font-size: 0.78rem; }

/* Sticky notes: your own words on a lesson */
.sticky { background: #3b3519; border: 1px solid #6b5f22; border-radius: var(--radius-sm); padding: 10px 12px; margin: 6px 0 10px; }
.sticky[hidden] { display: none; }
.sticky-text { white-space: pre-wrap; overflow-wrap: anywhere; color: #fbeaa0; }
.sticky-input { width: 100%; background: #2a2612; color: #fbeaa0; border: 1px solid #6b5f22; border-radius: var(--radius-sm); padding: 8px; font: inherit; resize: vertical; }
.sticky-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; color: #c9b96a; font-size: 0.8rem; }
.sticky-foot span { margin-right: auto; }
.sticky-preview { color: #f0d76b; font-size: 0.85rem; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Quiz: flash cards over the page */
#quiz-dialog { width: min(680px, 94vw); max-height: 90vh; background: var(--surface); color: var(--text); border: 1px solid var(--border-2); border-radius: var(--radius); padding: calc(var(--gap) * 1.5); }
#quiz-body:focus { outline: none; }
#quiz-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.quiz-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--gap); }
.quiz-head h2 { margin: 0 0 4px; }
.quiz-where { color: var(--muted); font-size: 0.85rem; margin: var(--gap) 0 8px; }
.quiz-front { font-size: 1.2rem; font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 6px; }
.quiz-back { font-size: 1.1rem; color: var(--good); white-space: pre-wrap; overflow-wrap: anywhere; margin: var(--gap) 0 6px; }
.quiz-source { color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; border-left: 3px solid var(--border-2); padding-left: 10px; }
.quiz-verdict { margin-top: 10px; color: var(--muted); }
.quiz-verdict.good { color: var(--good); }
#quiz-typed { width: 100%; margin-top: var(--gap); background: var(--input); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; font: inherit; resize: vertical; }
.quiz-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: var(--gap); }
.quiz-miss { background: #5a2b2b; }
.quiz-miss:hover { background: #6e3434; }
.quiz-knew { background: #2b5a3c; }
.quiz-knew:hover { background: #346e49; }
.quiz-keys { font-size: 0.78rem; margin: var(--gap) 0 0; }
.quiz-due { color: var(--accent); }
@media (max-width: 640px) { #quiz-dialog { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100vh; margin: 0; border-radius: 0; } }
.side-quiz { color: #c9a7ff; font-weight: 600; }
.quiz-hint { color: #f0d76b; margin-top: 8px; font-family: ui-monospace, monospace; overflow-wrap: anywhere; }

/* Your own flash cards on a note */
.cards-box { border: 1px solid var(--border-2); border-radius: var(--radius-sm); padding: 10px 12px; margin: 10px 0; background: var(--surface-2); }
.cards-box[hidden] { display: none; }
.card-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: start; padding: 8px 0; border-top: 1px solid var(--border); }
.card-front { font-weight: 600; overflow-wrap: anywhere; }
.card-back { color: var(--good); overflow-wrap: anywhere; }
.card-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card-form { display: grid; gap: 8px; margin-top: 10px; }
.card-form textarea { width: 100%; background: var(--input); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; font: inherit; resize: vertical; }
@media (max-width: 640px) { .card-row { grid-template-columns: 1fr; } }
.quiz-modes { display: flex; gap: 6px; align-items: center; }
.flip-card { white-space: normal; display: flex; flex-direction: column; justify-content: center; gap: 10px; width: 100%; min-height: 200px; margin-top: 4px; padding: calc(var(--gap) * 1.5); background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--radius); text-align: center; color: var(--text); cursor: pointer; font: inherit; }
.flip-card:hover { background: var(--surface-2); border-color: var(--accent); }
.flip-card.flipped { border-color: var(--good); }
.flip-card .quiz-back { margin: 0; }
.quiz-code { font-family: ui-monospace, monospace; font-size: 1rem; font-weight: 500; background: var(--input); border-radius: var(--radius-sm); padding: 10px 12px; }
.quiz-why { margin-top: 10px; padding: 8px 12px; border-left: 3px solid #f0d76b; color: #f0d76b; background: #2a2612; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
/* The question sits in its own box */
.quiz-question { background: var(--surface-2); border: 1px solid var(--border-2); border-left: 4px solid var(--accent); border-radius: var(--radius-sm); padding: 14px 16px; margin: 6px 0 8px; }
.quiz-front code, .quiz-back code { font-family: ui-monospace, monospace; background: var(--input); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 0.92em; }
.quiz-example { min-width: 0; max-width: 100%; margin-top: 12px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: var(--input); text-align: left; }
.quiz-example-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 6px 12px 0; }
.quiz-example pre { margin: 0; padding: 6px 12px 10px; font-family: ui-monospace, monospace; font-size: 0.88rem; white-space: pre; overflow-x: auto; color: var(--text); }   /* code keeps its lines: a long one scrolls instead of wrapping into what looks like a new line */
#quiz-typed.quiz-template { font-family: ui-monospace, monospace; font-size: 0.92rem; line-height: 1.5; border-color: var(--accent); }

/* Help and Privacy links in the top bar */
.top-link { white-space: nowrap; }

/* first-visit welcome: blue, not amber like the backup reminder */
.banner.welcome { border-color: #2d4380; border-left-color: var(--accent); background: #1a2236; color: var(--text); }

/* ✨ Make it nice, Privacy and Help windows */
#refine-dialog, .page-dialog { width: min(760px, 94vw); max-height: 90vh; background: var(--surface); color: var(--text); border: 1px solid var(--border-2); border-radius: var(--radius); padding: calc(var(--gap) * 1.5); }
#refine-dialog::backdrop, .page-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.refine-steps { padding-left: 1.3em; }
.refine-steps li { margin-bottom: var(--gap); }
.refine-steps textarea { margin: 8px 0; font-family: ui-monospace, monospace; font-size: 0.85rem; }
#refine-prompt { color: var(--muted); }
#refine-message { min-height: 1.5em; white-space: pre-wrap; }
#refine-message.good { color: var(--good); }
.small-print { font-size: 0.85rem; }
.refine-btn { color: #f0d76b; }
.page-dialog h3 { margin: calc(var(--gap) * 1.25) 0 6px; font-size: 1.05rem; }
.page-dialog ul, .page-dialog ol { padding-left: 1.3em; margin: 0; }
.page-dialog li { margin-bottom: 6px; line-height: 1.45; }
.page-dialog video { display: block; width: 100%; max-width: 640px; margin-top: var(--gap); border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: #000; }
.page-dialog a { color: var(--accent); }
kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); font: 0.85em ui-monospace, monospace; }
@media (max-width: 640px) { #refine-dialog, .page-dialog { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100vh; margin: 0; border-radius: 0; } }

/* the tour: the thing being explained gets a bright ring, the rest of the page dims */
.tour-spot { position: relative; z-index: 60; outline: 3px solid var(--accent); outline-offset: 3px; border-radius: var(--radius-sm); box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.55); }
#tour-bubble { position: fixed; z-index: 70; width: min(340px, calc(100vw - 24px)); padding: 14px 16px; background: var(--surface); color: var(--text); border: 1px solid var(--accent); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); }
#tour-bubble[hidden] { display: none; }
#tour-bubble p { margin: 6px 0 12px; line-height: 1.45; }
.tour-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* Add notes: the 4 steps, warnings in the preview, and "make them nice" after saving */
.add-steps { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 var(--gap); counter-reset: step; }
.add-steps li { counter-increment: step; padding: 4px 10px; border: 1px solid var(--border-2); border-radius: 999px; font-size: 0.85rem; color: var(--muted); }
.add-steps li::before { content: counter(step) ". "; }
.add-steps li.on { border-color: var(--accent); color: var(--text); }
.add-what { margin: 4px 0 8px; font-size: 0.9rem; line-height: 1.45; }
.add-warn { color: #f0d76b; }
.add-warn[hidden], #add-next[hidden] { display: none; }
#preview-list .warn { color: #f0d76b; font-size: 0.85rem; }
#add-next { margin-top: var(--gap); padding-top: var(--gap); border-top: 1px solid var(--border); }
.add-next-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.add-mode { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: var(--gap); }
.ai-help { border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: var(--surface-2); padding: 10px 14px; margin-bottom: var(--gap); }
.ai-help[hidden], #add-boxes[hidden] { display: none; }
.ai-help p { margin: 6px 0; }
#preview-list .warn.bad { color: var(--bad); }
.add-what[hidden] { display: none; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

/* quiz: pick all cards, struggle cards, or the ones you keep missing */
.quiz-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.quiz-picker[hidden] { display: none; }

/* Recording mode: sticky notes hidden everywhere while you record or share your screen */
body.recording .sticky-text, body.recording .sticky-input, body.recording .sticky-foot,
body.recording .sticky-preview, body.recording .sticky-btn { display: none !important; }
body.recording .sticky:not([hidden])::before { content: "📝 Sticky note hidden (Recording mode)"; color: #c9b96a; font-size: 0.85rem; }
#recording-toggle[aria-pressed="true"] { background: #3b3519; border-color: #6b5f22; color: #fbeaa0; }
#recording-badge { position: fixed; left: 12px; bottom: 12px; z-index: 50; background: #3b3519; color: #fbeaa0; border: 1px solid #6b5f22;
  border-radius: 999px; padding: 6px 8px 6px 12px; font-size: 0.85rem; display: flex; align-items: center; gap: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
#recording-badge[hidden] { display: none; }
