:root {
  color-scheme: dark;
  --bg: #0a0a0f;
  --bg-blur: rgba(10, 10, 15, 0.8);
  --surface-modal: #0d0e14;
  --surface-frame: #0d0e12;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --surface-subtle: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.1);
  --line-hover: rgba(255, 255, 255, 0.2);
  --line-faint: rgba(255, 255, 255, 0.06);
  --text: #ffffff;
  --text-strong: rgba(255, 255, 255, 0.7);
  --text-body: rgba(255, 255, 255, 0.6);
  --text-muted: rgba(255, 255, 255, 0.55);
  --text-eyebrow: rgba(255, 255, 255, 0.55);
  --text-placeholder: rgba(255, 255, 255, 0.45);
  --action: #3bffc8;
  --action-hover: #2ee8b0;
  --action-line: rgba(59, 255, 200, 0.4);
  --action-wash: rgba(59, 255, 200, 0.08);
  --action-wash-lo: rgba(59, 255, 200, 0.06);
  --action-ring: rgba(59, 255, 200, 0.2);
  --action-glow: 0 0 24px rgba(59, 255, 200, 0.35);
  --ident: #ff6b3b;
  --ident-hover: #f7931e;
  --ident-glow: rgba(255, 107, 59, 0.04);
  --violet-glow: rgba(155, 123, 255, 0.05);
  --danger: #f87171;
  --danger-line: rgba(248, 113, 113, 0.3);
  --danger-wash: rgba(248, 113, 113, 0.1);
  --danger-on: #1a0709;
  --r-input: 0.5rem;
  --r-card: 0.75rem;
  --r-modal: 1rem;
  --r-pill: 999px;
  --font-sans:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --font-mono:
    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono",
    monospace;
  --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--action);
}

.consent a,
.fine-print a,
.brand,
.top-actions a {
  min-width: 44px;
  min-height: 44px;
}

.consent a,
.fine-print a,
.top-actions a {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

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

button,
input,
select,
textarea,
a {
  outline-offset: 3px;
}

:focus-visible {
  outline: 2px solid var(--action);
}

button {
  min-height: 44px;
  border: 1px solid var(--action-line);
  border-radius: var(--r-pill);
  padding: 0.7rem 1rem;
  color: var(--action);
  background: transparent;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

button:hover {
  border-color: var(--action);
  background: var(--action-wash);
  transform: translateY(-1px);
}

button.primary {
  border-color: var(--action);
  background: var(--action);
  color: var(--bg);
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(59, 255, 200, 0.2);
}

button.primary:hover {
  border-color: var(--action-hover);
  background: var(--action-hover);
}

button.quiet {
  min-height: 44px;
  border-color: var(--line-strong);
  color: var(--text-strong);
  background: transparent;
}

button.quiet:hover {
  border-color: var(--line-hover);
  color: var(--text);
  background: var(--surface-hover);
}

button.danger {
  border-color: var(--danger-line);
  color: var(--danger);
  background: transparent;
}

button.danger:hover,
button.danger:focus-visible {
  border-color: var(--danger);
  background: var(--danger-wash);
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  padding: 0.75rem;
  background: var(--surface);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--action-line);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-placeholder);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

label,
legend {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
}

legend,
h3 {
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 650;
}

form {
  display: grid;
  gap: 0.65rem;
}

[data-welcome-question] {
  display: grid;
  gap: 0.65rem;
}

[data-welcome-question][hidden] {
  display: none;
}

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

h1 {
  margin-bottom: 0.4rem;
  font-size: clamp(1.65rem, 3vw, 2.6rem);
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

.eyebrow {
  margin-bottom: 0.45rem;
  color: var(--text-eyebrow);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "[ ";
}

.eyebrow::after {
  content: " ]";
}

.eyebrow[data-accent="action"] {
  color: var(--action);
}

.eyebrow[data-accent="ident"] {
  color: var(--ident);
}

.muted,
.fine-print {
  color: var(--text-muted);
  line-height: 1.5;
}

.status {
  min-height: 1.4em;
  margin: 0;
  color: var(--text-body);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.status:not(:empty)::before {
  content: "› ";
  color: var(--action);
}

.login-page {
  position: relative;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  isolation: isolate;
}

.login-page::before {
  position: fixed;
  z-index: -1;
  width: 500px;
  height: 500px;
  border-radius: var(--r-pill);
  background: var(--action-wash-lo);
  filter: blur(120px);
  content: "";
  pointer-events: none;
}

.login-card {
  width: min(100%, 520px);
  border: 1px solid var(--line);
  border-radius: var(--r-modal);
  padding: clamp(1.4rem, 5vw, 2.5rem);
  background: var(--surface-modal);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand-lockup img {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-input);
  padding: 5px;
  background: var(--surface-subtle);
  object-fit: contain;
}

.lede {
  color: var(--text-body);
  line-height: 1.55;
}

.consent {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem;
  min-height: 44px;
  margin: 0.65rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 450;
  line-height: 1.45;
  cursor: pointer;
}

.consent input {
  width: 20px;
  height: 20px;
  margin: 0.1rem 0 0;
  accent-color: var(--action);
}

.login-card .primary {
  width: 100%;
}

.fine-print {
  margin: 1.2rem 0 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line-faint);
  font-size: 0.82rem;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0.7rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  background: var(--bg-blur);
  backdrop-filter: blur(24px);
  transform: translateZ(0);
}

.topbar::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--action), var(--ident));
  content: "";
  pointer-events: none;
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 800;
  text-decoration: none;
}

