/* Acadex: one stylesheet, shared by the app and the offline export. */

/* Measurements, not colours: the same whichever theme is on. */
:root {
  --shell: 980px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Dark is what you get unless you ask for otherwise. The theme button writes
   data-theme on <html>, and that beats the machine's own preference either way,
   so a choice made here is the choice that sticks. */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --paper: #1c1c1e;
  --ink: #f5f5f7;
  --soft: #98989d;
  --line: #38383a;
  --hair: rgba(255, 255, 255, 0.14);
  --accent: #0a84ff;
  --accent-soft: rgba(10, 132, 255, 0.18);
  --right: #30d158;
  --right-soft: rgba(48, 209, 88, 0.16);
  --wrong: #ff453a;
  --wrong-soft: rgba(255, 69, 58, 0.16);
  --idle: #2c2c2e;
}

/* The app always writes data-theme, so this only reaches pages that do not:
   the saved offline file, which has no button and follows the device instead. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #f5f5f7;
    --paper: #ffffff;
    --ink: #1d1d1f;
    --soft: #6e6e73;
    --line: #d2d2d7;
    --hair: rgba(0, 0, 0, 0.09);
    --accent: #0071e3;
    --accent-soft: rgba(0, 113, 227, 0.08);
    --right: #248a3d;
    --right-soft: rgba(36, 138, 61, 0.1);
    --wrong: #d70015;
    --wrong-soft: rgba(215, 0, 21, 0.07);
    --idle: #dcdce1;
  }
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f5f7;
  --paper: #ffffff;
  --ink: #1d1d1f;
  --soft: #6e6e73;
  --line: #d2d2d7;
  --hair: rgba(0, 0, 0, 0.09);
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.08);
  --right: #248a3d;
  --right-soft: rgba(36, 138, 61, 0.1);
  --wrong: #d70015;
  --wrong-soft: rgba(215, 0, 21, 0.07);
  --idle: #dcdce1;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

.shell {
  width: min(100% - 40px, var(--shell));
  margin-inline: auto;
}

.measure {
  max-width: 34em;
}

.hidden {
  display: none !important;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hair);
}

.masthead-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 48px;
  width: min(100% - 40px, var(--shell));
  margin-inline: auto;
  font-size: 15px;
}

.wordmark {
  font-weight: 600;
  letter-spacing: -0.012em;
}

.masthead-right {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.masthead-meta {
  color: var(--soft);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* In the bar the save button has to be small enough not to raise its height. */
.masthead .btn-small {
  font-size: 13px;
  padding: 6px 13px;
}

/* Sun or moon, as wide as it is tall so it reads as one mark rather than a
   button with a label in it. */
