:root {
  --brand: #1c4587;
  --brand-dark: #123262;
  --text-muted: #6b7280;
  --radius: 18px;
}

/* Hard rule: whenever [hidden] is set, it must win over any utility class
   (Tailwind's .flex / .flex-col also just set `display`, and being a class
   selector it can otherwise tie/beat the browser's own [hidden] rule). */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
}

/* ---- PIN pad ---- */
.pin-digit {
  width: 44px;
  height: 54px;
  border-radius: 12px;
  border: 1px solid #e2e6ef;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--brand-dark);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pin-digit:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(28, 69, 135, 0.1);
}
#pin-boxes.shake { animation: shake 0.4s ease; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

/* ---- Card / screen entrance ---- */
.fade-up { animation: fadeUp 0.45s cubic-bezier(.2,.8,.2,1) both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Topic option cards (built in app.js) ---- */
.topic-option {
  animation: fadeUp 0.4s cubic-bezier(.2,.8,.2,1) both;
}

/* ---- Chat message bubbles ---- */
.msg {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: 0 2px 10px rgba(20, 30, 60, 0.06);
  animation: msgIn 0.25s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  border-bottom-right-radius: 6px;
}
.msg.bot {
  align-self: flex-start;
  background: #fff;
  color: #1c2230;
  border: 1px solid #eef0f5;
  border-bottom-left-radius: 6px;
}
.msg.system {
  align-self: center;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  box-shadow: none;
  padding: 4px 10px;
}

/* ---- Typing indicator (3 bouncing dots) ---- */
.typing-dots { display: inline-flex; gap: 4px; align-items: center; height: 14px; padding: 2px 4px; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted);
  animation: dotBounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dotBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---- Messages list ---- */
#messages { scroll-behavior: smooth; }
#messages::-webkit-scrollbar { width: 6px; }
#messages::-webkit-scrollbar-thumb { background: #d7dce6; border-radius: 999px; }

/* ---- Input bar safe-area padding (notch phones) ---- */
.chat-input-bar { padding-bottom: calc(0.75rem + env(safe-area-inset-bottom)); }
