:root {
  --pq-bg: oklch(0.14 0.012 250);
  --pq-bg-elev: oklch(0.18 0.012 250);
  --pq-bg-sunk: oklch(0.11 0.012 250);
  --pq-fg: oklch(0.97 0.005 250);
  --pq-fg-mute: oklch(0.68 0.012 250);
  --pq-fg-faint: oklch(0.50 0.012 250);
  --pq-border: oklch(0.24 0.012 250);
  --pq-border-strong: oklch(0.34 0.012 250);
  --pq-brand: oklch(0.66 0.20 250);
  --pq-brand-soft: oklch(0.74 0.18 250);
  --pq-brand-glow: oklch(0.66 0.20 250 / 0.18);
  --pq-success: oklch(0.74 0.16 155);
  --pq-warn: oklch(0.78 0.13 75);
  --pq-wrong: oklch(0.62 0.18 25);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--pq-fg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--pq-bg);
  background-image:
    radial-gradient(60rem 32rem at 82% -8%, var(--pq-brand-glow), transparent 62%),
    radial-gradient(40rem 24rem at -4% 96%, oklch(0.55 0.22 305 / 0.10), transparent 58%),
    radial-gradient(28rem 18rem at 50% 102%, oklch(0.78 0.16 75 / 0.05), transparent 60%);
  background-attachment: fixed;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.grid-backdrop {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, oklch(1 0 0 / 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, oklch(1 0 0 / 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, black, transparent 70%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 20px;
  border-bottom: 1px solid oklch(0.20 0.012 250);
  background: oklch(0.13 0.012 250 / 0.76);
  backdrop-filter: blur(18px);
}

.topbar::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px;
  height: 1px;
  background: linear-gradient(to right, transparent, oklch(0.66 0.20 250 / 0.45), transparent);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid oklch(0.30 0.012 250);
  border-radius: 7px;
  background: var(--pq-bg-elev);
  font-family: "SFMono-Regular", ui-monospace, Menlo, monospace;
  font-size: 11px;
  font-weight: 800;
}

.brand-mark::after {
  content: "";
  position: absolute;
  top: -3px;
  right: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pq-brand);
  box-shadow: 0 0 8px oklch(0.66 0.20 250 / 0.70);
}

.admin-link,
.eyebrow,
.pill,
.micro {
  font-family: "SFMono-Regular", ui-monospace, Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.admin-link {
  color: var(--pq-fg-mute);
  font-size: 11px;
  transition: color 160ms ease;
}

.admin-link:hover {
  color: var(--pq-fg);
}

.page {
  width: min(100%, 960px);
  margin: 0 auto;
  padding: 40px 20px 72px;
}

.page-phone {
  max-width: 520px;
}

.page-wide {
  max-width: 1120px;
}

.stack-sm > * + * {
  margin-top: 10px;
}

.stack-md > * + * {
  margin-top: 16px;
}

.stack-lg > * + * {
  margin-top: 28px;
}

.hero {
  padding-top: 18px;
}

.eyebrow {
  margin: 0;
  color: oklch(0.82 0.13 250);
  font-size: 11px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 11ch;
  font-size: clamp(42px, 11vw, 64px);
  line-height: 0.98;
  font-weight: 760;
}

h2 {
  font-size: clamp(26px, 7vw, 42px);
  line-height: 1.05;
  font-weight: 720;
}

h3 {
  font-size: 17px;
  line-height: 1.2;
}

.muted {
  color: var(--pq-fg-mute);
  line-height: 1.58;
}

.panel {
  border: 1px solid var(--pq-border);
  border-radius: 18px;
  padding: 18px;
  background: oklch(0.16 0.012 250 / 0.78);
  box-shadow: 0 20px 50px -28px oklch(0.05 0.02 250 / 0.80);
}

.field {
  display: grid;
  gap: 8px;
  color: var(--pq-fg-mute);
  font-size: 13px;
  font-weight: 650;
}

.field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--pq-border);
  border-radius: 12px;
  padding: 0 14px;
  color: var(--pq-fg);
  background: var(--pq-bg-sunk);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field textarea {
  width: 100%;
  min-height: 340px;
  resize: vertical;
  border: 1px solid var(--pq-border);
  border-radius: 12px;
  padding: 14px;
  color: var(--pq-fg);
  background: var(--pq-bg-sunk);
  outline: none;
  line-height: 1.5;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field textarea[readonly] {
  color: var(--pq-fg-mute);
}

.field input:focus,
.field textarea:focus {
  border-color: var(--pq-brand);
  box-shadow: 0 0 0 3px oklch(0.66 0.20 250 / 0.20);
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--pq-border-strong);
  border-radius: 12px;
  padding: 0 16px;
  color: var(--pq-fg);
  background: var(--pq-bg-elev);
  cursor: pointer;
  font-size: 14px;
  font-weight: 760;
  transition: transform 160ms var(--ease-out-quart), border-color 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
  border-color: oklch(0.44 0.028 250);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.button-primary {
  border-color: oklch(0.70 0.18 250);
  background: linear-gradient(180deg, oklch(0.70 0.18 250), oklch(0.56 0.20 250));
  box-shadow: 0 14px 34px -18px oklch(0.66 0.20 250 / 0.88);
}

.button-ghost {
  min-height: 36px;
  border-color: transparent;
  color: var(--pq-fg-mute);
  background: transparent;
}

.progress-wrap {
  display: grid;
  gap: 10px;
}

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--pq-fg-mute);
  font-size: 12px;
}

