/* Hablingo — phone-first single column: top bar, one screen at a time, sticky composer in conversations */
:root {
  --bg: #f4f6f2; --panel: #ffffff; --ink: #17201d; --muted: #5e6b66; --line: #dde3dc;
  --teal: #2f8f9d; --teal-soft: #e0f0f1; --orange: #ff7a1a; --orange-soft: #fff0e3; --gold: #c98a00; --gold-soft: #fff4d6;
  --ok: #1f7a4a; --ok-soft: #e3f3ea; --warn: #9a5b00; --warn-soft: #fbf0dc; --bad: #c0392b; --bad-soft: #fbe5e2;
  --me: #2f8f9d; --me-ink: #fff;
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif; --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; --r: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #0f1513; --panel: #17201d; --ink: #e8eeeb; --muted: #9aa8a2; --line: #2a3531;
  --teal: #5cc3d0; --teal-soft: #123236; --orange: #ff9a4a; --orange-soft: #3a2412; --gold: #f3c14b; --gold-soft: #3a2d0d;
  --ok: #5fd394; --ok-soft: #143225; --warn: #f2b34d; --warn-soft: #3a2b10; --bad: #ff7b6b; --bad-soft: #3a1a17; --me: #237482; color-scheme: dark } }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body); -webkit-tap-highlight-color: transparent; }
#app { max-width: 560px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-bottom: 28px; }
header.top { position: sticky; top: 0; z-index: 5; background: var(--bg); display: flex; align-items: center; gap: 10px; padding-top: calc(12px + env(safe-area-inset-top, 0px)); padding-bottom: 12px; }
.brand { font: 800 21px/1 var(--display); display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.01em; text-wrap: balance; margin: 0; }
h1 { font-size: 28px; line-height: 1.12; } h2 { font-size: 21px; } h3 { font-size: 16px; }
p { margin: 0; } img { max-width: 100%; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
button, .btn { font: 600 15px var(--body); border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 12px 14px; cursor: pointer; text-decoration: none; text-align: center; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
button.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
button.teal { background: var(--teal); border-color: var(--teal); color: #fff; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 8px 10px; }
button:disabled { opacity: .5; cursor: default; }
.wide { width: 100%; }
input, textarea, select { font: 15px var(--body); color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; width: 100%; }
textarea { resize: none; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.eyebrow { font: 600 11px var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; font: 600 12px var(--body); padding: 4px 10px; border-radius: 999px; background: var(--teal-soft); color: var(--teal); }
.pill.orange { background: var(--orange-soft); color: var(--orange); } .pill.gold { background: var(--gold-soft); color: var(--gold); }
.bar { height: 9px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--orange); border-radius: 99px; transition: width .4s; }
.bar.teal > i { background: var(--teal); }
.hero { display: flex; gap: 14px; align-items: flex-end; }
.hero img { width: 96px; flex: none; }
.bubble { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; flex: 1; min-width: 0; }
.bubble::after { content: ""; position: absolute; left: -7px; bottom: 18px; width: 12px; height: 12px; background: var(--panel); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: rotate(45deg); }
.lvl { font: 800 42px/1 var(--display); color: var(--orange); font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { text-align: center; padding: 12px 6px; } .stat b { display: block; font: 800 22px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.cats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cat { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 14px; min-width: 0; }
.cat b { font-family: var(--display); color: var(--teal); } .cat span { font-weight: 500; font-size: 12px; color: var(--muted); }
.list { display: grid; gap: 8px; }
.phrase { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); text-align: left; }
.phrase .t { flex: 1; min-width: 0; } .phrase .t b { display: block; font-weight: 600; } .phrase .t i { font-style: normal; color: var(--muted); font-size: 13px; }
.spk { flex: none; width: 34px; height: 34px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
.spk svg, .mic svg { width: 17px; height: 17px; fill: currentColor; }
.chat { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; flex: 1; }
.scene { display: flex; gap: 12px; align-items: center; }
.npc { width: 46px; height: 46px; border-radius: 50%; background: var(--orange-soft); color: var(--orange); display: grid; place-items: center; font: 800 20px var(--display); flex: none; }
.msg { max-width: 86%; padding: 10px 13px; border-radius: 16px; min-width: 0; overflow-wrap: anywhere; }
.msg.them { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg.me { align-self: flex-end; background: var(--me); color: var(--me-ink); border-bottom-right-radius: 5px; }
.msg .tr { margin-top: 6px; font-size: 13px; color: var(--muted); }
.msg .tools { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; } .msg .tools button { padding: 4px 8px; font-size: 12px; border-radius: 8px; }
.fix { align-self: flex-end; max-width: 86%; font-size: 13px; padding: 8px 12px; border-radius: 12px; }
.fix.ok { background: var(--ok-soft); color: var(--ok); } .fix.no { background: var(--warn-soft); border: 1px solid var(--warn); } .fix.no b { color: var(--warn); }
.typing { align-self: flex-start; color: var(--muted); font-size: 13px; }
.composer { position: sticky; bottom: 0; background: var(--bg); padding-top: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); }
.composer .row { flex-wrap: nowrap; } .composer textarea { flex: 1; min-width: 0; min-height: 46px; max-height: 120px; }
.mic { width: 46px; height: 46px; padding: 0; border-radius: 50%; display: grid; place-items: center; flex: none; }
.mic.on { background: var(--orange); color: #fff; border-color: var(--orange); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px var(--orange-soft); } }
@media (prefers-reduced-motion: reduce) { .mic.on { animation: none; } .bar > i { transition: none; } }
.opt { text-align: left; width: 100%; font-weight: 500; } .opt.sel { border-color: var(--teal); background: var(--teal-soft); }
.flash { text-align: center; padding: 28px 16px; } .flash .w { font: 800 30px/1.2 var(--display); }
.note { font-size: 13px; padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); }
.err { font-size: 14px; padding: 12px; border-radius: 12px; background: var(--bad-soft); }
.hist { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding-block: 8px; border-bottom: 1px solid var(--line); } .hist:last-child { border-bottom: 0; }
.score { font: 800 56px/1 var(--display); color: var(--teal); font-variant-numeric: tabular-nums; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; } .seg button { flex: 1; padding: 9px 6px; font-size: 13px; } .seg button.sel { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.plan { display: flex; flex-direction: column; gap: 8px; } .plan.best { border-color: var(--orange); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; } .or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 20; max-width: 90%; }
[hidden] { display: none !important; }
/* admin */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; } .tbl th, .tbl td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; } .tbl th { color: var(--muted); font-weight: 600; cursor: pointer; } .tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--teal-soft); }
.scroll { overflow-x: auto; }
.heat { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; } .heat i { aspect-ratio: 1; border-radius: 3px; background: var(--line); } .heat i.l1 { background: #bfe3e7; } .heat i.l2 { background: #6fc0ca; } .heat i.l3 { background: var(--teal); }
.mgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mopt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: 12px; min-width: 0; }
.mopt img { width: 100%; max-width: 64px; } .mopt.sel { border-color: var(--teal); background: var(--teal-soft); }
.plan.best { border-color: var(--orange); border-width: 2px; }
