:root {
  --bg-top: #eef7ff;
  --bg-bottom: #d7e9fb;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #ffffff;
  --text: #17324a;
  --muted: #59738e;
  --primary: #2c8fd6;
  --primary-dark: #1b6fa8;
  --accent: #d9eefc;
  --border: rgba(44, 143, 214, 0.16);
  --bot-bubble: #eff7fd;
  --user-bubble: #2c8fd6;
  --warning: #fff4e8;
  --shadow: 0 18px 50px rgba(39, 94, 148, 0.16);
  --radius-lg: 28px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Malgun Gothic", sans-serif;
  font-size: 14px;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.72), transparent 26%),
    radial-gradient(circle at bottom right, rgba(120, 186, 235, 0.24), transparent 28%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

button,
input {
  font: inherit;
}

.app-shell {
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 14px;
}

.phone-frame {
  width: 100%;
  max-width: 480px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 34px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero {
  padding: 10px 8px 6px;
}

.hero-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 14px;
}

.hero-logo img {
  display: block;
  width: min(220px, 70%);
  height: auto;
  object-fit: contain;
}

.hero h1 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  line-height: 1.1;
  text-align: center;
}

.subtitle {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
}

.notice-card,
.status-card {
  margin: 14px 4px 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #eef7ff, #f8fcff);
  border: 1px solid rgba(85, 145, 204, 0.2);
}

.notice-card strong {
  display: block;
}

.notice-list {
  margin: 8px 0 0;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.6;
}

.notice-list li + li {
  margin-top: 4px;
}

.question-emphasis {
  font-weight: 800;
  color: #174e8a;
}

.status-card {
  margin-top: 0;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 12px;
}

.chat-tools {
  display: flex;
  justify-content: flex-end;
  padding: 0 4px 8px;
}

.tool-button {
  min-height: 34px;
  padding: 8px 13px;
  border: 1px solid rgba(44, 143, 214, 0.2);
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--primary-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.tool-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(44, 143, 214, 0.13);
}

.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 360px;
  max-height: 52vh;
  overflow-y: auto;
  padding: 10px 4px 6px;
}

.message {
  max-width: 86%;
  padding: 13px 15px;
  border-radius: 20px;
  line-height: 1.55;
  white-space: pre-wrap;
  animation: fade-up 0.24s ease-out;
}

.message.bot {
  align-self: flex-start;
  background: var(--bot-bubble);
  border-top-left-radius: 8px;
}

.message.user {
  align-self: flex-end;
  background: var(--user-bubble);
  color: #fff;
  border-top-right-radius: 8px;
}

.message.error {
  align-self: flex-start;
  background: var(--warning);
  border: 1px solid #f2c59f;
  color: #733400;
}

.phone-link,
.external-link {
  color: inherit;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.message.bot .phone-link,
.message.bot .external-link {
  color: var(--primary-dark);
}

.message.user .phone-link,
.message.user .external-link {
  color: #fff;
}

.message.pending {
  display: inline-flex;
  flex-direction: column;
}

.pending-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
}

.pending-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.3;
  animation: dot-pulse 1.1s ease-in-out infinite;
}

.pending-dot:nth-child(2) {
  animation-delay: 0.18s;
}

.pending-dot:nth-child(3) {
  animation-delay: 0.36s;
}

.sources {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(44, 143, 214, 0.14);
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.source {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--primary-dark);
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 800;
}

.image-list {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(44, 143, 214, 0.14);
  display: grid;
  gap: 10px;
}

.image-card {
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(44, 143, 214, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.image-card img {
  display: block;
  width: 100%;
  height: auto;
  background: #dfeaf5;
  cursor: zoom-in;
}

.image-card img:focus {
  outline: 3px solid rgba(44, 143, 214, 0.32);
  outline-offset: -3px;
}

.image-card figcaption {
  padding: 9px 11px 11px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.modal-open {
  overflow: hidden;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  gap: 14px;
  padding: 52px 18px 24px;
  background: rgba(9, 22, 36, 0.82);
}

.image-modal[hidden] {
  display: none;
}

.image-modal img {
  display: block;
  max-width: min(1100px, 96vw);
  max-height: 78vh;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

.image-modal p {
  margin: 0;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.image-modal-close {
  position: fixed;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #17324a;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 4px 10px;
}

.chip {
  min-height: 36px;
  padding: 9px 13px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--primary-dark);
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
}

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

.composer input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 13px 15px;
  font-size: 14px;
  background: var(--panel-strong);
  outline: none;
}

.composer input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(44, 143, 214, 0.13);
}

.composer button {
  min-width: 62px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
}

.chip:disabled,
.tool-button:disabled,
.composer input:disabled,
.composer button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dot-pulse {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 10px;
  }

  .phone-frame {
    min-height: calc(100dvh - 20px);
    padding: 14px;
    border-radius: 24px;
  }

  .hero h1 {
    font-size: 21px;
  }

  .chat-panel {
    min-height: 320px;
    max-height: 48vh;
  }

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