:root {
  color-scheme: light;

  /* Design system tokens (.cursorrules) */
  --ds-primary: #4f46e5;
  --ds-primary-hover: #6366f1;
  --ds-primary-tint: #eef2ff;
  --ds-text: #111827;
  --ds-text-muted: #6b7280;
  --ds-text-faint: #9ca3af;
  --ds-label: #6b7280;
  --ds-surface: #f9fafb;
  --ds-card: #ffffff;
  --ds-border: rgba(0, 0, 0, 0.1);
  --ds-border-strong: rgba(0, 0, 0, 0.2);
  --ds-border-input: rgba(0, 0, 0, 0.15);
  --ds-focus-ring: 0 0 0 3px rgba(79, 70, 229, 0.15);
  --ds-danger: #ef4444;
  --ds-danger-hover: #dc2626;
  --ds-danger-tint: #fef2f2;
  --ds-danger-text: #b91c1c;
  --ds-success-tint: #f0fdf4;
  --ds-success-text: #166534;
  --ds-warning-tint: #fffbeb;
  --ds-warning-text: #92400e;
  --ds-info-tint: #eff6ff;
  --ds-info-text: #1d4ed8;

  /* Legacy aliases → design system */
  --brand-dark: var(--ds-text);
  --brand-mid: var(--ds-primary);
  --brand-gray: var(--ds-text-muted);
  --brand-accent: var(--ds-primary);
  --bg: var(--ds-surface);
  --bg-subtle: #f3f4f6;
  --surface: var(--ds-card);
  --surface2: var(--ds-border);
  --surface-strong: var(--ds-border-strong);
  --text: var(--ds-text);
  --text-secondary: var(--ds-text-muted);
  --muted: var(--ds-text-muted);
  --accent: var(--ds-primary);
  --accent-hover: var(--ds-primary-hover);
  --accent2: var(--ds-primary-hover);
  --accent-bright: var(--ds-primary);
  --danger: var(--ds-danger);
  --danger-bg: var(--ds-danger-tint);
  --danger-text: var(--ds-danger-text);
  --success-bg: var(--ds-success-tint);
  --success-text: var(--ds-success-text);
  --warning-bg: var(--ds-warning-tint);
  --warning-border: #fde68a;
  --warning-text: var(--ds-warning-text);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-btn-sm: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif;
  --focus-ring: var(--ds-focus-ring);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  background: var(--ds-surface);
  color: var(--ds-text);
  min-height: 100vh;
  cursor: default;
  user-select: none;
}

input,
textarea,
select,
.blank-input {
  user-select: text;
  cursor: text;
}

