:root {
  --bg: #07080d;
  --bg-soft: #0d1017;
  --panel: #171a23;
  --panel-2: #20242f;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f7f7fb;
  --muted: #9ca0ac;
  --green: #58c982;
  --blue: #5d7cff;
  --red: #f36c77;
  --yellow: #f2cc66;
  --teal: #56c6b3;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.34);
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% -10%, rgba(93, 124, 255, 0.18), transparent 32%),
    linear-gradient(145deg, #07080d 0%, #0b0f16 48%, #080910 100%);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.boot-screen,
.auth-screen,
.onboarding-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card,
.onboarding-card {
  width: min(760px, 100%);
  background: rgba(23, 26, 35, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-hero {
  min-height: 220px;
  padding: 28px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(7, 8, 13, 0.62), rgba(7, 8, 13, 0.12)),
    url("/assets/palette.avif") center / cover;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 800;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1;
}

h2 {
  font-size: 28px;
  line-height: 1.1;
}

h3 {
  font-size: 18px;
}

p {
  color: var(--muted);
}

.auth-actions,
.form-grid,
.toolbar,
.row,
.mobile-bar,
.chat-actions,
.metric-row,
.tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 20px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10131b;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(88, 201, 130, 0.7);
  box-shadow: 0 0 0 3px rgba(88, 201, 130, 0.12);
}

.btn {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn.primary {
  background: var(--green);
  color: #06100a;
  font-weight: 800;
  border-color: transparent;
}

.btn.blue {
  background: var(--blue);
  border-color: transparent;
  color: white;
}

.btn.red {
  background: rgba(243, 108, 119, 0.16);
  border-color: rgba(243, 108, 119, 0.32);
  color: #ff9aa3;
}

.btn.ghost {
  background: transparent;
}

.btn svg,
.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
}

.icon-btn.recording {
  color: #ff9aa3;
  border-color: rgba(243, 108, 119, 0.45);
  background: transparent;
}

.icon-btn.danger {
  color: #ff9aa3;
  border-color: rgba(243, 108, 119, 0.32);
  background: transparent;
}

button:disabled {
  opacity: 0.62;
  cursor: progress;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 360px;
}

.sidebar,
.ai-panel {
  background: rgba(13, 16, 23, 0.88);
  border-right: 1px solid var(--line);
  padding: 16px;
}

.ai-panel {
  border-right: 0;
  border-left: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  font-size: 14px;
}

.ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-head h3 {
  margin: 0;
}

.ai-head .icon-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 18px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #071009;
  font-weight: 900;
}

.menu {
  display: grid;
  gap: 6px;
}

.sidebar-tools {
  margin-top: 18px;
}

.menu button,
.mobile-bar button,
.tab {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  border: 1px solid transparent;
}

.menu button.active,
.mobile-bar button.active,
.tab.active {
  background: rgba(93, 124, 255, 0.14);
  border-color: rgba(93, 124, 255, 0.3);
  color: var(--text);
}