.theme {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  appearance: none;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.theme:hover {
  background: var(--idle);
  border-color: var(--line);
}

.hero {
  padding: 76px 0 36px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(38px, 7.2vw, 72px);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.032em;
}

.hero p {
  margin: 20px auto 0;
  max-width: 28em;
  color: var(--soft);
  font-size: clamp(17px, 2.2vw, 21px);
  line-height: 1.45;
}

.quiz-h {
  font-size: clamp(28px, 4.6vw, 42px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.026em;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--hair);
  border-radius: 20px;
  padding: 28px;
}

.panel-gap {
  margin-top: 20px;
}

.panel h2 {
  font-size: clamp(22px, 3vw, 28px);
  letter-spacing: -0.022em;
}

.panel-note {
  margin-top: 8px;
  color: var(--soft);
  font-size: 15px;
}

.drop {
  display: block;
  width: 100%;
  padding: 60px 28px;
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.drop:hover {
  border-color: var(--soft);
}

.drop.is-hot {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop-title {
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 600;
  letter-spacing: -0.022em;
}

.drop-note {
  margin: 10px auto 24px;
  max-width: 26em;
  color: var(--soft);
  font-size: 15px;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font: 500 17px/1 var(--sans);
  padding: 14px 26px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.12s ease;
}

.btn:hover {
  opacity: 0.86;
}

.btn:active {
  transform: scale(0.985);
}

.btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.btn-quiet {
  background: transparent;
  color: var(--accent);
  border-color: var(--line);
}

.btn-small {
  font-size: 15px;
  padding: 10px 18px;
}

.btn-link {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font: 400 15px/1.4 var(--sans);
  cursor: pointer;
}

.files {
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.file {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 14px 2px;
  border-top: 1px solid var(--hair);
  font-size: 15px;
}

.file-name {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.file-meta {
  margin-left: auto;
  color: var(--soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.file-warn {
  flex-basis: 100%;
  color: var(--wrong);
  font-size: 13px;
}

/* Coverage lattice: one tile per slide or page of the uploaded material. */
.lattice {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13px, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tile,
.dot {
  border: 0;
  padding: 0;
  border-radius: 3px;
  background: var(--idle);
}

.tile {
  appearance: none;
  display: block;
  aspect-ratio: 1;
  animation: tile-in 0.38s ease both;
  animation-delay: calc(var(--i, 0) * 9ms);
}

button.tile {
  cursor: pointer;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.is-used {
  background: var(--accent);
}

.is-right {
  background: var(--right);
}

.is-wrong {
  background: var(--wrong);
}

.is-part {
  background: linear-gradient(135deg, var(--right) 50%, var(--wrong) 50%);
}

@keyframes tile-in {
  from {
    opacity: 0;
    transform: scale(0.55);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 16px;
  color: var(--soft);
  font-size: 13px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.track {
  height: 4px;
  border-radius: 999px;
  background: var(--idle);
  overflow: hidden;
}

.track-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.35s ease;
}

.status {
  margin-top: 14px;
  color: var(--soft);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.status.is-bad {
  color: var(--wrong);
}

.mix {
  margin-top: 20px;
}

.mix-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 15px 2px;
  border-top: 1px solid var(--hair);
}

.mix-label {
  font-weight: 500;
}

.mix-hint {
  display: block;
  color: var(--soft);
  font-size: 13px;
  font-weight: 400;
}

.stepper {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.step-btn {
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1 var(--sans);
  cursor: pointer;
}

.step-btn:hover {
  border-color: var(--soft);
}

.step-value {
  width: 2.4em;
  min-width: 2.4em;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: center;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.step-value:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 15px 2px;
  border-top: 1px solid var(--hair);
}

.field-label {
  font-weight: 500;
}

/* A short field on a settings row sits with the controls, not across them. */
.field .answer {
  width: auto;
  min-width: 8em;
  max-width: 14em;
  margin-left: auto;
}

/* The file input is hidden, so its label has to carry the focus ring. */
.drop input:focus-visible + .btn {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.seg {
  display: inline-flex;
  gap: 2px;
  margin-left: auto;
  padding: 2px;
  background: var(--idle);
  border-radius: 999px;
}

.seg-btn {
  appearance: none;
  border: 0;
  background: none;
  color: var(--ink);
  font: 400 15px/1 var(--sans);
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
}

.seg-btn[aria-pressed='true'] {
  background: var(--paper);
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 26px;
}

.q {
  padding: 34px 0;
  border-top: 1px solid var(--hair);
}

.q-first {
  border-top: 0;
}

.q-head {
  display: flex;
  gap: 14px;
  align-items: baseline;
}

.q-no {
  min-width: 2.2em;
  color: var(--soft);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.q-text {
  max-width: 32em;
  font-size: 21px;
  font-weight: 500;
  line-height: 1.42;
  letter-spacing: -0.014em;
}

.q-kind {
  margin-top: 6px;
  color: var(--soft);
  font-size: 13px;
}

.q-body {
  margin: 20px 0 0 calc(2.2em + 14px);
  max-width: 34em;
}

@media (max-width: 600px) {
  .q-body {
    margin-left: 0;
  }
}

/* On a phone there is no room for a label and its control on one line, so every
   settings row stacks: label first, control under it and across the full width.
   Without this the auto margins push the control onto the label. */
@media (max-width: 620px) {
  .shell,
  .masthead-in,
  .dock-in {
    width: min(100% - 28px, var(--shell));
  }

  .panel {
    padding: 20px 18px;
    border-radius: 16px;
  }

  .drop {
    padding: 40px 18px;
  }

  .hero {
    padding: 48px 0 28px;
  }

  .mix-row,
  .field {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .stepper,
  .seg,
  .field .answer {
    margin-left: 0;
  }

  /* Both controls spread across the row, so the taps are wide and even. */
  .stepper {
    justify-content: space-between;
    align-self: stretch;
  }

  .step-value {
    flex: 1 1 auto;
    font-size: 19px;
  }

  .step-btn {
    flex: none;
    width: 44px;
    height: 44px;
  }

  .seg {
    align-self: stretch;
  }

  .seg-btn {
    flex: 1 1 0;
    padding: 11px 6px;
    text-align: center;
  }

  .field .answer {
    width: 100%;
    max-width: none;
  }

  /* A matching row is a term over its dropdown, not beside it. */
  .pair {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .pair-left {
    flex: 0 0 auto;
  }

  .pick {
    width: 100%;
  }

  /* Label and score on the first line, the bar underneath spanning both. */
  .bar-row {
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
  }

  .bar-row .track {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .bar-count {
    grid-column: 2;
    grid-row: 1;
  }

  .actions .btn,
  .dock-in .btn {
    flex: 1 1 100%;
  }

  .file-meta {
    margin-left: 0;
  }

  .footer {
    padding: 32px 0 44px;
  }
}

.choices {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.choice:hover {
  border-color: var(--soft);
}

.choice input {
  margin: 3px 0 0;
  accent-color: var(--accent);
}

.choice.is-picked {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.choice.is-key {
  border-color: var(--right);
  background: var(--right-soft);
}

.choice.is-miss {
  border-color: var(--wrong);
  background: var(--wrong-soft);
}

.choice-key {
  color: var(--soft);
  font-variant-numeric: tabular-nums;
}

.answer,
.blank {
  width: 100%;
  max-width: 24em;
  padding: 13px 16px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  font: 400 17px/1.4 var(--sans);
}

.answer:focus,
.blank:focus {
  border-color: var(--accent);
  outline: none;
}

.blanks {
  display: grid;
  gap: 8px;
}

.blank-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.blank-no {
  min-width: 1.4em;
  color: var(--soft);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.pair {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 12px 0;
  border-top: 1px solid var(--hair);
}

.pair-first {
  border-top: 0;
}

.pair-left {
  flex: 0 0 32%;
  min-width: 8em;
  font-weight: 500;
}

.pick {
  flex: 1 1 12em;
  padding: 11px 12px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  font: 400 15px/1.3 var(--sans);
}

.pick:focus {
  border-color: var(--accent);
  outline: none;
}

/* A graded input keeps its shape and just changes colour. */
.answer.is-ok,
.blank.is-ok,
.pick.is-ok {
  border-color: var(--right);
  background: var(--right-soft);
  color: var(--ink);
}

.answer.is-no,
.blank.is-no,
.pick.is-no {
  border-color: var(--wrong);
  background: var(--wrong-soft);
  color: var(--ink);
}

.answer:disabled,
.blank:disabled,
.pick:disabled {
  opacity: 1;
}

.verdict {
  margin-top: 16px;
  font-size: 15px;
}

.verdict-right {
  color: var(--right);
}

.verdict-wrong {
  color: var(--wrong);
}

.verdict-why {
  margin-top: 6px;
  color: var(--soft);
  max-width: 34em;
}

.source {
  margin-top: 8px;
  color: var(--soft);
  font-size: 13px;
}

.dock {
  position: sticky;
  bottom: 0;
  z-index: 15;
  margin-top: 28px;
  padding: 14px 0 16px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--hair);
}

.dock-in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  width: min(100% - 40px, var(--shell));
  margin-inline: auto;
}

.dock-meta {
  color: var(--soft);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.score {
  padding: 16px 0 4px;
  text-align: center;
}

.score-value {
  font-size: clamp(66px, 14vw, 132px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.042em;
  font-variant-numeric: tabular-nums;
}

.score-sub {
  margin-top: 14px;
  color: var(--soft);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.bar-row {
  display: grid;
  grid-template-columns: 8.5em 1fr 4.5em;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--hair);
  font-size: 15px;
}

.bar-count {
  text-align: right;
  color: var(--soft);
  font-variant-numeric: tabular-nums;
}

.review-item {
  padding: 22px 0;
  border-top: 1px solid var(--hair);
}

.review-q {
  max-width: 34em;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.45;
}

.review-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 10px;
  font-size: 15px;
}

.review-key {
  flex: 0 0 6em;
  color: var(--soft);
}

.review-value {
  flex: 1 1 12em;
  overflow-wrap: anywhere;
}

.mark-right {
  color: var(--right);
}

.mark-wrong {
  color: var(--wrong);
}

.history {
  margin: 0;
  padding: 0;
  list-style: none;
}

.history li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 2px;
  border-top: 1px solid var(--hair);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.footer {
  padding: 44px 0 56px;
  color: var(--soft);
  font-size: 13px;
  line-height: 1.6;
}

/* Prose is held to a readable measure and centred in the page, so on a wide
   screen the footer sits under the middle of the content rather than hugging
   the left edge. :not(.credit) keeps this off the credit line, which spans the
   full width -- a plain .credit rule would lose to .footer p on specificity. */
.footer p:not(.credit) {
  max-width: 46em;
  margin-inline: auto;
}

.footer p + p {
  margin-top: 14px;
}

.footer a {
  color: var(--soft);
}

.credit {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--hair);
  font-weight: 500;
  text-align: center;
}

.section {
  padding: 26px 0;
}

.section-flush {
  padding-top: 0;
}

.print-only {
  display: none;
}

/* The key sheet only ever appears on paper, so it is set for paper: numbers
   in a narrow column, answers ranged left beside them. */
.keysheet h2 {
  font-size: 15pt;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 10pt;
}

.key-list {
  columns: 2;
  column-gap: 24pt;
}

.key-row {
  display: flex;
  gap: 8pt;
  break-inside: avoid;
  padding: 2pt 0;
  font-size: 10.5pt;
  line-height: 1.35;
}

.key-no {
  min-width: 2.2em;
  color: var(--soft);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.key-a {
  flex: 1 1 auto;
}

.note {
  color: var(--soft);
  font-size: 14px;
  line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  :root {
    --bg: #ffffff;
    --paper: #ffffff;
    --ink: #000000;
    --soft: #444444;
    --line: #999999;
    --hair: #cccccc;
    --idle: #dddddd;
  }

  .masthead,
  .dock,
  .footer,
  .no-print {
    display: none !important;
  }

  .print-only {
    display: block;
  }

  body {
    background: #ffffff;
    font-size: 11.5pt;
  }

  .shell {
    width: auto;
  }

  .panel {
    border: 0;
    border-radius: 0;
    padding: 0;
  }

  .hero {
    padding: 0 0 18pt;
    text-align: left;
  }

  .hero h1 {
    font-size: 22pt;
  }

  .q {
    break-inside: avoid;
    padding: 12pt 0;
  }

  .choice {
    padding: 4pt 8pt;
    border-radius: 4pt;
  }

  .answer,
  .blank,
  .pick {
    border: 0;
    border-bottom: 1px solid #000000;
    border-radius: 0;
    background: none;
  }

  .keysheet {
    break-before: page;
  }
}

/* ══════════════════════════════════════════════════════════
   NAVBAR  –  Twenty-style
══════════════════════════════════════════════════════════ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--hair);
}

.navbar-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 58px;
  width: min(100% - 40px, var(--shell));
  margin-inline: auto;
}

.nav-logo {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  flex: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-link {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--soft);
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.nav-link:hover  { color: var(--ink); background: var(--idle); }
.nav-link.active { color: var(--ink); background: var(--idle); font-weight: 600; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--hair);
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.15s;
}

.hamburger:hover { background: var(--idle); }

.hbar {
  display: block;
  width: 16px;
  height: 1.5px;
  background: currentColor;
  border-radius: 2px;
  transform-origin: center;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              opacity   0.22s ease;
}

.hamburger[aria-expanded="true"] .hbar:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.hamburger[aria-expanded="true"] .hbar:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger[aria-expanded="true"] .hbar:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Mobile drawer */
.nav-mobile {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 10px 20px 18px;
  border-top: 1px solid var(--hair);
  animation: mobileSlide 0.18s ease;
}

@keyframes mobileSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}

.nav-mobile.open { display: flex; }

.nav-mobile-link {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  transition: background 0.15s;
}

.nav-mobile-link:hover { background: var(--idle); }

@media (max-width: 640px) {
  .nav-links   { display: none; }
  .hamburger   { display: flex; }
  .masthead-meta { display: none; }
}

/* ══════════════════════════════════════════════════════════
   HERO  –  Animated (overrides original static hero)
══════════════════════════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: none; }
}

/* ══════════════════════════════════════════════════════════
   FILE CONVERTER PAGE
══════════════════════════════════════════════════════════ */

/* Converter hero (reuses orb + fadeUp from above) */
.conv-hero {
  position: relative;
  overflow: hidden;
  padding: 84px 0 48px;
  text-align: center;
}

.conv-hero h1 {
  font-size: clamp(32px, 5vw, 58px);
  font-weight: 700;
  letter-spacing: -0.028em;
  line-height: 1.08;
  animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.conv-hero p {
  margin: 14px auto 0;
  max-width: 32em;
  color: var(--soft);
  font-size: clamp(15px, 2vw, 19px);
  line-height: 1.5;
  animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

/* Step label */
.step-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--soft);
  margin-bottom: 12px;
}

/* Format grid */
.format-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
  gap: 8px;
  margin-bottom: 28px;
}

.fmt-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 13px 14px 14px;
  background: transparent;
  border: 1px solid var(--hair);
  border-radius: 12px;
  cursor: pointer;
  color: var(--ink);
  text-align: left;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}

.fmt-btn:hover { background: var(--idle); border-color: var(--line); }

.fmt-btn.sel {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.fmt-name { font-size: 13.5px; font-weight: 600; }
.fmt-desc { font-size: 12px; color: var(--soft); }

.ocr-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
}

/* Drop zone */
.conv-drop {
  display: block;
  width: 100%;
  border: 2px dashed var(--line);
  border-radius: 18px;
  padding: 52px 28px;
  text-align: center;
  cursor: pointer;
  background: transparent;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 6px;
}

.conv-drop:hover,
.conv-drop.over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.conv-drop-icon  { font-size: 44px; line-height: 1; margin-bottom: 12px; display: block; }
.conv-drop-title { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.conv-drop-note  { font-size: 14px; color: var(--soft); }

/* Progress */
.conv-progress        { margin-top: 18px; display: none; }
.conv-progress.show   { display: block; }

.progress-bar-wrap {
  height: 6px;
  background: var(--idle);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-label { font-size: 13px; color: var(--soft); margin-top: 8px; }

/* Result */
.conv-result        { margin-top: 20px; display: none; }
.conv-result.show   { display: block; }

.conv-output {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  font-family: "SF Mono", "Fira Code", Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 340px;
  overflow-y: auto;
  color: var(--ink);
  margin-bottom: 14px;
}

.conv-dl-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════
   CLEAN LAYER  –  flat surfaces, hairlines, generous space
══════════════════════════════════════════════════════════ */
.hero { padding: 88px 0 44px; text-align: center; }
.hero h1 { animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both; }
.hero p  { animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both; }

.navbar-in { height: 48px; }
.nav-logo  { font-size: 17px; font-weight: 600; }
.nav-link  { font-size: 14px; font-weight: 400; }
.nav-link:hover,
.nav-link.active { background: none; color: var(--ink); }
.nav-link.active { font-weight: 500; }

.panel { border-radius: 20px; box-shadow: none; }
.btn,
.fmt-btn.sel,
.progress-bar-fill { box-shadow: none; }

/* Export chooser */
.export-dialog {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.export-card {
  width: min(520px, 100%);
  padding: 28px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--hair);
  border-radius: 20px;
}
.export-card h2 { margin: 0 0 6px; font-size: 24px; }
.export-note { margin: 0 0 20px; color: var(--soft); font-size: 15px; }
.export-options { display: grid; gap: 10px; margin-bottom: 18px; }
.export-option {
  display: block;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  background: transparent;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 14px;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.export-option:hover { border-color: var(--accent); background: var(--accent-soft); }
.export-option strong { display: block; margin-bottom: 2px; font-weight: 600; }
.export-option span { color: var(--soft); font-size: 14px; }
.pdf-layout {
  margin: 0 0 18px;
  padding: 12px 16px;
  border: 1px solid var(--hair);
  border-radius: 14px;
}
.pdf-layout legend { padding: 0 6px; font-weight: 600; font-size: 14px; }
.pdf-layout label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 6px 14px 6px 0;
  font-size: 15px;
  cursor: pointer;
}
.export-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE FIXES – phone/tablet navigation + converter
   Keeps the desktop layout unchanged while preventing cramped
   cards, overflowing controls and mobile navbar overlap.
══════════════════════════════════════════════════════════ */

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.navbar,
.navbar-in,
.nav-actions,
.nav-mobile,
.panel,
.format-grid,
.fmt-btn,
.conv-drop,
.conv-result,
.conv-output {
  min-width: 0;
}

/* Prevent the mobile drawer from being visually lost behind page content. */
.nav-mobile {
  width: 100%;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
}

@media (max-width: 700px) {
  .shell,
  .navbar-in,
  .dock-in {
    width: min(100% - 24px, var(--shell));
  }

  .navbar-in {
    height: 58px;
    gap: 10px;
  }

  .nav-logo {
    flex: 1 1 auto;
    min-width: 0;
  }

  .nav-links {
    display: none;
  }

  .nav-actions {
    flex: 0 0 auto;
    gap: 7px;
  }

  .masthead-meta {
    display: none;
  }

  .theme {
    width: 40px;
    height: 40px;
  }

  .hamburger {
    display: flex;
    width: 42px;
    height: 42px;
    position: relative;
    z-index: 2;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .nav-mobile {
    position: relative;
    z-index: 1;
    padding: 8px 12px 14px;
    border-top: 1px solid var(--hair);
    box-shadow: 0 18px 36px -28px rgba(0, 0, 0, .8);
  }

  .nav-mobile.open {
    display: flex;
  }

  .nav-mobile-link {
    display: flex;
    align-items: center;
    min-height: 46px;
    width: 100%;
    padding: 11px 12px;
  }

  /* Main reviewer page */
  .hero {
    padding: 58px 0 28px;
  }

  .hero h1 {
    font-size: clamp(36px, 12vw, 54px);
  }

  .panel {
    padding: 20px 16px;
    border-radius: 18px;
  }

  .drop {
    padding: 38px 16px;
    border-radius: 18px;
  }

  /* Converter page */
  .conv-hero {
    padding: 54px 0 30px;
  }

  .conv-hero h1 {
    font-size: clamp(34px, 10vw, 48px);
  }

  .conv-hero p {
    margin-top: 12px;
    font-size: 16px;
  }

  .format-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-bottom: 24px;
  }

  .fmt-btn {
    width: 100%;
    min-height: 68px;
    padding: 14px 15px;
  }

  .fmt-name,
  .fmt-desc {
    max-width: calc(100% - 54px);
    overflow-wrap: anywhere;
  }

  .conv-drop {
    padding: 38px 16px;
    border-radius: 18px;
  }

  .conv-drop-icon {
    font-size: 38px;
  }

  .conv-drop-note {
    overflow-wrap: anywhere;
  }

  .conv-output {
    width: 100%;
    max-width: 100%;
    max-height: 300px;
    padding: 14px;
    font-size: 12px;
    overflow-x: auto;
  }

  .conv-dl-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .conv-dl-row .btn {
    width: 100%;
    min-height: 46px;
  }

  /* Export dialog on the main page must fit short phone screens too. */
  .export-dialog {
    align-items: start;
    overflow-y: auto;
    padding: 12px;
  }

  .export-card {
    width: 100%;
    max-height: calc(100dvh - 24px);
    margin: auto 0;
    overflow-y: auto;
    padding: 18px;
    border-radius: 16px;
  }

  .export-actions {
    flex-direction: column-reverse;
  }

  .export-actions .btn {
    width: 100%;
  }
}

@media (max-width: 420px) {
  body {
    font-size: 16px;
  }

  .navbar-in,
  .shell,
  .dock-in {
    width: min(100% - 20px, var(--shell));
  }

  .navbar-in {
    gap: 6px;
  }

  .nav-actions {
    gap: 5px;
  }

  .navbar .btn-small {
    padding: 8px 10px;
    font-size: 12px;
  }

  .theme {
    width: 38px;
    height: 38px;
  }

  .hamburger {
    width: 40px;
    height: 40px;
  }

  .panel {
    padding: 17px 13px;
  }

  .conv-hero {
    padding-top: 42px;
  }

  .conv-drop {
    padding: 32px 12px;
  }

  .step-label {
    font-size: 11px;
  }

  .ocr-badge {
    top: 9px;
    right: 9px;
  }
}

/* ── Polish ── */
.hero h1 { font-size: clamp(40px, 7.4vw, 80px); text-wrap: balance; }
.hero p  { max-width: 30em; text-wrap: balance; }

/* Footer sits at the bottom on tall screens. Scoped so the saved offline file is untouched. */
body:has(> .navbar) { min-height: 100vh; display: flex; flex-direction: column; }
body:has(> .navbar) .footer { margin-top: auto; }

.drop-icon { color: var(--accent); margin-bottom: 14px; }
.drop-note { margin: 10px auto 16px; }
.chips {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 8px; margin: 0 0 24px; padding: 0; list-style: none;
}
.chips li {
  padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--soft); font-size: 12px; font-weight: 500; letter-spacing: 0.02em;
}

.how {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px; margin: 0; padding: 0; list-style: none;
}
.how-item {
  padding: 24px; background: var(--paper);
  border: 1px solid var(--hair); border-radius: 20px;
}
.how-num {
  display: inline-grid; place-items: center; width: 28px; height: 28px;
  margin-bottom: 14px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: 14px; font-weight: 600;
}
.how-item h3 { font-size: 19px; margin-bottom: 6px; }
.how-item p  { color: var(--soft); font-size: 15px; line-height: 1.45; }

@media (max-width: 700px) {
  .how { grid-template-columns: 1fr; }
}

.step-value {
  width: 3.2em;
  min-width: 0;
  padding: 6px 0;
  text-align: center;
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 10px;
  font: 500 17px/1.2 var(--sans);
  font-variant-numeric: tabular-nums;
  appearance: none;
}
.step-value:hover { border-color: var(--line); }
.step-value:focus {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
