:root {
  color-scheme: light;
  --ink: #181a18;
  --muted: #64685f;
  --paper: #f5f0e7;
  --paper-deep: #e9e0d2;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --line: #d8d0c3;
  --line-strong: #aca493;
  --accent: #ef6d3f;
  --accent-dark: #b84320;
  --accent-soft: #ffe0d0;
  --green: #1f7954;
  --green-soft: #dcefe5;
  --blue: #315c82;
  --blue-soft: #e1ebf5;
  --yellow: #9c6715;
  --yellow-soft: #faeac4;
  --red: #a3352b;
  --red-soft: #f9ded9;
  --shadow: 0 18px 50px rgba(42, 37, 28, 0.09);
  --shadow-small: 0 6px 20px rgba(42, 37, 28, 0.07);
  --radius: 20px;
  --radius-small: 12px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(239, 109, 63, 0.11), transparent 30rem),
    linear-gradient(180deg, #f9f5ed 0%, var(--paper) 42%, #efe8dc 100%);
}

body,
button,
input,
textarea,
select {
  font: inherit;
}

button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  touch-action: manipulation;
}

button {
  color: inherit;
}

a {
  color: var(--accent-dark);
  text-underline-offset: 0.2em;
}

img {
  max-width: 100%;
}

.avatar {
  display: block;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(172, 164, 147, 0.7);
  border-radius: 14px;
  object-fit: cover;
  background: var(--paper-deep);
  box-shadow: 0 3px 10px rgba(42, 37, 28, 0.08);
}

.avatar-sm {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

.avatar-md {
  width: 48px;
  height: 48px;
}

.avatar-lg {
  width: 68px;
  height: 68px;
  border-radius: 18px;
}

.profile {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  vertical-align: middle;
}

.profile-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  letter-spacing: -0.035em;
  line-height: 1.05;
}

p {
  line-height: 1.6;
}

code,
.invoice,
.numeric,
.identity-chip,
.relay-status,
.pending-status {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(172, 164, 147, 0.5);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  color: #fff;
  background: var(--ink);
  font-weight: 900;
  letter-spacing: -0.08em;
  box-shadow: 4px 4px 0 var(--accent);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 0.94rem;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
}

.status-cluster {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.relay-status,
.pending-status,
.identity-chip,
.live-pill,
.rank-badge,
.key-created {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.72);
  color: var(--muted);
  font-size: 0.71rem;
  font-weight: 700;
  white-space: nowrap;
}

.relay-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
}

.relay-status.online i {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(31, 121, 84, 0.12);
}

.pending-status {
  color: var(--yellow);
  border-color: #e7c77f;
  background: var(--yellow-soft);
}

.identity-chip {
  max-width: 180px;
}

.identity-chip .profile-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice {
  position: sticky;
  top: 10px;
  z-index: 30;
  width: min(760px, calc(100% - 32px));
  margin: 10px auto 0;
  padding: 12px 44px 12px 16px;
  border: 1px solid;
  border-radius: var(--radius-small);
  box-shadow: var(--shadow-small);
  font-weight: 700;
}

.notice button {
  position: absolute;
  inset: 50% 10px auto auto;
  translate: 0 -50%;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 1.3rem;
}

.notice-success {
  color: #155a3d;
  border-color: #9dcbb5;
  background: #eef8f2;
}

.notice-error {
  color: #7d251f;
  border-color: #dda29b;
  background: #fff0ed;
}

.notice-info {
  color: #244d70;
  border-color: #a7bfd4;
  background: #edf5fb;
}

.page {
  width: min(1240px, calc(100% - 40px));
  flex: 1;
  margin: 0 auto;
  padding: 46px 0 72px;
}

.narrow-page {
  width: min(760px, 100%);
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 40px;
  padding: clamp(36px, 8vw, 86px) clamp(26px, 6vw, 72px);
  overflow: hidden;
  border: 1px solid #272722;
  border-radius: 30px;
  color: #fff;
  background:
    linear-gradient(130deg, rgba(239, 109, 63, 0.96), rgba(192, 63, 32, 0.98)),
    var(--accent);
  box-shadow: 9px 9px 0 var(--ink);
}

.hero h1 {
  max-width: 830px;
  margin-bottom: 18px;
  font-size: clamp(2.5rem, 6vw, 5.7rem);
}

.hero p {
  max-width: 720px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(1rem, 1.7vw, 1.25rem);
}

.hero .eyebrow {
  color: #fff4da;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.section-heading,
.panel-heading,
.session-title-row,
.project-card-head,
.summary-project-title,
.profile-preview-head,
.current-demo-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.section-heading {
  margin: 56px 0 20px;
  align-items: end;
}

.section-heading h2,
.panel-heading h2,
.panel-heading h3 {
  margin-bottom: 0;
}

.section-heading > span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.card-grid,
.project-grid,
.follow-grid,
.summary-projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr));
  gap: 18px;
}

.project-grid {
  grid-template-columns: 1fr;
}

.session-card,
.panel,
.project-card,
.summary-project,
.follow-card,
.profile-preview,
.current-demo,
.captain-controls,
.ranking-editor,
.feedback-form,
.feedback-results,
.follow-panel,
.identity-panel,
.callout {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow-small);
}

.session-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 300px;
  padding: 24px;
}

.session-card-open {
  border-color: var(--green);
  background: var(--green-soft);
}

.session-card-closed {
  border-color: var(--red);
  background: var(--red-soft);
}

.session-status {
  margin: 0;
  padding: 4px 8px;
  border-radius: 999px;
}

.session-status-open {
  color: var(--green);
  background: var(--green-soft);
}

.session-status-closed {
  color: var(--red);
  background: var(--red-soft);
}

.session-card-head {
  display: flex;
  align-items: center;
  gap: 15px;
}

.session-card-head > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
}

.session-card h2 {
  margin: 0;
  font-size: 1.42rem;
}

.session-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.session-metrics,
.summary-metrics,
.project-stats,
.metadata-list,
.summary-timing {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--line);
}