.main {
  padding: 22px;
  overflow: auto;
  max-height: 100vh;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.level-top {
  margin-bottom: 12px;
}

.level-neuro-panel .ring-grid {
  grid-template-columns: repeat(4, minmax(70px, 1fr));
  gap: 8px;
}

.level-neuro-panel .ring {
  width: min(96px, 100%);
}

.card,
.panel {
  background: rgba(23, 26, 35, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.card.compact {
  padding: 10px;
}

.stat {
  font-size: 44px;
  color: var(--green);
  font-weight: 900;
  line-height: 1;
}

.muted {
  color: var(--muted);
}

.progress {
  height: 10px;
  border-radius: 999px;
  background: #0d1017;
  overflow: hidden;
  border: 1px solid var(--line);
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.level-ladder {
  display: grid;
  gap: 8px;
}

.level-step {
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 12px;
  background: #11141c;
}

.level-step.active {
  border-color: rgba(93, 124, 255, 0.7);
  background: rgba(93, 124, 255, 0.14);
}

.level-step.completed {
  border-color: rgba(88, 201, 130, 0.6);
  background: rgba(88, 201, 130, 0.12);
}

.markdown {
  line-height: 1.55;
}

.markdown ul {
  padding-left: 18px;
}

.reality-stack,
.criteria-stack {
  display: grid;
  gap: 12px;
}

.reality-block h3,
.criteria-section h3 {
  margin-bottom: 10px;
}

.reality-textarea {
  min-height: 220px;
  line-height: 1.45;
}

.reality-preview {
  min-height: 120px;
}

.task-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.task-row.done {
  margin-inline: -10px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(88, 201, 130, 0.28);
  background: rgba(88, 201, 130, 0.1);
}

.task-row.draggable {
  cursor: grab;
}

.task-row.dragging {
  border-color: rgba(88, 201, 130, 0.8);
  background: rgba(88, 201, 130, 0.12);
  box-shadow: var(--shadow);
}

.task-row:first-child {
  border-top: 0;
}

.task-row.done:first-child {
  border-top: 1px solid rgba(88, 201, 130, 0.28);
}

.task-row[role="button"] {
  cursor: pointer;
}

.task-row[role="button"]:hover {
  background: rgba(255, 255, 255, 0.03);
}

.task-row.done[role="button"]:hover,
.task-row.dragging[role="button"]:hover {
  background: rgba(88, 201, 130, 0.12);
}

.task-title-line {
  display: flex;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}

.task-title-line strong {
  overflow-wrap: anywhere;
}

.task-number {
  flex: 0 0 auto;
  min-width: 22px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.task-context {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 12px;
}

.badge.green {
  background: rgba(88, 201, 130, 0.14);
  color: var(--green);
}

.badge.red {
  background: rgba(243, 108, 119, 0.16);
  color: #ff9aa3;
}

.form-error {
  margin: 0;
  border: 1px solid rgba(243, 108, 119, 0.35);
  border-radius: 8px;
  padding: 10px;
  background: rgba(243, 108, 119, 0.12);
  color: #ffb3ba;
}

.ring-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 12px;
}

.ring {
  aspect-ratio: 1;
  width: min(116px, 100%);
  border-radius: 50%;
  background: conic-gradient(var(--green) calc(var(--value) * 1%), rgba(255, 255, 255, 0.12) 0);
  padding: 10px;
  justify-self: center;
}

.ring-inner {
  height: 100%;
  border-radius: 999px;
  background: var(--panel);
  display: grid;
  place-items: center;
  text-align: center;
}

.ring strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.ring span {
  display: block;
  font-size: 12px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.criteria-section {
  display: grid;
  gap: 8px;
}

.criterion-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.15fr) minmax(110px, 0.9fr) minmax(130px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.criterion-row:first-of-type {
  border-top: 0;
}

.criterion-progress {
  display: grid;
  grid-template-columns: minmax(76px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.criterion-actions {
  display: inline-flex;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}

.chat-log {
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  padding: 12px 0;
  overscroll-behavior: contain;
}

.message {
  border-radius: 8px;
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 14px;
}

.message.user {
  background: rgba(93, 124, 255, 0.16);
}

.message.pending {
  opacity: 0.72;
}

.pending-action {
  border: 1px solid rgba(242, 204, 102, 0.4);
  background: rgba(242, 204, 102, 0.08);
}

.chat-form {
  display: grid;
  gap: 8px;
}

.chat-form textarea {
  min-height: 116px;
  font-size: 14px;
  line-height: 1.4;
}

.chat-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.send-btn {
  min-width: 106px;
}

.send-btn.loading {
  justify-content: center;
}

.send-btn svg {
  animation: spin 1.2s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.64);
}

.modal {
  width: min(860px, 100%);
  max-height: min(86vh, 920px);
  overflow: auto;
  background: rgba(23, 26, 35, 0.98);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.task-detail {
  display: grid;
  gap: 12px;
}

.neuro-test {
  display: grid;
  gap: 18px;
}

.neuro-test h2 {
  max-width: 760px;
}

.color-list,
.rank-list {
  display: grid;
  gap: 10px;
}

.color-row,
.rank-row {
  display: grid;
  grid-template-columns: 72px minmax(120px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.rank-row {
  grid-template-columns: minmax(180px, 1fr);
  cursor: grab;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.rank-row:active {
  cursor: grabbing;
}

.rank-row.dragging {
  transform: rotate(-1deg) scale(1.015);
  border-color: rgba(88, 201, 130, 0.8);
  background: rgba(88, 201, 130, 0.12);
  box-shadow: var(--shadow);
  cursor: grabbing;
}

.drag-handle {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.drag-handle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.color-swatch {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.34);
}

.stars {
  display: flex;
  gap: 2px;
}

.stars button {
  width: 32px;
  height: 32px;
  color: rgba(255, 255, 255, 0.22);
  background: transparent;
  font-size: 25px;
  line-height: 1;
}

.stars button.active {
  color: #ffffff;
}

.neuro-result {
  display: grid;
  gap: 18px;
}

.neuro-ring-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 14px;
}

.neuro-ring-card {
  display: grid;
  place-items: center;
  min-height: 170px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.neuro-ring {
  width: min(138px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 12px;
  background: conic-gradient(var(--green) calc(var(--value) * 1%), rgba(255, 255, 255, 0.22) 0);
}

.neuro-ring-inner {
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
  background: var(--panel);
}

.neuro-ring-inner span,
.neuro-ring-inner strong {
  display: block;
}

.neuro-ring-inner span {
  font-size: 14px;
}

.neuro-ring-inner strong {
  font-size: 26px;
  line-height: 1;
}

.neuro-ring-inner .neuro-code {
  color: var(--green);
  font-size: 38px;
}

.neuro-block {
  display: grid;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px dotted rgba(255, 255, 255, 0.18);
}

.neuro-block h3 {
  font-size: 26px;
}

.neuro-block p {
  margin: -6px 0 0;
}

.radar-legend {
  display: flex;
  gap: 28px;
  justify-content: center;
  color: var(--muted);
}

.radar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.radar-legend i {
  width: 42px;
  height: 18px;
  border: 5px solid currentColor;
}

.radar-legend .ideal {
  color: var(--green);
}

.radar-legend .actual {
  color: #737780;
}

.radar-chart {
  width: min(560px, 100%);
  justify-self: center;
  overflow: visible;
}

.radar-chart line {
  stroke: rgba(255, 255, 255, 0.12);
}

.radar-chart text {
  fill: rgba(255, 255, 255, 0.42);
  font-size: 11px;
  text-anchor: middle;
}

.radar-target {
  fill: rgba(88, 201, 130, 0.22);
  stroke: var(--green);
  stroke-width: 4;
}

.radar-current {
  fill: rgba(156, 160, 172, 0.2);
  stroke: rgba(180, 184, 194, 0.72);
  stroke-width: 4;
}

.radar-point {
  fill: var(--panel);
  stroke: #f7f7fb;
  stroke-width: 2;
}

.ability-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ability-card {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 132px;
  padding: 14px;
  border-radius: 8px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: #252832;
  color: var(--text);
}

.ability-card span,
.ability-card em {
  font-style: normal;
  font-size: 16px;
}

.ability-card strong {
  font-size: clamp(34px, 7vw, 58px);
  line-height: 0.9;
}

.ability-card.growth {
  color: var(--green);
}

.ability-card.warm {
  color: #ff747e;
}

.ability-card.hot {
  color: #ffffff;
  background: #ef6670;
  box-shadow: 0 16px 38px rgba(243, 108, 119, 0.26);
}

.body-block {
  min-height: 360px;
}

.body-map {
  width: min(560px, 100%);
  justify-self: center;
}

.body-line,
.body-outline,
.body-diamond {
  fill: none;
  stroke: rgba(150, 155, 168, 0.33);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.body-outline {
  stroke-width: 3;
}

.body-diamond {
  stroke-width: 7;
}

.body-guide {
  fill: none;
  stroke-width: 3;
  stroke-dasharray: 3 6;
}

.body-guide.red {
  stroke: #ef6670;
}

.body-guide.green {
  stroke: var(--green);
}

.body-guide.neutral {
  stroke: rgba(255, 255, 255, 0.42);
}

.body-point circle {
  fill: #777b84;
  stroke: rgba(255, 255, 255, 0.86);
  stroke-width: 5;
}

.body-point text {
  fill: #ffffff;
  font-size: 30px;
  font-weight: 900;
  text-anchor: middle;
}

.body-point.growth circle {
  fill: var(--green);
  stroke: var(--green);
}

.body-point.hot circle,
.body-point.warm circle {
  fill: #ef6670;
  stroke: #ef6670;
}

.mobile-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 10px;
  background: rgba(7, 8, 13, 0.92);
  border-bottom: 1px solid var(--line);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: #11141c;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  z-index: 50;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .shell {
    display: block;
  }

  .mobile-bar {
    display: flex;
  }

  .sidebar,
  .ai-panel {
    display: none;
    min-height: calc(100vh - 61px);
  }

  .main {
    max-height: none;
    padding: 16px;
  }

  .shell.show-menu .sidebar,
  .shell.show-ai .ai-panel {
    display: block;
  }

  .shell.show-menu .main,
  .shell.show-ai .main {
    display: none;
  }

  .grid.cols-2,
  .grid.cols-3,
  .ring-grid,
  .neuro-ring-grid,
  .ability-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .level-neuro-panel .ring-grid,
  .neuro-result .ring-grid,
  .neuro-ring-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .criterion-row,
  .color-row,
  .rank-row,
  .task-row {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
  }

  .modal {
    max-height: 92vh;
  }

  .section-head {
    display: grid;
  }
}