.brand img {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.brand-name {
  white-space: nowrap;
}

.proto-badge {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 107, 59, 0.25);
  border-radius: var(--r-pill);
  padding: 0.3rem 0.55rem;
  color: var(--ident);
  background: rgba(255, 107, 59, 0.06);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 1rem;
}

.top-actions a {
  color: var(--text-body);
  text-decoration: none;
}

.top-actions a:hover {
  color: var(--text);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 370px);
  gap: 1rem;
  width: 100%;
  max-width: 1700px;
  margin: 0 auto;
  padding: 1rem;
}

.prototype-card,
.research-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

.prototype-card {
  overflow: hidden;
  background: var(--surface-frame);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
}

.section-heading h1 {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.privacy-chip {
  flex: 0 0 auto;
  border: 1px solid var(--action-ring);
  border-radius: var(--r-pill);
  padding: 0.45rem 0.7rem;
  color: var(--action);
  background: var(--action-wash-lo);
  font-size: 0.75rem;
  white-space: nowrap;
}

.privacy-chip::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--action);
  content: "";
  vertical-align: 0.08em;
}

.state {
  display: grid;
  place-items: center;
  min-height: 65vh;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.state[hidden],
iframe[hidden] {
  display: none;
}

iframe {
  display: block;
  width: 100%;
  height: calc(100vh - 170px);
  min-height: 620px;
  border: 0;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--line-faint);
}

.research-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
}

.panel-block {
  border-top: 1px solid var(--line-faint);
  padding-top: 1rem;
}

fieldset {
  margin: 0;
  border: 0;
  padding: 0;
}

.rating-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.rating-row label {
  position: relative;
}

.rating-row label input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.rating-row span {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  color: var(--text-body);
  background: var(--surface);
  cursor: pointer;
}

.rating-row input:focus-visible + span {
  outline: 2px solid var(--action);
  outline-offset: 3px;
}

.rating-row input:checked + span {
  border-color: var(--action-line);
  color: var(--action);
  background: var(--action-wash);
  font-weight: 700;
}

.notes-list {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.notes-list:empty::after {
  color: var(--text-muted);
  font-size: 0.8125rem;
  content: "No notes yet.";
}

.notes-list li,
.task-card {
  border: 1px solid var(--line-faint);
  border-radius: var(--r-input);
  padding: 0.75rem;
  color: var(--text-strong);
  background: var(--surface-subtle);
}

.notes-list .button-row {
  margin-top: 0.5rem;
}

.queue-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  padding: 0.7rem;
  background: var(--surface);
}

.queue-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.86rem;
}

#delete-data {
  margin-top: 0.25rem;
  border-top-color: var(--danger-line);
}

.modal-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(100%, 520px);
  border: 1px solid var(--line);
  border-radius: var(--r-modal);
  padding: 2rem;
  background: var(--surface-modal);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}

#confirm-deletion {
  border-color: var(--danger);
  color: var(--danger-on);
  background: var(--danger);
  font-weight: 700;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
}

@supports not (backdrop-filter: blur(1px)) {
  .topbar {
    background: rgba(10, 10, 15, 0.95);
  }

  .modal-backdrop {
    background: rgba(0, 0, 0, 0.82);
  }
}

@media (min-width: 901px) {
  .research-panel {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
  }
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  iframe {
    height: 70vh;
    min-height: 520px;
  }

  .research-panel {
    order: -1;
  }
}

@media (max-width: 560px) {
  .top-actions {
    gap: 0.5rem;
  }

  .top-actions a {
    display: none;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .queue-card {
    align-items: stretch;
    flex-direction: column;
  }

  .modal {
    border-radius: var(--r-card);
    padding: 1.5rem;
  }
}

@media (max-width: 400px) {
  .brand-name {
    display: none;
  }
}

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