@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
  --bg: #0d0d14;
  --surface: #15151f;
  --surface2: #1c1c2a;
  --border: #2a2a3d;
  --accent: #7c5cff;
  --accent2: #ff5cf0;
  --accent3: #5cf0b5;
  --accent4: #ffb95c;
  --text: #e8e8f0;
  --muted: #6b6b8a;
  --danger: #ff6b6b;
  --control-bg: #222234;
  --control-border: #3a3a56;
  --control-border-focus: #7c5cff;
  --control-shadow-focus: 0 0 0 3px rgba(124, 92, 255, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

.app-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #1a0a3d 0%, #0d0d14 55%, #0a1a2d 100%);
}

.app-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.app-header .sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.eyebrow {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.layout {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}

.progress-wrap {
  margin-bottom: 1.25rem;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  font-family: 'Space Mono', monospace;
}

.progress-bar {
  height: 6px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  width: 0%;
  transition: width 0.25s ease;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.35rem 1.5rem;
  margin-bottom: 1rem;
}

.card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.card .subtitle {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.q-block {
  margin-bottom: 1.15rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.q-block:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.tool-row-bundle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem 1.15rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

.tool-row-bundle .q-block {
  border-bottom: none;
  margin-bottom: 0.85rem;
  padding-bottom: 0;
}

.tool-row-ratings {
  margin-top: 0.35rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(124, 92, 255, 0.22);
}

.tool-row-ratings-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent2);
  margin: 0 0 0.35rem;
}

.rating-legend {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
  line-height: 1.45;
}

.rating-legend strong {
  color: var(--accent4);
}

.bundle-skip-note {
  margin-top: 0.5rem;
}

.gate-prompt-block {
  margin-bottom: 1.5rem;
}

.gate-prompt-line1 {
  margin-bottom: 0;
}

.gate-prompt-highlight {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-top: 0.55rem;
  background: linear-gradient(120deg, rgba(124, 92, 255, 0.35), rgba(92, 240, 181, 0.2));
  color: var(--accent3);
  font-weight: 700;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(124, 92, 255, 0.45);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
  line-height: 1.4;
}

.gate-callout {
  font-size: 0.95rem;
  color: var(--text);
  margin: 0.75rem 0 0.35rem;
  line-height: 1.45;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: rgba(124, 92, 255, 0.12);
  border: 1px solid rgba(124, 92, 255, 0.35);
}

.gate-callout strong {
  color: var(--accent3);
  font-weight: 700;
}

.gate-router-sub {
  margin-top: 0.35rem !important;
}

.yesno-segment {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.45rem;
}

.yesno-btn {
  flex: 1;
  padding: 0.55rem 0.75rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
}

.yesno-btn:hover {
  border-color: rgba(124, 92, 255, 0.45);
  color: var(--text);
}

.yesno-btn-active {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.4), rgba(255, 92, 240, 0.18));
  border-color: rgba(124, 92, 255, 0.55);
  color: var(--text);
}

.q-label {
  font-weight: 600;
  margin-bottom: 0.45rem;
  display: block;
}

.q-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.2rem 0 0.5rem;
}

.opts {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.opt {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.35rem 0.15rem;
}

.opt input {
  margin-top: 0.2rem;
}

.scale-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.scale-row label {
  font-size: 0.85rem;
  color: var(--muted);
}

.scale-inline {
  display: grid;
  grid-template-columns: 1fr minmax(180px, 220px) 1fr;
  gap: 0.65rem;
  align-items: center;
}

.scale-anchor {
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.35;
}

.scale-anchor-left {
  text-align: right;
}

.scale-anchor-right {
  text-align: left;
}

.scale-select {
  width: 100%;
  text-align-last: center;
  font-weight: 600;
}

textarea,
input[type='text'],
input[type='email'],
select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--control-border);
  background: var(--control-bg);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input[type='text']:focus,
input[type='email']:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--control-border-focus);
  box-shadow: var(--control-shadow-focus);
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2rem;
  cursor: pointer;
  line-height: 1.2;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 3px),
    calc(100% - 10px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

select:hover {
  border-color: rgba(124, 92, 255, 0.5);
}

select option {
  background: #1a1a28;
  color: var(--text);
}

.rating-card {
  background: var(--surface2);
  border: 1px solid rgba(124, 92, 255, 0.25);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 0.85rem;
}

.rating-card h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--accent4);
}

.dim-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.75rem;
  align-items: center;
  margin-bottom: 0.45rem;
  font-size: 0.88rem;
}

.dim-row select {
  min-width: 88px;
  width: auto;
  padding: 0.45rem 1.8rem 0.45rem 0.6rem;
  border-radius: 7px;
  font-weight: 600;
  text-align-last: center;
}

.tool-row-bundle .dim-row > span:first-child::after {
  content: ' (1 = poor → 5 = excellent)';
  display: inline;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
  margin-left: 0.2rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0.55rem 1rem;
  background: var(--surface2);
  color: var(--text);
}

button.primary {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.35), rgba(255, 92, 240, 0.2));
  border-color: rgba(124, 92, 255, 0.45);
  font-weight: 600;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.errors {
  background: rgba(255, 107, 107, 0.08);
  border: 1px solid rgba(255, 107, 107, 0.35);
  color: #ffb4b4;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.88rem;
}

.success {
  background: rgba(92, 240, 181, 0.08);
  border: 1px solid rgba(92, 240, 181, 0.35);
  color: var(--accent3);
  padding: 1rem;
  border-radius: 10px;
}

.success code {
  font-family: 'Space Mono', monospace;
  font-size: 0.85rem;
}

.success-inbox {
  margin: 0.65rem 0 0;
  color: rgba(232, 232, 240, 0.92);
  font-size: 0.95rem;
  line-height: 1.45;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.95rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.toggle-text {
  flex: 1;
  font-weight: 500;
  line-height: 1.35;
}

.toggle-switch {
  position: relative;
  width: 2.75rem;
  height: 1.5rem;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  border-radius: 999px;
  transition: background 0.2s, border-color 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 1.1rem;
  width: 1.1rem;
  left: 0.18rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--muted);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: rgba(124, 92, 255, 0.35);
  border-color: var(--accent);
}

.toggle-switch input:focus-visible + .toggle-slider {
  box-shadow: var(--control-shadow-focus);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translate(1.15rem, -50%);
  background: var(--accent);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 1rem 0;
}

.phase-title {
  font-family: 'Space Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent2);
  margin: 0.35rem 0 0.75rem;
}

@media (max-width: 520px) {
  .dim-row {
    grid-template-columns: 1fr;
  }

  .scale-inline {
    grid-template-columns: 1fr;
  }

  .scale-anchor-left,
  .scale-anchor-right {
    text-align: left;
  }
}
