:root {
  --bg: #f3f6fc;
  --paper: #ffffff;
  --ink: #1a1f36;
  --muted: #667085;
  --line: #dfe6f2;
  --accent: #1d5bd4;
  --danger: #dc2626;
  --success: #10b981;
  --radius: 16px;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
}

.admin-shell {
  width: min(1760px, calc(100% - 24px));
  margin: 12px auto 44px;
}

.admin-topbar,
.admin-login,
.admin-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 26px 30px;
}

.admin-topbar h1,
.admin-card h2 {
  margin: 0;
}

.admin-topbar h1 {
  font-size: clamp(2rem, 3vw, 3.2rem);
  line-height: 1;
}

.admin-card h2 {
  font-size: clamp(1.45rem, 2vw, 2.1rem);
  line-height: 1.1;
}

.admin-topbar p,
.admin-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.admin-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-grid {
  display: grid;
  gap: 24px;
  margin-top: 24px;
}

.admin-card {
  padding: clamp(24px, 2.4vw, 36px);
}

.session-admin-card {
  margin-top: 24px;
}

.admin-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.admin-list {
  display: grid;
  gap: 16px;
}

.session-create-form {
  display: grid;
  gap: 16px;
  margin-bottom: 22px;
}

.ambiance-choice {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  gap: 10px;
}

.ambiance-choice legend {
  padding: 0 6px;
  font-weight: 800;
  font-size: 0.85rem;
}

.ambiance-choice label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 10px;
  align-items: start;
}

.ambiance-choice input {
  grid-row: span 2;
  margin-top: 4px;
}

.ambiance-choice span {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.85rem;
}

.live-pulse,
.projector-pulse {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.live-pulse article,
.projector-pulse article {
  padding: 12px 10px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.05);
  text-align: center;
}

.live-pulse strong,
.projector-pulse strong {
  display: block;
  font-size: 1.6rem;
}

.live-pulse span,
.projector-pulse span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.projector-pulse {
  margin: 28px 0 8px;
}

.projector-pulse strong {
  font-size: clamp(2rem, 6vw, 4rem);
}

.projector-names {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.projector-names span {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  font-weight: 700;
}

.projector-hint {
  margin-top: 20px !important;
  color: var(--muted) !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-weight: 600 !important;
  font-size: 1.05rem !important;
}


.session-admin-list {
  display: grid;
  gap: 12px;
}

.session-admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfcff;
}

.session-admin-code {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 12px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 1.16rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.session-admin-row h3 {
  margin: 0;
  font-size: 1.35rem;
}

.session-admin-row p {
  margin: 5px 0 0;
  color: var(--muted);
}

.session-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
}

.session-links a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.session-admin-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.session-admin-empty {
  padding: 18px;
  border-radius: 16px;
  background: #fbfcff;
  color: var(--muted);
  font-weight: 700;
}

.admin-row {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfcff;
}

.step-row {
  grid-template-columns: 110px minmax(300px, 1fr) 260px 170px auto;
}

.card-row {
  grid-template-columns: 130px 230px minmax(300px, 0.8fr) minmax(420px, 1.2fr) auto;
}

.row-action-field {
  align-self: end;
}

.cards-by-step {
  display: grid;
  gap: 20px;
}

.step-card-editor {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #f8fbff;
}

.step-card-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.step-card-editor-head strong,
.step-card-editor-head span {
  display: block;
}

.step-card-editor-head strong {
  font-size: 1.28rem;
}

.step-card-editor-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 800;
}

.scenario-row {
  grid-template-columns: 1.2fr 1fr;
}

.settings-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.brand-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.brand-copy-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.popup-row {
  grid-template-columns: 1fr 1fr 2fr;
}

.popup-body-field textarea {
  min-height: 72px;
}

.design-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.theme-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.brand-studio {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 22px;
  margin-bottom: 20px;
}

.brand-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  border: 1px dashed var(--line);
  border-radius: 20px;
  background: #fbfcff;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.brand-preview img {
  display: block;
  max-width: 240px;
  max-height: 150px;
  object-fit: contain;
}

