/* ============================================================
   Clicker — shared design tokens
   ============================================================ */
:root {
  --bg: #05070d;
  --bg-soft: #0a0f1a;
  --panel: rgba(14, 21, 34, 0.74);
  --panel-solid: #0d1420;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.26);
  --text: #e8eef8;
  --muted: #8b98ad;
  --muted-dim: #5d697c;
  --accent: #6ee7ff;
  --accent-2: #a78bfa;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --radius: 18px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(110, 231, 255, 0.25);
}

/* ============================================================
   Shared controls
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease, opacity 0.18s ease;
}

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

.btn--ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
  color: var(--muted);
}

.btn--ghost:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
}

.btn--soft {
  background: rgba(110, 231, 255, 0.1);
  border-color: rgba(110, 231, 255, 0.28);
  color: var(--accent);
}

.btn--soft:hover {
  background: rgba(110, 231, 255, 0.16);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(10, 15, 26, 0.6);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  backdrop-filter: blur(12px);
}

.chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-dim);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.chip[data-status="open"] {
  color: var(--good);
}

.chip[data-status="open"] .dot {
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.14);
}

.chip[data-status="connecting"] .dot,
.chip[data-status="reconnecting"] .dot {
  background: var(--warn);
  animation: pulse 1.4s ease-in-out infinite;
}

.chip[data-status="closed"] {
  color: var(--bad);
}

.chip[data-status="closed"] .dot {
  background: var(--bad);
}

.chip--muted[data-active="true"] {
  color: var(--accent);
  border-color: rgba(110, 231, 255, 0.3);
}

.chip--deck {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  border-color: rgba(110, 231, 255, 0.24);
}

.chip--ratio {
  font-family: var(--mono);
  color: var(--accent-2);
  border-color: rgba(167, 139, 250, 0.3);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 60;
  transform: translate(-50%, 12px);
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(10, 15, 26, 0.92);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  backdrop-filter: blur(16px);
  max-width: min(90vw, 640px);
  text-align: center;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ============================================================
   Host (big screen)
   ============================================================ */
body.host {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(1000px 700px at 82% -12%, rgba(110, 231, 255, 0.12), transparent 62%),
    radial-gradient(900px 720px at -6% 108%, rgba(167, 139, 250, 0.14), transparent 58%),
    var(--bg);
}

body.host::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: linear-gradient(to right, rgba(148, 163, 184, 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.055) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(78% 70% at 50% 42%, #000 25%, transparent 100%);
  mask-image: radial-gradient(78% 70% at 50% 42%, #000 25%, transparent 100%);
  pointer-events: none;
}

.stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
}

/* PDF stage — letterboxed to the page's own aspect ratio. */
.deckstage {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  background: #000;
  overflow: hidden;
}

.deckstage__image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.deckstage__loading {
  position: absolute;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(10, 15, 26, 0.82);
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  backdrop-filter: blur(12px);
}

.slide {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(56px, 8vw, 128px);
  animation: slide-in 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.kicker {
  margin: 0 0 22px;
  color: var(--accent);
  font-size: clamp(11px, 1.05vw, 14px);
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  opacity: 0.9;
}

.slide h1,
.slide h2 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.04;
}

.display {
  font-size: clamp(56px, 8.6vw, 148px);
  line-height: 0.98 !important;
}

.display em {
  font-style: normal;
  background: linear-gradient(100deg, var(--accent) 10%, var(--accent-2) 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.slide h2 {
  font-size: clamp(34px, 4.5vw, 74px);
}

.slide .lead {
  margin: clamp(26px, 3vw, 42px) 0 0;
  max-width: 26em;
  color: var(--muted);
  font-size: clamp(16px, 1.55vw, 26px);
  line-height: 1.65;
}

.slide .hint {
  position: absolute;
  left: clamp(56px, 8vw, 128px);
  bottom: clamp(40px, 5vw, 72px);
  margin: 0;
  color: var(--muted-dim);
  font-size: clamp(12px, 1vw, 15px);
  letter-spacing: 0.12em;
}

.slide--cover .slide__glow {
  position: absolute;
  width: 46vw;
  height: 46vw;
  right: -8vw;
  top: -10vw;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, rgba(110, 231, 255, 0.22), transparent 62%);
  filter: blur(30px);
  pointer-events: none;
}

.slide--end {
  align-items: flex-start;
}

/* cards */
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 1.8vw, 28px);
  margin-top: clamp(36px, 4vw, 64px);
  max-width: 1280px;
}

