/* IWillPassNCLEX AI Coach - student chat window */
:root {
  --brand: #0b5c7a;
  --brand-tint: color-mix(in srgb, var(--brand) 9%, #fff);
  --brand-soft: color-mix(in srgb, var(--brand) 18%, #fff);
  --brand-deep: color-mix(in srgb, var(--brand) 82%, #000);
  --ink: #14232b;
  --muted: #5a6a73;
  --canvas: #f3f6f8;
  --surface: #fff;
  --line: #dfe7eb;
  --good: #1a7f55;
  --good-tint: #e6f5ee;
  --warn: #b26a12;
  --warn-tint: #fdf2e1;
  --bad: #b93a34;
  --bad-tint: #fbeceb;
  --radius: 14px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--canvas); -webkit-text-size-adjust: 100%;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, #fff); outline-offset: 2px; }

.app { height: 100%; display: flex; flex-direction: column; max-width: 860px; margin: 0 auto; background: var(--surface); }
@media (min-width: 900px) { .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }

/* header */
.top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--brand); color: #fff; flex: none; }
.top .mark { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.16); display: grid; place-items: center; flex: none; }
.top h1 { font-size: 15.5px; line-height: 1.2; margin: 0; font-weight: 650; letter-spacing: .1px; }
.top .sub { font-size: 12px; opacity: .85; }
.top .grow { flex: 1; min-width: 0; }
.top .icon-btn { background: rgba(255,255,255,.14); border: 0; color: #fff; border-radius: 9px; padding: 7px 10px; font-size: 12.5px; white-space: nowrap; }
.top .icon-btn:hover { background: rgba(255,255,255,.26); }

/* scroll area */
.scroll { flex: 1; overflow-y: auto; padding: 16px; scroll-behavior: smooth; overscroll-behavior: contain; }
.hello { margin: 2px 0 14px; }
.hello h2 { font-size: 20px; margin: 0 0 2px; letter-spacing: -.2px; }
.hello p { margin: 0; color: var(--muted); }

/* progress card */
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px; margin-bottom: 14px; }
.progress { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.ring { --p: 0; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--brand-soft) 0); }
.ring > div { width: 66px; height: 66px; border-radius: 50%; background: #fff; display: grid; place-items: center; text-align: center; line-height: 1.05; }
.ring b { font-size: 20px; font-variant-numeric: tabular-nums; }
.ring small { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.progress h3 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 650; }
.meta { font-size: 13px; color: var(--muted); margin-top: 6px; }
.meta .up { color: var(--good); font-weight: 600; } .meta .down { color: var(--bad); font-weight: 600; }
.areas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width: 520px) { .areas { grid-template-columns: 1fr; } }
.areas h4 { margin: 0 0 6px; font-size: 12.5px; font-weight: 650; }
.chip { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; padding: 5px 9px; border-radius: 8px; margin-bottom: 4px; }
.chip.good { background: var(--good-tint); color: #0f5a3b; } .chip.weak { background: var(--warn-tint); color: #7a4708; }
.chip span:last-child { font-variant-numeric: tabular-nums; font-weight: 650; }
.none { font-size: 13px; color: var(--muted); }

/* quick actions */
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-bottom: 16px; }
.quick button { text-align: left; background: var(--brand-tint); border: 1px solid var(--brand-soft); color: var(--brand-deep);
  border-radius: 11px; padding: 10px 12px; font-weight: 600; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.quick button:hover { background: var(--brand-soft); }
.quick button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.quick button.primary:hover { background: var(--brand-deep); }
.quick .ic { flex: none; width: 18px; text-align: center; }

/* messages */
.msgs { display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 5px; white-space: pre-wrap; }
.msg.bot { align-self: flex-start; background: var(--canvas); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg.bot.error { background: var(--bad-tint); border-color: #f0cfcc; color: #7d2520; }
.msg h5 { margin: 12px 0 4px; font-size: 12.5px; letter-spacing: .6px; text-transform: uppercase; color: var(--brand-deep); }
.msg h5:first-child { margin-top: 0; }
.msg p { margin: 0 0 8px; } .msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 0 0 8px; padding-left: 20px; } .msg li { margin: 2px 0; }
.msg .ok { color: var(--good); font-weight: 600; } .msg .flag { color: var(--warn); font-weight: 600; }
.msg .src { margin-top: 8px; font-size: 12px; color: var(--muted); }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .35; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: .9; } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; } .scroll { scroll-behavior: auto; } }

