:root {
  color-scheme: light;
  --ink: #18212b;
  --muted: #66717f;
  --line: #d9e0e7;
  --surface: #f5f7f8;
  --panel: #ffffff;
  --accent: #0b7a75;
  --accent-2: #c74632;
  --soft: #e8f3f1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background: var(--surface);
}

.app {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 280px minmax(420px, 1fr) 320px;
}

.rail,
.inspector {
  padding: 28px;
  background: #eef2f3;
  border-right: 1px solid var(--line);
}

.inspector {
  border-right: 0;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.eyebrow,
.label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: 32px;
  line-height: 1.08;
  margin-bottom: 36px;
}

h2 {
  font-size: 22px;
  margin-bottom: 0;
}

h3 {
  font-size: 18px;
  line-height: 1.45;
  font-weight: 650;
}

.stages {
  display: grid;
  gap: 8px;
}

.stage {
  width: 100%;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  color: var(--muted);
  font-size: 14px;
}

.stage i {
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
}

.stage.active {
  color: var(--ink);
  font-weight: 700;
}

.stage.active i,
.stage.done i {
  border-color: var(--accent);
  background: var(--accent);
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--panel);
}

.topbar {
  min-height: 96px;
  padding: 24px 32px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.score {
  width: 220px;
  display: grid;
  gap: 8px;
  justify-items: end;
  font-weight: 700;
}

.meter {
  width: 100%;
  height: 8px;
  background: #edf0f2;
  overflow: hidden;
}

.meter i {
  display: block;
  width: 10%;
  height: 100%;
  background: var(--accent);
  transition: width 260ms ease;
}

.chat {
  padding: 28px 32px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.message {
  max-width: 74%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  line-height: 1.6;
  white-space: pre-wrap;
  animation: rise 180ms ease both;
}

.message.user {
  align-self: flex-end;
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.message.assistant {
  align-self: flex-start;
  background: #fbfcfc;
}

.message small {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.composer {
  padding: 18px 32px 28px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 12px;
}

textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--line);
  padding: 14px;
  font: inherit;
  line-height: 1.5;
  outline: none;
}

textarea:focus {
  border-color: var(--accent);
}

button {
  border: 0;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: #08635f;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips span {
  padding: 7px 10px;
  background: var(--soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
}

.skillbox {
  display: grid;
  gap: 6px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.skillbox span {
  color: var(--muted);
  line-height: 1.5;
}

.configbox {
  display: grid;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fbfcfc;
}

.configbox dl {
  margin: 0;
  display: grid;
  gap: 12px;
}

.configbox div {
  display: grid;
  gap: 4px;
}

.configbox dt {
  color: var(--muted);
  font-size: 12px;
}

.configbox dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 650;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }

  .rail,
  .inspector {
    border: 0;
  }

  .rail {
    padding-bottom: 12px;
  }

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

  .topbar,
  .composer {
    padding-inline: 20px;
  }

  .chat {
    padding-inline: 20px;
    min-height: 420px;
  }

  .message {
    max-width: 92%;
  }
}