.card {
  position: relative;
  padding: clamp(22px, 2.2vw, 34px);
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 80% at 100% 0%, rgba(110, 231, 255, 0.09), transparent 55%);
  pointer-events: none;
}

.card__num {
  display: block;
  margin-bottom: clamp(18px, 2vw, 30px);
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: clamp(12px, 1vw, 15px);
  letter-spacing: 0.16em;
}

.card h3 {
  margin: 0 0 10px;
  font-size: clamp(18px, 1.7vw, 28px);
  letter-spacing: -0.02em;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(13px, 1.1vw, 17px);
  line-height: 1.65;
}

/* steps */
.steps {
  list-style: none;
  margin: clamp(34px, 4vw, 60px) 0 0;
  padding: 0;
  max-width: 1000px;
  display: grid;
  gap: clamp(14px, 1.6vw, 24px);
  counter-reset: step;
}

.steps li {
  display: flex;
  align-items: center;
  gap: clamp(20px, 2.4vw, 36px);
  padding: clamp(18px, 2vw, 28px) clamp(22px, 2.4vw, 36px);
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.steps__num {
  font-family: var(--mono);
  font-size: clamp(24px, 2.6vw, 42px);
  font-weight: 700;
  color: transparent;
  -webkit-text-stroke: 1px rgba(110, 231, 255, 0.55);
  letter-spacing: 0.02em;
}

.steps h3 {
  margin: 0 0 6px;
  font-size: clamp(18px, 1.6vw, 26px);
}

.steps p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(13px, 1.05vw, 16px);
}

/* stats */
.slide--stats .stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 32px);
  margin-top: clamp(40px, 5vw, 76px);
  max-width: 1280px;
}

.stat {
  padding: clamp(24px, 2.6vw, 40px);
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.stat strong {
  display: block;
  font-size: clamp(48px, 6vw, 104px);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
  background: linear-gradient(120deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat strong small {
  margin-left: 4px;
  font-size: 0.3em;
  letter-spacing: 0;
  color: var(--muted);
  -webkit-text-fill-color: var(--muted);
}

.stat span {
  display: block;
  margin-top: 18px;
  color: var(--muted);
  font-size: clamp(13px, 1.1vw, 17px);
}

/* bars */
.bars {
  margin-top: clamp(36px, 4vw, 60px);
  max-width: 1000px;
  display: grid;
  gap: clamp(22px, 2.6vw, 38px);
}

.bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 20px;
  align-items: baseline;
}

.bar span {
  grid-row: 1;
  grid-column: 1;
  font-size: clamp(15px, 1.3vw, 21px);
  color: var(--text);
}

.bar b {
  grid-row: 1;
  grid-column: 2;
  font-family: var(--mono);
  font-size: clamp(14px, 1.2vw, 19px);
  color: var(--accent);
}

.bar i {
  grid-row: 2;
  grid-column: 1 / -1;
  display: block;
  width: var(--w, 50%);
  height: clamp(8px, 1vw, 12px);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 24px rgba(110, 231, 255, 0.25);
}

.footnote {
  margin-top: clamp(30px, 3vw, 46px);
  color: var(--muted-dim);
  font-size: clamp(11px, 0.95vw, 14px);
}

/* quote */
.slide--quote {
  align-items: center;
  text-align: center;
}

.slide--quote blockquote {
  margin: 0;
  max-width: 22em;
  font-size: clamp(34px, 4.8vw, 82px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.28;
  background: linear-gradient(120deg, #ffffff, #a8c6d8 70%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.attribution {
  margin-top: clamp(28px, 3vw, 44px);
  color: var(--muted-dim);
  font-size: clamp(13px, 1.1vw, 17px);
  letter-spacing: 0.06em;
}

/* feature grid */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: clamp(34px, 4vw, 58px);
  max-width: 1180px;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
}

.feature {
  padding: clamp(20px, 2.2vw, 34px);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.feature:nth-child(3n) {
  border-right: none;
}

.feature:nth-last-child(-n + 3) {
  border-bottom: none;
}

.feature h3 {
  margin: 0 0 8px;
  font-size: clamp(16px, 1.4vw, 22px);
}

.feature p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(12px, 1vw, 15px);
  line-height: 1.6;
}

/* HUD */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(18px, 2vw, 30px);
  background: linear-gradient(to bottom, rgba(5, 7, 13, 0.85), transparent);
  pointer-events: none;
}

.hud__group {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.hud__page {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(10, 15, 26, 0.6);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(12px);
}

/* pair panel */
.pair {
  position: fixed;
  z-index: 40;
  right: clamp(18px, 2vw, 30px);
  bottom: clamp(26px, 3vw, 42px);
  width: 218px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  background: rgba(8, 12, 20, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.pair.is-hidden {
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
}

.pair__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pair__eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.pair__live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-dim);
  font-size: 10.5px;
  letter-spacing: 0.06em;
}

.pair__live i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--warn);
  animation: pulse 1.6s ease-in-out infinite;
}

.pair__code {
  margin: 8px 0 10px;
  font-family: var(--mono);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: 0.09em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, #ffffff, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  user-select: all;
}

.pair__qr {
  display: block;
  width: 148px;
  height: auto;
  margin: 0 auto;
  border-radius: 10px;
  background: #fff;
}

.pair__hint {
  margin: 10px 0 12px;
  color: var(--muted-dim);
  font-size: 10.5px;
  line-height: 1.5;
  text-align: center;
  word-break: break-all;
}

.pair__hint span {
  color: var(--muted);
}

.pair .btn {
  width: 100%;
  padding: 9px 14px;
  font-size: 12.5px;
}

.pair__tip {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted-dim);
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
  letter-spacing: 0.04em;
}

