:root {
  color-scheme: dark;
  --bg: #000000;
  --rail: #000000;
  --panel: #0d0d0f;
  --panel-border: #1d1d20;
  --composer: #242424;
  --composer-line: #333333;
  --text: #f5f5f5;
  --muted: #a5a5a5;
  --soft: #18181a;
  --chip-line: #2a2a2d;
  --blue: #316dd9;
  --blue-hover: #4078ee;
  --drawer: #f8f9fb;
  --drawer-text: #20242a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, "Pretendard", "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg);
}

.side-rail {
  z-index: 40;
  display: flex;
  align-items: center;
  flex-direction: column;
  min-height: 100vh;
  padding: 17px 10px 18px;
  border-right: 1px solid #151515;
  background: var(--rail);
}

.rail-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

.rail-button {
  border: 0;
  background: transparent;
  color: #f1f1f1;
}

.rail-button span {
  display: block;
  width: 17px;
  height: 1.5px;
  border-radius: 99px;
  background: #f2f2f2;
}

.rail-button span + span {
  margin-top: 4px;
}

.rail-button:hover {
  background: #171717;
}

.rail-spacer {
  flex: 1;
}

.asset-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.34);
}

.asset-panel {
  position: fixed;
  top: 0;
  left: 58px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 318px;
  height: 100vh;
  padding: 20px 14px 16px;
  border-right: 1px solid var(--panel-border);
  background: #080808;
  box-shadow: 20px 0 48px rgba(0, 0, 0, 0.38);
  transform: translateX(-105%);
  transition: transform 180ms ease;
}

.asset-panel.open {
  transform: translateX(0);
}

.asset-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 7px;
}

.asset-header span {
  display: block;
  color: #777777;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.asset-header strong {
  display: block;
  margin-top: 5px;
  color: #f3f3f3;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.25;
}

.panel-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #d8d8d8;
  font-size: 24px;
}

.panel-close:hover {
  background: #1b1b1d;
}

.asset-search {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #252528;
  border-radius: 8px;
  outline: none;
  background: #111113;
  color: var(--text);
  font-size: 14px;
}

.asset-search:focus {
  border-color: #4a76d8;
}

.asset-search::placeholder {
  color: #777b82;
}

.asset-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  min-height: 0;
}

.asset-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 49px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #ececec;
  text-align: left;
}

.asset-item:hover,
.asset-item.active {
  border-color: #282a2f;
  background: #151517;
}

.asset-item strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-item span {
  color: #858991;
  font-size: 12px;
}

.load-status {
  margin: 0;
  padding: 2px;
  color: #777b82;
  font-size: 12px;
  line-height: 1.4;
}

.chat-stage {
  position: relative;
  display: flex;
  align-items: center;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  background: #000000;
}

.back-button {
  position: fixed;
  top: 18px;
  left: 78px;
  z-index: 15;
  display: none;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid #232326;
  border-radius: 18px;
  background: #080809;
  color: #e9e9e9;
  font-size: 13px;
  font-weight: 500;
}

.back-button:hover {
  background: #151517;
}

.chat-stage.has-answer .back-button,
.chat-stage.show-back .back-button {
  display: inline-flex;
  align-items: center;
}

.answer-panel {
  width: 100%;
  min-height: 0;
}

.hero-copy {
  padding-top: clamp(210px, 34.4vh, 331px);
  text-align: center;
}

.hero-copy h1 {
  margin: 0;
  color: #ffffff;
  font-size: 30px;
  font-weight: 400;
  line-height: 1.32;
}

.composer-wrap {
  width: min(862px, calc(100vw - 156px));
  margin-top: 39px;
}

.composer {
  display: grid;
  grid-template-columns: 43px minmax(0, 1fr) 43px;
  align-items: center;
  min-height: 58px;
  padding: 0 8px;
  border: 1px solid var(--composer-line);
  border-radius: 30px;
  background: var(--composer);
}

.question-input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: #f4f4f4;
  font-size: 16px;
  font-weight: 400;
}

.question-input::placeholder {
  color: #b6b6b6;
}

.plus-button,
.send-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  line-height: 1;
}

.plus-button {
  background: transparent;
  color: #ececec;
  font-size: 30px;
  font-weight: 300;
}

.plus-button:hover {
  background: #303030;
}