/* practice question */
.pq { align-self: stretch; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: #fff; }
.pq .tag { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 650; display: flex; justify-content: space-between; gap: 8px; }
.pq .stem { margin: 8px 0 12px; font-weight: 550; }
.pq .opt { display: flex; gap: 10px; width: 100%; text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 11px; padding: 10px 12px; margin-bottom: 8px; }
.pq .opt:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-tint); }
.pq .opt:disabled { cursor: default; opacity: 1; }
.pq .opt b { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--canvas); display: grid; place-items: center; font-size: 12.5px; }
.pq .opt.right { border-color: var(--good); background: var(--good-tint); } .pq .opt.right b { background: var(--good); color: #fff; }
.pq .opt.wrong { border-color: var(--bad); background: var(--bad-tint); } .pq .opt.wrong b { background: var(--bad); color: #fff; }
.pq .opt small { display: block; color: var(--muted); margin-top: 3px; font-size: 13px; }
.pq .verdict { font-weight: 700; margin: 6px 0; } .pq .verdict.right { color: var(--good); } .pq .verdict.wrong { color: var(--bad); }
.pq .why h5 { margin: 10px 0 3px; font-size: 12.5px; letter-spacing: .6px; text-transform: uppercase; color: var(--brand-deep); }
.pq .why p { margin: 0; }
.pq .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.btn { background: var(--brand); color: #fff; border: 0; border-radius: 10px; padding: 9px 16px; font-weight: 600; }
.btn:hover { background: var(--brand-deep); } .btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--brand-deep); border: 1.5px solid var(--brand-soft); }
.btn.ghost:hover { background: var(--brand-tint); }

/* composer */
.composer { flex: none; border-top: 1px solid var(--line); padding: 10px 12px calc(8px + env(safe-area-inset-bottom)); background: #fff; }
.composer form { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; max-height: 140px; min-height: 44px; background: var(--canvas); }
.composer textarea:focus { outline: none; border-color: var(--brand); background: #fff; }
.composer .send { height: 44px; min-width: 76px; }
.foot { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--muted); margin-top: 6px; }

/* sign-in + lock screens */
.gate { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: var(--canvas); }
.gate-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 26px 22px; text-align: center; }
.gate-icon { width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand); }
.gate-icon svg { width: 28px; height: 28px; }
.gate-card.lock .gate-icon { background: var(--warn-tint); color: var(--warn); }
.gate-card h1 { font-size: 20px; margin: 0 0 8px; letter-spacing: -.2px; }
.gate-card p { color: var(--muted); margin: 0 0 14px; }
.gate-card label { display: block; text-align: left; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.gate-card input { width: 100%; border: 1.5px solid var(--line); border-radius: 11px; padding: 11px 12px; margin-bottom: 12px; font-size: 16px; }
.gate-card input:focus { outline: none; border-color: var(--brand); }
.gate-card input.code { text-align: center; letter-spacing: 8px; font-size: 22px; font-variant-numeric: tabular-nums; }
.gate-card .btn { width: 100%; padding: 12px; }
.gate-card .link { background: none; border: 0; color: var(--brand); text-decoration: underline; margin-top: 12px; font-size: 13.5px; }
.gate-card .err { color: var(--bad); font-size: 13.5px; margin: -4px 0 10px; text-align: left; }
.gate-card .note { font-size: 12.5px; margin-top: 14px; margin-bottom: 0; }
.loading { height: 100%; display: grid; place-items: center; color: var(--muted); }

@media (max-width: 480px) {
  .top { padding: 10px 12px; gap: 8px; }
  .top .sub { display: none; }
  .top h1 { font-size: 14.5px; }
  .top .icon-btn { padding: 7px 8px; font-size: 12px; }
  .scroll { padding: 14px 12px; }
  .msg { max-width: 94%; }
  .foot span:first-child { display: none; }
  .foot { justify-content: flex-end; }
}
