/* Matura Tutor – system wizualny. Mobile-first, tryb jasny/ciemny, kontrast AA, prefers-reduced-motion. */
:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-2: #eef4f2;
  --surface-3: #e2ebe8;
  --text: #10201d;
  --muted: #566764;
  --border: #d6e1de;
  --primary: #0f766e;
  --primary-strong: #0b5e57;
  --primary-soft: #dff2ef;
  --on-primary: #ffffff;
  --accent: #d97706;
  --accent-soft: #fff3dc;
  --success: #15803d;
  --success-soft: #e3f5e8;
  --danger: #be123c;
  --danger-soft: #fde7ec;
  --info: #1d4ed8;
  --info-soft: #e5edff;
  --violet: #6d28d9;
  --violet-soft: #efe7ff;
  --shadow: 0 1px 2px rgba(16, 32, 29, .06), 0 4px 16px rgba(16, 32, 29, .06);
  --shadow-lg: 0 10px 40px rgba(16, 32, 29, .16);
  --radius: 16px;
  --radius-sm: 10px;
  --gap: 16px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --nav-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1614;
    --surface: #12211e;
    --surface-2: #172a27;
    --surface-3: #1f3632;
    --text: #e8f1ef;
    --muted: #9db2ae;
    --border: #284541;
    --primary: #2dd4bf;
    --primary-strong: #5eead4;
    --primary-soft: #113a35;
    --on-primary: #04211e;
    --accent: #fbbf24;
    --accent-soft: #3a2a0a;
    --success: #4ade80;
    --success-soft: #0f2e1b;
    --danger: #fb7185;
    --danger-soft: #3b0f1a;
    --info: #93b4ff;
    --info-soft: #14203f;
    --violet: #c4b5fd;
    --violet-soft: #2a1d4a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--text); background: var(--bg);
  min-height: 100vh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
@media (min-width: 860px) { body { padding-bottom: 0; } }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-strong); }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
small, .muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- układ ---------- */
.container { width: 100%; max-width: 980px; margin: 0 auto; padding: 16px; }
.container.narrow { max-width: 640px; }
.container.wide { max-width: 1240px; }
.stack > * + * { margin-top: var(--gap); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 720px) { .grid.sidebar { grid-template-columns: 2fr 1fr; } }
.spacer { flex: 1; }

/* ---------- nagłówek i nawigacja ---------- */
.topbar { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border); }
.topbar .container { display: flex; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.brand .logo { width: 34px; height: 34px; }
.mainnav { display: none; gap: 4px; margin-left: 12px; }
.mainnav a { padding: 8px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .95rem; }
.mainnav a:hover { background: var(--surface-2); color: var(--text); }
.mainnav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary-strong); }
@media (min-width: 860px) { .mainnav { display: flex; } }
.stats { display: flex; gap: 8px; margin-left: auto; align-items: center; }
.stat-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; font-weight: 700;
  font-size: .9rem; background: var(--surface-2); color: var(--text); text-decoration: none; }
.stat-chip.streak { background: var(--accent-soft); color: var(--accent); }
.stat-chip.xp { background: var(--violet-soft); color: var(--violet); }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border); }
.bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted);
  text-decoration: none; font-size: .72rem; font-weight: 600; }
.bottomnav a[aria-current="page"] { color: var(--primary); }
.bottomnav .ic { width: 24px; height: 24px; }
@media (min-width: 860px) { .bottomnav { display: none; } }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ic.lg { width: 28px; height: 28px; }
.ic.xl { width: 40px; height: 40px; }