.send-button {
  background: var(--blue);
  color: white;
  font-size: 22px;
  font-weight: 650;
}

.send-button:hover {
  background: var(--blue-hover);
}

.quick-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 12px;
  margin-top: 26px;
}

.quick-options button {
  min-height: 44px;
  padding: 0 17px;
  border: 1px solid var(--chip-line);
  border-radius: 23px;
  background: #050505;
  color: #e5e5e5;
  font-size: 14px;
  font-weight: 400;
}

.quick-options button:hover {
  border-color: #3a3c42;
  background: #111113;
}

.chat-stage.has-answer {
  align-items: center;
  height: 100vh;
  overflow: hidden;
}

.chat-stage.has-answer .answer-panel {
  flex: 1;
  overflow-y: auto;
  width: min(860px, calc(100vw - 128px));
  min-height: 0;
  padding: 78px 0 24px;
}

.chat-stage.has-answer .hero-copy {
  padding-top: 0;
}

.chat-stage.has-answer .composer-wrap {
  width: min(862px, calc(100vw - 156px));
  flex-shrink: 0;
  margin: 0 0 34px;
}

.answer-card {
  color: #f1f1f1;
}

.answer-card h2 {
  margin: 0 0 15px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.35;
}

.answer-card p {
  margin: 0 0 14px;
  color: #d8d8d8;
  font-size: 15px;
  line-height: 1.78;
}

.answer-card .answer-meta {
  color: #888888;
  font-size: 12px;
  line-height: 1.45;
}

.answer-card ol {
  margin: 0 0 18px;
  padding-left: 22px;
  color: #d8d8d8;
  font-size: 15px;
  line-height: 1.78;
}

.evidence {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.evidence h3 {
  margin: 0 0 4px;
  color: #f2f2f2;
  font-size: 15px;
  font-weight: 650;
}

.evidence-item {
  padding: 13px 14px;
  border: 1px solid #242428;
  border-radius: 8px;
  background: #101012;
}

.evidence-item button {
  border: 0;
  padding: 0;
  background: transparent;
  color: #8ab4ff;
  font-weight: 700;
}

.evidence-item p {
  margin: 8px 0 0;
  color: #cfcfcf;
  font-size: 14px;
  line-height: 1.68;
}

.script-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 35;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(760px, calc(100vw - 58px));
  height: 100vh;
  border-left: 1px solid #d8dde5;
  background: var(--drawer);
  color: var(--drawer-text);
  box-shadow: -28px 0 60px rgba(0, 0, 0, 0.42);
  transform: translateX(100%);
  transition: transform 180ms ease;
}

.script-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid #dce1e8;
  background: #ffffff;
}

.drawer-header span {
  color: #8a5b18;
  font-size: 11px;
  font-weight: 900;
}

.drawer-header h2 {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 650;
}

.drawer-actions {
  display: flex;
  gap: 8px;
}

.drawer-button {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid #cbd3df;
  border-radius: 8px;
  background: #ffffff;
  color: #1f252d;
  font-weight: 700;
}

.drawer-button:hover {
  background: #eef2f6;
}

.script-viewer {
  overflow: auto;
  margin: 0;
  padding: 20px;
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: anywhere;
  color: #222831;
  font-family: "D2Coding", "Consolas", "Menlo", monospace;
  font-size: 13px;
  line-height: 1.72;
}

mark {
  border-radius: 4px;
  background: #ffe38c;
  color: inherit;
}

@media (max-width: 900px) {
  .composer-wrap,
  .chat-stage.has-answer .composer-wrap,
  .chat-stage.has-answer .answer-panel {
    width: calc(100vw - 104px);
  }
}

@media (max-width: 680px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-rail {
    position: fixed;
    inset: auto 0 0;
    min-height: 56px;
    height: 56px;
    padding: 9px 14px;
    border-top: 1px solid #151515;
    border-right: 0;
  }

  .asset-panel {
    left: 0;
    width: min(318px, 100vw);
  }

  .hero-copy {
    padding-top: 190px;
  }

  .hero-copy h1 {
    font-size: 25px;
  }

  .composer-wrap,
  .chat-stage.has-answer .composer-wrap,
  .chat-stage.has-answer .answer-panel {
    width: calc(100vw - 24px);
  }

  .script-drawer {
    width: 100vw;
  }

  .back-button {
    top: 14px;
    left: 14px;
  }
}