/* audience questions */
.qa {
  position: fixed;
  z-index: 42;
  left: clamp(18px, 2vw, 30px);
  bottom: clamp(26px, 3vw, 42px);
  width: min(340px, 42vw);
  max-height: 46vh;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: rgba(8, 12, 20, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  overflow: hidden;
}

.qa__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.qa__list {
  list-style: none;
  margin: 0;
  padding: 10px 14px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qa__list li {
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.qa__list li b {
  display: block;
  margin-bottom: 2px;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

/* progress */
.progress {  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  height: 3px;
  background: rgba(148, 163, 184, 0.1);
}

.progress__fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
  box-shadow: 0 0 18px rgba(110, 231, 255, 0.5);
}

/* PDF import progress */
.upload {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  background: rgba(3, 5, 9, 0.72);
  backdrop-filter: blur(10px);
}

.upload__card {
  width: min(420px, calc(100vw - 48px));
  padding: 26px;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  background: rgba(10, 15, 26, 0.94);
  box-shadow: var(--shadow);
}

.upload__title {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
}

.upload__bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.upload__bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.25s ease;
}

.upload.is-busy .upload__bar i {
  width: 100% !important;
  transform-origin: left;
  animation: upload-busy 1.2s ease-in-out infinite;
}

@keyframes upload-busy {
  0%,
  100% {
    transform: scaleX(0.3);
    opacity: 0.65;
  }
  50% {
    transform: scaleX(1);
    opacity: 1;
  }
}

.upload__note {
  margin: 12px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.5px;
}

/* Projector safety area (toggle with G) */
.safearea {
  position: fixed;
  inset: 5%;
  z-index: 46;
  border: 1px dashed rgba(251, 191, 36, 0.55);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.16);
  pointer-events: none;
}

.safearea__label {
  position: absolute;
  bottom: -12px;
  left: 16px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(10, 15, 26, 0.9);
  color: var(--warn);
  font-size: 11px;
  letter-spacing: 0.14em;
}

/* laser */
.laser-dot {
  position: fixed;
  z-index: 50;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 30px;
  margin: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 38% 34%, #ffd9d9 0%, #ff4d4d 34%, #e4002b 62%, rgba(228, 0, 43, 0) 72%);
  box-shadow: 0 0 22px 6px rgba(255, 59, 92, 0.55), 0 0 70px 22px rgba(255, 59, 92, 0.22);
  opacity: 0;
  transition: opacity 0.16s ease, left 0.07s linear, top 0.07s linear;
  pointer-events: none;
  mix-blend-mode: screen;
}

.laser-dot.is-on {
  opacity: 1;
}

/* ============================================================
   Remote (phone)
   ============================================================ */
body.remote {
  min-height: 100dvh;
  background:
    radial-gradient(700px 520px at 50% -18%, rgba(110, 231, 255, 0.11), transparent 62%),
    radial-gradient(620px 480px at 50% 118%, rgba(167, 139, 250, 0.13), transparent 58%),
    var(--bg);
}

/* join */
.join {
  min-height: 100dvh;
  max-width: 460px;
  margin: 0 auto;
  padding: max(30px, env(safe-area-inset-top)) 24px max(26px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.brand {
  margin-bottom: 28px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.46em;
}

.join__title {
  margin: 0;
  font-size: clamp(24px, 7vw, 30px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.join__sub {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.digits {
  display: flex;
  justify-content: center;
  gap: clamp(6px, 1.8vw, 10px);
  margin: 30px 0 4px;
}

.digit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(40px, 12vw, 52px);
  height: clamp(54px, 15vw, 64px);
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.035);
  font-family: var(--mono);
  font-size: clamp(24px, 7.5vw, 30px);
  font-weight: 600;
  color: var(--text);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.digit.is-active {
  border-color: rgba(110, 231, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(110, 231, 255, 0.1);
}

.digit.is-filled {
  background: rgba(110, 231, 255, 0.07);
  border-color: rgba(110, 231, 255, 0.3);
}

.digits.is-loading {
  opacity: 0.6;
}

.digits.is-loading .digit {
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px);
  }
  40% {
    transform: translateX(7px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(3px);
  }
}

.digits.shake {
  animation: shake 0.36s ease;
  border-color: var(--bad);
}

.join__error {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--bad);
  font-size: 13px;
  line-height: 1.5;
}

.join__conn {
  min-height: 18px;
  margin: 2px 0 0;
  color: var(--muted-dim);
  font-size: 12px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 2vw, 12px);
  margin-top: 18px;
}

.keypad button {
  height: clamp(54px, 8.4vh, 68px);
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.042);
  color: var(--text);
  font-family: var(--mono);
  font-size: clamp(20px, 5.6vw, 24px);
  font-weight: 500;
  transition: background 0.12s ease, transform 0.1s ease, border-color 0.12s ease;
}

.keypad button:active {
  background: rgba(110, 231, 255, 0.14);
  border-color: rgba(110, 231, 255, 0.4);
  transform: scale(0.96);
}

.keypad__fn {
  font-family: var(--font) !important;
  font-size: 14px !important;
  color: var(--muted) !important;
}

.join__foot {
  margin: 26px 0 0;
  color: var(--muted-dim);
  font-size: 11.5px;
  letter-spacing: 0.04em;
}

/* control */
.control {
  min-height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.control__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 2px 12px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-dim);
}

.status[data-status="open"] {
  color: var(--good);
}

.status[data-status="open"] i {
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.13);
}