.brand-studio-fields {
  display: grid;
  gap: 18px;
}

.field-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.palette-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.palette-swatch {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.palette-swatch::before {
  content: "";
  display: block;
  width: 48px;
  height: 48px;
  background: var(--swatch);
}

.palette-swatch span {
  padding: 0 14px;
}

.palette-swatch input {
  display: none;
}

.color-field input[type="color"] {
  min-height: 42px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 14px 16px;
  color: var(--ink);
  font: inherit;
  min-height: 54px;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.field textarea {
  min-height: 128px;
  resize: vertical;
}

.field input[type="color"] {
  padding: 5px;
  min-height: 58px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
}

.toggle input {
  width: 24px;
  height: 24px;
  accent-color: var(--accent);
}

.button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  min-height: 54px;
  padding: 0 20px;
  font-weight: 800;
  font-size: 0.98rem;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  background: var(--accent);
  color: #fff;
}

.button.secondary,
.link-button {
  background: rgba(15, 23, 42, 0.06);
  color: var(--ink);
}

.button.danger {
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger);
}

.flash {
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: 16px;
  font-weight: 700;
}

.flash.success {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.flash.error {
  background: rgba(220, 38, 38, 0.12);
  color: #b42318;
}

.admin-login {
  width: min(100%, 420px);
  margin: 80px auto 0;
  padding: 26px;
}

.admin-login form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.helper {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.live-session-shell {
  width: min(1500px, calc(100% - 32px));
}

.live-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 22px;
  align-items: center;
  margin-top: 18px;
  background:
    radial-gradient(circle at top left, rgba(29, 91, 212, 0.14), transparent 36%),
    var(--paper);
}

.live-logo {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  margin-bottom: 12px;
}

.live-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
}

.live-hero h2 {
  margin: 8px 0 12px;
  font-size: clamp(1.5rem, 3vw, 3rem);
}

.live-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 8px 28px;
  border-radius: 24px;
  background: var(--accent);
  color: #fff;
  font-size: clamp(3rem, 10vw, 8rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  box-shadow: 0 18px 40px rgba(29, 91, 212, 0.24);
}

.live-status {
  margin-top: 14px;
  font-size: 1.1rem;
}

.live-qr-card {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  text-align: center;
  font-weight: 800;
}

.live-qr-card img {
  width: 100%;
  max-width: 220px;
  border-radius: 12px;
}

.live-actions-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-top: 18px;
}

.live-links {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}

.live-links label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.live-links input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  font: inherit;
}

.live-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 18px;
  margin-top: 18px;
}

.live-list,
.live-ranking {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.live-list-row,
.live-ranking li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcff;
}

.live-list-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.live-progress-row {
  align-items: stretch;
}

.live-progress-row strong {
  display: block;
  margin-bottom: 4px;
}

.live-progress-row span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.live-progress-track {
  height: 9px;
  margin-top: 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.live-progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--brand-secondary));
}

.live-progress-stats {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 8px;
  align-items: center;
  text-align: right;
}

.live-progress-stats b,
.live-progress-stats span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.live-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.live-empty {
  padding: 14px;
  border-radius: 14px;
  background: #fbfcff;
  color: var(--muted);
  font-weight: 800;
  list-style: none;
}

.debrief-hero {
  margin-top: 18px;
}

.debrief-hero h2 {
  margin: 8px 0 16px;
  font-size: clamp(1.6rem, 4vw, 3.2rem);
}

.debrief-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.debrief-metrics.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.debrief-metrics article {
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcff;
}

.debrief-metrics strong {
  display: block;
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  line-height: 1;
  color: var(--accent);
}

.debrief-metrics span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.debrief-prompts {
  margin-top: 18px;
}

.debrief-prompts li {
  margin: 10px 0;
  font-weight: 800;
}

.security-card,
.session-maintenance-form {
  margin-bottom: 18px;
}

.security-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.audit-card {
  margin-top: 18px;
}

.audit-list {
  display: grid;
  gap: 8px;
}

.audit-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 220px 140px 100px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcff;
  font-size: 0.82rem;
}

