:root {
  --bg: #f5f3ee; --surface: #ffffff; --ink: #172624; --muted: #5d6b68; --line: #e3e0d8;
  --brand: #0f5a52; --brand-2: #127a6d; --brand-soft: #e2f0ec; --accent: #d9902b; --accent-soft: #fbf0de;
  --danger: #b3413a; --radius: 18px; --shadow: 0 1px 2px rgba(20,40,36,.06), 0 8px 28px rgba(20,40,36,.07);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---- Top bar ---- */
.top { height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.mark { width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: grid; place-items: center; flex: none; }
.mark svg { width: 18px; height: 18px; }
.title { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.sub { font-size: 12px; color: var(--muted); margin-top: -2px; }
.top .grow { flex: 1; }
.brandtag { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--ink); }
.icon-btn:hover { background: var(--bg); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---- Layout ---- */
.app { height: calc(100% - 60px); display: grid; grid-template-columns: minmax(340px, 44%) 1fr; }
.stage { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px; gap: 16px;
  background: radial-gradient(120% 90% at 50% 20%, #e9f3ef 0%, #dde9e4 55%, #d2e1db 100%); border-right: 1px solid var(--line); overflow: hidden; }
.portrait { position: relative; width: min(100%, 420px, 52vh); aspect-ratio: 3/4; border-radius: 28px; overflow: hidden; background: #dfe9e4; box-shadow: 0 20px 50px rgba(15,70,62,.18); }
.portrait .avatar-svg, .portrait .avatar-photo { width: 100%; height: 100%; display: block; object-fit: cover; }
.portrait::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 3px transparent; transition: box-shadow .3s; pointer-events: none; }
.portrait[data-state=listening]::after { box-shadow: inset 0 0 0 3px var(--accent); animation: pulse 1.6s ease-in-out infinite; }
.portrait[data-state=speaking]::after { box-shadow: inset 0 0 0 3px rgba(18,122,109,.55); }
@keyframes pulse { 50% { box-shadow: inset 0 0 0 6px rgba(217,144,43,.45); } }
.nameplate { position: absolute; left: 14px; right: 14px; bottom: 14px; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px;
  background: rgba(255,255,255,.86); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.nameplate b { display: block; font-size: 14px; }
.nameplate span { display: block; font-size: 12px; color: var(--muted); }
.nameplate .grow { flex: 1; }
.pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.pill[data-s=listening] { background: var(--accent-soft); color: #95600f; }
.pill[data-s=thinking] { background: #eceaf6; color: #4b4592; }
.dots i { display: inline-block; width: 4px; height: 4px; margin-left: 2px; border-radius: 50%; background: currentColor; animation: dot 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 50% { opacity: .2; transform: translateY(-2px); } }
.caption { position: relative; height: 7.3em; overflow: hidden; scroll-behavior: smooth; max-width: 520px; text-align: center; font-size: 17px; line-height: 1.45; color: #36504b; }
.caption .w { transition: color .12s; color: #9fb2ad; }
.caption .w.on { color: var(--ink); }

/* ---- Conversation ---- */
.chat { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.log { flex: 1; overflow-y: auto; padding: 24px clamp(16px, 4vw, 48px); display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 640px; display: flex; gap: 10px; align-items: flex-end; animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.msg .bubble { padding: 12px 16px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); white-space: pre-wrap; }
.msg.coach .bubble { border-bottom-left-radius: 6px; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg.me .bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 6px; }
.msg .who { width: 30px; height: 30px; border-radius: 50%; flex: none; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.msg.me .who { background: #dfe6f3; color: #34507e; }
.msg .label { font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 3px; text-transform: uppercase; letter-spacing: .04em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 0 40px; }
.chip { border: 1px solid var(--brand); color: var(--brand); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600; }
.chip:hover { background: var(--brand-soft); }

/* ---- Composer ---- */
.composer { padding: 14px clamp(16px, 4vw, 48px) 18px; border-top: 1px solid var(--line); background: var(--surface); }
.hint { font-size: 13px; color: var(--muted); min-height: 1.4em; margin-bottom: 8px; }
.hint.warn { color: var(--danger); }
.row { display: flex; align-items: flex-end; gap: 10px; }
.field { flex: 1; display: flex; align-items: flex-end; border: 1.5px solid var(--line); border-radius: 16px; background: var(--bg); padding: 4px 4px 4px 14px; transition: border-color .15s; }
.field:focus-within { border-color: var(--brand-2); background: var(--surface); }
textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; font: inherit; padding: 10px 0; max-height: 140px; color: var(--ink); }
.send { width: 42px; height: 42px; border-radius: 12px; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; }
.send:disabled { background: #c8d3d0; cursor: default; }
.send svg { width: 18px; height: 18px; }
.mic { width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 6px 18px rgba(217,144,43,.35); transition: transform .12s; }
.mic:active { transform: scale(.95); }
.mic svg { width: 24px; height: 24px; }
.mic.on { background: var(--danger); box-shadow: 0 0 0 0 rgba(179,65,58,.5); animation: ring 1.4s infinite; }
@keyframes ring { 70% { box-shadow: 0 0 0 14px rgba(179,65,58,0); } }
.mic:disabled, .send:disabled { opacity: .55; }

/* ---- Overlays ---- */
.overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(16,36,33,.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.card { width: min(100%, 460px); background: var(--surface); border-radius: 24px; padding: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.card h1 { font-size: 24px; line-height: 1.25; margin: 0 0 8px; letter-spacing: -.02em; }
.card p { margin: 0 0 16px; color: var(--muted); }
.card ul { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 10px; }
.card li { display: flex; gap: 10px; align-items: flex-start; }
.card li i { flex: none; width: 24px; height: 24px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-style: normal; font-size: 13px; font-weight: 700; }
.primary { width: 100%; border: 0; border-radius: 14px; padding: 14px; background: var(--brand); color: #fff; font-weight: 700; font-size: 16px; }
.primary:hover { background: var(--brand-2); }
.fine { font-size: 12px; color: var(--muted); margin-top: 12px; text-align: center; }
.pin { width: 100%; font: 600 24px/1 var(--font); letter-spacing: .4em; text-align: center; padding: 14px; border: 1.5px solid var(--line); border-radius: 14px; margin-bottom: 10px; }
.err { color: var(--danger); font-size: 13px; min-height: 1.3em; margin-bottom: 8px; }

/* ---- Mobile ---- */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .stage { padding: 12px 16px 10px; gap: 8px; border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; }
  .portrait { width: 34vw; max-width: 170px; border-radius: 18px; flex: none; }
  .nameplate { left: 6px; right: 6px; bottom: 6px; padding: 5px 8px; border-radius: 10px; }
  .nameplate span, .nameplate .pill { display: none; }
  .nameplate b { font-size: 12px; }
  .caption { font-size: 15px; text-align: left; flex: 1; height: auto; max-height: 8.7em; }
  .brandtag { display: none; }
  .top { padding: 0 12px; }
  .log { padding: 16px; }
  .composer { padding: 10px 12px 14px; }
}

/* ---- Role play ---- */
.portrait[data-inrole] { box-shadow: 0 20px 50px rgba(150,96,15,.22), 0 0 0 4px var(--accent); }
.rolebadge { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px;
  background: rgba(38,26,8,.72); color: #fff; font-size: 13px; line-height: 1.3; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transform: translateY(-8px); opacity: 0; transition: .3s; pointer-events: none; }
.portrait[data-inrole] .rolebadge { transform: none; opacity: 1; }
.rolebadge i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(217,144,43,.35); }
.rolebadge b { font-weight: 700; }

.strip { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px clamp(16px, 4vw, 48px); background: var(--surface); border-bottom: 1px solid var(--line); font-size: 13px; }
.strip .sc { font-weight: 700; }
.strip .grow { flex: 1; }
.strip .turns { color: var(--muted); white-space: nowrap; }
.mood { display: flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--muted); }
.mood .bar { display: flex; gap: 3px; }
.mood .bar span { width: 16px; height: 6px; border-radius: 3px; background: var(--line); transition: background .4s; }
.mood b { color: var(--ink); min-width: 64px; }
.mood[data-m="0"] .bar span:nth-child(-n+1) { background: #c9483f; }
.mood[data-m="1"] .bar span:nth-child(-n+2) { background: #de7a36; }
.mood[data-m="2"] .bar span:nth-child(-n+3) { background: #d9a92b; }
.mood[data-m="3"] .bar span:nth-child(-n+4) { background: #7bab4c; }
.mood[data-m="4"] .bar span:nth-child(-n+5) { background: #2f8f5b; }

.msg.cust .who { background: var(--accent-soft); color: #95600f; }
.msg.cust .bubble { background: #fffaf1; border: 1px solid #f1dfbd; box-shadow: none; border-bottom-left-radius: 6px; }
.msg.cust .label { color: #95600f; }
.msg.scene .bubble { background: var(--brand-soft); box-shadow: none; }

.coachcard { margin: -4px 0 4px 40px; max-width: 600px; border-left: 3px solid var(--brand-2); background: var(--surface); border-radius: 4px 14px 14px 4px; padding: 12px 14px; box-shadow: var(--shadow); font-size: 14px; animation: rise .3s ease-out; }
.coachcard .cc-h { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--brand); margin-bottom: 4px; }
.coachcard .cc-note { font-weight: 500; margin-bottom: 8px; }
.coachcard .cc-row { display: flex; gap: 8px; margin: 3px 0; color: #34433f; }
.coachcard .cc-row i { flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 700; margin-top: 1px; }
.coachcard .good i { background: #e1f1e7; color: #2f8f5b; }
.coachcard .miss i { background: #fbeadf; color: #b95a1c; }
.coachcard .cc-try { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--bg); color: #34433f; }
.coachcard .cc-try b { color: var(--brand); font-weight: 700; }
.coachcard .cc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.coachcard .tag { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); display: inline-flex; align-items: center; gap: 6px; }
.coachcard .tag .dots5 { display: inline-flex; gap: 2px; }
.coachcard .tag .dots5 span { width: 5px; height: 5px; border-radius: 50%; background: var(--line); }
.coachcard .tag[data-s="1"] .dots5 span:nth-child(-n+1), .coachcard .tag[data-s="2"] .dots5 span:nth-child(-n+2) { background: #de7a36; }
.coachcard .tag[data-s="3"] .dots5 span:nth-child(-n+3) { background: #d9a92b; }
.coachcard .tag[data-s="4"] .dots5 span:nth-child(-n+4), .coachcard .tag[data-s="5"] .dots5 span:nth-child(-n+5) { background: #2f8f5b; }
.chip[disabled] { border-color: var(--line); color: var(--muted); cursor: default; background: transparent; }
.chip small { font-weight: 500; opacity: .8; }
@media (max-width: 820px) {
  .rolebadge { top: 6px; left: 6px; right: 6px; padding: 4px 6px; font-size: 10px; }
  .rolebadge span { display: none; }
  .coachcard { margin-left: 0; }
  .strip { padding: 8px 16px; gap: 8px; }
  .strip .sc { width: 100%; }
}

/* ---- Ask Asha ---- */
.hintrow { display: flex; align-items: center; gap: 10px; min-height: 1.4em; margin-bottom: 8px; }
.hintrow .hint { margin: 0; flex: 1; }
.askbtn { border: 1px solid var(--brand); background: var(--surface); color: var(--brand); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.askbtn:hover { background: var(--brand-soft); }
.msg.tip .bubble { background: var(--brand-soft); box-shadow: none; }

/* ---- Decision moment ---- */
.decision { margin: 2px 0 4px 40px; max-width: 620px; display: grid; gap: 8px; animation: rise .3s ease-out; }
.decision .opt { text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px 14px; font-size: 14.5px; color: var(--ink); display: flex; gap: 10px; align-items: flex-start; transition: border-color .15s, background .15s; }
.decision .opt:hover:not([disabled]) { border-color: var(--brand-2); background: #f7fbfa; }
.decision .opt b { flex: none; width: 24px; height: 24px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 13px; }
.decision .opt[disabled] { cursor: default; opacity: .55; }
.decision .opt.picked { opacity: 1; border-color: var(--brand-2); }
.decision .opt.picked[data-q=best] { border-color: #2f8f5b; background: #eef8f2; }
.decision .opt.picked[data-q=partial] { border-color: #d9a92b; background: #fdf8ea; }
.decision .opt.picked[data-q=poor] { border-color: #c9483f; background: #fcefed; }
.decision .opt.reveal[data-q=best] { opacity: 1; border-style: dashed; border-color: #2f8f5b; }
.verdict { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; margin-bottom: 4px; }
.verdict[data-q=best] { background: #e1f1e7; color: #23714a; }
.verdict[data-q=partial] { background: #fbf0d6; color: #8a6510; }
.verdict[data-q=poor] { background: #fbe3e0; color: #a3352e; }
.timeout { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #4b4592; }

/* ---- Report ---- */
.report { background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); padding: clamp(18px, 3vw, 28px); max-width: 760px; width: 100%; animation: rise .35s ease-out; }
.rp-kicker { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.rp-head { display: flex; gap: 18px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.rp-head h2 { margin: 4px 0 0; font-size: 19px; line-height: 1.35; letter-spacing: -.01em; }
.rp-score { flex: none; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; text-align: center; background: conic-gradient(var(--band) calc(var(--pct) * 1%), var(--line) 0); position: relative; }
.rp-score::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--surface); }
.rp-score div { position: relative; line-height: 1.05; }
.rp-score b { font-size: 24px; }
.rp-score small { display: block; font-size: 10.5px; font-weight: 700; color: var(--band); text-transform: uppercase; letter-spacing: .03em; margin-top: 2px; }
.rp-sec { padding-top: 18px; }
.rp-sec h3 { font-size: 13px; letter-spacing: .05em; text-transform: uppercase; color: var(--brand); margin: 0 0 12px; }
.bh { display: grid; grid-template-columns: 190px 1fr 34px; gap: 6px 14px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.bh:last-child { border-bottom: 0; }
.bh .nm { font-weight: 600; font-size: 14px; }
.bh .bar { height: 10px; border-radius: 5px; background: var(--bg); overflow: hidden; }
.bh .bar i { display: block; height: 100%; border-radius: 5px; width: 0; transition: width .9s cubic-bezier(.2,.8,.2,1); }
.bh .sc { font-weight: 700; text-align: right; font-size: 15px; }
.bh .why { grid-column: 1 / -1; font-size: 13.5px; color: #3c4b47; }
.bh .why q { display: block; margin-top: 4px; color: var(--muted); font-style: italic; quotes: "\201C" "\201D"; }
.bh .why .noev { display: block; margin-top: 4px; color: var(--muted); font-size: 12.5px; }
.rp-two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.rp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.rp-list li { display: flex; gap: 8px; }
.rp-list li i { flex: none; font-style: normal; color: #2f8f5b; font-weight: 700; }
.rp-list.obs li i { color: var(--brand); }
.rp-list.obs b { font-weight: 600; }
.imp { display: grid; gap: 10px; counter-reset: imp; }
.imp div { position: relative; padding: 12px 14px 12px 46px; border-radius: 14px; background: var(--bg); font-size: 14px; counter-increment: imp; }
.imp div::before { content: counter(imp); position: absolute; left: 14px; top: 12px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.imp b { display: block; margin-bottom: 4px; }
.imp span { color: #3c4b47; }
.imp span em { color: var(--brand); font-style: normal; font-weight: 600; }
.rp-meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 18px; padding-top: 16px; }
.rp-meta b { color: var(--ink); font-weight: 600; }
.rp-foot { font-size: 12px; color: var(--muted); padding-top: 14px; border-top: 1px solid var(--line); margin-top: 16px; }
@media (max-width: 820px) {
  .decision { margin-left: 0; }
  .rp-head { flex-direction: column; align-items: flex-start; }
  .bh { grid-template-columns: 1fr 34px; }
  .bh .bar { grid-column: 1 / -1; grid-row: 2; }
  .rp-two { grid-template-columns: 1fr; }
}
/* ---- Phone: give the conversation the space (the chat bubbles already carry the spoken text) ---- */
@media (max-width: 820px) {
  .top { height: 52px; }
  .app { height: calc(100% - 52px); }
  .title { font-size: 15px; }
  .sub { display: none; }
  .stage { justify-content: center; padding: 10px 16px; }
  .caption { display: none; }
  .portrait { width: 30vw; max-width: 132px; }
  .strip .sc, .strip .grow { display: none; }
  .strip { justify-content: space-between; }
}