.session-metrics {
  grid-template-columns: 1fr;
  margin: 0;
}

.session-metrics div,
.summary-metrics div,
.project-stats div,
.metadata-list div,
.summary-timing div {
  min-width: 0;
  padding: 14px;
  background: var(--surface);
}

.session-metrics strong,
.session-metrics span,
.summary-metrics strong,
.summary-metrics span,
.project-stats strong,
.project-stats span,
.summary-timing strong,
.summary-timing span {
  display: block;
}

.session-metrics strong {
  margin-bottom: 4px;
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.session-metrics span,
.summary-metrics span,
.project-stats span,
.summary-timing span,
.metadata-list dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.card-actions,
.button-row,
.form-actions,
.current-actions,
.project-links,
.ranking-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.card-actions {
  margin-top: auto;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
  line-height: 1.15;
  cursor: pointer;
  transition: transform 130ms ease, box-shadow 130ms ease, background 130ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(1px);
}

.button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.button-primary {
  color: #fff;
  border-color: var(--ink);
  background: var(--ink);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.22);
}

.button-primary:hover:not(:disabled) {
  background: #30332f;
}

.button-secondary {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface-strong);
}

.button-quiet {
  color: var(--muted);
  border-color: transparent;
  background: transparent;
}

.button-danger {
  color: #fff;
  border-color: #7d251f;
  background: var(--red);
}

.button-zap {
  color: #543600;
  border-color: #d7ad48;
  background: #ffd86c;
}

.button-large {
  min-height: 52px;
  padding-inline: 22px;
  font-size: 1rem;
}

.hero .button-primary {
  color: var(--ink);
  border-color: #fff;
  background: #fff;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.22);
}

.button-small,
.icon-button {
  min-height: 34px;
  padding: 6px 11px;
  font-size: 0.78rem;
}

.icon-button {
  width: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
}

.text-button,
.back-link {
  padding: 0;
  border: 0;
  color: var(--accent-dark);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.back-link {
  display: inline-flex;
  margin-bottom: 24px;
  text-decoration: none;
}

.panel {
  padding: clamp(22px, 4vw, 38px);
}

.panel + .panel,
.panel + .callout,
.callout + .panel {
  margin-top: 18px;
}

.panel-heading {
  margin-bottom: 24px;
}

.panel-heading p {
  margin: 7px 0 0;
  color: var(--muted);
}

.form-stack {
  display: grid;
  gap: 18px;
}

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

.field > span:first-child {
  font-size: 0.86rem;
  font-weight: 800;
}

.field small,
.fine-print,
.protocol-note {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.field input,
.field textarea,
.field select,
.invoice {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--ink);
  background: var(--surface-strong);
  outline: 0;
}

.invoice-qr {
  width: min(280px, 80vw);
  margin: 18px auto;
  padding: 10px;
  border-radius: 10px;
  background: #fff;
}

.invoice-qr svg {
  display: block;
  width: 100%;
  height: auto;
}

.field input,
.field select {
  min-height: 46px;
  padding: 10px 12px;
}

.field textarea {
  min-height: 120px;
  padding: 12px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(239, 109, 63, 0.12);
}

.input-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.input-paste-button {
  display: grid;
  width: 46px;
  height: 46px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--accent-dark);
  background: var(--surface-strong);
  cursor: pointer;
}

.input-paste-button:hover,
.input-paste-button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.input-paste-button:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 4px rgba(239, 109, 63, 0.12);
}

.input-paste-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-search-results {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-strong);
}

.profile-search-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 12px;
  padding: 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.profile-search-result:last-child {
  border-bottom: 0;
}

.profile-search-result:hover,
.profile-search-result:focus-visible {
  outline: 0;
  background: var(--accent-soft);
}

.profile-search-result .profile {
  grid-column: 1 / -1;
}

.profile-search-details,
.profile-search-result code,
.profile-search-message {
  color: var(--muted);
  font-size: 0.82rem;
}

.profile-search-result code {
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-search-message {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 2px;
}

.profile-search-message .spinner {
  width: 18px;
  height: 18px;
}

.form-divider {
  height: 1px;
  margin: 4px 0;
  background: var(--line);
}

.profile-preview {
  margin-top: 22px;
  padding: 20px;
}

.profile-preview-head {
  align-items: center;
}

.profile-preview-head > div {
  flex: 1;
  overflow: hidden;
}

.profile-npub {
  display: block;
  max-width: 100%;
  overflow: hidden;
  font-size: clamp(0.62rem, 2.8vw, 0.78rem);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.profile-confirm {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
  margin-top: 18px;
}

.profile-confirm .eyebrow {
  margin-bottom: 0;
}

.captain-profile-card {
  display: inline-flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 3px;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 10px 12px;
}

.captain-profile-card .eyebrow {
  margin-bottom: 0;
}

.join-form-heading {
  margin: 36px 0 14px;
  text-align: center;
}

.join-page > h1 {
  margin-bottom: 16px;
}

.profile-about,
.project-description,
.display-description {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.relay-fallback,
.secret-backup,
.danger-zone,
.zap-unavailable,
.protocol-note {
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--radius-small);
}

.relay-fallback,
.protocol-note {
  border: 1px solid #c6b16f;
  background: #fff6db;
}

.secret-backup {
  border: 1px solid #d5a49d;
  background: #fff1ee;
}

.secret-backup code {
  display: block;
  margin: 10px 0;
  overflow-wrap: anywhere;
}

.danger-zone {
  border: 1px solid #d6a39d;
  background: var(--red-soft);
}

.danger-text {
  color: var(--red);
}

.callout {
  padding: 20px;
  border-color: var(--line-strong);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 48vh;
  padding: 50px 20px;
  text-align: center;
}

.empty-state h1,
.empty-state h2 {
  max-width: 760px;
  margin-bottom: 14px;
  font-size: clamp(2rem, 5vw, 4rem);
}

.empty-state p,
.empty-copy {
  max-width: 620px;
  color: var(--muted);
}

.session-title-row {
  align-items: center;
  margin-bottom: 22px;
}

.session-title-row > div:first-child {
  display: grid;
  justify-items: start;
  min-width: 0;
}

.session-title-row .back-link {
  margin-bottom: 12px;
}

.session-title-row h1 {
  margin: 0;
  font-size: clamp(2.1rem, 5vw, 4.4rem);
}

.live-pill {
  color: var(--green);
  border-color: #a8cdb9;
  background: var(--green-soft);
}

.session-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.72fr);
  align-items: start;
  gap: 20px;
}

