:root {
  color-scheme: light;
  --bg: #d1d1d1;
  --sidebar: #eeeeee;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --surface-alt: #f7f7f7;
  --text: #191919;
  --muted: #5d5d5d;
  --line: rgba(132, 132, 132, 0.34);
  --accent: #d33f35;
  --accent-dark: #ad2f28;
  --danger: #b42318;
}

@font-face {
  font-family: "DOSSamgukji3";
  src:
    url("./fonts/DOSSamgukji3.woff2") format("woff2"),
    url("./fonts/DOSSamgukji3.ttf") format("truetype");
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "DOSSamgukji3", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  font-size: 17px;
}

button,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
  padding: 20px;
  gap: 16px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: calc(100vh - 40px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--sidebar);
  padding: 18px;
  box-shadow: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
}

.brand-mark,
.avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 8px;
  background:
    url("./assets/site-icon.png") center / 88% auto no-repeat,
    rgba(255, 253, 250, 0.72);
  color: transparent;
  font-weight: 800;
}

.brand-mark {
  border: 1px solid rgba(217, 120, 87, 0.24);
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.new-chat {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  padding: 0 14px;
  color: var(--text);
  font-weight: 700;
}

.new-chat:hover {
  background: #f4f4f4;
}

.new-chat span {
  font-size: 22px;
  line-height: 1;
}

.field {
  display: grid;
  gap: 8px;
  padding: 2px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 11px 12px;
}

.quick-guide {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.quick-guide p {
  margin: 0;
}

.quick-guide p + p {
  margin-top: 10px;
}

.chat {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: calc(100vh - 40px);
  overflow: hidden;
  border: 1px solid rgba(90, 90, 90, 0.22);
  border-radius: 8px;
  background: #f7f7f7;
  box-shadow: none;
}

.topbar {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: #ededed;
  padding: 10px 22px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.topbar h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
  letter-spacing: 0;
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 7px 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.error {
  border-color: rgba(180, 35, 24, 0.28);
  color: var(--danger);
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 20px;
  background: #d1d1d1;
}

.message {
  display: grid;
  grid-template-columns: 36px minmax(0, 820px);
  justify-content: center;
  gap: 12px;
  padding: 0;
}

.message.assistant {
  background: transparent;
}

.message.user {
  background: transparent;
}

.message.user .avatar {
  background: #4f5f66;
  color: #ffffff;
}

.bubble-wrap {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.bubble {
  min-width: 0;
  border: 1px solid rgba(120, 120, 120, 0.22);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px 16px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.72;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.04);
}

.message.user .bubble {
  background: #f4f4f4;
}

.copy-button {
  justify-self: start;
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 4px 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.copy-button:hover {
  color: var(--text);
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 820px);
  justify-content: center;
  border-top: 1px solid var(--line);
  background: #eeeeee;
  padding: 14px 20px 18px;
}

.composer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
  border: 1px solid rgba(120, 120, 120, 0.3);
  border-radius: 8px;
  background: var(--surface-solid);
  padding: 8px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.composer textarea {
  max-height: 220px;
  min-height: 62px;
  resize: none;
  border: 0;
  padding: 6px 8px;
  color: var(--text);
  background: transparent;
  line-height: 1.62;
  outline: none;
}

.composer button {
  align-self: end;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
  font-size: 15px;
}

.composer button:hover {
  background: var(--accent-dark);
}

.composer button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

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

  .sidebar {
    min-height: auto;
  }

  .quick-guide {
    margin-top: 0;
  }

  .chat {
    min-height: 75vh;
  }

  .message {
    grid-template-columns: 36px minmax(0, 1fr);
    justify-content: stretch;
    padding: 0;
  }

  .topbar,
  .composer {
    padding-right: 16px;
    padding-left: 16px;
  }

  .composer-inner {
    grid-template-columns: 1fr;
  }

  .messages {
    padding: 16px;
  }
}