/* ---------- karty i kafelki ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card.tint { background: var(--primary-soft); border-color: transparent; }
.card.warn { background: var(--accent-soft); border-color: transparent; }
.card.danger { background: var(--danger-soft); border-color: transparent; }
.card.success { background: var(--success-soft); border-color: transparent; }
.card h2 { margin-bottom: .6em; }
.hero { display: grid; gap: 18px; align-items: center; }
@media (min-width: 720px) { .hero { grid-template-columns: 1.2fr 1fr; } }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.kpi b { display: block; font-size: 1.5rem; line-height: 1.1; }
.kpi span { font-size: .8rem; color: var(--muted); }

/* ---------- przyciski ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: 12px; border: 2px solid transparent; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  background: var(--primary); color: var(--on-primary); box-shadow: 0 3px 0 var(--primary-strong); transition: transform .06s, filter .15s; }
.btn:hover { filter: brightness(1.05); color: var(--on-primary); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--primary-strong); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn.secondary { background: var(--surface); color: var(--primary); border-color: var(--border); box-shadow: 0 3px 0 var(--border); }
.btn.secondary:hover { color: var(--primary-strong); }
.btn.ghost { background: transparent; color: var(--text); box-shadow: none; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--danger); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--danger) 70%, #000); }
.btn.accent { background: var(--accent); color: #1f1300; box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 70%, #000); }
.btn.big { min-height: 54px; font-size: 1.05rem; padding: 12px 24px; border-radius: 14px; }
.btn.block { width: 100%; }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: .88rem; box-shadow: none; }
.linkbtn { background: none; border: 0; padding: 6px 4px; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; min-height: 44px; }
.action-bar.ok .linkbtn { color: var(--success); } .action-bar.bad .linkbtn { color: var(--danger); }

/* ---------- formularze ---------- */
label { display: block; font-weight: 600; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.field small { display: block; margin-top: 4px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=time], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; color: var(--text); background: var(--surface);
  border: 2px solid var(--border); border-radius: 12px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--primary); flex: none; }