.audit-row span {
  color: var(--muted);
  font-weight: 800;
}

.projector-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 4vw;
  background:
    radial-gradient(circle at 10% 10%, rgba(29, 91, 212, 0.18), transparent 30%),
    var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.projector-card {
  width: min(1500px, 100%);
  padding: clamp(28px, 5vw, 72px);
  border: 1px solid var(--line);
  border-radius: 34px;
  background: var(--paper);
  box-shadow: var(--shadow);
  text-align: center;
}

.projector-logo {
  max-width: 160px;
  max-height: 80px;
  object-fit: contain;
}

.projector-card p,
.projector-label {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 900;
}

.projector-card h1 {
  margin: 10px 0 34px;
  font-size: clamp(2.4rem, 6vw, 6rem);
  line-height: 1;
}

.projector-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: clamp(24px, 5vw, 72px);
  align-items: center;
}

.projector-code {
  display: block;
  margin-top: 10px;
  color: var(--accent);
  font-size: clamp(5rem, 16vw, 15rem);
  line-height: 0.9;
  letter-spacing: 0.1em;
}

.projector-count {
  display: inline-flex;
  margin-top: 24px;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  font-weight: 900;
}

.projector-qr {
  width: min(360px, 100%);
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}

.projector-url {
  margin-top: 28px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.5rem);
  font-weight: 800;
}

.ranking-projector-card {
  text-align: left;
}

.ranking-projector-card h1,
.ranking-projector-card > p,
.ranking-projector-card .projector-count {
  text-align: center;
}

.projector-ranking {
  display: grid;
  gap: 14px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.projector-ranking li {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 180px 260px;
  gap: 18px;
  align-items: center;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fbfcff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.projector-ranking li span {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 1000;
}

.projector-ranking strong {
  min-width: 0;
  font-size: clamp(1.2rem, 3vw, 2.1rem);
  overflow-wrap: anywhere;
}

.projector-ranking em {
  color: var(--accent);
  font-style: normal;
  font-size: clamp(1.1rem, 2vw, 1.7rem);
  font-weight: 1000;
}

.projector-ranking small {
  color: var(--muted);
  font-size: clamp(0.9rem, 1.4vw, 1.15rem);
  font-weight: 900;
}

.admin-tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 10px;
  margin: 18px 0 22px;
  padding: 10px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(14px);
}

.admin-tabs button {
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.admin-tabs button.is-active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 26px rgba(69, 69, 164, 0.22);
}

[data-admin-panel][hidden] {
  display: none !important;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.export-tile {
  display: grid;
  gap: 10px;
  min-height: 150px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfcff;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.export-tile:hover {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  transform: translateY(-1px);
}

.export-tile strong {
  color: var(--accent);
  font-size: 1.05rem;
}

.export-tile span {
  color: var(--muted);
  line-height: 1.45;
}

.maintenance-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: #fbfcff;
}

@media (max-width: 980px) {
  .step-row,
  .card-row,
  .scenario-row,
  .brand-row,
  .brand-copy-row,
  .popup-row,
  .design-row,
  .brand-studio,
  .theme-row,
  .settings-row {
    grid-template-columns: 1fr;
  }

  .admin-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .session-create-form,
  .session-admin-row {
    grid-template-columns: 1fr;
  }

  .session-admin-actions {
    justify-content: flex-start;
  }

  .live-hero,
  .live-actions-card,
  .live-links,
  .live-grid {
    grid-template-columns: 1fr;
  }

  .live-code {
    width: 100%;
    font-size: clamp(2.8rem, 16vw, 5rem);
  }

  .live-ranking li {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .live-progress-row,
  .live-progress-stats {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .live-progress-stats {
    display: flex;
    flex-wrap: wrap;
  }

  .debrief-metrics,
  .debrief-metrics.compact {
    grid-template-columns: 1fr;
  }

  .audit-row,
  .projector-grid {
    grid-template-columns: 1fr;
  }

  .security-form,
  .export-grid,
  .projector-ranking li {
    grid-template-columns: 1fr;
  }
}