.progress {
  overflow: hidden;
  height: 7px;
  border-radius: 999px;
  background: var(--pq-bg-sunk);
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pq-brand), var(--pq-success));
  transition: width 260ms var(--ease-out-quart);
}

.question-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.choice-grid {
  display: grid;
  gap: 12px;
}

.choice {
  width: 100%;
  min-height: 88px;
  border: 1px solid var(--pq-border);
  border-radius: 16px;
  padding: 16px;
  color: var(--pq-fg);
  text-align: left;
  background: oklch(0.18 0.012 250 / 0.72);
  cursor: pointer;
  transition: transform 180ms var(--ease-out-quart), border-color 160ms ease, background 160ms ease;
}

.choice:hover {
  transform: translateY(-2px);
  border-color: oklch(0.44 0.028 250);
  background: oklch(0.20 0.014 250 / 0.88);
}

.choice strong {
  display: block;
  margin-bottom: 8px;
  color: oklch(0.82 0.13 250);
  font-family: "SFMono-Regular", ui-monospace, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.choice span {
  display: block;
  font-size: 17px;
  line-height: 1.38;
  font-weight: 680;
}

.choice-selected {
  border-color: oklch(0.62 0.18 25 / 0.80);
  background: oklch(0.62 0.18 25 / 0.10);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--pq-border);
  border-radius: 999px;
  padding: 0 8px;
  color: var(--pq-fg-mute);
  font-size: 10px;
  white-space: nowrap;
}

.pill-live {
  border-color: oklch(0.74 0.16 155 / 0.40);
  color: oklch(0.86 0.12 155);
  background: oklch(0.74 0.16 155 / 0.10);
}

.question-head .pill {
  align-self: flex-start;
}

.removed-note {
  border-left: 2px solid oklch(0.66 0.20 250 / 0.38);
  padding: 4px 0 4px 12px;
  color: var(--pq-fg-mute);
}

.removed-note .micro {
  color: var(--pq-fg-faint);
  font-size: 10px;
}

.removed-note p:last-child {
  max-width: 46ch;
  color: oklch(0.78 0.018 250);
  font-size: 14px;
  line-height: 1.4;
  font-weight: 620;
}

.finish {
  text-align: center;
  padding: 52px 22px;
}

.finish h1 {
  max-width: none;
  font-size: clamp(36px, 10vw, 56px);
}

.error {
  border-color: oklch(0.62 0.18 25 / 0.45);
  color: oklch(0.84 0.13 25);
  background: oklch(0.62 0.18 25 / 0.10);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.stat {
  border: 1px solid var(--pq-border);
  border-radius: 14px;
  padding: 14px;
  background: oklch(0.16 0.012 250 / 0.65);
}

.stat .value {
  margin-top: 6px;
  font-size: 28px;
  font-weight: 760;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--pq-border);
  border-radius: 16px;
  background: oklch(0.14 0.012 250 / 0.70);
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid oklch(0.22 0.012 250);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  color: var(--pq-fg-mute);
  font-family: "SFMono-Regular", ui-monospace, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: oklch(0.12 0.012 250 / 0.86);
}

td:first-child,
td:nth-child(n + 3):not(.punishment-cell) {
  font-variant-numeric: tabular-nums;
}

tr:last-child td {
  border-bottom: 0;
}

.punishment-cell {
  min-width: 320px;
  font-weight: 650;
  line-height: 1.4;
}

.loading {
  color: var(--pq-fg-mute);
}

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

.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--pq-border);
  border-radius: 14px;
  padding: 12px 14px;
  background: oklch(0.16 0.012 250 / 0.55);
}

.session-row strong {
  display: block;
  margin-bottom: 3px;
}

.session-row span {
  color: var(--pq-fg-mute);
  font-size: 12px;
}

@media (max-width: 760px) {
  .page {
    padding: 28px 16px 56px;
  }

  .topbar {
    padding: 0 16px;
  }

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

  .question-head,
  .toolbar,
  .session-row {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions .button {
    flex: 1;
  }
}
