@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=SUIT:wght@400;500;700&display=swap");

:root {
  --bg: #f6f4ef;
  --ink: #181a1f;
  --panel: rgba(255, 255, 255, 0.74);
  --line: rgba(24, 26, 31, 0.12);
  --strong: #0f796b;
  --strong-2: #1d4ed8;
  --accent: #ef6c3f;
  --muted: #556273;
  --shadow: 0 24px 50px rgba(17, 28, 45, 0.15);
}

* {
  box-sizing: border-box;
}

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

body {
  position: relative;
  overflow-x: hidden;
  color: var(--ink);
  font: 16px/1.6 "SUIT", "Noto Sans KR", sans-serif;
  background: linear-gradient(130deg, #fdfcf9 0%, #eff6ff 45%, #f8efe7 100%);
}

.bg-layer {
  position: fixed;
  z-index: 0;
  width: 52vw;
  height: 52vw;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(3px);
  opacity: 0.65;
}

.bg-a {
  top: -22vw;
  right: -16vw;
  background: radial-gradient(circle, #7fd4c6 0%, transparent 64%);
  animation: driftA 16s ease-in-out infinite;
}

.bg-b {
  bottom: -28vw;
  left: -18vw;
  background: radial-gradient(circle, #ffc8a7 0%, transparent 68%);
  animation: driftB 18s ease-in-out infinite;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  padding: 28px 20px 22px;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 14px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  border-radius: 22px;
  padding: 22px 24px;
  animation: riseIn 420ms ease-out both;
}

.hero-copy h1 {
  margin: 6px 0 8px;
  font: 700 clamp(24px, 3.2vw, 36px)/1.15 "Space Grotesk", "SUIT", sans-serif;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0;
  color: var(--strong-2);
  font: 700 12px/1 "Space Grotesk", sans-serif;
  letter-spacing: 0.18em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

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

.ghost-btn,
.send-btn,
.quick-btn {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  font: 600 14px/1 "SUIT", sans-serif;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.ghost-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(32, 56, 88, 0.12);
}

.status-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  color: #1f2937;
  font: 600 12px/1 "SUIT", sans-serif;
}

.badge.loading::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  animation: blink 1s linear infinite;
}

.badge.ok::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
}

.badge.error::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #dc2626;
}

.badge.subtle::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3b82f6;
}

.chat-log {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  padding: 14px;
  overflow: auto;
}

.msg {
  margin: 0 0 10px;
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  transform-origin: bottom;
  animation: msgIn 220ms ease-out both;
}

.msg.user {
  margin-left: auto;
  border: 1px solid #f2b8a2;
  background: linear-gradient(145deg, #ffe9df, #ffd6c4);
}

.msg.bot {
  margin-right: auto;
  border: 1px solid #9fd8d0;
  background: linear-gradient(145deg, #e4faf6, #d3f5ed);
}

.meta {
  color: #6b7280;
  font-size: 12px;
  margin-bottom: 3px;
}

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

.quick-btn {
  background: rgba(255, 255, 255, 0.74);
  color: #22334e;
}

.quick-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(19, 42, 73, 0.12);
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.composer input {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font: 500 15px/1.2 "SUIT", sans-serif;
  outline: none;
}

.composer input:focus {
  border-color: rgba(15, 121, 107, 0.55);
  box-shadow: 0 0 0 4px rgba(15, 121, 107, 0.12);
}

.send-btn {
  border: none;
  background: linear-gradient(145deg, var(--strong-2), var(--strong));
  color: white;
  min-width: 98px;
}

.send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(17, 71, 138, 0.26);
}

.api-dialog {
  border: none;
  border-radius: 16px;
  width: min(460px, calc(100vw - 30px));
  padding: 0;
}

.api-dialog::backdrop {
  background: rgba(15, 23, 42, 0.44);
}

.api-dialog-form {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.api-dialog-form h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

.api-dialog-form p {
  margin: 0;
  color: var(--muted);
}

.api-dialog-form input {
  border: 1px solid #d4d8e0;
  border-radius: 10px;
  padding: 10px 12px;
}

.api-dialog-form menu {
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

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

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes driftA {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(-18px, 14px, 0);
  }
}

@keyframes driftB {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(14px, -14px, 0);
  }
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 18px 12px 16px;
  }

  .hero {
    flex-direction: column;
    padding: 16px;
  }

  .hero-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .msg {
    max-width: 94%;
  }
}
