:root {
  --ink: #101218;
  --paper: #f4efe4;
  --panel: #181c24;
  --line: #2a3140;
  --muted: #9aa3b5;
  --gold: #c4a35a;
  --good: #7d9a6f;
  --bad: #c45b4a;
  --text: #e8e4d9;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
  color: var(--text);
  font-family: "IBM Plex Sans", sans-serif;
}

body {
  background-image:
    radial-gradient(1200px 500px at 10% -10%, #243049 0%, transparent 55%),
    linear-gradient(180deg, #0c0e13 0%, #101218 40%, #0b0d11 100%);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 20px 40px;
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto 1fr;
  gap: 22px;
}

.mast {
  grid-column: 1 / -1;
  display: flex;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.mark {
  width: 18px;
  height: 42px;
  background: var(--gold);
  clip-path: polygon(50% 0, 100% 18%, 72% 100%, 28% 100%, 0 18%);
}

.kicker {
  margin: 0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--gold);
}

h1 {
  margin: 2px 0 0;
  font-family: Fraunces, serif;
  font-size: 34px;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.rail,
.stage {
  background: var(--panel);
  border: 1px solid var(--line);
  min-height: 70vh;
}

.rail {
  padding: 18px;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
  overflow: hidden;
}

.rail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.rail-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.skills-toggle {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--line);
}

.skills-toggle .triangle {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent var(--gold);
  transition: transform 0.15s ease;
}

.skills-toggle[aria-expanded="true"] .triangle {
  transform: rotate(90deg);
}

.rail h2,
.gate label {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.rail-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

#skill-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

#skill-list li {
  border: 1px solid var(--line);
  padding: 10px 12px;
  cursor: pointer;
}

#skill-list strong {
  display: block;
  font-size: 14px;
}

#skill-list span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.stage {
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.thread {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bubble {
  max-width: 78%;
  padding: 12px 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.bubble.user {
  align-self: flex-end;
  background: #232a38;
}

.bubble.assistant {
  align-self: flex-start;
  background: #12151c;
  border-left: 3px solid var(--gold);
}

.bubble .who {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.tool-note {
  font-size: 12px;
  color: var(--good);
  margin-top: 8px;
}

.exam-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.exam-links a {
  color: #1a1408;
  background: var(--gold);
  text-decoration: none;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
}

.attachments {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachments li {
  border: 1px solid var(--line);
  padding: 6px 8px;
  font-size: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.attachments img {
  width: 48px;
  height: 48px;
  object-fit: cover;
}

.bubble.user img.chat-shot,
.bubble.assistant img.chat-shot {
  display: block;
  max-width: 220px;
  margin-top: 8px;
}

.attachments button {
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 0;
  font-weight: 500;
}

.composer-left {
  display: flex;
  gap: 8px;
}

.composer {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

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

textarea,
input {
  width: 100%;
  background: #10141b;
  border: 1px solid var(--line);
  padding: 10px 12px;
  resize: vertical;
}

.composer-bar,
.gate-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

button {
  background: var(--gold);
  color: #1a1408;
  border: 0;
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
}

button.ghost,
.rail-head button {
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--line);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.status,
.error {
  min-height: 1.2em;
  font-size: 13px;
  color: var(--muted);
}

.error {
  color: var(--bad);
}

.gate {
  margin-bottom: 16px;
}

.hidden {
  display: none;
}

.empty {
  color: var(--muted);
  font-size: 14px;
  padding: 8px 0;
}

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

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

  .rail,
  .stage {
    min-height: auto;
  }
}