.status[data-status="connecting"] i,
.status[data-status="reconnecting"] i {
  background: var(--warn);
  animation: pulse 1.4s ease-in-out infinite;
}

.status[data-status="closed"] {
  color: var(--bad);
}

.status[data-status="closed"] i {
  background: var(--bad);
}

.control__room {
  color: var(--muted-dim);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.linkbtn {
  padding: 6px 2px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 4px;
}

.control__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.8vh, 16px);
}

.control__page {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  padding: clamp(4px, 1vh, 12px) 0;
}

.control__page-num {
  font-size: clamp(58px, 17vw, 88px);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(140deg, #ffffff 20%, var(--accent) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.control__page-total {
  color: var(--muted);
  font-size: clamp(15px, 4.2vw, 19px);
  font-variant-numeric: tabular-nums;
}

.control__deck {
  margin: -4px 0 0;
  overflow: hidden;
  color: var(--muted-dim);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control__nav {
  display: grid;
  grid-template-columns: 1fr 1.32fr;
  gap: 10px;
}

.navbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: clamp(96px, 17vh, 148px);
  border-radius: 22px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  font-size: clamp(15px, 4vw, 18px);
  font-weight: 600;
  transition: transform 0.1s ease, background 0.15s ease, opacity 0.15s ease;
}

.navbtn:active {
  transform: scale(0.975);
  background: rgba(255, 255, 255, 0.08);
}

.navbtn:disabled {
  opacity: 0.32;
}

.navbtn--primary {
  border-color: transparent;
  background: linear-gradient(120deg, var(--accent), #9bdcff 55%, var(--accent-2));
  color: #04121a;
  box-shadow: 0 18px 40px -18px rgba(110, 231, 255, 0.55);
}

.navbtn--primary:active {
  background: linear-gradient(120deg, #8beaff, var(--accent-2));
}

.navbtn__icon {
  font-size: 1.2em;
  line-height: 1;
}

.control__jump {
  display: flex;
  gap: 8px;
}

.input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.input::placeholder {
  color: var(--muted-dim);
}

.input:focus {
  border-color: rgba(110, 231, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(110, 231, 255, 0.1);
}

.control__jump .btn {
  height: 46px;
  padding: 0 20px;
  border-radius: 14px;
}

.laserpad {
  position: relative;
  flex: 1;
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  border: 1px dashed rgba(148, 163, 184, 0.3);
  background: radial-gradient(120% 120% at 50% 0%, rgba(167, 139, 250, 0.07), transparent 60%),
    rgba(255, 255, 255, 0.018);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.laserpad.is-active {
  border-color: rgba(255, 77, 77, 0.55);
  border-style: solid;
  background: radial-gradient(120% 120% at 50% 0%, rgba(255, 77, 77, 0.14), transparent 62%),
    rgba(255, 77, 77, 0.03);
}

.laserpad__hint {
  color: var(--muted-dim);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  pointer-events: none;
}

.laserpad__dot {
  position: absolute;
  left: var(--lx, 50%);
  top: var(--ly, 50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 77, 77, 0.6);
  box-shadow: 0 0 0 10px rgba(255, 77, 77, 0.08), 0 0 30px rgba(255, 77, 77, 0.28);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.6);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

.laserpad.is-active .laserpad__dot {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.laserpad.is-active .laserpad__hint {
  opacity: 0;
}

.control__note {
  margin: 0;
  padding: 2px 0 0;
  color: var(--muted-dim);
  font-size: 11px;
  text-align: center;
  letter-spacing: 0.02em;
}

.control__tools {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* ============================================================
   Presenter view
   ============================================================ */
.presenter {
  min-height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.presenter__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.presenter__header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.presenter__timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
}

.presenter__timer-display {
  font-family: var(--mono);
  font-size: 36px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.presenter__notes {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.presenter__note-block {
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.presenter__note-block h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.presenter__note-block p {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

.presenter__next-page {
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(135deg, rgba(110, 231, 255, 0.08), rgba(167, 139, 250, 0.08));
}

.presenter__next-page h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.presenter__next-page p {
  margin: 0;
  color: var(--accent);
  font-size: 16px;
  font-weight: 500;
}

/* ============================================================
   Calibration view
   ============================================================ */
.calibrate {
  min-height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.calibrate__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 0;
}

.calibrate__header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.calibrate__instruction {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.calibrate__canvas {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: radial-gradient(120% 120% at 50% 0%, rgba(167, 139, 250, 0.07), transparent 60%),
    rgba(255, 255, 255, 0.018);
  touch-action: none;
}

/* ============================================================
   Viewer view
   ============================================================ */
.viewer {
  min-height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.viewer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.viewer__header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.viewer__stage {
  position: relative;
  flex: 1;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: #000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer__image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.viewer__loading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(10, 15, 26, 0.82);
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  backdrop-filter: blur(12px);
}

.viewer__interact {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.viewer__questions,
.viewer__poll {
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.viewer__questions h3,
.viewer__poll h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#question-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

#question-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.questions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.question-item {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
  line-height: 1.5;
}

.poll-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.poll-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: background 0.15s ease;
}

.poll-option:hover {
  background: rgba(110, 231, 255, 0.08);
}

.poll-option input {
  accent-color: var(--accent);
}

.poll-option label {
  flex: 1;
  font-size: 14px;
}

/* ============================================================
   Join view role selector
   ============================================================ */
.join__role {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.join__role label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.join__role label:hover {
  border-color: var(--accent);
  background: rgba(110, 231, 255, 0.05);
}

.join__role input {
  accent-color: var(--accent);
}

.join__role span {
  font-size: 13px;
  font-weight: 500;
}

.join__viewer-name {
  margin-top: 12px;
}

#viewer-name {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .cards,
  .slide--stats .stats,
  .grid {
    grid-template-columns: 1fr;
  }

  .hud {
    flex-wrap: wrap;
    gap: 8px;
  }

  .chip--deck,
  .chip--ratio {
    display: none;
  }

  .feature {
    border-right: none;
  }

  .feature:nth-last-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }

  .feature:last-child {
    border-bottom: none;
  }

  .pair {
    width: 196px;
    padding: 14px;
  }

  .pair__code {
    font-size: 28px;
  }

  .pair__qr {
    width: 124px;
  }
}

@media (max-height: 700px) {
  .join {
    justify-content: flex-start;
    padding-top: max(20px, env(safe-area-inset-top));
  }

  .brand {
    margin-bottom: 18px;
  }

  .digits {
    margin-top: 20px;
  }

  .keypad {
    margin-top: 12px;
  }

  .keypad button {
    height: 50px;
  }

  .control__page-num {
    font-size: 52px;
  }

  .navbtn {
    height: 88px;
  }

  .control__note {
    display: none;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .control {
    max-width: 720px;
  }

  .control__page {
    padding: 0;
  }

  .control__page-num {
    font-size: 44px;
  }

  .navbtn {
    height: 68px;
  }

  .laserpad {
    min-height: 64px;
  }

  .control__note,
  .laserpad__hint {
    display: none;
  }
}

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