.errors { background: var(--danger-soft); color: var(--danger); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.errors ul { margin: 0; padding-left: 18px; }
.notice { background: var(--success-soft); color: var(--success); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.notice.warn { background: var(--accent-soft); color: var(--text); }
.notice.warn form { gap: 12px; flex-wrap: wrap; }

/* ---------- elementy informacyjne ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: .76rem; font-weight: 700;
  background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.badge.ok, .badge.approved, .badge.downloaded, .badge.mastered, .badge.accepted { background: var(--success-soft); color: var(--success); }
.badge.warn, .badge.pending_review, .badge.expected, .badge.reviewing, .badge.open, .badge.practicing { background: var(--accent-soft); color: var(--accent); }
.badge.bad, .badge.rejected, .badge.missing, .badge.error, .badge.learning, .badge.retired { background: var(--danger-soft); color: var(--danger); }
.badge.info, .badge.draft, .badge.discovered, .badge.ai_generated, .badge.template { background: var(--info-soft); color: var(--info); }
.badge.duplicate, .badge.cke { background: var(--violet-soft); color: var(--violet); }
.progress { height: 12px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 70%, var(--accent))); border-radius: 999px; transition: width .4s ease; }
.progress.thin { height: 6px; }
.progress.goal > span { background: linear-gradient(90deg, var(--accent), #f97316); }
.ring { --p: 0; --size: 120px; width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-3) 0); }
.ring > div { width: calc(var(--size) - 22px); height: calc(var(--size) - 22px); border-radius: 50%; background: var(--surface);
  display: grid; place-items: center; text-align: center; }
.ring b { font-size: 1.6rem; line-height: 1; display: block; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 90px; }
.week .bar { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.week .bar span { width: 100%; max-width: 28px; background: var(--primary); border-radius: 6px 6px 3px 3px; min-height: 3px; }
.week .bar span.zero { background: var(--surface-3); }
.week .bar small { font-size: .72rem; }
.mastery-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.mastery-row:last-child { border-bottom: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.diff-wrong { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; border-radius: 4px; padding: 0 3px; }
.diff-right { background: var(--success-soft); color: var(--success); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.quote { border-left: 4px solid var(--primary); padding: 6px 12px; background: var(--surface-2); border-radius: 0 10px 10px 0; }
kbd { font-family: ui-monospace, monospace; background: var(--surface-3); border-radius: 6px; padding: 1px 6px; font-size: .85em; }
pre.code { white-space: pre-wrap; background: var(--surface-2); padding: 12px; border-radius: 10px; font-size: .85rem; overflow-x: auto; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty .ic { width: 44px; height: 44px; opacity: .6; }

/* ---------- ścieżka nauki ---------- */
.unit { margin: 26px 0; }
.unit-head small { color: rgba(255, 255, 255, .88); font-weight: 600; }
.unit-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); color: #fff; margin-bottom: 14px; }
.unit-head.teal { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.unit-head.amber { background: linear-gradient(135deg, #b45309, #f59e0b); }
.unit-head.violet { background: linear-gradient(135deg, #5b21b6, #8b5cf6); }
.unit-head.blue { background: linear-gradient(135deg, #1e40af, #3b82f6); }
.unit-head.green { background: linear-gradient(135deg, #166534, #22c55e); }
.unit-head.rose { background: linear-gradient(135deg, #9f1239, #f43f5e); }
.path-nodes { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.path-node { --off: 0px; transform: translateX(var(--off)); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.path-node:nth-child(4n+2) { --off: 54px; } .path-node:nth-child(4n+4) { --off: -54px; }
.node-btn { width: 76px; height: 72px; border-radius: 22px; border: 0; cursor: pointer; display: grid; place-items: center;
  background: var(--surface-3); color: var(--muted); box-shadow: 0 6px 0 color-mix(in srgb, var(--surface-3) 60%, #000); }
.node-btn .ic { width: 32px; height: 32px; }
.path-node.current .node-btn { background: var(--primary); color: var(--on-primary); box-shadow: 0 6px 0 var(--primary-strong);
  animation: pulse 2s infinite; }
.path-node.done .node-btn { background: var(--accent); color: #1f1300; box-shadow: 0 6px 0 #b45309; }
.path-node.open .node-btn { background: var(--surface); color: var(--primary); border: 2px solid var(--primary); box-shadow: 0 6px 0 var(--border); }
.path-node .node-title { font-weight: 700; font-size: .92rem; text-align: center; max-width: 140px; }
@keyframes pulse { 0%, 100% { outline: 0 solid color-mix(in srgb, var(--primary) 40%, transparent); } 50% { outline: 10px solid color-mix(in srgb, var(--primary) 0%, transparent); } }

/* ---------- odtwarzacz lekcji ---------- */
.lesson-shell { max-width: 720px; margin: 0 auto; padding: 12px 16px 140px; min-height: calc(100vh - 60px); display: flex; flex-direction: column; }
.lesson-top { display: flex; align-items: center; gap: 12px; padding: 6px 0 14px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.lesson-top .progress { flex: 1; height: 14px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); }
.reason-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--info-soft); color: var(--info); }
.reason-chip.review { background: var(--violet-soft); color: var(--violet); }
.reason-chip.drill, .reason-chip.transfer, .reason-chip.production { background: var(--accent-soft); color: var(--accent); }
.q-instructions { color: var(--muted); font-size: .95rem; margin: 10px 0; white-space: pre-line; }
.q-prompt { font-size: 1.3rem; font-weight: 700; margin: 8px 0 18px; white-space: pre-line; }
.stimulus { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 6px 0 14px;
  max-height: 42vh; overflow-y: auto; white-space: pre-line; font-size: .98rem; }
.stimulus details summary { cursor: pointer; font-weight: 700; }
.options { display: grid; gap: 10px; }
.option { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px 16px; min-height: 56px; border-radius: 14px;
  border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 1.02rem; cursor: pointer;
  box-shadow: 0 3px 0 var(--border); }
.option:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); }
.option .key { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 800;
  border: 2px solid var(--border); color: var(--muted); font-size: .9rem; }
.option[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 3px 0 var(--primary); }
.option[aria-pressed="true"] .key { border-color: var(--primary); color: var(--primary); }
.option.correct { border-color: var(--success); background: var(--success-soft); box-shadow: 0 3px 0 var(--success); }
.option.wrong { border-color: var(--danger); background: var(--danger-soft); box-shadow: 0 3px 0 var(--danger); }
.answer-input { font-size: 1.15rem !important; min-height: 56px !important; }
.wordcount { font-size: .85rem; color: var(--muted); text-align: right; margin-top: 4px; }
.wordcount.bad { color: var(--danger); font-weight: 700; }
.action-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 2px solid var(--border); transition: background .2s; }
.action-bar .inner { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 640px) { .action-bar .inner { flex-direction: row; align-items: center; } }
.action-bar.ok { background: var(--success-soft); border-color: var(--success); }
.action-bar.bad { background: var(--danger-soft); border-color: var(--danger); }
.fb-title { font-size: 1.2rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.action-bar.ok .fb-title { color: var(--success); }
.action-bar.bad .fb-title { color: var(--danger); }
.fb-body { font-size: .95rem; max-height: 34vh; overflow-y: auto; }
.rule-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-top: 8px; font-size: .92rem; }
.rule-card b { color: var(--text); }
.audio-box { display: flex; align-items: center; gap: 12px; background: var(--info-soft); color: var(--info); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; }
.summary-hero { text-align: center; padding: 22px 8px; }
.summary-hero .big { font-size: 3rem; font-weight: 900; color: var(--accent); line-height: 1; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- rozmowa ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 18px; line-height: 1.45; white-space: pre-line; }
.msg.teacher { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 6px; align-self: flex-start; }
.msg.student { background: var(--primary); color: var(--on-primary); border-bottom-right-radius: 6px; align-self: flex-end; }
.msg.system { align-self: center; background: var(--surface-2); color: var(--muted); font-size: .85rem; border-radius: 999px; }
.msg .conf { display: block; font-size: .72rem; opacity: .8; margin-top: 2px; }
.msg .src { display: block; font-size: .72rem; color: var(--muted); margin-top: 2px; }
.correction s { opacity: .75; }
.ai-banner { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; }
.ai-banner[hidden] { display: none; }
.correction { align-self: stretch; background: var(--accent-soft); border-radius: 14px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.composer { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: var(--bg); padding: 10px 0; display: flex; gap: 8px; align-items: flex-end; }
@media (min-width: 860px) { .composer { bottom: 0; } }
.composer textarea { min-height: 52px; height: 52px; }
.mic { width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--danger); color: #fff; cursor: pointer; display: grid; place-items: center; flex: none; }
.mic.on { animation: micpulse 1.2s infinite; }
@keyframes micpulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 50%, transparent); } 50% { box-shadow: 0 0 0 14px transparent; } }
.exam-brief { background: var(--violet-soft); color: var(--text); border-radius: 14px; padding: 12px 14px; }

/* ---------- wideorozmowa z awatarem ---------- */
.call { position: relative; background: #f9d9bf; border-radius: 22px; overflow: hidden; aspect-ratio: 3 / 4; max-height: 72vh; margin: 0 auto; width: 100%; }
@media (min-width: 720px) { .call { aspect-ratio: 16 / 10; } }
.call .avatar-stage { position: absolute; inset: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 18% 22%, rgba(45, 212, 191, .28), transparent 22%),
    radial-gradient(circle at 84% 30%, rgba(251, 191, 36, .30), transparent 20%),
    radial-gradient(circle at 76% 82%, rgba(244, 114, 182, .18), transparent 24%),
    radial-gradient(circle at 50% 38%, #fffaf2 0%, #ffe9d4 45%, #f6caa8 100%); }
@media (prefers-color-scheme: dark) {
  .call { background: #121c1a; }
  .call .avatar-stage { background: radial-gradient(circle at 18% 22%, rgba(45, 212, 191, .16), transparent 22%),
      radial-gradient(circle at 84% 30%, rgba(251, 191, 36, .14), transparent 20%),
      radial-gradient(circle at 50% 38%, #36574f 0%, #203632 55%, #121c1a 100%); }
  .call .ctrl { background: rgba(255, 255, 255, .16); }
}
/* mimika awatara (klasy ustawia avatar.js) */
#avatar-svg #avatar-breathe { animation: avatar-breathe 4.6s ease-in-out infinite; }
@keyframes avatar-breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(1.4px); } }
#avatar-svg #avatar-tilt { transform-box: view-box; transform-origin: 100px 160px; transition: transform .5s ease; }
#avatar-svg.listening #avatar-tilt { transform: rotate(-4deg); }
#avatar-svg .pupil { transition: transform .35s ease; }
#avatar-svg .eye-closed { opacity: 0; }
#avatar-svg.blinking .eye-closed { opacity: 1; }  /* mrugnięcie: łuk rzęs na dole oka */
#avatar-svg.blinking .lash-up { opacity: 0; }
#avatar-svg .lid-low, #avatar-svg .cheek { transition: transform .35s ease; }
#avatar-svg.mood-happy .lid-low { transform: translateY(-2.8px); }  /* uśmiech oczami */
#avatar-svg.mood-happy .cheek { transform: translateY(-1.8px); }
#avatar-svg #brow-l, #avatar-svg #brow-r { transition: transform .3s ease; }
#avatar-svg.mood-happy #brow-l, #avatar-svg.mood-happy #brow-r { transform: translateY(-2px); }
#avatar-svg.mood-thinking #brow-l { transform: translateY(-3.5px); }
#avatar-svg.mood-thinking #brow-r { transform: translateY(-1px); }
.call .avatar-stage svg { width: min(78%, 420px); height: auto; }
.call .captions { position: absolute; left: 12px; right: 12px; bottom: 82px; text-align: center; }
.call .captions span { display: inline; background: rgba(0, 0, 0, .72); color: #fff; padding: 4px 10px; border-radius: 8px; line-height: 1.8;
  font-size: clamp(.95rem, 2.6vw, 1.15rem); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.call .captions .you { color: #a7f3d0; }
.call .selfview { position: absolute; right: 12px; top: 12px; width: 26%; max-width: 180px; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden;
  background: #0f2a26; border: 2px solid rgba(255, 255, 255, .25); }
.call .selfview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.call .selfview .placeholder { display: grid; place-items: center; height: 100%; color: #9db2ae; font-size: .8rem; text-align: center; padding: 8px; }
.call .controls { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; justify-content: center; gap: 12px; }
.call .ctrl { width: 54px; height: 54px; border-radius: 50%; border: 0; background: rgba(16, 32, 29, .62); color: #fff; box-shadow: 0 2px 10px rgba(16, 32, 29, .18); display: grid; place-items: center; cursor: pointer; }
.call .ctrl.end { background: #e11d48; }
.call .ctrl.active { background: #fff; color: #0b1614; }
.call .status { position: absolute; left: 12px; top: 12px; color: #f0fdf9; font-size: .8rem; background: rgba(16, 32, 29, .74); padding: 4px 10px; border-radius: 999px; }
.mouth { transition: d .05s; }

/* ---------- strona startowa ---------- */
.landing-hero { padding: 36px 0 12px; }
.landing-hero h1 { font-size: clamp(2rem, 6vw, 3.1rem); }
.feature { display: flex; gap: 12px; align-items: flex-start; }
.feature .ic-box { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.loop { display: grid; gap: 10px; counter-reset: step; }
.loop li { list-style: none; position: relative; padding-left: 44px; }
.loop li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #1f1300; display: grid; place-items: center; font-weight: 800; }
.footer { color: var(--muted); font-size: .88rem; padding: 26px 0 36px; }
.footer a { color: var(--muted); }

/* ---------- toasty ---------- */
.toast-area { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; }
.toast.error { background: var(--danger); color: #fff; }

/* ---------- panel administracyjny ---------- */
.admin-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-nav a { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text); font-weight: 600; font-size: .9rem; }
.admin-nav a[aria-current="page"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.filters { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 14px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: .93rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
textarea.json { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; min-height: 90px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
