:root {
  --bg: #f4efe7;
  --bg-2: #ece4d8;
  --surface: #fffcf7;
  --line: rgba(42, 35, 28, .12);
  --text: #1e1a16;
  --muted: #6d655c;
  --gold: #c47a3a;
  --teal: #3d655f;
  --red: #c43c3c;
  --blue: #2b5c8a;
  --yellow: #c9923a;
  --green: #3a7a48;
  --purple: #6b4a8a;
  --orange: #c45c26;
  --danger: #b4232e;
  --radius: 16px;
  --shadow: 0 18px 40px rgba(42, 35, 28, .08);
  --font-sans: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-family: var(--font-sans);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { position: relative; }

body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 46% at 8% -8%, rgba(196, 122, 58, .16), transparent 58%),
    radial-gradient(ellipse 50% 40% at 100% 0%, rgba(61, 101, 95, .11), transparent 52%),
    radial-gradient(ellipse 45% 35% at 90% 100%, rgba(196, 122, 58, .07), transparent 55%);
}
body > * { position: relative; z-index: 1; }

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

h1, h2, .brand { font-family: var(--font-serif); font-weight: 600; letter-spacing: -.02em; }
h1 { font-size: clamp(2rem, 4.4vw, 3.5rem); line-height: 1.12; margin: 0 0 .5rem; }
.h2 { font-size: .78rem; margin: 1.2rem 0 .4rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-family: var(--font-sans); font-weight: 700; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; color: var(--gold); font-size: .72rem; font-weight: 700; margin: 0 0 .55rem; }
.lede { font-size: 1.18rem; color: var(--muted); max-width: 38rem; line-height: 1.55; }
.muted { color: var(--muted); }
.tiny { font-size: .82rem; color: var(--muted); line-height: 1.45; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 700; font-size: 1.15rem; }
.brand.center { justify-content: center; width: 100%; margin-bottom: 1rem; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 0; border-radius: 12px; padding: .7rem 1.15rem; font-weight: 700;
  cursor: pointer; font-family: inherit; font-size: .95rem; text-decoration: none;
  transition: filter .15s ease, transform .15s ease, background .15s ease;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-primary { background: #2a231c; color: #f6f0e6; }
.btn-accent { background: var(--gold); color: #1a1208; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-sm { padding: .4rem .8rem; font-size: .85rem; }
.btn-lg { padding: 1rem 1.3rem; font-size: 1.1rem; width: 100%; }
.btn.danger { color: var(--danger); }
.inline { display: inline; }

.marketing-header, .app-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.15rem 6vw; gap: 1rem;
}
.app-header {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 8;
}
.marketing-header nav, .app-nav { display: flex; gap: .85rem; align-items: center; flex-wrap: wrap; }
.marketing-header nav > a:not(.btn),
.app-nav > a {
  color: var(--text); font-weight: 600; font-size: .95rem;
  text-underline-offset: .2em;
}

.hero {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(280px, .95fr);
  gap: clamp(1.5rem, 5vw, 4rem); align-items: center;
  padding: 5vh 6vw 5vh; max-width: 78rem; margin: 0 auto;
}
.hero-copy { max-width: 38rem; }
.pin-hero { display: flex; gap: .55rem; margin: 1.7rem 0 .7rem; max-width: 30rem; }
.pin-hero input, input, textarea, select {
  width: 100%; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; padding: .85rem 1rem;
  font: inherit;
}
.pin-hero input { letter-spacing: .12em; font-weight: 700; }
textarea { resize: vertical; }
label { display: block; font-weight: 600; margin-bottom: .2rem; }
label input, label textarea { margin-top: .35rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; }
.check input { width: auto; margin-top: .2rem; }

.hero-visual { display: flex; justify-content: center; }
.hero-board {
  width: min(100%, 420px);
  background: #1c1915; color: #f6f1ea;
  border-radius: 22px; padding: 1.35rem 1.4rem 1.2rem;
  box-shadow: 0 30px 60px rgba(42, 35, 28, .22);
  transform: rotate(-1.4deg);
}
.hero-kicker {
  margin: 0 0 .7rem; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase;
  color: #d4b08a; font-weight: 700;
}
.hero-board-q {
  font-family: var(--font-serif); font-size: 1.45rem; font-weight: 600;
  line-height: 1.25; margin: 0 0 1.1rem;
}
.hero-board-opts { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.hero-board-opts span {
  display: grid; place-items: center; min-height: 52px; border-radius: 12px;
  font-weight: 700; font-size: .95rem; color: #fff;
}
.hero-board-opts span:nth-child(1) { background: var(--red); }
.hero-board-opts span:nth-child(2) { background: var(--blue); }
.hero-board-opts span:nth-child(3) { background: var(--yellow); color: #1a1208; }
.hero-board-opts span:nth-child(4) { background: var(--green); }

.features {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem;
  padding: 1vh 6vw 7vh; max-width: 78rem; margin: 0 auto;
}
.features article {
  background: transparent; border: 0; box-shadow: none; padding: 0 0.2rem 0 0;
  border-top: 1px solid var(--line); padding-top: 1.1rem;
}
.feat-num {
  font-family: var(--font-serif); color: var(--gold); margin: 0 0 .4rem;
  font-size: 1.05rem; font-weight: 600;
}
.features h2 { font-size: 1.25rem; margin: 0 0 .4rem; }
.features p { color: var(--muted); line-height: 1.5; margin: 0; }

.quiz-card, .panel, .auth-card, .empty, .stats article {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem 1.35rem; box-shadow: var(--shadow);
}
.site-footer {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1.6rem 6vw 2.2rem; color: var(--muted); font-size: .85rem;
  border-top: 1px solid var(--line); max-width: 78rem; margin: 0 auto; width: 100%;
}

.auth-card { width: min(440px, 92vw); margin: 8vh auto; }
.auth-card.wide { width: min(640px, 92vw); }
.stack { display: flex; flex-direction: column; gap: .9rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }

.alert { padding: .8rem 1rem; border-radius: 12px; margin-bottom: 1rem; }
.alert-error { background: #f8e8e4; border: 1px solid #e3b7ae; color: #7a2c24; }
.alert-ok { background: #e6f0ed; border: 1px solid #b5cfc8; color: #1f4a44; }

.app-shell .app-main { padding: 0 6vw 5rem; max-width: 86rem; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin: 1.4rem 0 1.5rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.2rem; }
.stats span { display: block; font-size: 1.85rem; font-family: var(--font-serif); color: var(--gold); font-weight: 600; }
.search-bar { display: flex; gap: .6rem; margin-bottom: 1.2rem; }
.quiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.quiz-card h2 { font-size: 1.25rem; margin: .25rem 0 .4rem; }
.tag { display: inline-block; background: color-mix(in srgb, var(--teal) 12%, transparent); color: var(--teal); padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.card-actions, .row-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }
.compact-settings { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.compact-settings input { width: auto; min-width: 140px; }

.editor-layout { display: grid; grid-template-columns: 240px 1fr 300px; gap: 1rem; align-items: start; }
.q-list { display: flex; flex-direction: column; gap: .4rem; }
.q-item { text-align: left; background: var(--surface); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: .7rem; cursor: pointer; font: inherit; }
.q-item.active { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, var(--surface)); }
.preview-stage { min-height: 280px; background: #1c1915; color: #f6f1ea; border-radius: var(--radius); padding: 1rem; border: 1px solid #2e2822; }
.preview-q { font-size: 1.15rem; font-weight: 700; margin-bottom: 1rem; overflow-wrap: anywhere; }
.preview-opts { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.preview-opts .answer-tile { min-height: 56px; font-size: .9rem; }
.opt-chip { padding: .8rem; border-radius: 12px; color: #fff; font-weight: 700; display: flex; gap: .5rem; align-items: center; min-height: 56px; }

/* —— Telão e celular do aluno (alto contraste, sem grade) —— */
.stage-body {
  --bg: #1c1915;
  --bg-2: #2a241e;
  --surface: #322c26;
  --line: rgba(255,255,255,.1);
  --text: #f6f1ea;
  --muted: #b7aea3;
  --danger: #fb7185;
  --shadow: 0 20px 50px rgba(0,0,0,.35);
  color-scheme: dark;
  min-height: 100vh; min-height: 100dvh; overflow-x: hidden;
  background: var(--bg); color: var(--text);
}
.stage-body::before {
  background:
    radial-gradient(ellipse 70% 50% at 12% -4%, rgba(196, 122, 58, .2), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 8%, rgba(61, 101, 95, .16), transparent 50%);
}
.stage-body .alert-error { background: rgba(196, 60, 60, .18); border-color: rgba(196, 60, 60, .4); color: #fecaca; }
.stage-body .alert-ok { background: rgba(61, 101, 95, .22); border-color: rgba(61, 101, 95, .4); color: #cde8e2; }
.stage-body .btn-primary { background: #f3eadc; color: #1c1915; }
.stage-body .btn-ghost { color: var(--text); border-color: var(--line); }

.host-root, .player-root {
  min-height: 100vh; min-height: 100dvh; min-height: 100svh;
  display: flex; flex-direction: column;
}
.host-root:has(.question-stage) {
  height: 100dvh; height: 100svh; overflow: hidden;
}
.player-root:has(.question-stage) {
  height: auto; min-height: 100svh; overflow-x: hidden; overflow-y: auto;
}
.host-top { display: flex; justify-content: space-between; align-items: center; padding: 1rem 2rem; }
.host-pin { font-family: var(--font-serif); font-size: clamp(2.2rem, 10vw, 6rem); letter-spacing: .08em; margin: 0; word-break: break-all; font-weight: 600; }
.lobby { display: grid; grid-template-columns: 1.1fr .9fr; min-height: 100vh; min-height: 100dvh; }
.lobby-left { padding: 4vh 5vw; display: flex; flex-direction: column; justify-content: center; }
.lobby-right { background: var(--bg-2); padding: 3vh 4vw; overflow: auto; }
.player-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { background: var(--surface); border-radius: 999px; padding: .35rem .7rem; font-weight: 700; }
.qr-box { background: #fff; padding: 12px; border-radius: 16px; width: fit-content; margin: 1rem 0; }
.qr-box img { display: block; width: min(220px, 56vw); height: auto; aspect-ratio: 1; }
.host-controls { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .25rem; flex-shrink: 0; }
.count-pill { font-size: clamp(1.1rem, 3vw, 1.4rem); font-weight: 800; color: var(--gold); }

.question-stage {
  --stage-pad-x: clamp(.75rem, 4vw, 5vw);
  --stage-pad-t: calc(12px + env(safe-area-inset-top, 0px));
  --stage-pad-b: calc(.7rem + env(safe-area-inset-bottom, 0px));
  padding: var(--stage-pad-t) var(--stage-pad-x) var(--stage-pad-b);
  flex: 1; min-height: 0; height: 100%;
  display: flex; flex-direction: column;
  gap: clamp(.35rem, 1.1vh, .9rem);
  overflow: hidden;
}
.host-root .question-stage {
  --stage-pad-b: calc(3rem + env(safe-area-inset-bottom, 0px));
}
.q-prompt {
  flex: 0 0 auto;
  display: flex; flex-direction: column;
  gap: .45rem;
  min-width: 0;
}
.question-stage > .lede {
  overflow-wrap: anywhere; max-height: 12vh; overflow: auto; flex-shrink: 0; margin: 0;
}
.q-text {
  font-family: var(--font-serif);
  font-size: clamp(1.12rem, 2vw + .85rem, 3rem);
  font-weight: 600; line-height: 1.25; margin: 0;
  padding: .1rem 0 .2rem;
  overflow-wrap: anywhere;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 0 0 auto;
  min-height: 2.8em;
  max-height: 32vh;
}
.q-image {
  max-height: min(22vh, 200px); max-width: min(100%, 720px);
  object-fit: contain; border-radius: 12px; align-self: center; flex-shrink: 0;
}
.answer-area {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; gap: .6rem;
  overflow: hidden;
}
.answer-grid {
  display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr;
  gap: clamp(8px, 1.2vw, 16px);
  flex: 1 1 auto; min-height: 0;
}
.answer-grid.opts-3 > :last-child,
.answer-grid.opts-5 > :last-child { grid-column: 1 / -1; }
.answer-btn, .answer-tile {
  border: 0; border-radius: clamp(12px, 1.5vw, 16px); color: #fff; font: inherit; font-weight: 700;
  font-size: clamp(.9rem, 1.4vw + .5rem, 1.55rem);
  padding: clamp(.55rem, 1.3vh + .35rem, 1.2rem);
  min-height: 0;
  display: flex; align-items: center; justify-content: center; gap: .6rem; text-align: center;
  cursor: pointer; position: relative; overflow: hidden;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.opt-text {
  overflow-wrap: anywhere; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.answer-btn:disabled { cursor: default; filter: grayscale(.15); }
.answer-tile.correct { outline: 6px solid #fff; transform: scale(1.02); }
.answer-tile.dim { opacity: .35; }
.shape { width: clamp(20px, 3vw, 28px); height: clamp(20px, 3vw, 28px); flex-shrink: 0; }

.timer-bar {
  position: fixed; left: 0; right: 0; z-index: 4;
  top: env(safe-area-inset-top, 0px);
  height: 5px; background: var(--gold); width: 100%; transform-origin: left;
}
.meta-line {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .25rem 1rem;
  color: var(--muted); font-weight: 700; font-size: clamp(.75rem, 1.6vw, .95rem); flex-shrink: 0;
}

.leaderboard { max-width: 720px; width: 100%; margin: 4vh auto; padding: 0 1rem 3rem; }
.lb-row { display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto; gap: 1rem; align-items: center; background: var(--surface); margin-bottom: .5rem; padding: .8rem 1rem; border-radius: 14px; }
.lb-row span { overflow-wrap: anywhere; }
.lb-row.up { box-shadow: inset 3px 0 0 var(--teal); }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 1rem; min-height: min(50vh, 420px); padding: 6vh 4vw; flex-wrap: wrap; }
.pod { text-align: center; background: var(--surface); border-radius: 20px; padding: 1.5rem 1.2rem; width: min(220px, 30vw); animation: rise .7s ease; }
.pod.first { height: 280px; background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 28%, transparent), var(--surface)); order: 2; }
.pod.second { height: 220px; order: 1; }
.pod.third { height: 180px; order: 3; }
.pod .place { font-size: 2rem; font-family: var(--font-serif); color: var(--gold); }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.join-screen { max-width: 420px; margin: 0 auto; padding: max(6vh, env(safe-area-inset-top)) 1.2rem max(3rem, env(safe-area-inset-bottom)); }
.join-brand { display: flex; align-items: center; gap: .5rem; font-family: var(--font-serif); font-weight: 700; margin-bottom: 1.5rem; }
.join-brand img { border-radius: 8px; }
.avatar-picker { display: flex; flex-wrap: wrap; gap: .4rem; }
.avatar-picker label { margin: 0; }
.avatar-picker input { display: none; }
.avatar-picker span {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  background: var(--surface); border: 2px solid transparent; font-size: 1.4rem; cursor: pointer;
}
.avatar-picker input:checked + span { border-color: var(--gold); }

.player-root { padding: 0; }
.player-root .question-stage {
  --stage-pad-t: calc(16px + env(safe-area-inset-top, 0px));
  height: auto;
  overflow: visible;
  justify-content: flex-start;
}
.player-root .q-text {
  color: var(--text);
  flex: none;
  min-height: 0;
  max-height: none;
  overflow: visible;
  font-size: clamp(1.2rem, 5.6vw, 1.8rem);
  line-height: 1.3;
}
.player-root .answer-area,
.player-root .answer-grid {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
}
.player-root .answer-grid {
  grid-auto-rows: minmax(4.75rem, 18vh);
}
.waiting { margin: auto; text-align: center; font-size: clamp(1.1rem, 4vw, 1.4rem); padding: 2rem 1rem; }
.sent { margin: auto; text-align: center; padding: 1.5rem; }
.sent h2 { font-size: clamp(1.5rem, 6vw, 2rem); }

.dist { display: flex; flex-direction: column; gap: .6rem; margin-top: .4rem; flex-shrink: 0; max-height: 28vh; overflow: auto; }
.dist-row { display: grid; grid-template-columns: 2rem 1fr 3rem; gap: .6rem; align-items: center; }
.dist-bar { height: 18px; border-radius: 8px; background: #222; overflow: hidden; }
.dist-bar > i { display: block; height: 100%; }

.a11y-bar {
  position: fixed; z-index: 5;
  right: max(.6rem, env(safe-area-inset-right));
  bottom: max(.6rem, env(safe-area-inset-bottom));
  display: flex; gap: .3rem;
}
.a11y-bar button { border-radius: 10px; }

.mode-pills { display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0; }
.pill { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); border-radius: 999px; padding: .2rem .7rem; font-size: .8rem; font-weight: 700; }
.pill.off { background: rgba(255,255,255,.06); color: var(--muted); }
.scoring-opts { display: flex; flex-direction: column; gap: .4rem; margin-top: .6rem; }
.delta { font-weight: 800; margin-left: .35rem; }
.delta.up { color: #7dcdc0; }
.delta.down { color: var(--danger); }
.streak, .streak-lg { color: var(--gold); font-weight: 800; }
.streak-lg { font-size: 1.2rem; }
.lb-row.climber { outline: 2px solid var(--teal); background: color-mix(in srgb, var(--teal) 16%, transparent); }
.lb-row.down { box-shadow: inset 3px 0 0 var(--danger); }
.lb-row.you { outline: 2px solid var(--gold); }
.climber-tag { color: #7dcdc0; font-style: normal; font-size: .8rem; margin-left: .35rem; }

table.data { width: 100%; border-collapse: collapse; margin: 0 0 2rem; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.data th, table.data td { text-align: left; padding: .75rem .9rem; border-bottom: 1px solid var(--line); }
table.data th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
table.data tr.weak td { background: #f8e8e4; }
.order-list { margin: 0; padding-left: 1.4rem; font-size: clamp(1rem, 2.4vw, 1.3rem); font-weight: 700; overflow: auto; }
.order-edit { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; overflow: auto; flex: 1; min-height: 0; }
.order-edit li { display: flex; justify-content: space-between; align-items: center; gap: .8rem; background: var(--surface); border-radius: 14px; padding: .8rem 1rem; font-weight: 700; }
.order-edit li > span:first-child { overflow-wrap: anywhere; min-width: 0; }
.order-btns { display: flex; gap: .3rem; flex-shrink: 0; }
.match-grid { display: flex; flex-direction: column; gap: .6rem; overflow: auto; flex: 1; min-height: 0; }
.match-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: .6rem; align-items: center; background: var(--surface); padding: .8rem 1rem; border-radius: 14px; font-weight: 700; }
.match-row span { overflow-wrap: anywhere; min-width: 0; }
.answer-form { max-width: 420px; margin: 0 auto; width: 100%; overflow: auto; }
.answer-btn.picked { outline: 5px solid #fff; transform: scale(1.02); }
.team-board { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }
.chip { border: 2px solid transparent; }
.ans-send { flex-shrink: 0; }

body.high-contrast { background: #000; color: #ffe600; }
body.high-contrast .q-text { color: #fff; }
body.xl-text .q-text { font-size: clamp(1.4rem, 3.2vw + 1rem, 4rem); max-height: 34vh; }

@media (max-width: 1100px) {
  .editor-layout { grid-template-columns: 200px 1fr; }
  .preview-stage { grid-column: 1 / -1; }
  .hero { grid-template-columns: 1fr; }
  .hero-board { transform: none; }
}

@media (max-width: 900px) {
  .lobby, .grid-2, .features { grid-template-columns: 1fr; }
  .hero, .marketing-header, .app-header, .app-shell .app-main { padding-left: 1.1rem; padding-right: 1.1rem; }
  .site-footer { padding-left: 1.1rem; padding-right: 1.1rem; }
  .marketing-header, .app-header { flex-wrap: wrap; }
  .page-head { flex-direction: column; align-items: stretch; }
  .stats { grid-template-columns: 1fr; }
  .search-bar, .pin-hero { flex-direction: column; }
  .site-footer { flex-direction: column; gap: .5rem; }
  .podium { flex-direction: column; align-items: center; min-height: 0; }
  .pod, .pod.first, .pod.second, .pod.third { order: 0; height: auto; width: min(280px, 92vw); }
  table.data { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .compact-settings select, .compact-settings input { width: 100%; min-width: 0; }
  .host-controls .btn { flex: 1 1 calc(50% - .5rem); }
  .a11y-bar { transform: scale(.92); transform-origin: bottom right; }
}

@media (max-width: 700px) {
  .editor-layout { grid-template-columns: 1fr; }
  .question-stage { --stage-pad-x: .75rem; }
  .q-text {
    font-size: clamp(1.15rem, 5.4vw, 1.65rem);
    max-height: min(40vh, 14rem);
    min-height: 3.2em;
  }
  .host-pin { letter-spacing: .06em; }
  .match-row { grid-template-columns: 1fr; text-align: center; gap: .25rem; }
  .order-edit li { flex-wrap: wrap; }
  .quiz-card .card-actions form.stack { width: 100%; }
  .preview-opts { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .answer-grid.opts-2 { grid-template-columns: 1fr; }
  .answer-btn, .answer-tile { min-height: 3.4rem; }
}

@media (max-height: 540px) and (orientation: landscape) {
  .q-text { max-height: min(34vh, 8.5rem); min-height: 2.4em; font-size: clamp(.95rem, 4.2vh, 1.35rem); }
  .question-stage { gap: .3rem; --stage-pad-t: calc(8px + env(safe-area-inset-top, 0px)); }
  .answer-btn, .answer-tile { padding: .4rem .7rem; font-size: clamp(.82rem, 3.2vh, 1.15rem); border-radius: 12px; }
  .host-controls { gap: .3rem; }
  .host-controls .btn { padding: .35rem .7rem; font-size: .82rem; min-height: 0; }
  .shape { width: 18px; height: 18px; }
  .timer-bar { height: 4px; }
  .q-image { max-height: 16vh; }
}

@media (pointer: coarse) {
  .host-controls .btn, .ans-send { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .pod, .answer-tile.correct, .answer-btn.picked, .hero-board { animation: none; transform: none; }
}
