/* VocaPal — web app. Blue-led, white surfaces, soft grey panels. System fonts only. */
:root {
  --ink: #0f172a;
  --muted: #56617a;
  --bg: #ffffff;
  --panel: #f4f6fa;
  --card: #ffffff;
  --line: #e3e7ef;
  --line-strong: #cfd6e3;
  --brand: #2049c7;
  --brand-2: #1a3aa3;
  --brand-3: #2f5ce0;
  --brand-soft: #e8eefc;
  --brand-line: #c9d6f7;
  --ok: #157a52;
  --ok-soft: #e1f4ea;
  --warn: #8a5300;
  --warn-soft: #fff3d6;
  --bad: #b3261e;
  --bad-soft: #fde8e6;
  --coral: #ff8a6a;
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, "SF Arabic", "Geeza Pro", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh;
  font: 15px/1.55 var(--font);
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid #ffb020; outline-offset: 2px; border-radius: 8px; }
.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 50; padding: 8px 14px; border-radius: 999px;
  background: var(--brand); color: #fff; transform: translateY(-160%); transition: transform .2s; text-decoration: none;
}
.skip-link:focus { transform: none; }

/* Top bar */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 14px clamp(16px, 3vw, 40px); background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.logo { display: inline-flex; align-items: center; gap: 10px; margin-inline-end: auto; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
.logo svg { width: 34px; height: 34px; color: var(--brand); }
.pill { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--muted); }
.pill-plan { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-2); font-weight: 700; }
.local-badge { font-size: 12px; color: var(--muted); }
.top-link { font-size: 14px; color: var(--muted); text-decoration: none; padding: 4px 6px; }
.top-link:hover { color: var(--brand); }

/* Shell: sidebar on desktop, bottom tabs on mobile */
.shell { display: block; }
.view { max-width: 820px; margin: 0 auto; padding: 24px 16px 32px; outline: none; }

.tabs {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 20; display: flex; overflow-x: auto; gap: 2px;
  background: #fff; border-top: 1px solid var(--line);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
}
.tabs button {
  flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px;
  border: 0; background: transparent; padding: 6px 8px; border-radius: 12px; cursor: pointer; color: var(--muted); font-size: 12px;
}
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button[aria-current="page"] { background: var(--brand-soft); color: var(--brand-2); font-weight: 700; }

@media (min-width: 960px) {
  body { padding-bottom: 0; }
  .shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - 66px); }
  .shell:has(> .tabs[hidden]) { grid-template-columns: minmax(0, 1fr); }
  .tabs {
    position: sticky; top: 66px; align-self: start; height: calc(100vh - 66px);
    flex-direction: column; gap: 4px; overflow: auto; padding: 20px 14px; border-top: 0; border-inline-end: 1px solid var(--line);
  }
  .tabs button { flex: 0 0 auto; flex-direction: row; gap: 12px; justify-content: flex-start; padding: 10px 14px; font-size: 14.5px; }
  .tabs button[aria-current="page"] { box-shadow: inset 0 0 0 1px var(--brand-line); }
  .tabs svg { width: 20px; height: 20px; }
  .view { padding: 36px 40px 56px; max-width: 900px; margin: 0; }
  .shell:has(> .tabs[hidden]) .view { margin: 0 auto; max-width: 1180px; }
  .shell:not(:has(> .tabs[hidden])) .view { background: #fafbfd; max-width: none; min-height: 100%; }
}

