:root {
  color-scheme: light;
  --ink: #202522;
  --muted: #69716b;
  --line: #d9ded9;
  --paper: #f3f5f2;
  --white: #fff;
  --green: #176b52;
  --green-dark: #0d4d3a;
  --red: #dc2626;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--paper); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid #e48a38; outline-offset: 3px; }

.topbar { height: 68px; padding: 0 clamp(18px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.76); }
.wordmark { font-size: 14px; font-weight: 800; letter-spacing: 0; }
.wordmark span { color: var(--green); }
.topbar-meta { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #c47a1c; box-shadow: 0 0 0 3px rgba(196,122,28,.13); }
.status-dot.connected { background: #18845f; box-shadow: 0 0 0 3px rgba(24,132,95,.13); }
.status-dot.disconnected { background: #bd4545; box-shadow: 0 0 0 3px rgba(189,69,69,.13); }
.workspace { max-width: 1440px; margin: 0 auto; padding: 36px clamp(18px, 5vw, 72px) 32px; }
.toolbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.eyebrow { margin: 0 0 7px; color: var(--green); font: 500 10px/1.4 Consolas, monospace; letter-spacing: 0; }
h1 { margin: 0; font-size: clamp(21px, 3vw, 30px); line-height: 1.2; font-weight: 700; }
.toolbar-note { margin: 0 0 3px; color: var(--muted); font-size: 13px; }
.slide-total { color: #858c87; font-size: .65em; font-weight: 500; }
.controls { display: flex; gap: 8px; }
.button { min-height: 40px; padding: 0 14px; border: 1px solid transparent; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 700; transition: background-color .15s, border-color .15s; }
.button:disabled { cursor: not-allowed; opacity: .45; }
.button.primary { background: var(--green); color: white; }
.button.primary:hover:not(:disabled) { background: var(--green-dark); }
.button.secondary { border-color: var(--line); background: white; color: var(--ink); }
.button.secondary:hover:not(:disabled) { border-color: #9ba79f; background: #fbfcfb; }
.slide-area { width: 100%; padding: 14px; border: 1px solid #dfe3df; background: #e7ebe7; }
.slide-frame { position: relative; width: min(100%, calc((100vh - 255px) * 16 / 9)); min-width: 0; aspect-ratio: 16 / 9; margin: 0 auto; overflow: hidden; background: white; box-shadow: 0 4px 16px rgba(32,37,34,.08); touch-action: none; }
.slide-frame:fullscreen { width: min(100vw, 177.7778vh); height: min(100vh, 56.25vw); aspect-ratio: 16 / 9; margin: auto; box-shadow: none; }
.slide-frame::backdrop { background: #000; }
.slide-frame img { display: block; width: 100%; height: 100%; object-fit: fill; user-select: none; -webkit-user-drag: none; }
.annotation-layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; pointer-events: none; }
.annotation-layer [hidden] { display: none; }
.annotation-layer rect { vector-effect: non-scaling-stroke; }
.student-workspace .annotation-layer { pointer-events: auto; cursor: crosshair; touch-action: none; }
.preview-rectangle { fill: rgba(23,107,82,.12); stroke: rgba(23,107,82,.8); stroke-width: 2; stroke-dasharray: 6 4; }
.own-rectangle { fill: rgba(23,107,82,.08); stroke: rgba(23,107,82,.65); stroke-width: 2; }
.lecturer-rectangle { fill: rgba(239, 68, 68, 0.08); stroke: rgba(220, 38, 38, 0.55); stroke-width: 2; }
.slide-error { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; background: #fff; color: #6b3939; text-align: center; font-size: 14px; }
.slide-error[hidden] { display: none; }
.feedback { min-height: 24px; margin: 12px 2px 0; color: var(--muted); font-size: 12px; }
.auth-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; padding: 12px 14px; border-block: 1px solid var(--line); }
.auth-bar[hidden] { display: none; }
.auth-bar label { font-size: 12px; font-weight: 700; }
.auth-bar input { width: min(280px, 38vw); min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 3px; background: white; }
.auth-bar [role=status] { color: var(--muted); font-size: 12px; }
.upload-bar { display: flex; align-items: center; gap: 10px; margin: -18px 0 18px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.upload-bar label { flex: 0 0 auto; font-size: 12px; font-weight: 700; }
.upload-bar input { min-width: 0; flex: 1; color: var(--muted); font-size: 12px; }
.upload-bar [role=status] { color: var(--muted); font-size: 12px; }
.annotation-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 2px 0; }
.annotation-footer p { margin: 0; color: var(--muted); font-size: 12px; }
.annotation-footer p span { color: var(--ink); font: 500 14px Consolas, monospace; }

.landing-page { position: relative; display: grid; min-height: 100vh; overflow: hidden; align-items: center; background: #e8eee9; }
.landing-main { z-index: 1; width: min(760px, 100%); padding: 72px clamp(24px, 10vw, 150px); }
.landing-main h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(52px, 9vw, 100px); line-height: .98; letter-spacing: 0; }
.landing-main h1 span { color: var(--green); }
.landing-copy { max-width: 390px; margin: 24px 0 34px; color: #5d6861; font-size: 16px; line-height: 1.7; }
.landing-links { display: grid; gap: 0; width: min(390px, 100%); border-top: 1px solid #cbd5cd; }
.landing-links a { display: flex; justify-content: space-between; padding: 17px 2px; border-bottom: 1px solid #cbd5cd; color: #414a44; font-size: 13px; font-weight: 700; }
.landing-links a:hover { color: var(--green); }
.landing-links .primary-link { color: var(--green-dark); }
.landing-mark { position: absolute; right: 6vw; top: 14vh; display: flex; width: min(39vw, 460px); aspect-ratio: 1; align-items: end; gap: 4%; transform: rotate(-8deg); opacity: .72; }
.landing-mark span { flex: 1; height: 42%; border: 1px solid rgba(23,107,82,.38); background: rgba(255,255,255,.24); }
.landing-mark span:nth-child(2) { height: 71%; background: rgba(23,107,82,.12); }
.landing-mark span:nth-child(3) { height: 92%; background: rgba(228,138,56,.16); }

@media (max-width: 640px) {
  .topbar { height: 58px; padding-inline: 16px; }
  .workspace { padding: 24px 14px; }
  .toolbar { align-items: start; flex-direction: column; gap: 14px; }
  .lecturer-toolbar { flex-direction: row; align-items: end; }
  .controls { flex-shrink: 0; }
  .button { padding-inline: 10px; }
  .slide-area { padding: 6px; }
  .slide-frame { width: 100%; }
  .auth-bar { flex-wrap: wrap; gap: 8px; }
  .auth-bar label { width: 100%; }
  .auth-bar input { flex: 1; width: auto; min-width: 120px; }
  .auth-bar [role=status] { width: 100%; }
  .upload-bar { align-items: stretch; flex-direction: column; margin-top: -18px; }
  .upload-bar input { width: 100%; }
  .landing-main { padding: 58px 26px; }
  .landing-mark { top: auto; right: -3vw; bottom: 5vh; width: 34vw; opacity: .45; }
}