a {
  color: var(--ds-primary);
  text-decoration: none;
  cursor: pointer;
}
a:hover {
  color: var(--ds-primary-hover);
  text-decoration: underline;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--ds-card);
  border-bottom: 0.5px solid var(--ds-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ds-text);
}
.brand:hover {
  text-decoration: none;
  color: var(--ds-primary);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  border: 0.5px solid transparent;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.nav-btn:hover {
  text-decoration: none;
}
.nav-btn--primary {
  background: var(--ds-primary);
  border-color: var(--ds-primary);
  color: #fff;
}
.nav-btn--primary:hover {
  background: var(--ds-primary-hover);
  border-color: var(--ds-primary-hover);
  color: #fff;
}
.nav-btn--user {
  background: var(--bg-subtle);
  border-color: var(--ds-border);
  color: var(--ds-text);
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-btn--user:hover {
  background: #e5e7eb;
  border-color: var(--ds-border-strong);
  color: var(--ds-text);
}
.nav-btn--ghost {
  background: var(--ds-card);
  border-color: var(--ds-border);
  color: var(--ds-text);
}
.nav-btn--ghost:hover {
  background: var(--bg-subtle);
  border-color: var(--ds-border-strong);
  color: var(--ds-text);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.participant-shell {
  max-width: 520px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
  min-height: 100vh;
}

.hero {
  text-align: left;
  padding: 2rem 0 1rem;
}
.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  margin: 0 0 0.5rem;
  line-height: 1.15;
}
.lead {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 36rem;
  margin: 0 0 1.5rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.page-head h1 {
  margin: 0 0 0.25rem;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
}

.grid-list {
  display: grid;
  gap: 1rem;
}

.presentation-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.presentation-search {
  flex: 1 1 260px;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.presentation-search-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.presentation-search-input {
  width: 100%;
  padding: 0 12px;
  min-height: 36px;
  border: 0.5px solid var(--ds-border-input);
  border-radius: var(--radius-sm);
  background: var(--ds-card);
  color: var(--ds-text);
  font-size: 14px;
}

.presentation-search-input:focus {
  outline: none;
  border-color: var(--ds-primary);
  box-shadow: var(--ds-focus-ring);
}

.presentation-search-meta {
  margin: 0;
  font-size: 0.9rem;
}

.presentation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1.25rem;
}

@media (min-width: 900px) {
  .presentation-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (min-width: 1200px) {
  .presentation-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.presentation-grid .card {
  margin-bottom: 0;
}

.presentation-grid[hidden] {
  display: none !important;
}

.card {
  background: var(--ds-card);
  border: 0.5px solid var(--ds-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 1rem;
}
.card h2 {
  margin-top: 0;
  font-size: 1.1rem;
  font-weight: 500;
}

.empty {
  text-align: center;
  color: var(--muted);
}

.pres-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  border-top: 2px solid var(--ds-primary);
  transition: border-color 0.15s ease;
}

.pres-card:hover {
  border-color: var(--ds-border-strong);
  border-top-color: var(--ds-primary);
}

.pres-card-body {
  flex: 1 1 auto;
  min-height: 0;
}

.pres-card h2,
.pres-card-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  line-height: 1.3;
  word-break: break-word;
}

.pres-card-meta {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.4;
}

.pres-card-actions {
  flex-direction: column;
  align-items: stretch;
  margin-top: auto;
  padding-top: 0.85rem;
}

.pres-card-actions .btn,
.pres-card-form-btn {
  width: 100%;
}

.pres-card-form {
  display: block;
  width: 100%;
}

.pres-card[hidden] {
  display: none;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
}

.inline-form {
  display: inline;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: 0.5px solid var(--ds-primary);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  background: var(--ds-primary);
  color: #fff;
  text-decoration: none;
  transition: all 0.15s ease;
}
.btn:hover {
  background: var(--ds-primary-hover);
  border-color: var(--ds-primary-hover);
  filter: none;
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-sm {
  height: 28px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: var(--radius-btn-sm);
}
.btn-secondary {
  background: #f3f4f6;
  border-color: var(--ds-border);
  color: var(--ds-text);
}
.btn-secondary:hover {
  background: #e5e7eb;
  border-color: var(--ds-border-strong);
  color: var(--ds-text);
}
.btn-accent {
  background: var(--ds-primary);
  border-color: var(--ds-primary);
  color: #ffffff;
}
.btn-accent:hover {
  background: var(--ds-primary-hover);
  border-color: var(--ds-primary-hover);
  color: #ffffff;
}
.btn-danger {
  background: var(--ds-danger);
  border-color: var(--ds-danger);
  color: #fff;
}
.btn-danger:hover {
  background: var(--ds-danger-hover);
  border-color: var(--ds-danger-hover);
  color: #fff;
}
.btn-primary {
  background: var(--ds-primary);
  border-color: var(--ds-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--ds-primary-hover);
  border-color: var(--ds-primary-hover);
  color: #fff;
}

.form label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 12px;
  font-weight: 500;
  color: var(--ds-label);
  cursor: pointer;
}
.form input,
.form textarea,
.form select {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0 12px;
  min-height: 36px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--ds-border-input);
  background: var(--ds-card);
  color: var(--ds-text);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form input:focus,
.form textarea:focus,
.form select:focus {
  outline: none;
  border-color: var(--ds-primary);
  box-shadow: var(--ds-focus-ring);
}
.form textarea {
  resize: vertical;
  min-height: 80px;
  padding: 8px 12px;
}

.inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: 1rem;
  color: var(--text);
}

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--ds-primary-tint);
  color: #4338ca;
  margin-right: 0.35rem;
  border: 0.5px solid rgba(79, 70, 229, 0.2);
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.alert {
  padding: 12px 14px;
  border-radius: 0 8px 8px 0;
  border-left: 3px solid var(--ds-border);
  margin-bottom: 1rem;
  font-size: 13px;
}
.alert-error {
  background: var(--ds-danger-tint);
  border-left-color: var(--ds-danger);
  color: var(--ds-danger-text);
}
.alert-success {
  background: var(--ds-success-tint);
  border-left-color: #22c55e;
  color: var(--ds-success-text);
}

.reorder-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.reorder-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border: 0.5px solid var(--ds-border);
  border-radius: var(--radius-sm);
  background: var(--ds-card);
  cursor: grab;
}

.reorder-item:active {
  cursor: grabbing;
}

.reorder-item--dragging {
  opacity: 0.55;
}

.reorder-item--over {
  border-color: var(--ds-primary);
  box-shadow: var(--ds-focus-ring);
}

.reorder-handle {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.05em;
  user-select: none;
  cursor: grab;
}

.reorder-handle:active {
  cursor: grabbing;
}

.reorder-prompt {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.35;
}

.reorder-actions {
  flex-shrink: 0;
  display: flex;
  gap: 0.35rem;
}

.reorder-actions .btn {
  min-width: 2.25rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.reorder-actions .btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.type-block {
  margin: 0.75rem 0 1rem;
}

.mc-rows .mc-row,
.mc-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.mc-row input[type="text"] {
  flex: 1 1 180px;
  min-width: 0;
}

.question-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.editor-sidebar {
  margin-bottom: 0;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.editor-sidebar-head h2 {
  margin: 0 0 0.15rem;
  font-size: 1.05rem;
}

.editor-sidebar-meta {
  margin: 0;
  font-size: 0.85rem;
}

.editor-sidebar-empty {
  margin: 0;
  font-size: 0.9rem;
}

.editor-sidebar-actions {
  display: flex;
  gap: 0.5rem;
}

.editor-sidebar-actions .btn {
  width: 100%;
}

.editor-save-order {
  width: 100%;
  margin-top: 0.65rem;
}

.editor-import {
  margin-top: 0.25rem;
  font-size: 0.9rem;
}

.editor-import summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-secondary);
}

.editor-import .form {
  margin-top: 0.75rem;
}

.editor-main {
  min-width: 0;
}

.editor-main .card {
  margin-bottom: 0;
}

.editor-panel[hidden] {
  display: none !important;
}

.editor-panel-kicker {
  margin: 0 0 0.15rem;
  font-size: 0.85rem;
}

.editor-question-list {
  gap: 0.4rem;
}

.editor-question-item {
  padding: 0.35rem 0.45rem;
  gap: 0.35rem;
  cursor: default;
}

.editor-question-item.reorder-item {
  cursor: default;
}

.editor-question-item.is-active {
  border-color: var(--ds-primary);
  background: var(--ds-primary-tint);
  box-shadow: inset 3px 0 0 var(--ds-primary);
}

.editor-question-select {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.35rem 0.25rem;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.editor-question-select:hover {
  filter: none;
}

.editor-question-num {
  flex-shrink: 0;
  width: 1.35rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.editor-question-prompt {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.88rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pill-sm {
  flex-shrink: 0;
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
}

.editor-question-item .reorder-actions {
  flex-direction: column;
  gap: 0.15rem;
}

.editor-question-item .reorder-actions .btn {
  min-width: 1.75rem;
  padding: 0.15rem 0.35rem;
  font-size: 0.75rem;
}

@media (max-width: 960px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }

  .editor-sidebar {
    position: static;
    max-height: none;
  }
}

/* Live trainer */
.live-grid {
  display: grid;
  gap: 1rem;
}
@media (min-width: 900px) {
  .live-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.code-big {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: 0.2em;
  text-align: center;
  margin: 0.5rem 0;
  font-variant-numeric: tabular-nums;
}

.join-link {
  word-break: break-all;
  font-size: 0.9rem;
  color: var(--accent);
}

.trainer-stage {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.trainer-prompt {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  line-height: 1.35;
  margin: 0 0 1rem;
}

.question-image-wrap {
  margin: 0 0 1rem;
}
.question-image {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 0.5px solid var(--ds-border);
}

/* Live trainer: keep question images compact on the control screen */
.trainer-stage .question-image-wrap {
  max-width: min(100%, 480px);
  margin-left: auto;
  margin-right: auto;
}
.trainer-stage .question-image {
  max-height: min(36vh, 240px);
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  object-fit: contain;
}

/* Participant: preview size; tap opens lightbox (see participant_session.js) */
.question-image-wrap--participant {
  cursor: zoom-in;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}
.question-image-wrap--participant:focus {
  outline: 2px solid var(--ds-primary);
  outline-offset: 3px;
}
.question-image-wrap--participant .question-image {
  max-height: min(32vh, 200px);
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  object-fit: contain;
}
.question-image-tap-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  text-align: center;
}

.p-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  box-sizing: border-box;
}
.p-image-lightbox[hidden] {
  display: none !important;
}
.p-image-lightbox-backdrop {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(9, 60, 93, 0.88);
  cursor: pointer;
}
.p-image-lightbox-panel {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  pointer-events: none;
}
.p-image-lightbox-panel .btn,
.p-image-lightbox-panel .p-image-lightbox-img {
  pointer-events: auto;
}
.p-image-lightbox-img {
  max-width: min(96vw, 1100px);
  max-height: min(82dvh, 820px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius);
  border: 0.5px solid var(--ds-border);
}
.p-image-lightbox-close {
  flex-shrink: 0;
}

.trainer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.chart-wrap {
  position: relative;
  height: min(55vh, 420px);
  margin-top: 0.5rem;
}

.leader-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}
.leader-table th,
.leader-table td {
  text-align: left;
  padding: 0.45rem 0.35rem;
  border-bottom: 1px solid var(--surface2);
}
.leader-table th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.scoreboard-panel {
  margin-top: 1rem;
}
.scoreboard-panel h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.status-line {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Participant */
.participant h1 {
  font-size: 1.35rem;
  margin: 0 0 0.35rem;
}
.participant .card {
  margin-bottom: 0.85rem;
}

.session-ended-card .session-ended-action {
  display: block;
  width: 100%;
  margin-top: 1rem;
  text-align: center;
  text-decoration: none;
}

.participant-prompt {
  font-size: 1.05rem;
  line-height: 1.35;
  margin: 0 0 0.75rem;
  color: var(--text);
}

.option-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.option-btn {
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--ds-border-input);
  background: var(--ds-card);
  color: var(--ds-text);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.option-btn:hover {
  border-color: var(--ds-primary);
  background: var(--ds-primary-tint);
}
.option-btn.selected {
  border-color: var(--ds-primary);
  background: var(--ds-primary-tint);
  box-shadow: var(--ds-focus-ring);
}

.word-answers-wrap {
  margin-top: 0.75rem;
}
.word-answers-wrap h3 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 600;
}
.word-answers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
  align-items: center;
}
.word-answer-tag {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border-radius: 100px;
  background: var(--ds-primary-tint);
  border: 0.5px solid rgba(79, 70, 229, 0.2);
  font-weight: 600;
  font-size: 0.95rem;
  color: #4338ca;
  line-height: 1.2;
}

.word-cloud {
  width: 100%;
}

.word-cloud--radial {
  position: relative;
  display: block;
  min-height: 10.5rem;
  margin: 0 auto;
}

.word-cloud--radial .word-cloud-item {
  position: absolute;
  margin: 0;
  white-space: nowrap;
}

.word-cloud-item {
  display: inline-block;
  font-weight: 700;
  line-height: 1.05;
  padding: 0.1rem 0.2rem;
  transition: font-size 0.35s ease, left 0.35s ease, top 0.35s ease;
  transform-origin: center center;
}

.text-answers {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.text-answer-item {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 0.5px solid var(--ds-border);
  color: var(--ds-text);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.word-input {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--ds-border-input);
  background: var(--ds-card);
  color: var(--ds-text);
  font-size: 1.05rem;
}
.word-input:focus {
  outline: none;
  border-color: var(--ds-primary);
  box-shadow: var(--ds-focus-ring);
}

.p-chip {
  display: inline-block;
  background: var(--ds-primary-tint);
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
  border: 0.5px solid rgba(79, 70, 229, 0.2);
  color: #4338ca;
}

/* Presentation view — framed slide canvas */
.present-body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.present-page {
  min-height: 100vh;
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.present-page-bar {
  width: min(960px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.35rem 0 0.5rem;
}

.present-page-bar-text {
  flex: 1 1 200px;
  min-width: 0;
  text-align: left;
}

.present-page-hint {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.present-page-join {
  margin: 0;
  font-size: 0.8rem;
  word-break: break-all;
}

.present-page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

.present-scoreboard-btn {
  padding: 0.65rem 1.15rem;
  font-size: 0.95rem;
}

.present-exit-btn {
  padding: 0.65rem 1.15rem;
  font-size: 0.95rem;
}

.present-control-btn {
  flex-shrink: 0;
  padding: 0.65rem 1.25rem;
  font-size: 1rem;
}

.present-frame {
  width: min(960px, 100%);
  aspect-ratio: 16 / 10;
  max-height: min(70vh, 600px);
  background: var(--ds-card);
  border: 0.5px solid var(--ds-border);
  border-radius: calc(var(--radius) + 2px);
  overflow: hidden;
  display: flex;
}

.present-shell {
  flex: 1;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  outline: none;
  background: var(--surface);
}

.present-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--surface2);
}

.present-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.present-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.present-code {
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--ds-primary);
  line-height: 1;
}

.present-header-right {
  text-align: right;
  max-width: 55%;
}

.present-title {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.present-meta {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.present-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem 0.75rem;
  min-height: 0;
  outline: none;
  overflow: hidden;
  caret-color: transparent;
}

.present-main:focus {
  outline: none;
}

.present-slide {
  flex: 0 0 auto;
  text-align: center;
  margin: 0 auto;
  width: 100%;
}

.present-slide-title {
  font-size: clamp(1.15rem, 2.4vw, 1.75rem);
  font-weight: 700;
  line-height: 1.25;
  margin: 0.35rem 0 0.5rem;
  color: var(--text);
}

.present-slide-sub {
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  color: var(--muted);
  margin: 0;
}

.present-slide-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.present-q-image {
  max-width: min(360px, 85%);
  margin: 0 auto 0.65rem;
}

.present-q-image .question-image {
  max-height: min(22vh, 180px);
}

.present-results {
  flex: 1;
  min-height: 0;
  width: 100%;
  margin: 0.75rem auto 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.present-chart-wrap {
  flex: 1;
  min-height: 120px;
  height: min(28vh, 240px);
  margin-top: 0;
}

.present-answers-wrap {
  margin-top: 0.35rem;
  text-align: left;
}

.present-answers-wrap .present-results-title {
  font-size: 1.05rem;
  margin-bottom: 0.75rem;
}

.present-answers-wrap .word-cloud--radial {
  min-height: min(34vh, 260px);
  width: 100%;
}

.present-answers-wrap .word-cloud-item {
  padding: 0.15rem 0.25rem;
}

.present-answers-wrap .text-answers {
  gap: 0.65rem;
}

.present-answers-wrap .text-answer-item {
  padding: 0.85rem 1.1rem;
  font-size: 1.15rem;
  line-height: 1.5;
}

.present-results-title {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0 0 0.5rem;
  text-align: center;
}

.present-scoreboard {
  margin-top: 0.35rem;
}

.present--finished .present-main {
  justify-content: center;
}

.present--end .present-main {
  justify-content: center;
}

.present-slide-exit-hint {
  margin-top: 1rem;
  font-size: 0.95rem;
  max-width: 28rem;
}

@media (max-width: 700px) {
  .present-page {
    padding: 0.75rem;
  }
  .present-page-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .present-page-actions {
    width: 100%;
    flex-direction: column;
  }
  .present-page-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .present-control-btn {
    width: 100%;
    justify-content: center;
  }
  .present-frame {
    max-height: none;
    aspect-ratio: 4 / 5;
  }
  .present-header {
    flex-direction: column;
    padding: 0.75rem 1rem;
  }
  .present-header-right {
    text-align: left;
    max-width: none;
  }
  .present-main {
    padding: 0.75rem 1rem 0.5rem;
  }
}