.session-main,
.session-sidebar {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.session-focus {
  width: min(900px, 100%);
  margin-inline: auto;
}

.current-demo {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 5vw, 48px);
  background:
    linear-gradient(150deg, rgba(255,255,255,.96), rgba(255,246,236,.95));
}

.current-demo::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -70px;
  top: -80px;
  border-radius: 50%;
  background: rgba(239, 109, 63, 0.14);
}

.current-demo h2 {
  position: relative;
  max-width: 900px;
  margin: 18px 0 12px;
  font-size: clamp(2rem, 5vw, 4.6rem);
}

.current-demo .project-description {
  position: relative;
  max-width: 850px;
  color: #41463f;
  font-size: 1.03rem;
}

.focus-feedback {
  position: relative;
  margin-top: 28px;
  background: rgba(255, 255, 255, 0.72);
}

.focus-feedback textarea {
  min-height: 120px;
}

.focus-feedback .live-feedback-results {
  margin: 18px 0;
  padding: 16px;
  box-shadow: none;
}

.feedback-prompt {
  border-color: #a8cdb9;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.97), rgba(220, 239, 229, 0.92));
}

.timer {
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 14px;
  margin: 22px 0;
  padding: 14px 18px;
  border: 1px solid;
  border-radius: 16px;
  font-variant-numeric: tabular-nums;
}

