:root { color-scheme: dark; --bg: #101b19; --panel: #182622; --line: #34483e; --ink: #f3f0e7; --muted: #abbcb1; --accent: #efc769; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
button { padding: .5rem .85rem; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: var(--panel); cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.primary, #present { background: var(--accent); color: #15221b; font-weight: 650; }
.app-header { display: flex; gap: 1rem; justify-content: space-between; align-items: center; padding: 1rem 1.4rem; border-bottom: 1px solid var(--line); }
.brand { color: var(--ink); font-size: 1.35rem; text-decoration: none; font-weight: 700; white-space: nowrap; }
.brand span { color: var(--accent); }
.file-actions, .editor-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.view-tabs { display: flex; gap: .35rem; }
.view-tabs [aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: #15221b; }
.editing .workspace { display: grid; grid-template-columns: 250px minmax(0, 1fr); max-width: 1500px; margin: 0 auto; }
.editing .presenter { display: none; }
.editing #source { min-height: max(380px, calc(100dvh - 400px)); }
.workspace { display: grid; grid-template-columns: minmax(270px, 340px) minmax(0, 1fr); gap: 1rem; padding: 1rem; }
.editor-panel { display: flex; flex-direction: column; gap: .6rem; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; }
.editor-panel label { font-weight: 650; }
input, select, textarea { border: 1px solid var(--line); border-radius: 6px; padding: .5rem; background: #0d1814; color: var(--ink); }
#source { width: 100%; min-height: 380px; flex: 1; resize: vertical; font: 13px/1.55 ui-monospace, monospace; tab-size: 2; }
.help { margin: 0; color: var(--muted); font-size: .84rem; }
#status { margin: .25rem 0; font-size: .9rem; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
#status[data-error="true"] { color: #ffb0a5; }
.presenter { min-width: 0; }
.presentation-bar { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .7rem; color: var(--muted); }
.presentation-bar > div { display: flex; gap: .5rem; }
.stage { background: #0a1210; border: 1px solid var(--line); border-radius: 12px; aspect-ratio: 16 / 9; width: 100%; overflow: auto; }
.slides { min-height: 100%; }
.slide { position: relative; min-height: var(--slide-min-height, 0px); padding: clamp(1.2rem, 3vw, 3.5rem); font-size: clamp(18px, 1.65vw, 30px); line-height: 1.55; overflow-wrap: anywhere; }
.slide > :first-child { margin-top: 0; }
.slide h1 { font-size: 2em; line-height: 1.15; color: var(--accent); }
.slide h2 { font-size: 1.6em; line-height: 1.2; color: var(--accent); }
.slide h3, .slide h4, .slide h5, .slide h6 { font-size: 1.15em; }
.slide p { margin: .65em 0; }
.slide li { margin: .4em 0; }
.slide code, .slide pre { font-size: .8em; }
.slide pre { overflow-x: auto; padding: .8em; background: var(--panel); border-radius: 7px; }
.apc-math { margin: 1em 0; overflow-x: auto; }
.apc-image, .apc-video { display: block; max-width: 100%; max-height: 55vh; object-fit: contain; margin: 1em 0; }
.apc-audio { width: 100%; }
.apc-table { border-collapse: collapse; margin: 1em 0; max-width: 100%; }
.apc-table th, .apc-table td { border: 1px solid var(--line); padding: .35em .7em; text-align: left; }
.apc-table th { color: var(--accent); }
.apc-callout { background: var(--panel); border-left: 3px solid var(--accent); padding: .7em 1em; margin: 1em 0; border-radius: 0 8px 8px 0; }
.apc-callout-label, .apc-question-title { color: var(--accent); font-weight: 650; }
.apc-question-options { display: grid; gap: .4em; margin: .8em 0; }
.apc-question-option { display: flex; gap: .5em; align-items: baseline; background: var(--panel); padding: .3em .6em; border-radius: 6px; cursor: pointer; }
.apc-question-option input { accent-color: var(--accent); }
.apc-question-answer-input { max-width: 100%; }
.apc-question-feedback { font-size: .8em; }
.apc-question-feedback[data-correct="true"] { color: #85d8a8; }
.apc-question-feedback[data-correct="false"], .apc-error { color: #ffb0a5; }
.apc-question-check { font-size: .7em; }
.slide details { margin-top: .65em; border-top: 1px solid var(--line); padding-top: .4em; }
.slide summary { color: var(--accent); cursor: pointer; }
.ai-audio-disclosure { display: block; color: var(--muted); font-size: .65em; }
.tool-link { color: var(--accent); font-size: .75em; }
.apc-sequence-player { margin: 1em 0; padding: .8em 1em; border: 1px solid var(--line); border-radius: 10px; background: #101b19; }
.apc-sequence-title { margin: 0 0 .65em; color: var(--accent); font-size: 1.1em; }
.apc-sequence-frame { min-height: 4em; }
.apc-sequence-frame > :first-child { margin-top: 0; }
.sequence-enter { animation: sequence-enter .28s ease-out; }
@keyframes sequence-enter { from { opacity: .2; transform: translateY(.35em); } to { opacity: 1; transform: translateY(0); } }
.apc-sequence-controls { display: flex; align-items: center; gap: .4em; flex-wrap: wrap; margin-top: .65em; font-size: .62em; }
.apc-sequence-controls button { padding: .35em .65em; }
.apc-sequence-controls input[type="range"] { flex: 1 1 7em; min-width: 5em; padding: 0; accent-color: var(--accent); }
.apc-sequence-position { min-width: 3.5em; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.slide-controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .8rem; }
#slide-picker { max-width: min(320px, 40vw); }
#counter { color: var(--muted); min-width: 4rem; text-align: center; font-variant-numeric: tabular-nums; }
.teacher-notes { padding: 1rem; border: 1px dashed var(--line); margin-top: 1rem; border-radius: 8px; }
.teacher-notes p { margin: .3rem 0; }
.empty { padding: 2rem; color: var(--muted); }
.overflow { font-size: .85rem; color: var(--accent); }
.presenting .app-header, .presenting .editor-panel, .presenting .slide-library { display: none; }
.presenting .workspace { display: block; max-width: 1700px; margin: 0 auto; }
.presenting .stage { aspect-ratio: auto; height: calc(100dvh - 230px); min-height: 240px; }
.presenting .slide { font-size: clamp(22px, 2.1vw, 38px); }
.presenter:fullscreen { background: var(--bg); padding: 1rem; overflow: auto; }
.presenter:fullscreen .stage { height: calc(100dvh - 220px); min-height: 240px; aspect-ratio: auto; }
.presenter:fullscreen .slide { font-size: clamp(24px, 2.1vw, 40px); }
@media (max-width: 800px) {
  .app-header { align-items: flex-start; flex-direction: column; }
  .workspace { grid-template-columns: 1fr; }
  .editing .workspace { grid-template-columns: 1fr; }
  #source { min-height: 240px; }
  .stage { aspect-ratio: auto; min-height: 420px; max-height: 75vh; }
  .presenting .stage { max-height: none; }
  .slide-picker-label { display: none; }
}
.annotation-toolbar { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; margin-bottom: .7rem; padding: .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-size: .85rem; }
.annotation-modes { display: flex; gap: .25rem; flex-wrap: wrap; }
.annotation-toolbar button { padding: .4rem .65rem; }
.annotation-toolbar button[aria-pressed="true"] { background: var(--accent); color: #15221b; border-color: var(--accent); }
.annotation-toolbar label { display: flex; align-items: center; gap: .35rem; }
#ink-colour { padding: .15rem; width: 2.5rem; height: 2rem; cursor: pointer; }
#ink-width { padding: .3rem; }
.ink-status { color: var(--muted); flex: 1 1 210px; }
.slide-ink { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; overflow: hidden; }
.slide-ink[data-drawing="true"] { pointer-events: auto; touch-action: none; cursor: crosshair; }
.slide-ink[data-tool="eraser"] { cursor: cell; }
.slide-ink path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ink-drawing .slide { user-select: none; -webkit-user-select: none; }
.slide-library { padding: 1rem; border: 1px solid var(--line); border-radius: 10px; align-self: start; }
.slide-library h2 { margin: 0 0 .8rem; font-size: 1.1rem; }
.editor-slides { display: grid; gap: .4rem; max-height: 55vh; overflow: auto; }
.editor-slides button { text-align: left; overflow-wrap: anywhere; }
.editor-slides button[aria-pressed="true"] { background: var(--accent); color: #15221b; border-color: var(--accent); }
.slide-library-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.slide-library-actions button { font-size: .8rem; }
