:root {
  --paper: #f4f2ec;
  --surface: #ffffff;
  --ink: #18211e;
  --muted: #65706c;
  --line: #d9ddd8;
  --brand: #145c4d;
  --brand-dark: #0c4036;
  --accent: #e5a92f;
  --danger: #b43b36;
  --soft: #e8efec;
  --shadow: 0 18px 50px rgba(24, 33, 30, .09);
  --radius: 14px;
  --max: 1160px;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(20, 92, 77, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 92, 77, .035) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  font: 16px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.shell { width: min(var(--max), calc(100% - 40px)); margin: 0 auto; }
.topbar {
  min-height: 72px;
  border-bottom: 1px solid rgba(24, 33, 30, .11);
  background: rgba(244, 242, 236, .92);
  backdrop-filter: blur(12px);
}
.topbar .shell {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 760;
  letter-spacing: -.02em;
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--brand);
  color: white;
  font-size: 17px;
  font-weight: 850;
}
.nav { display: flex; align-items: center; gap: 8px; }
.nav-link {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
}
.nav-link:hover { color: var(--ink); background: rgba(255,255,255,.7); }
.page { padding: 44px 0 64px; }
.hero {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr);
  align-items: center;
  gap: clamp(40px, 8vw, 100px);
  padding: 64px 0;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.eyebrow::before {
  width: 22px;
  height: 2px;
  content: "";
  background: var(--accent);
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  max-width: 760px;
  margin-bottom: 22px;
  font-size: clamp(42px, 6vw, 74px);
  line-height: .98;
  letter-spacing: -.055em;
}
h2 { margin-bottom: 8px; font-size: 24px; line-height: 1.2; letter-spacing: -.025em; }
h3 { margin-bottom: 6px; font-size: 16px; }
.lead { max-width: 650px; color: var(--muted); font-size: 18px; }
.hero-note { margin-top: 32px; color: var(--muted); font-size: 14px; }
.access-grid { display: grid; gap: 14px; }
.access-card {
  position: relative;
  display: block;
  padding: 26px 58px 26px 26px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 6px 20px rgba(24,33,30,.05);
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.access-card:hover {
  transform: translateY(-3px);
  border-color: #b8c5c0;
  box-shadow: var(--shadow);
}
.access-card::after {
  position: absolute;
  top: 50%;
  right: 24px;
  content: "→";
  color: var(--brand);
  font-size: 24px;
  transform: translateY(-50%);
}
.access-card small { color: var(--muted); }
.access-card strong { display: block; margin-bottom: 3px; font-size: 20px; }
.access-card.primary { color: white; border-color: var(--brand); background: var(--brand); }
.access-card.primary small { color: rgba(255,255,255,.72); }
.access-card.primary::after { color: var(--accent); }
.auth-wrap {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  align-items: center;
  gap: 80px;
  padding: 64px 0;
}
.auth-copy h1 { font-size: clamp(40px, 5vw, 66px); }
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.panel-body { padding: 28px; }
.panel-header {
  padding: 22px 26px;
  border-bottom: 1px solid var(--line);
}
.panel-header p, .muted { color: var(--muted); }
.panel-header p { margin: 4px 0 0; font-size: 14px; }
.field { display: grid; gap: 7px; margin-bottom: 18px; }
.field label { font-size: 13px; font-weight: 750; }
.input, .textarea {
  width: 100%;
  border: 1px solid #cbd2ce;
  border-radius: 10px;
  outline: none;
  background: #fbfcfa;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input { height: 46px; padding: 0 13px; }
.textarea { min-height: 112px; padding: 12px 13px; resize: vertical; }
.input:focus, .textarea:focus {
  border-color: var(--brand);
  background: white;
  box-shadow: 0 0 0 3px rgba(20, 92, 77, .12);
}
.help { color: var(--muted); font-size: 12px; }
.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  background: var(--brand);
  color: white;
  font-weight: 750;
  text-decoration: none;
  transition: background .15s, transform .15s, opacity .15s;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: .48; }
.btn-block { width: 100%; }
.btn-secondary { border-color: var(--line); background: white; color: var(--ink); }
.btn-secondary:hover { background: var(--soft); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #92312d; }
.btn-quiet { background: transparent; color: var(--muted); }
.btn-quiet:hover { background: rgba(24,33,30,.06); color: var(--ink); }
.alert {
  margin-bottom: 18px;
  padding: 11px 13px;
  border: 1px solid #e5b7b3;
  border-radius: 9px;
  background: #fff2f0;
  color: #7c2c28;
  font-size: 14px;
}
.session-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 750;
}
.session-badge::before {
  width: 7px;
  height: 7px;
  content: "";
  border-radius: 50%;
  background: #36a275;
}
.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(310px, .75fr);
  gap: 20px;
}
.stack { display: grid; gap: 20px; align-content: start; }
.form-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 18px; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.file-control {
  padding: 12px;
  border: 1px dashed #b8c3be;
  border-radius: 10px;
  background: #f8faf8;
}
.file-control input { width: 100%; font-size: 13px; }
.preview { display: block; max-width: 180px; max-height: 120px; margin-top: 10px; border-radius: 8px; object-fit: cover; }
.queue { display: grid; gap: 10px; margin-top: 20px; }
.empty {
  padding: 28px 18px;
  border: 1px dashed #c8ceca;
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
}
.queue-item {
  display: grid;
  grid-template-columns: 34px minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfa;
}
.queue-index {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--soft);
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
}
.queue-meta { color: var(--muted); font-size: 12px; }
.icon-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
}
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.status-card { position: sticky; top: 20px; overflow: hidden; }
.status-top { padding: 24px; background: var(--brand); color: white; }
.status-label {
  margin-bottom: 16px;
  color: rgba(255,255,255,.7);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.status-question { min-height: 82px; font-size: 22px; font-weight: 740; line-height: 1.25; }
.status-image { width: 100%; max-height: 230px; margin-top: 16px; border-radius: 9px; object-fit: contain; background: rgba(0,0,0,.12); }
.metrics { display: grid; grid-template-columns: 1fr 1fr; }
.metric { padding: 20px 22px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric-value { display: block; font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.metric-label { color: var(--muted); font-size: 12px; }
.join-layout { max-width: 760px; margin: 0 auto; }
.join-card { overflow: hidden; }
.join-head { padding: 28px; border-bottom: 1px solid var(--line); }
.join-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; padding: 22px 28px 28px; }
.question-area { padding: clamp(24px, 5vw, 46px); }
.question-kicker { color: var(--brand); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.question-title { margin: 12px 0 22px; font-size: clamp(28px, 5vw, 46px); line-height: 1.08; letter-spacing: -.035em; }
.question-image { width: 100%; max-height: 360px; margin-bottom: 22px; border-radius: 10px; object-fit: contain; background: var(--soft); }
.answer-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.timer { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.message { min-height: 24px; margin-top: 12px; color: var(--brand); font-size: 14px; font-weight: 700; }
.hidden { display: none !important; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 20;
  padding: 12px 17px;
  border-radius: 9px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.ranking-controls { display: flex; gap: 10px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.ranking-controls .input { max-width: 260px; }
.ranking-list { padding: 8px 24px 24px; }
.rank-row {
  display: grid;
  grid-template-columns: 56px minmax(0,1fr) repeat(3, 100px);
  align-items: center;
  min-height: 66px;
  border-bottom: 1px solid var(--line);
}
.rank-row:last-child { border-bottom: 0; }
.rank-head { min-height: 44px; color: var(--muted); font-size: 12px; font-weight: 750; }
.rank-position { color: var(--muted); font-weight: 800; }
.rank-name { overflow: hidden; font-weight: 730; text-overflow: ellipsis; white-space: nowrap; }
.rank-points { color: var(--brand); font-weight: 850; }
.podium .rank-position { color: var(--accent); font-size: 19px; }
@media (max-width: 840px) {
  .hero, .auth-wrap, .dashboard { grid-template-columns: 1fr; }
  .hero, .auth-wrap { gap: 42px; padding: 46px 0; }
  .auth-copy { display: none; }
  .status-card { position: static; }
  .form-grid { grid-template-columns: 1fr; }
  .join-form { grid-template-columns: 1fr; }
  .rank-row { grid-template-columns: 42px minmax(0,1fr) 82px; }
  .rank-hide-mobile { display: none; }
}
@media (max-width: 560px) {
  .shell { width: min(100% - 24px, var(--max)); }
  .topbar, .topbar .shell { min-height: 62px; }
  .page { padding: 24px 0 42px; }
  h1 { font-size: 43px; }
  .nav-link.optional { display: none; }
  .panel-body, .panel-header, .join-head, .question-area { padding: 20px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .actions .btn { flex: 1 1 auto; }
  .queue-item { grid-template-columns: 30px minmax(0,1fr); }
  .queue-actions { grid-column: 2; }
  .ranking-controls { flex-wrap: wrap; padding: 16px; }
  .ranking-controls .input { max-width: none; flex: 1; }
  .ranking-list { padding: 6px 16px 18px; }
}

/* Multiple choice */
.option-fieldset,
.answer-options {
  min-width: 0;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}
.option-fieldset legend,
.answer-options legend {
  margin-bottom: 9px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}
.option-editor {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  margin-bottom: 9px;
}
.option-letter,
.answer-option-key {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--soft);
  color: var(--brand);
  font-weight: 850;
}
.correct-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.correct-selector label { cursor: pointer; }
.correct-selector input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.correct-selector span {
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid #cbd2ce;
  border-radius: 9px;
  background: #fbfcfa;
  font-weight: 850;
  transition: border-color .15s, background .15s, color .15s, box-shadow .15s;
}
.correct-selector input:checked + span {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
  box-shadow: 0 0 0 3px rgba(20, 92, 77, .12);
}
.correct-selector label:hover span { border-color: var(--brand); }
.compact-options {
  display: grid;
  gap: 7px;
  margin-top: 18px;
}
.compact-options > div {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  color: rgba(255,255,255,.86);
  font-size: 13px;
}
.compact-options strong { color: var(--accent); }
.answer-options {
  display: grid;
  gap: 10px;
}
.answer-option {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 13px;
  align-items: center;
  min-height: 64px;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
  background: #fbfcfa;
  transition: border-color .15s, background .15s, box-shadow .15s, transform .15s;
}
.answer-option:hover {
  border-color: #9fb4ab;
  background: white;
  transform: translateY(-1px);
}
.answer-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.answer-option:has(input:checked) {
  border-color: var(--brand);
  background: #eef5f2;
  box-shadow: 0 0 0 3px rgba(20, 92, 77, .10);
}
.answer-option:has(input:checked) .answer-option-key {
  background: var(--brand);
  color: white;
}
.answer-option:has(input:disabled) {
  cursor: default;
  opacity: .68;
  transform: none;
}
.answer-option-text { font-weight: 680; }
@media (max-width: 560px) {
  .answer-option { min-height: 58px; padding: 8px 11px; }
}

/* Presentation screen */
.projection-page { overflow-x: hidden; }
.projection-bar .topbar,
.projection-bar { background: rgba(244, 242, 236, .97); }
.projection-main {
  min-height: calc(100vh - 72px);
  display: grid;
  align-items: center;
  padding: 28px 0 38px;
}
.projection-join {
  width: min(520px, 100%);
  margin: 0 auto;
}
.projection-pin-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.projection-content { width: 100%; }
.projection-status {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 720;
}
.projection-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #9da5a1;
}
.projection-status-dot[data-state="active"] {
  background: #2c9b70;
  box-shadow: 0 0 0 5px rgba(44, 155, 112, .13);
}
.projection-status-dot[data-state="finished"] { background: var(--accent); }
.projection-status-dot[data-state="error"] { background: var(--danger); }
.projection-timer {
  margin-left: auto;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.projection-card {
  min-height: min(720px, calc(100vh - 150px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}
.projection-question-wrap {
  padding: clamp(26px, 4vw, 54px) clamp(26px, 5vw, 64px) clamp(22px, 3vw, 38px);
  border-bottom: 1px solid var(--line);
}
.projection-question {
  max-width: 1050px;
  margin: 12px 0 0;
  font-size: clamp(34px, 5vw, 66px);
  line-height: 1.05;
  letter-spacing: -.045em;
}
.projection-image {
  display: block;
  max-width: 100%;
  max-height: 270px;
  margin: 28px auto 0;
  border-radius: 10px;
  object-fit: contain;
}
.projection-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(12px, 2vw, 22px);
  align-content: center;
  padding: clamp(22px, 4vw, 48px) clamp(26px, 5vw, 64px);
}
.projection-option {
  min-height: clamp(86px, 12vh, 132px);
  display: grid;
  grid-template-columns: clamp(48px, 5vw, 66px) minmax(0, 1fr);
  gap: clamp(14px, 2vw, 24px);
  align-items: center;
  padding: clamp(16px, 2vw, 26px);
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fbfcfa;
  font-size: clamp(19px, 2.2vw, 30px);
  font-weight: 690;
  transition: background .25s, border-color .25s, box-shadow .25s;
}
.projection-option-key {
  width: clamp(48px, 5vw, 66px);
  height: clamp(48px, 5vw, 66px);
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--soft);
  color: var(--brand);
  font-size: clamp(20px, 2.4vw, 30px);
  font-weight: 900;
}
.projection-option.is-correct {
  border-color: #278460;
  background: #e8f4ee;
  box-shadow: 0 0 0 5px rgba(39, 132, 96, .12);
}
.projection-option.is-correct .projection-option-key {
  background: #278460;
  color: white;
}
.projection-result {
  padding: 18px clamp(26px, 5vw, 64px);
  background: var(--brand);
  color: white;
  font-size: clamp(18px, 2vw, 26px);
}
.projection-result strong {
  display: inline-grid;
  min-width: 40px;
  place-items: center;
  margin-left: 5px;
  color: var(--accent);
  font-size: 1.25em;
}
@media (max-width: 720px) {
  .projection-options { grid-template-columns: 1fr; }
  .projection-card { min-height: calc(100vh - 130px); }
  .projection-pin-form { grid-template-columns: 1fr; }
}
@media (max-height: 760px) and (min-width: 721px) {
  .projection-card { min-height: calc(100vh - 125px); }
  .projection-question-wrap { padding-top: 24px; padding-bottom: 20px; }
  .projection-question { font-size: clamp(30px, 4vw, 50px); }
  .projection-options { padding-top: 20px; padding-bottom: 20px; }
}