.timer [data-timer-phase] {
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.timer [data-timer-value] {
  font-size: clamp(2.2rem, 6vw, 5rem);
  font-weight: 900;
  letter-spacing: -0.06em;
}

.timer-presentation {
  color: #1b5d43;
  border-color: #8ebda7;
  background: var(--green-soft);
}

.timer-questions {
  color: #714b10;
  border-color: #ddbc71;
  background: var(--yellow-soft);
}

.timer-overtime {
  color: #852b24;
  border-color: #d89c94;
  background: var(--red-soft);
}

.ready-label,
.waiting {
  display: inline-flex;
  padding: 9px 13px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ready-label {
  color: #244d70;
  background: var(--blue-soft);
}

.waiting {
  color: var(--muted);
  background: var(--paper-deep);
}

.captain-controls,
.ranking-editor,
.feedback-form,
.feedback-results,
.identity-panel,
.follow-panel {
  padding: 22px;
}

.captain-button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.captain-button-grid .button-danger {
  grid-column: 1 / -1;
}

.captain-controls-live .captain-button-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-card {
  display: grid;
  gap: 15px;
  min-width: 0;
  padding: 20px;
}

.project-card-head {
  align-items: center;
  justify-content: flex-start;
}

.project-card-head > div,
.summary-project-title > div,
.profile-preview-head > div {
  min-width: 0;
}

.project-card-head > div {
  flex: 1;
}

.project-card h3 {
  margin: 0;
  font-size: 1.3rem;
}

.project-card .project-description {
  margin: 0;
  color: var(--muted);
}

.demo-editor > summary {
  width: fit-content;
  list-style: none;
}

.demo-editor > summary::-webkit-details-marker {
  display: none;
}

.demo-editor[open] > summary {
  margin-bottom: 15px;
}

.project-details > summary {
  cursor: pointer;
  font-weight: 800;
}

.project-feedback {
  display: grid;
  gap: 15px;
  margin-top: 15px;
}

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

.project-stats strong,
.summary-timing strong {
  margin-bottom: 3px;
}

.feedback-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.feedback-results h4 {
  margin-bottom: 10px;
}

.feedback-results blockquote,
.zap-comments blockquote {
  margin: 0 0 10px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  line-height: 1.5;
}

.ranking-list,
.unranked {
  display: grid;
  gap: 8px;
  margin: 12px 0 18px;
}

.ranking-list {
  counter-reset: rank;
}

.ranking-list > li,
.unranked-item {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-strong);
  list-style: none;
}

.ranking-list > li[draggable="true"],
.unranked-item[draggable="true"] {
  cursor: grab;
}

.ranking-number,
.position-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  background: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.drag-handle {
  color: var(--line-strong);
  user-select: none;
}

.ranking-card-content {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.ranking-card-content > strong,
.ranking-card-content .profile-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-card-content .profile {
  min-width: 0;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  background: var(--paper);
  font-size: 0.71rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rank-badge {
  justify-content: center;
  min-width: 32px;
  color: var(--ink);
  background: var(--paper-deep);
}

.identity-panel .metadata-list {
  margin: 15px 0;
}

.metadata-list {
  grid-template-columns: 1fr;
}

.metadata-list div {
  display: grid;
  grid-template-columns: minmax(120px, 0.5fr) minmax(0, 1fr);
  gap: 14px;
}

.metadata-list dl,
.metadata-list dt,
.metadata-list dd {
  margin: 0;
}

.metadata-list dd {
  overflow-wrap: anywhere;
}

.summary-hero {
  padding: clamp(30px, 6vw, 60px);
  border-radius: 26px;
  color: #fff;
  background: var(--ink);
  box-shadow: 8px 8px 0 var(--accent);
}

.summary-hero h1 {
  margin-bottom: 12px;
  font-size: clamp(2.4rem, 6vw, 5.4rem);
}

.summary-hero p {
  color: rgba(255,255,255,.72);
}

.summary-hero .back-link {
  display: flex;
  width: max-content;
  color: var(--accent);
}

.summary-hero .eyebrow {
  color: var(--accent);
}

.summary-hero .button-primary {
  color: var(--ink);
  border-color: #fff;
  background: #fff;
}

.summary-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 28px;
  border-color: var(--line);
  background: var(--line);
}

.summary-metrics div {
  color: var(--ink);
  background: var(--surface);
}

.summary-metrics strong {
  font-size: 1.55rem;
}

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

.summary-page > * + * {
  margin-top: 22px;
}

.summary-project {
  min-width: 0;
  padding: 23px;
}

.summary-projects {
  grid-template-columns: 1fr;
}

.summary-project-title {
  align-items: center;
  justify-content: flex-start;
}

.summary-project-title > div {
  flex: 1;
}

.summary-project h3 {
  margin: 0;
  font-size: 1.5rem;
}

.summary-timing {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 18px 0;
}

.project-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.project-detail-grid > div {
  min-width: 0;
}

.project-detail-grid span,
.project-detail-grid strong,
.project-detail-grid code {
  display: block;
}

.project-detail-grid span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.project-detail-grid code {
  overflow-wrap: anywhere;
  font-size: 0.78rem;
  line-height: 1.45;
}

.project-detail-grid .account-detail {
  grid-column: 1 / -1;
}

.feedback-message {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 14px;
}

.feedback-message .profile-name {
  display: none;
}

.feedback-message .avatar {
  margin-bottom: 3px;
}

.zap-message {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.zap-message p {
  margin: 0;
}

.zap-anonymous {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.live-zap-comments {
  margin-top: 18px;
}

.feedback-results .feedback-bubble,
.feedback-columns .feedback-bubble {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  max-width: min(680px, calc(100% - 44px));
  margin: 0;
  padding: 12px 15px;
  border: 0;
  border-radius: 17px 17px 17px 5px;
  background: var(--paper-deep);
  line-height: 1.45;
}

.feedback-results .feedback-bubble::before,
.feedback-columns .feedback-bubble::before {
  content: "";
  position: absolute;
  left: -6px;
  bottom: 0;
  width: 14px;
  height: 14px;
  background: var(--paper-deep);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.feedback-bubble p {
  position: relative;
  margin: 0;
}

.feedback-bubble .button {
  flex: 0 0 auto;
}

.feedback-bubble cite {
  position: relative;
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 700;
}

.project-section {
  min-width: 0;
}

.project-section h4 {
  margin-bottom: 10px;
}

.follow-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 18px;
}

.follow-card code {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.72rem;
}

footer {
  width: min(1240px, calc(100% - 40px));
  margin: auto auto 0;
  padding: 22px 0 28px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}

footer nav {
  display: flex;
  gap: 18px;
}

footer a {
  text-decoration: none;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 15px;
  color: #fff;
  background: rgba(24, 26, 24, 0.72);
  backdrop-filter: blur(5px);
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { rotate: 360deg; }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(19, 20, 18, 0.66);
  backdrop-filter: blur(4px);
}

.modal {
  position: relative;
  width: min(580px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow-y: auto;
  padding: 28px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(0,0,0,.3);
}

.modal-close {
  position: absolute;
  top: 13px;
  right: 13px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--paper-deep);
  cursor: pointer;
}

.modal-state {
  padding-top: 15px;
}

.invoice {
  max-height: 150px;
  margin: 15px 0;
  padding: 12px;
  overflow: auto;
  overflow-wrap: anywhere;
  font-size: 0.72rem;
  line-height: 1.4;
}

.zap-icon {
  font-size: 1.2em;
}

.zap-success-card {
  display: grid;
  width: min(220px, 65vw);
  aspect-ratio: 1;
  margin: 8px auto 24px;
  place-content: center;
  gap: 12px;
  border: 3px solid #25804f;
  border-radius: 22px;
  color: var(--ink);
  background: #e8f5ec;
  text-align: center;
}

.zap-success-tick {
  color: #25804f;
  font-size: 5rem;
  font-weight: 900;
  line-height: 0.8;
}

.zap-success-card strong {
  font-size: 1.45rem;
}

.zap-unavailable {
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  background: var(--paper);
}

/* Full-room display */
.display-shell {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

.display-main {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #10120f;
}

.display-stage {
  position: relative;
  display: grid;
  place-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: clamp(24px, 5vmin, 64px);
  overflow: hidden;
  color: #fff;
  text-align: center;
  background: #10120f;
}

.display-stage::before {
  content: none;
}

.display-exit {
  position: fixed;
  top: 32px;
  right: 32px;
  z-index: 3;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.display-kicker {
  color: var(--accent);
  font-size: clamp(.8rem, 1.5vw, 1.2rem);
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.display-stage h1 {
  max-width: 1400px;
  margin: clamp(10px, 2vh, 20px) auto;
  font-size: clamp(2.5rem, min(8vw, 13vh), 8rem);
  line-height: .94;
  overflow-wrap: anywhere;
}

.display-description {
  max-width: 1050px;
  margin: 0 auto;
  color: rgba(255,255,255,.69);
  font-size: clamp(1rem, min(2.2vw, 3vh), 1.75rem);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.display-rule {
  width: min(500px, 70%);
  height: 1px;
  margin: clamp(24px, 5vh, 54px) auto;
  background: rgba(255,255,255,.2);
}

.display-phase {
  font-size: clamp(1rem, 2vw, 1.7rem);
  font-weight: 900;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.display-stage [data-timer-value] {
  display: block;
  margin-top: 10px;
  font-size: clamp(4rem, min(18vw, 28vh), 14rem);
  font-weight: 900;
  line-height: .85;
  letter-spacing: -.08em;
  font-variant-numeric: tabular-nums;
}

.display-stage.timer-presentation .display-phase,
.display-stage.timer-presentation [data-timer-value] { color: #8af0bd; }
.display-stage.timer-questions .display-phase,
.display-stage.timer-questions [data-timer-value] { color: #ffd778; }
.display-stage.timer-overtime .display-phase,
.display-stage.timer-overtime [data-timer-value] { color: #ff8b7e; }

.display-summary {
  max-width: 900px;
  padding: clamp(24px, 5vmin, 64px);
  overflow: hidden;
  color: rgba(255,255,255,.68);
  font-size: clamp(1rem, 2vw, 1.5rem);
  text-align: center;
}

.between-count {
  display: block;
  margin-top: 28px;
  color: var(--accent);
  font-size: clamp(1rem, 2vw, 1.5rem);
  font-weight: 800;
}

@media (max-width: 920px) {
  .hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .session-layout {
    grid-template-columns: 1fr;
  }

  .session-sidebar {
    grid-row: 1;
  }

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

  .project-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 660px) {
  .topbar,
  .page,
  footer {
    width: min(100% - 24px, 1240px);
  }

  .topbar {
    min-height: 72px;
  }

  .brand strong {
    font-size: .83rem;
  }

  .brand small,
  .pending-status {
    display: none;
  }

  .identity-chip {
    padding: 4px;
  }

  .identity-chip .profile-name {
    display: none;
  }

  .page {
    padding-top: 24px;
  }

  .hero {
    padding: 34px 22px;
    border-radius: 22px;
    box-shadow: 5px 5px 0 var(--ink);
  }

  .section-heading,
  .session-title-row,
  .current-demo-top,
  .summary-project-title,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .feedback-columns {
    grid-template-columns: 1fr;
  }

  .captain-button-grid {
    grid-template-columns: 1fr;
  }

  .captain-button-grid .button-danger {
    grid-column: auto;
  }

  .summary-metrics,
  .summary-timing,
  .project-stats {
    grid-template-columns: 1fr 1fr;
  }

  .metadata-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .button-row > .button,
  .form-actions > .button,
  .card-actions > .button {
    flex: 1 1 auto;
  }

  .display-exit {
    top: 18px;
    right: 18px;
  }

  footer {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .spinner { animation: none; }
  .button,
  .input-paste-button,
  :where(a, button, input, textarea, select, summary) { transition: none; }
}

/* Cybernetic relay control room */
:root {
  color-scheme: dark;
  --ink: #eaf8ff;
  --muted: #8499aa;
  --paper: #05070d;
  --paper-deep: #090d17;
  --surface: #0a101c;
  --surface-strong: #0d1523;
  --line: rgba(92, 215, 255, .18);
  --line-strong: rgba(118, 225, 255, .42);
  --accent: #61e9ff;
  --accent-dark: #8cf1ff;
  --accent-soft: rgba(69, 217, 255, .12);
  --green: #55f6b1;
  --green-soft: rgba(32, 231, 144, .1);
  --blue: #67a7ff;
  --blue-soft: rgba(73, 132, 255, .12);
  --yellow: #ffd76a;
  --yellow-soft: rgba(255, 199, 68, .1);
  --red: #ff597d;
  --red-soft: rgba(255, 67, 107, .1);
  --shadow: 0 22px 70px rgba(0, 0, 0, .48), inset 0 1px rgba(255, 255, 255, .035);
  --shadow-small: 0 12px 34px rgba(0, 0, 0, .34), inset 0 1px rgba(255, 255, 255, .03);
  --radius: 6px;
  --radius-small: 3px;
  --space-1: 6px;
  --space-2: 10px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 36px;
  --space-6: 56px;
  --content-gutter: clamp(16px, 3vw, 40px);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

::selection {
  color: #031015;
  background: var(--accent);
}

html {
  scrollbar-color: rgba(97, 233, 255, .5) #070b13;
  scrollbar-width: thin;
}

body {
  caret-color: var(--accent);
}

:where(a, button, input, textarea, select, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

html, body {
  background: #05070d;
}

body {
  background:
    radial-gradient(circle at 78% 8%, rgba(91, 45, 190, .22), transparent 34rem),
    radial-gradient(circle at 12% 28%, rgba(0, 196, 255, .1), transparent 30rem),
    #05070d;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: .12;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(143, 231, 255, .08) 4px);
  mix-blend-mode: screen;
}

.relay-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: .6;
}

.app-shell > :not(.relay-field) {
  position: relative;
  z-index: 1;
}

.topbar {
  width: min(1400px, calc(100% - (var(--content-gutter) * 2)));
  min-height: 88px;
  padding-block: var(--space-2);
  border-color: var(--line);
}

.brand-mark {
  border: 1px solid var(--accent);
  border-radius: 2px;
  color: #061016;
  background: var(--accent);
  box-shadow: 0 10px 28px rgba(143, 81, 255, .28), 0 0 25px rgba(97, 233, 255, .25);
}

.brand strong, h1, h2, h3, h4 {
  text-transform: uppercase;
}

h1, h2, h3, h4 {
  letter-spacing: -.03em;
  text-wrap: balance;
}

.brand small, .eyebrow, .session-metrics span, .project-stats span {
  letter-spacing: .14em;
}

.relay-status, .pending-status, .identity-chip, .live-pill, .rank-badge, .key-created {
  border-radius: 2px;
  background: rgba(7, 13, 23, .88);
  backdrop-filter: blur(14px);
}

.relay-status.online {
  color: var(--green);
  border-color: rgba(85, 246, 177, .38);
  box-shadow: inset 0 0 18px rgba(85, 246, 177, .07);
}

.page {
  width: min(1400px, calc(100% - (var(--content-gutter) * 2)));
  padding-block: var(--space-6) calc(var(--space-6) * 1.35);
}

.hero {
  position: relative;
  min-height: min(650px, 72vh);
  border: 1px solid rgba(97, 233, 255, .55);
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(8, 16, 29, .94), rgba(17, 8, 39, .78)),
    repeating-linear-gradient(90deg, transparent 0 79px, rgba(97, 233, 255, .08) 80px);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .42), 0 0 80px rgba(72, 211, 255, .08);
}

.hero > div:first-child {
  align-self: end;
}

.hero p,
.summary-hero p,
.current-demo .project-description,
.project-card .project-description {
  max-width: 70ch;
}

.section-heading {
  margin-block: var(--space-6) var(--space-4);
}

.hero::before {
  content: "CONTROL CHANNEL / DEMO NETWORK";
  position: absolute;
  top: 18px;
  right: 22px;
  color: var(--accent);
  font-size: .66rem;
  letter-spacing: .18em;
}

.hero h1 {
  color: #f1fbff;
  text-shadow: 0 0 42px rgba(97, 233, 255, .22);
}

.session-card, .panel, .project-card, .summary-project, .follow-card, .profile-preview,
.current-demo, .captain-controls, .ranking-editor, .feedback-form, .feedback-results,
.follow-panel, .identity-panel, .callout {
  position: relative;
  border-color: var(--line);
  border-radius: 4px;
  background: linear-gradient(145deg, rgba(13, 21, 35, .94), rgba(7, 11, 20, .9));
  box-shadow: var(--shadow-small);
  backdrop-filter: blur(15px);
}

.card-grid,
.project-grid,
.follow-grid,
.summary-projects {
  gap: var(--space-4);
}

.session-card {
  gap: var(--space-4);
  padding: var(--space-4);
}

.panel,
.current-demo {
  padding: clamp(var(--space-4), 4vw, var(--space-5));
}

.panel + .panel,
.panel + .callout,
.callout + .panel,
.session-main,
.session-sidebar {
  margin-top: 0;
}

.session-main,
.session-sidebar {
  gap: var(--space-4);
}

.session-layout {
  gap: var(--space-4);
}

.panel-heading {
  margin-bottom: var(--space-4);
}

.form-stack {
  gap: var(--space-4);
}

.session-card::before, .panel::before, .project-card::before, .current-demo::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 18px;
  width: 54px;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
}

.session-card-open { border-color: rgba(85, 246, 177, .42); background: linear-gradient(145deg, rgba(9, 30, 28, .94), rgba(6, 14, 20, .92)); }
.session-card-closed { border-color: rgba(255, 89, 125, .34); background: linear-gradient(145deg, rgba(32, 12, 25, .94), rgba(10, 10, 18, .92)); }
.session-status-open, .session-status-closed { background: transparent; }

.button {
  min-height: 44px;
  padding: 10px 17px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: .075em;
  font-size: .78rem;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.button:hover:not(:disabled) {
  transform: none;
}

.button:active:not(:disabled) {
  transform: translateY(1px);
}

.button-primary {
  color: #031015;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 10px 28px rgba(137, 77, 255, .2), 0 0 24px rgba(97, 233, 255, .2);
}
.button-primary:hover:not(:disabled) { color: #fff; background: #6f43dc; border-color: #a887ff; box-shadow: 0 0 30px rgba(147, 89, 255, .35); }
.button-secondary, .icon-button { color: var(--accent); border-color: var(--line-strong); background: rgba(9, 17, 29, .9); }
.hero .button-primary { color: #031015; border-color: var(--accent); background: var(--accent); }

.field input, .field textarea, .field select, .invoice {
  border-radius: 2px;
  background: rgba(3, 8, 15, .9);
}
.field { gap: var(--space-1); }
.field input, .field select { min-height: 48px; padding-inline: 14px; }
.field textarea { padding: 13px 14px; }
.field input:focus, .field textarea:focus, .field select:focus { box-shadow: 0 0 0 2px rgba(97, 233, 255, .18), 0 0 30px rgba(97, 233, 255, .08); }

.timer {
  border: 1px solid currentColor;
  border-radius: 3px;
  background: rgba(4, 9, 16, .9);
  box-shadow: inset 0 0 35px rgba(97, 233, 255, .055), 0 0 32px rgba(97, 233, 255, .06);
}
.timer [data-timer-value] { font-family: "SFMono-Regular", Consolas, monospace; letter-spacing: -.07em; }
.current-demo .project-description { color: var(--muted); }
.timer-presentation { color: var(--green); border-color: rgba(85, 246, 177, .5); }
.timer-questions { color: var(--yellow); border-color: rgba(255, 215, 106, .5); }
.timer-overtime { color: var(--red); border-color: rgba(255, 89, 125, .5); }

.ready-label {
  color: var(--blue);
  border: 1px solid rgba(103, 167, 255, .42);
  background: rgba(73, 132, 255, .12);
  box-shadow: inset 0 0 18px rgba(73, 132, 255, .07);
}

.relay-fallback {
  color: var(--yellow);
  border-color: rgba(255, 215, 106, .4);
  background: linear-gradient(145deg, rgba(34, 27, 10, .94), rgba(12, 13, 17, .94));
  box-shadow: inset 0 1px rgba(255, 255, 255, .04), 0 14px 32px rgba(0, 0, 0, .2);
}

.relay-fallback p,
.relay-fallback .field > span,
.relay-fallback .field small { color: var(--ink); }

.secret-backup {
  color: var(--red);
  border-color: rgba(255, 89, 125, .42);
  background: linear-gradient(145deg, rgba(35, 12, 24, .94), rgba(12, 11, 18, .94));
  box-shadow: inset 0 1px rgba(255, 255, 255, .04), 0 14px 32px rgba(0, 0, 0, .2);
}

.secret-backup p,
.secret-backup code { color: var(--ink); }

.zap-success-card {
  color: var(--ink);
  border-color: rgba(85, 246, 177, .58);
  border-radius: 4px;
  background: linear-gradient(145deg, rgba(8, 36, 29, .96), rgba(5, 14, 19, .96));
  box-shadow: inset 0 0 36px rgba(85, 246, 177, .08), 0 0 32px rgba(85, 246, 177, .08);
}

.zap-success-tick {
  color: var(--green);
  text-shadow: 0 0 24px rgba(85, 246, 177, .45);
}

.notice-error {
  color: #ffb6c5;
  border-color: rgba(255, 89, 125, .5);
  border-radius: 3px;
  background: linear-gradient(135deg, rgba(42, 11, 25, .97), rgba(14, 10, 19, .97));
  box-shadow: 5px 5px 0 rgba(117, 31, 70, .35), 0 0 28px rgba(255, 89, 125, .1);
}

.notice-error button { color: var(--red); }

.ranking-list > li { border-radius: 2px; background: rgba(5, 12, 21, .82); }
.ranking-number { color: var(--accent); text-shadow: 0 0 18px var(--accent); }
.avatar { border-radius: 3px; filter: saturate(.78) contrast(1.08); }
.feedback-bubble { border-radius: 2px !important; background: rgba(7, 16, 27, .92) !important; }
.modal-backdrop { background: rgba(1, 3, 8, .84); backdrop-filter: blur(12px); }
.modal { border: 1px solid var(--accent); border-radius: 4px; background: #09101c; box-shadow: 0 0 90px rgba(97, 233, 255, .16); }
.spinner { border-color: rgba(97, 233, 255, .18); border-top-color: var(--accent); }
.display-stage { background: radial-gradient(circle at 50% 45%, rgba(83, 47, 170, .24), transparent 42%), #03060b; }

.summary-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 32px;
  min-height: 390px;
  padding: clamp(28px, 5vw, 58px);
  overflow: hidden;
  border: 1px solid rgba(97, 233, 255, .48);
  border-radius: 4px;
  color: var(--ink);
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(97, 233, 255, .045) 50%, transparent 50.2%),
    linear-gradient(0deg, transparent 49.8%, rgba(97, 233, 255, .045) 50%, transparent 50.2%),
    radial-gradient(circle at 82% 30%, rgba(130, 68, 255, .22), transparent 27rem),
    linear-gradient(135deg, rgba(10, 20, 34, .97), rgba(5, 9, 18, .96));
  box-shadow: 0 30px 90px rgba(0, 0, 0, .4), 0 0 70px rgba(97, 233, 255, .07);
}

.summary-hero::before {
  content: "ARCHIVE NODE / SIGNED FINAL STATE";
  position: absolute;
  top: 19px;
  right: 22px;
  color: var(--accent);
  font-size: .64rem;
  letter-spacing: .18em;
}

.summary-hero::after {
  content: "";
  position: absolute;
  inset: 12px;
  pointer-events: none;
  border-top: 1px solid rgba(97, 233, 255, .12);
  border-right: 1px solid rgba(97, 233, 255, .12);
  clip-path: polygon(72% 0, 100% 0, 100% 45%, 98.8% 45%, 98.8% 1.5%, 72% 1.5%);
}

.summary-hero h1 {
  max-width: 950px;
  color: #effbff;
  font-size: clamp(2.6rem, 6vw, 5.8rem);
  line-height: .88;
  text-shadow: 0 0 38px rgba(97, 233, 255, .18);
}

.summary-hero p { color: var(--muted); }
.summary-hero .back-link, .summary-hero .eyebrow { color: var(--accent); }
.summary-hero .button-primary {
  color: #031015;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 10px 28px rgba(137, 77, 255, .22), 0 0 28px rgba(97, 233, 255, .2);
}

.summary-metrics {
  border-color: var(--line);
  background: var(--line);
}

.summary-metrics div { color: var(--ink); background: rgba(7, 14, 24, .94); }
.summary-metrics strong { color: #eefbff; }

.summary-page > * + * {
  margin-top: var(--space-4);
}

footer {
  width: min(1400px, calc(100% - (var(--content-gutter) * 2)));
  padding-block: var(--space-4);
}

footer nav {
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
}

footer a:hover {
  color: var(--accent);
}

/* Compact controls still keep a full touch target. */
.button-small,
.icon-button,
.modal-close,
.notice button {
  min-width: 44px;
  min-height: 44px;
}

.icon-button,
.modal-close,
.notice button {
  width: 44px;
  height: 44px;
}

.modal {
  padding: clamp(var(--space-4), 4vw, var(--space-5));
}

@media (max-width: 660px) {
  :root {
    --content-gutter: 12px;
    --space-5: 30px;
    --space-6: 42px;
  }
  .topbar {
    min-height: 76px;
    gap: var(--space-2);
  }
  .status-cluster { gap: var(--space-1); }
  .relay-status { padding-inline: 8px; }
  .page { padding-top: var(--space-4); }
  .hero { min-height: min(520px, calc(100dvh - 124px)); padding: var(--space-5) var(--space-4); box-shadow: 0 22px 60px rgba(0, 0, 0, .4); }
  .hero::before { position: static; grid-column: 1; }
  .relay-field { opacity: .38; }
  .summary-hero { grid-template-columns: 1fr; min-height: 430px; }
  .summary-hero::before { top: 14px; right: 14px; font-size: .55rem; }
  .section-heading { margin-block: var(--space-6) var(--space-3); }
  .session-title-row { margin-bottom: var(--space-4); }
  .button-row,
  .form-actions,
  .card-actions,
  .current-actions { align-items: stretch; }
  .button-row > .button,
  .form-actions > .button,
  .card-actions > .button,
  .current-actions > .button { flex: 1 1 100%; }
  footer nav { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .relay-field { opacity: .25; }
}

.theme-switcher {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--accent);
  background: rgba(7, 13, 23, .88);
  cursor: pointer;
}

.theme-switcher:hover {
  border-color: var(--line-strong);
  background: var(--accent-soft);
}

.theme-switcher svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:root[data-theme="light"] {
  color-scheme: light;
  --ink: #12212b;
  --muted: #526773;
  --paper: #f3f7fa;
  --paper-deep: #e8f0f4;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --line: rgba(15, 106, 133, .18);
  --line-strong: rgba(12, 106, 136, .42);
  --accent: #087f9f;
  --accent-dark: #05647e;
  --accent-soft: rgba(8, 127, 159, .1);
  --green: #147552;
  --green-soft: #e1f3ea;
  --blue: #285f9d;
  --blue-soft: #e5eefb;
  --yellow: #865a08;
  --yellow-soft: #fff0c9;
  --red: #a52d49;
  --red-soft: #fde6eb;
  --shadow: 0 22px 70px rgba(32, 61, 76, .13), inset 0 1px rgba(255, 255, 255, .75);
  --shadow-small: 0 12px 34px rgba(32, 61, 76, .1), inset 0 1px rgba(255, 255, 255, .8);
}

:root[data-theme="light"] ::selection { color: #fff; background: var(--accent); }
:root[data-theme="light"] { scrollbar-color: rgba(8, 127, 159, .5) #e8f0f4; }
:root[data-theme="light"],
:root[data-theme="light"] body { background: var(--paper); }
:root[data-theme="light"] body {
  background:
    radial-gradient(circle at 78% 8%, rgba(111, 70, 190, .09), transparent 34rem),
    radial-gradient(circle at 12% 28%, rgba(8, 127, 159, .08), transparent 30rem),
    var(--paper);
}
:root[data-theme="light"] body::after {
  opacity: .28;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(16, 102, 127, .045) 4px);
  mix-blend-mode: multiply;
}
:root[data-theme="light"] .relay-field { opacity: .38; }
:root[data-theme="light"] .brand-mark { color: #fff; box-shadow: 0 10px 28px rgba(74, 48, 142, .12), 0 0 25px rgba(8, 127, 159, .12); }
:root[data-theme="light"] .relay-status,
:root[data-theme="light"] .pending-status,
:root[data-theme="light"] .identity-chip,
:root[data-theme="light"] .live-pill,
:root[data-theme="light"] .rank-badge,
:root[data-theme="light"] .key-created,
:root[data-theme="light"] .theme-switcher { background: rgba(255, 255, 255, .88); }
:root[data-theme="light"] .hero {
  border-color: rgba(8, 127, 159, .42);
  background: linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(243, 238, 255, .9));
  box-shadow: 0 30px 90px rgba(32, 61, 76, .12), 0 0 80px rgba(8, 127, 159, .06);
}
:root[data-theme="light"] .hero h1,
:root[data-theme="light"] .summary-hero h1,
:root[data-theme="light"] .summary-metrics strong { color: var(--ink); text-shadow: none; }
:root[data-theme="light"] .session-card,
:root[data-theme="light"] .panel,
:root[data-theme="light"] .project-card,
:root[data-theme="light"] .summary-project,
:root[data-theme="light"] .follow-card,
:root[data-theme="light"] .profile-preview,
:root[data-theme="light"] .current-demo,
:root[data-theme="light"] .captain-controls,
:root[data-theme="light"] .ranking-editor,
:root[data-theme="light"] .feedback-form,
:root[data-theme="light"] .feedback-results,
:root[data-theme="light"] .follow-panel,
:root[data-theme="light"] .identity-panel,
:root[data-theme="light"] .callout { background: linear-gradient(145deg, rgba(255, 255, 255, .97), rgba(245, 249, 251, .94)); }
:root[data-theme="light"] .session-card-open { border-color: rgba(20, 117, 82, .36); background: linear-gradient(145deg, #f4fcf8, #edf8f4); }
:root[data-theme="light"] .session-card-closed { border-color: rgba(165, 45, 73, .3); background: linear-gradient(145deg, #fff8fa, #fbeff3); }
:root[data-theme="light"] .button-primary,
:root[data-theme="light"] .hero .button-primary,
:root[data-theme="light"] .summary-hero .button-primary { color: #fff; box-shadow: 0 10px 28px rgba(8, 127, 159, .16); }
:root[data-theme="light"] .button-primary:hover:not(:disabled) { color: #fff; background: #6542b5; border-color: #6542b5; box-shadow: 0 10px 28px rgba(74, 48, 142, .2); }
:root[data-theme="light"] .button-secondary,
:root[data-theme="light"] .icon-button { background: rgba(255, 255, 255, .92); }
:root[data-theme="light"] .field input,
:root[data-theme="light"] .field textarea,
:root[data-theme="light"] .field select,
:root[data-theme="light"] .invoice,
:root[data-theme="light"] .timer { background: rgba(255, 255, 255, .92); }
:root[data-theme="light"] .relay-fallback { background: linear-gradient(145deg, #fff9e8, #fff4d5); box-shadow: var(--shadow-small); }
:root[data-theme="light"] .secret-backup { background: linear-gradient(145deg, #fff4f7, #fde9ee); box-shadow: var(--shadow-small); }
:root[data-theme="light"] .zap-success-card { background: linear-gradient(145deg, #effaf5, #e4f4ed); box-shadow: var(--shadow-small); }
:root[data-theme="light"] .notice-error { color: #86223a; background: #fff0f3; box-shadow: var(--shadow-small); }
:root[data-theme="light"] .ranking-list > li { background: rgba(255, 255, 255, .9); }
:root[data-theme="light"] .ranking-number { text-shadow: none; }
:root[data-theme="light"] .avatar { filter: saturate(.9) contrast(1.02); }
:root[data-theme="light"] .feedback-bubble { background: #f5f9fb !important; }
:root[data-theme="light"] .modal-backdrop { background: rgba(25, 43, 54, .48); }
:root[data-theme="light"] .modal { background: #fff; box-shadow: 0 28px 90px rgba(32, 61, 76, .22); }
:root[data-theme="light"] .spinner { border-color: rgba(8, 127, 159, .18); border-top-color: var(--accent); }
:root[data-theme="light"] .display-stage { background: radial-gradient(circle at 50% 45%, rgba(111, 70, 190, .1), transparent 42%), #eef5f8; }
:root[data-theme="light"] .summary-hero {
  border-color: rgba(8, 127, 159, .38);
  color: var(--ink);
  background: radial-gradient(circle at 82% 30%, rgba(111, 70, 190, .1), transparent 27rem), linear-gradient(135deg, #fff, #edf5f8);
  box-shadow: 0 30px 90px rgba(32, 61, 76, .12);
}
:root[data-theme="light"] .summary-metrics div { color: var(--ink); background: rgba(255, 255, 255, .95); }
