:root {
  --bg: #eef7fb;
  --card: #ffffff;
  --ink: #17313b;
  --muted: #61747d;
  --brand: #0284a8;
  --brand-dark: #036780;
  --demo-gold: #d99a16;
  --demo-gold-dark: #b7790d;
  --demo-gold-soft: #fff4d6;
  --soft: #e3f4f8;
  --danger-bg: #fff4e5;
  --danger-border: #ffb454;
  --line: #d7e7ec;
  --shadow: 0 18px 50px rgba(20, 67, 84, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #cff6ff 0, transparent 32%),
    linear-gradient(135deg, #f7fcff 0%, var(--bg) 100%);
}

.shell {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 18px;
}

.card {
  min-height: calc(100vh - 36px);
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chatbot-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 12px 18px 18px;
  color: var(--muted);
  font-size: 12px;
}

.chatbot-footer span {
  display: inline-flex;
  align-items: center;
}

.chatbot-footer span + span::before {
  content: "";
  width: 5px;
  height: 5px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--line);
}

.header {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #048eb3, #0fb9a4);
  color: white;
}

.chatbot-logo-frame {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 35% 25%, rgba(255,255,255,0.95), rgba(255,255,255,0.76) 48%, rgba(209,250,244,0.94) 100%);
  box-shadow:
    0 14px 30px rgba(4, 78, 103, 0.22),
    inset 0 1px 0 rgba(255,255,255,0.82);
  overflow: hidden;
}

.chatbot-logo-frame::before {
  content: "";
  width: 31px;
  height: 23px;
  border: 4px solid #048eb3;
  border-radius: 13px;
  background: rgba(255,255,255,0.58);
  box-sizing: border-box;
}

.chatbot-logo-frame::after {
  content: "";
  position: absolute;
  left: 19px;
  bottom: 15px;
  width: 11px;
  height: 11px;
  border-left: 4px solid #048eb3;
  border-bottom: 4px solid #048eb3;
  transform: rotate(-24deg);
  border-bottom-left-radius: 4px;
}

.logo {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  background: white;
  object-fit: cover;
}

.logo.logo-load-failed {
  display: none;
}

.chatbot-logo-frame:has(.logo:not(.logo-load-failed))::before,
.chatbot-logo-frame:has(.logo:not(.logo-load-failed))::after {
  display: none;
}

.chatbot-logo-frame .logo {
  object-fit: contain;
  padding: 5px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,0.96), rgba(210,250,245,0.88) 62%, rgba(4,132,168,0.12) 100%);
  filter:
    drop-shadow(0 8px 14px rgba(3, 103, 128, 0.22))
    drop-shadow(0 0 10px rgba(33, 216, 255, 0.18));
}

h1,
h2,
p {
  margin: 0;
}

.header h1 {
  font-size: 22px;
  margin-bottom: 4px;
}

.header p {
  opacity: 0.9;
  font-size: 14px;
}

.emergency {
  margin: 16px 18px 0;
  padding: 13px 14px;
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
}

.consent-area {
  margin: 16px 18px 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: #fbfeff;
  border-radius: 16px;
}

.consent-area h2 {
  font-size: 18px;
  margin-bottom: 10px;
}

.consent-area p {
  margin: 0 0 10px;
  line-height: 1.45;
  color: var(--ink);
}

.consent-area button {
  margin-top: 6px;
  width: 100%;
}

.consent-actions {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.demo-area {
  margin: 16px 18px 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: #fbfeff;
  border-radius: 16px;
}

.demo-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--demo-gold-soft);
  color: #7a4b06;
  font-size: 12px;
  font-weight: 800;
}

.demo-area h2 {
  font-size: 18px;
  margin-bottom: 10px;
}

.demo-area p {
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 12px;
}

.demo-flow {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.demo-step {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
}

.demo-step strong,
.demo-step span {
  display: block;
}

.demo-step strong {
  margin-bottom: 4px;
}

.demo-step span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.demo-chat-preview {
  max-height: 260px;
  overflow-y: auto;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f7fcff;
}

.progress-wrap {
  padding: 16px 18px 4px;
}

.progress-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.progress-bar {
  height: 8px;
  background: #e8f1f4;
  border-radius: 999px;
  overflow: hidden;
}

#progressFill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #09a4c2, #23c39b);
  transition: width 0.25s ease;
}

.chat {
  flex: 1;
  padding: 14px 18px;
  overflow-y: auto;
  min-height: 240px;
}

.bubble {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 18px;
  margin: 10px 0;
  line-height: 1.45;
  white-space: pre-wrap;
}

.bot {
  background: var(--soft);
  border-top-left-radius: 6px;
}

.patient {
  margin-left: auto;
  background: var(--brand);
  color: white;
  border-top-right-radius: 6px;
}

.answer-area {
  border-top: 1px solid var(--line);
  padding: 14px 18px 18px;
}

.choices {
  display: grid;
  gap: 9px;
  margin-bottom: 12px;
}

.language-choice-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.language-choice-button {
  min-height: 48px;
  border: 2px solid rgba(4, 127, 163, 0.2);
  background: #ffffff;
  color: var(--brand-dark);
  font-weight: 800;
}

.language-choice-button:hover,
.language-choice-button:focus-visible {
  border-color: var(--brand);
  background: #e8f6fa;
  outline: none;
}

button {
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: white;
  padding: 11px 14px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--brand-dark);
}

.demo-button {
  background: var(--demo-gold);
  color: #ffffff;
}

.demo-button:hover {
  background: var(--demo-gold-dark);
}

.test-button {
  background: #7c3aed;
  color: #ffffff;
}

.test-button:hover {
  background: #5b21b6;
}

.test-mode-note {
  margin-top: 10px;
  color: #5b21b6;
  font-size: 13px;
  line-height: 1.45;
}

.test-mode-banner {
  margin: 14px 18px 0;
  padding: 10px 12px;
  border: 1px solid rgba(124, 58, 237, 0.28);
  border-radius: 14px;
  background: #f5f3ff;
  color: #4c1d95;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-align: center;
}

.choice-button {
  text-align: left;
  background: #f5fbfd;
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 600;
}

.choice-button:hover {
  background: #e8f6fa;
}

@media (max-width: 560px) {
  .language-choice-grid {
    grid-template-columns: 1fr;
  }
}

.suggestion-hint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  margin: 2px 0 4px;
}

.suggestion-chip {
  text-align: left;
  background: #fff7ed;
  color: #7c2d12;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  padding: 10px 12px;
  font-weight: 800;
}

.suggestion-chip:hover {
  background: #ffedd5;
}

.secondary {
  background: #e7eef1;
  color: var(--ink);
}

.secondary:hover {
  background: #d8e4e8;
}

.text-form {
  display: flex;
  gap: 10px;
}

input {
  flex: 1;
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 16px;
}

.nav-row {
  margin-top: 10px;
}

.final-area,
.done-area {
  padding: 18px;
  border-top: 1px solid var(--line);
}

.final-area h2,
.done-area h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

.review-list {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fbfeff;
}

.review-item {
  padding: 8px 0;
  border-bottom: 1px solid #edf3f5;
}

.review-item:last-child {
  border-bottom: 0;
}

.review-title {
  font-size: 12px;
  color: var(--muted);
}

.review-answer {
  margin-top: 3px;
  font-weight: 700;
}

.final-buttons {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.hidden {
  display: none !important;
}

@media (max-width: 560px) {
  .shell {
    padding: 0;
  }

  .card {
    min-height: 100vh;
    border-radius: 0;
  }

  .text-form {
    flex-direction: column;
  }

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