/* Cards and type */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 14px; }
.card h2, .card h3 { margin: 0 0 10px; letter-spacing: -.01em; }
.card h2 { font-size: 1.35rem; }
.view > h2 { font-size: 1.35rem; margin: 6px 0 8px; }
.page-head h1 { margin: 0 0 2px; font-size: 1.6rem; letter-spacing: -.02em; }
.page-head { margin-bottom: 18px; }
.muted { color: var(--muted); font-size: 13.5px; }
.kicker { margin: 0 0 4px; color: var(--brand); font-size: 12.5px; font-weight: 700; letter-spacing: .01em; }
.draft { display: inline-block; color: var(--warn); background: var(--warn-soft); border-radius: 6px; padding: 1px 7px; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.mock { display: inline-block; font-size: 11px; font-weight: 700; color: var(--warn); background: var(--warn-soft); border-radius: 6px; padding: 1px 7px; }
.notice { background: var(--warn-soft); border: 1px solid #f3d48a; border-radius: 12px; padding: 10px 14px; font-size: 13.5px; color: #3d2a00; }
.form-status:empty { display: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
  border: 0; border-radius: 999px; padding: 10px 22px; cursor: pointer;
  background: var(--brand); color: #fff; font-weight: 700; text-decoration: none; transition: background-color .15s, transform .15s;
}
.btn:hover { background: var(--brand-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand-2); box-shadow: inset 0 0 0 1px var(--brand-line); }
.btn-small { min-height: 36px; padding: 6px 14px; font-size: 13.5px; }
.btn-wide { width: 100%; }
.btn-white { background: #fff; color: var(--brand-2); }
.btn-white:hover { background: var(--brand-soft); }
.btn-hero {
  min-height: 64px; padding: 16px 40px; font-size: 1.15rem; width: min(100%, 440px);
  background: linear-gradient(135deg, #4a78ff, var(--brand)); box-shadow: 0 18px 34px -18px rgba(32,73,199,.8);
}
.btn-hero:hover { background: linear-gradient(135deg, #3d6bf5, var(--brand-2)); }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.choice {
  border: 1px solid var(--line-strong); background: #fff; border-radius: 14px; padding: 14px 16px; cursor: pointer; text-align: start;
  min-height: 52px; transition: border-color .15s, background-color .15s;
}
.choice:hover { border-color: var(--brand); }
.choice[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.choice.ok { border-color: var(--ok); background: var(--ok-soft); }
.choice.bad { border-color: var(--bad); background: var(--bad-soft); }
.progressbar { height: 8px; background: #e7ebf3; border-radius: 999px; overflow: hidden; margin: 8px 0 16px; }
.progressbar span { display: block; height: 100%; background: var(--brand); border-radius: inherit; transition: width .3s ease; }
.big { font-size: 34px; font-weight: 800; letter-spacing: -.02em; color: var(--brand); }
.target { font-size: 20px; font-weight: 700; }
.roman { color: var(--muted); font-style: italic; }

/* Welcome (first onboarding screen) */
.welcome { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 96px); align-items: center; padding: clamp(24px, 6vh, 72px) 0; }
.eyebrow { margin: 0 0 18px; color: var(--brand); font-weight: 600; font-size: 15px; }
.welcome h1 { margin: 0 0 24px; font-size: clamp(2.6rem, 5.4vw, 4.4rem); line-height: 1.04; letter-spacing: -.035em; font-weight: 700; }
.welcome h1 span { color: var(--brand); }
.welcome-lede { margin: 0 0 30px; color: #3a4459; font-size: 1.08rem; max-width: 30rem; }
.welcome .muted { margin-top: 18px; }
.welcome-panel { background: var(--panel); border-radius: 28px; padding: 32px; }
.wp-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.wp-mascot { width: 64px; height: 64px; flex: none; background: #fff; border-radius: 14px; padding: 6px; }
.wp-head p { margin: 0; font-size: 1.4rem; line-height: 1.3; letter-spacing: -.01em; }
.wp-head b { font-weight: 600; }
.wp-head span { color: var(--brand); font-weight: 600; }
.wp-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.wp-steps li { display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.wp-steps li.on { background: var(--brand-soft); border-color: var(--brand-line); }
.wp-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-2); font-weight: 800; font-size: 14px; }
.wp-steps li.on .wp-ico { background: #fff; }
.wp-steps small { display: block; color: var(--muted); font-size: 12.5px; }
.wp-steps b { display: block; font-size: 1.02rem; font-weight: 600; }
.wp-steps em { display: block; font-style: normal; color: var(--muted); font-size: 13px; }
.wp-check { color: var(--brand); font-weight: 700; }
.wp-foot { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: 13.5px; }

/* Onboarding steps */
.ob { max-width: 720px; margin: 0 auto; }
.ob-progress span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.ob-card { padding: 28px; border-radius: 22px; }
.ob-card h2 { font-size: clamp(1.4rem, 2.6vw, 1.8rem); margin-bottom: 16px; }
.ob-nav { justify-content: space-between; }
.ob-nav .btn:last-child { min-width: 140px; margin-inline-start: auto; }

/* Home / path */
.progress-card { display: flex; gap: 20px; align-items: center; justify-content: space-between; }
.progress-card > div:first-child { flex: 1; }
.progress-card .progressbar { margin-bottom: 0; }
.pc-title { margin: 0; font-weight: 700; }
.pc-side { text-align: center; padding-inline-start: 20px; border-inline-start: 1px solid var(--line); }
.pc-side strong { display: block; font-size: 1.6rem; color: var(--brand); }
.next-card {
  border-radius: 20px; padding: 24px; margin-bottom: 14px; color: #fff;
  background: linear-gradient(135deg, var(--brand-3), var(--brand-2));
}
.next-card h2 { margin: 10px 0 4px; font-size: 1.35rem; }
.next-card p { margin: 0 0 16px; opacity: .88; font-size: 14px; }
.chip-light { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,.2); }
.stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat-row .card { margin-bottom: 14px; }
.stat { text-align: center; }
.stat strong { display: block; font-size: 26px; letter-spacing: -.02em; }
.row > .stat.card { flex: 1 1 120px; }
.word-card .target { font-size: 22px; }
.unit { border-inline-start: 4px solid var(--brand); }
.unit h3 { font-size: 1.1rem; }
.step { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.step.locked { opacity: .5; }
.step .state { font-size: 12.5px; color: var(--muted); }
.done-badge { color: var(--ok); background: var(--ok-soft); border-radius: 999px; padding: 3px 10px; font-weight: 700; }
.lock { border: 1px dashed var(--line-strong); border-radius: 999px; padding: 3px 10px; }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 52vh; overflow: auto; padding: 6px 2px; }
.bubble { max-width: 85%; padding: 10px 14px; border-radius: 16px 16px 16px 6px; background: var(--panel); }
.bubble.me { align-self: flex-end; background: var(--brand); color: #fff; border-radius: 16px 16px 6px 16px; }
.bubble.me .tr, .bubble.me .fix { color: #dfe6ff; }
.bubble .tr { color: var(--muted); font-size: 13px; }
.bubble .fix { color: var(--warn); font-size: 13px; margin-top: 4px; }
.bubble .btn { margin-top: 6px; }
.mic-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.mic {
  width: 76px; height: 76px; border-radius: 50%; border: 6px solid var(--brand-soft); background: var(--brand); color: #fff; cursor: pointer;
  display: grid; place-items: center; touch-action: none; user-select: none; -webkit-user-select: none; flex: none;
  transition: background-color .15s, transform .15s;
}
.mic svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.mic:hover { background: var(--brand-2); }
.mic.on { background: var(--bad); border-color: var(--bad-soft); transform: scale(1.05); }
.mic-label { color: var(--muted); font-weight: 600; }
.voice-note { margin: 4px 0 12px; font-size: 12.5px; color: var(--muted); background: var(--panel); border-radius: 12px; padding: 10px 12px; }
.wordline span { padding: 0 2px; border-radius: 4px; }
.wordline .ok { background: var(--ok-soft); }
.wordline .miss { background: var(--bad-soft); }

/* Games */
.ws { display: grid; gap: 3px; width: max-content; user-select: none; }
.ws button { width: 32px; height: 32px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; font-weight: 700; }
.ws button.sel { background: #fff3c4; }
.ws button.found { background: var(--ok-soft); }
.scroll-x { overflow-x: auto; }
.cw { display: grid; gap: 3px; width: max-content; }
.cw input, .cw span { width: 32px; height: 32px; text-align: center; border: 1px solid var(--line-strong); border-radius: 6px; text-transform: uppercase; padding: 0; }
.cw span { border: 0; }
.cw input.ok { background: var(--ok-soft); }

/* Paywall plans */
.plan {
  border: 1.5px solid var(--line-strong); border-radius: 16px; padding: 16px 18px; cursor: pointer; background: #fff;
  text-align: start; width: 100%; line-height: 1.5;
}
.plan[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.bars { display: grid; gap: 10px; }
.bars div { display: grid; grid-template-columns: 96px 1fr 44px; gap: 10px; align-items: center; }
.bars i { display: block; height: 10px; background: var(--brand); border-radius: 999px; }
.bars b { display: block; background: #e7ebf3; border-radius: 999px; }

/* Forms */
input[type="text"], input[type="email"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 3px solid var(--brand-soft); outline-offset: 0; }
label.field { display: block; margin: 10px 0; font-weight: 600; font-size: 14px; }
label.field input { margin-top: 6px; font-weight: 400; }

/* Footer */
.foot { text-align: center; font-size: 12.5px; color: var(--muted); padding: 20px 16px; border-top: 1px solid var(--line); }
.foot a { color: inherit; }
.foot p { margin: 6px 0 0; }
@media (min-width: 960px) { .shell:not(:has(> .tabs[hidden])) + .foot { margin-inline-start: 232px; } }

[dir="rtl"] { text-align: right; }

@media (max-width: 860px) {
  .welcome { grid-template-columns: 1fr; padding-top: 12px; }
  .welcome-panel { padding: 20px; }
}
@media (max-width: 480px) {
  body { font-size: 14.5px; }
  .topbar { padding: 10px 14px; gap: 6px; }
  .logo { font-size: 1.02rem; }
  .logo svg { width: 30px; height: 30px; }
  .local-badge { display: none; }
  .view { padding: 18px 14px 28px; }
  .welcome h1 { font-size: 2.6rem; }
  .btn-hero { width: 100%; min-height: 58px; font-size: 1.05rem; }
  .wp-head p { font-size: 1.15rem; }
  .wp-steps li { padding: 14px; grid-template-columns: 36px 1fr auto; gap: 10px; }
  .ob-card { padding: 20px; }
  .big { font-size: 28px; }
  .progress-card { align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Paywall plan cards sit inside .bars; undo the skill-bar styling */
.bars .plan b { display: inline; background: none; border-radius: 0; font-size: 1.05rem; }
.bars .plan .draft { margin-top: 6px; }
@media (max-width: 480px) {
  .topbar { flex-wrap: nowrap; }
  #lang-pill { display: none; }
  .pill { padding: 3px 10px; font-size: 12px; }
}
