:root {
  --bg: #0B101B;
  --surface: #131B2E;
  --surface-2: #1B2640;
  --surface-3: #243d76;
  --ink: #EEF2F6;
  --muted: #94A3B8;
  --line: #263554;
  --accent: #4F75FF;
  --accent-2: #8B5CF6;
  --accent-ink: #FFFFFF;
  --done: #10B981;
  --done-soft: rgba(16, 185, 129, 0.15);
  --mid: #F59E0B;
  --mid-soft: rgba(245, 158, 11, 0.15);
  --open: #EF4444;
  --open-soft: rgba(239, 68, 68, 0.15);
  --code-bg: #090D16;
  --kw: #7AA8FF;
  --agg: #D98CF0;
  --fn: #4FD1C5;
  --al: #F0A45D;
  --str: #8BD18F;
  --num: #E3C26B;
  --cmt: #64748B;
  --head: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
:root[data-theme="light"] {
  --bg: #F1F5F9;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --surface-3: #E2E8F0;
  --ink: #0F172A;
  --muted: #475569;
  --line: #CBD5E1;
  --accent: #2563EB;
  --accent-2: #7C3AED;
  --accent-ink: #FFFFFF;
  --done: #059669;
  --done-soft: #D1FAE5;
  --mid: #D97706;
  --mid-soft: #FEF3C7;
  --open: #DC2626;
  --open-soft: #FEE2E2;
  --code-bg: #F8FAFC;
  --kw: #1D4ED8;
  --agg: #9333EA;
  --fn: #0D9488;
  --al: #C2410C;
  --str: #15803D;
  --num: #A16207;
  --cmt: #64748B;
}
*, *::before, *::after {
  box-sizing: border-box;
}
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 var(--body);
  -webkit-text-size-adjust: 100%;
}
body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
  background-image: radial-gradient(850px 320px at 50% -110px, rgba(79, 117, 255, 0.14), transparent);
  padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
}
.app {
  max-width: 680px;
  margin: 0 auto;
  padding: 12px 14px calc(40px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  width: 100%;
}

/* Responsywne zabezpieczenie przed rozjeżdżaniem ramek (Punkt 14) */
.card,
.dl-spec-wrap,
.dl-prompt-box,
.dl-prompt-body,
.dl-assumptions-box,
.dl-assumptions-list,
.dl-cols-sublist,
.dl-cols-sublist li,
.theory-box,
.theory-body,
.fb-box,
.hint-stepper-box,
.hint-step-item,
.hint-step-body,
.val-checklist,
.val-item,
code,
pre {
  box-sizing: border-box;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
pre, .theory-code {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
}

/* Header */
.topbar,
.app-header {
  position: sticky;
  top: 0;
  z-index: 1200;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 14px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  padding: calc(6px + env(safe-area-inset-top, 0px)) 14px 6px;
  padding-top: env(safe-area-inset-top, 0px);
  border-radius: 16px;
  min-height: 50px; box-sizing: border-box;
}
:root[data-theme="light"] .topbar,
:root[data-theme="light"] .app-header {
  background: rgba(255, 255, 255, 0.96);
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-badge {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font: 700 13px var(--head);
  display: grid; place-items: center; flex: none;
}
.brand-title { font: 700 15px/1.2 var(--head); white-space: nowrap; }
.brand-txt b { display: block; font: 700 16px/1.15 var(--head); }
.brand-txt span { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.dot-online { width: 7px; height: 7px; border-radius: 50%; background: var(--done); display: inline-block; }
.pill-pg {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #4ade80;
  white-space: nowrap;
}
.pill-pg.loading {
  background: rgba(234, 179, 8, 0.15);
  border-color: rgba(234, 179, 8, 0.35);
  color: #facc15;
}
.pill-pg.error {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}
.top-stats { display: flex; align-items: center; gap: 6px; }
.pill-stat {
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 4px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
}

/* Base UI Elements */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 16px; margin-bottom: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}
.hero {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border-radius: 18px; padding: 16px 18px; margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(79, 117, 255, 0.25);
}
.hero h2 { margin: 0 0 4px; font: 600 12px var(--body); text-transform: uppercase; letter-spacing: .06em; opacity: .9; }
.hero p { margin: 0 0 8px; font: 700 19px/1.25 var(--head); }
.hero .sub-hero { font-size: 13px; opacity: .92; margin-bottom: 12px; }

h2 { font: 700 18px/1.25 var(--head); margin: 0 0 8px; }
h3 { font: 600 15px/1.3 var(--head); margin: 12px 0 6px; }
p { margin: 0 0 10px; }
.small { font-size: 13.5px; }
.muted { color: var(--muted); }
code.inline {
  font: 500 12.5px var(--mono); background: var(--surface-2);
  color: var(--al); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line);
}

/* Segmented Sub-navigation */
.subnav {
  display: flex; gap: 6px; background: var(--surface);
  padding: 5px; border-radius: 14px; border: 1px solid var(--line);
  margin-bottom: 14px;
}
.subnav button {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  font: 600 13px var(--body); padding: 9px 10px; border-radius: 10px;
  cursor: pointer; transition: all .15s;
}
.subnav button.active {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 10px rgba(79, 117, 255, 0.3);
}

/* Workspace Top Bar (Back button + Variant Switcher) */
.ws-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 12px; flex-wrap: wrap;
}
.var-pills { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.var-pill:hover { border-color: var(--accent); color: var(--ink); }
.var-pill.var-pill-mix { border-color: rgba(139, 92, 246, 0.45); color: var(--agg); }
.var-pill.var-pill-mix.active { border-color: var(--accent-2); background: var(--accent-2); color: #fff; }
.var-sep { font: 700 10px var(--body); text-transform: uppercase; letter-spacing: .04em; padding: 2px 6px; margin-left: 3px; border-radius: 6px; background: rgba(139, 92, 246, 0.14); color: var(--agg); border: 1px dashed rgba(139, 92, 246, 0.45); }
.var-pill {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--muted); font: 600 12px var(--mono);
  cursor: pointer; display: grid; place-items: center;
}
.var-pill.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.var-pill.done { border-color: var(--done); color: var(--done); }
.var-pill.active.done { background: var(--done); color: #fff; }

/* Buttons */
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn {
  font: 600 13.5px var(--body); padding: 9px 14px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  cursor: pointer; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform .1s ease, border-color .15s ease, background .15s ease;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.success { background: var(--done); border-color: var(--done); color: #fff; }
.btn.warn { background: var(--mid-soft); border-color: var(--mid); color: var(--mid); }
.btn.ghost { background: rgba(255,255,255,0.16); border-color: rgba(255,255,255,0.35); color: #fff; }
.btn.sm { min-height: 33px; padding: 5px 11px; font-size: 12.5px; border-radius: 9px; }

/* Chips & Progress Bar */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 99px;
  white-space: nowrap;
}
.chip.done { background: var(--done-soft); color: var(--done); }
.chip.mid { background: var(--mid-soft); color: var(--mid); }
.chip.open { background: var(--open-soft); color: var(--open); }
.chip.info { background: var(--surface-2); color: var(--kw); border: 1px solid var(--line); }

.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 8px 0; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--done)); transition: width .35s ease; }

/* Clean Curriculum & Task List Cards */
.stage-box {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px; margin-bottom: 12px;
}
.stage-box.unlocked { border-left: 4px solid var(--accent); }
.stage-box.completed { border-left: 4px solid var(--done); }
.node-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.node-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
  cursor: pointer; text-align: left; width: 100%; color: var(--ink);
  transition: border-color .15s, transform .1s;
  overflow: hidden;
  flex-wrap: wrap;
}
.node-item > div:first-child { flex: 1; min-width: 180px; }
.node-item > .chip { flex-shrink: 0; }
.node-item:hover { border-color: var(--accent); }
.node-item:active { transform: scale(.99); }
.node-title { font-weight: 600; font-size: 14px; display: block; margin-bottom: 2px; }
.node-meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.schema-cols { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }

/* Teach-First Theory Box */
details.theory-box { background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--accent-2); border-radius: 12px; padding: 10px 14px; margin: 10px 0; font-size: 13.5px; line-height: 1.55; }
details.theory-box summary { cursor: pointer; font-weight: 600; color: var(--ink); list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
details.theory-box summary::-webkit-details-marker { display: none; }
details.theory-box summary::after { content: "▼"; font-size: 10px; color: var(--muted); flex-shrink: 0; }
details.theory-box[open] summary::after { content: "▲"; }
.theory-body { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.theory-body ul { margin: 0 0 10px; padding-left: 18px; }
.theory-body li { margin-bottom: 6px; }
.theory-body code { font: 500 12px var(--mono); background: var(--surface); color: var(--kw); padding: 1px 5px; border-radius: 5px; border: 1px solid var(--line); }
.theory-code { background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; overflow-x: auto; }
.theory-code code { background: transparent; border: 0; padding: 0; color: var(--ink); white-space: pre-wrap; display: block; font: 500 12.5px/1.5 var(--mono); }

/* Prompt Box inside Workspace */
.prompt-box {
  background: var(--surface-2); border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px; padding: 12px 14px; margin: 10px 0;
  font-size: 14px; line-height: 1.55;
}

/* Collapsible Table Helper */
details.helper-fold {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 11px; padding: 8px 12px; margin-bottom: 10px; font-size: 12.5px;
}
details.helper-fold summary {
  cursor: pointer; font-weight: 600; color: var(--kw); list-style: none;
  display: flex; align-items: center; justify-content: space-between;
}
details.helper-fold summary::-webkit-details-marker { display: none; }
details.helper-fold summary::after { content: "▼"; font-size: 10px; color: var(--muted); }
details.helper-fold[open] summary::after { content: "▲"; }
.helper-col-btn {
  font: 500 12px var(--mono); background: var(--surface); color: var(--al);
  padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line);
  cursor: pointer; display: inline-flex; align-items: center; transition: all .12s ease;
}
.helper-col-btn:hover { border-color: var(--accent); background: var(--accent); color: #fff; }
.helper-col-btn:active { transform: scale(.95); }
.helper-tbl-btn {
  font: 700 12.5px var(--mono); background: transparent; color: var(--kw);
  padding: 2px 6px; border-radius: 6px; border: 1px dashed var(--line);
  cursor: pointer;
}
.helper-tbl-btn:hover { border-color: var(--kw); background: rgba(122, 168, 255, 0.12); }
.helper-col-btn.col-key-chip {
  border-color: var(--mid);
  background: var(--mid-soft);
  color: var(--mid);
  font-weight: 600;
}
.helper-col-btn.col-key-chip:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.join-keys-banner {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--mid-soft);
  border: 1px solid var(--mid);
  color: var(--ink);
  font-size: 12px;
}

/* Mobile SQL Quick-Bar (with visible horizontal scrollbar) */
.quickbar-label { font-size: 11px; color: var(--muted); margin: 6px 0 2px; display: block; }
.quickbar {
  display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 8px;
  scrollbar-width: thin; scrollbar-color: var(--accent) var(--surface-2);
  -webkit-overflow-scrolling: touch;
}
.quickbar::-webkit-scrollbar { height: 6px; display: block; }
.quickbar::-webkit-scrollbar-track { background: var(--surface-2); border-radius: 99px; }
.quickbar::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
.quickbar::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.qbtn {
  flex: none; font: 600 12px var(--mono); padding: 6px 10px;
  border-radius: 8px; background: var(--surface-2); color: var(--kw);
  border: 1px solid var(--line); cursor: pointer;
}
.qbtn.col { color: var(--al); background: rgba(240, 164, 93, 0.08); }
.qbtn:active { background: var(--accent); color: #fff; }

/* Dual-layer SQL Editor (iOS Safe + Vertical Line Numbers + Error Line Highlight) */
.ed {
  display: flex; border: 1px solid var(--line); border-radius: 12px;
  background: var(--code-bg); overflow: hidden; margin-top: 4px;
}
.ed:focus-within { border-color: var(--accent); outline: 2px solid var(--accent); }
#sqlgut, #sqlhl, #answer {
  font: 13.5px/1.6 var(--mono); letter-spacing: 0; word-spacing: 0;
}
#sqlgut {
  padding: 10px 6px; text-align: right; color: var(--muted);
  user-select: none; border-right: 1px solid var(--line); min-width: 2.8em;
  background: rgba(255,255,255,0.02); white-space: pre; overflow: hidden;
}
#sqlgut .ln { display: block; padding: 0 4px; border-radius: 4px; }
#sqlgut .ln.err { background: var(--open); color: #fff; font-weight: 700; }
.edwrap { position: relative; flex: 1; min-width: 0; }
#sqlhl, #answer { margin: 0; padding: 10px 12px; border: 0; white-space: pre; tab-size: 2; min-height: 118px; }
#sqlhl { position: absolute; inset: 0; overflow: hidden; pointer-events: none; color: var(--ink); }
#answer {
  position: relative; display: block; width: 100%; min-height: 118px;
  outline: 0; resize: none; background: transparent; color: transparent;
  caret-color: var(--ink); overflow-x: auto; overflow-y: hidden;
  appearance: none;
  -webkit-appearance: none;
}
#answer::selection { background: rgba(79, 117, 255, 0.32); }
.t-kw { color: var(--kw); font-weight: 600; }
.t-agg { color: var(--agg); font-weight: 600; }
.t-fn { color: var(--fn); }
.t-al { color: var(--al); }
.t-str { color: var(--str); }
.t-num { color: var(--num); }
.t-cmt { color: var(--cmt); font-style: italic; }
.t-bad { background: var(--open); color: #fff; }

/* Result Tables */
.tblwrap {
  overflow-x: auto; margin: 8px 0; border: 1px solid var(--line);
  border-radius: 10px; background: var(--code-bg); max-height: 260px;
}
.tblwrap table { border-collapse: collapse; width: 100%; font: 12.5px/1.45 var(--mono); }
.tblwrap th, .tblwrap td {
  padding: 6px 10px; text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.tblwrap th { background: var(--surface-2); color: var(--kw); font-weight: 600; position: sticky; top: 0; }
.tblwrap tr:last-child td { border-bottom: 0; }

/* Side-by-side / Stacked Comparison: Twój wynik vs Oczekiwany wynik */
.cmp-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 12px; }
@media (min-width: 600px) { .cmp-grid { grid-template-columns: 1fr 1fr; } }
.cmp-col { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--surface-2); min-width: 0; }
.cmp-col.bad { border-color: rgba(239, 68, 68, 0.45); }
.cmp-col.ok { border-color: rgba(16, 185, 129, 0.45); }
.cmp-hdr { font: 700 12.5px var(--body); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.cmp-hdr.bad { color: var(--open); }
.cmp-hdr.ok { color: var(--done); }
.cmp-col .tblwrap { margin: 0; max-height: 220px; }

/* Interview Difficulty Filter Pills & Table Specification Panel */
.diff-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 10px; }
.diff-pill { font: 600 12px var(--body); padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); cursor: pointer; transition: all .15s; }
.diff-pill:hover { border-color: var(--accent); color: var(--ink); }
.diff-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.iv-spec-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.iv-spec-hdr { font: 700 13.5px var(--head); color: var(--ink); margin-bottom: 2px; }
.iv-tbl-card { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.iv-tbl-card:first-of-type { border-top: 0; padding-top: 4px; margin-top: 4px; }
.iv-tbl-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.iv-schema-wrap { max-height: none; margin: 6px 0; }
details.iv-sample-fold { margin-top: 6px; font-size: 12px; }
details.iv-sample-fold summary { cursor: pointer; font-weight: 600; color: var(--kw); margin-bottom: 4px; }

/* Feedback Boxes */
.fb-box {
  border-radius: 12px; padding: 12px 14px; margin-top: 12px;
  border: 1px solid var(--line); background: var(--surface-2);
}
.fb-box.ok { border-color: var(--done); background: var(--done-soft); }
.fb-box.trap { border-color: var(--open); background: var(--open-soft); }
.fb-box.warn { border-color: var(--mid); background: var(--mid-soft); }

/* Bottom Navigation (Android Chrome + iOS Safari Safe Area) */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 20;
}
.tabs nav { max-width: 680px; margin: 0 auto; display: flex; }
.tab {
  flex: 1; background: none; border: 0; border-top: 3px solid transparent;
  color: var(--muted); font: 600 11px var(--body); padding: 8px 2px 10px;
  cursor: pointer; text-align: center;
}
.tab[aria-current="page"] { color: var(--accent); border-top-color: var(--accent); }
.tab svg { display: block; margin: 0 auto 3px; }
.bdg-cnt {
  display: inline-block; padding: 0 5px; border-radius: 99px;
  background: var(--open); color: #fff; font-size: 10px; margin-left: 3px;
}

input[type=text], input[type=password], select {
  width: 100%; font: 400 16px var(--body); padding: 9px 12px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--code-bg); color: var(--ink); margin-top: 4px;
}
#toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); font-weight: 600;
  padding: 10px 16px; border-radius: 12px; font-size: 13px;
  z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
#toast.show { opacity: 1; }

/* SoloLearn Tutorial Slides & SQL Execution Order Pipeline */
.tut-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 10px 0 14px; align-items: stretch; }
.tut-step-btn {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  border-radius: 9px; padding: 7px 4px; font: 600 11.5px var(--body);
  cursor: pointer; transition: all .15s; text-align: center;
  display: flex; align-items: center; justify-content: center;
  white-space: nowrap; min-width: 0;
}
.tut-step-btn.visited { border-color: rgba(16, 185, 129, 0.45); color: var(--done); }
.tut-step-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tut-card-inner { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.tut-list { margin: 8px 0 0; padding-left: 18px; }
.tut-list li { margin-bottom: 8px; line-height: 1.5; }
.tut-list code { font: 500 12px var(--mono); background: var(--surface); color: var(--kw); padding: 1px 5px; border-radius: 5px; border: 1px solid var(--line); }

.order-box { background: var(--code-bg); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; margin-bottom: 10px; }
.order-box.exec { border-color: rgba(79, 117, 255, 0.45); }
.order-label { font: 700 12px var(--body); color: var(--muted); margin-bottom: 8px; }
.order-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.order-arr { color: var(--muted); font-size: 12px; }
.order-pill {
  font: 600 11.5px var(--mono); padding: 3px 8px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}
.order-pill.active { background: rgba(79, 117, 255, 0.2); border-color: var(--accent); color: var(--kw); }

.exec-grid { display: grid; grid-template-columns: 1fr; gap: 6px; }
@media (min-width: 520px) { .exec-grid { grid-template-columns: 1fr 1fr; } }
.exec-step {
  display: flex; flex-direction: column; padding: 6px 10px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--line); font-size: 12px; opacity: 0.72;
}
.exec-step strong { font: 700 12px var(--mono); color: var(--kw); }
.exec-step span { color: var(--muted); font-size: 11.5px; }
.exec-step.active {
  opacity: 1; border-color: var(--done); background: var(--done-soft);
}
.exec-step.active strong { color: var(--done); }
.exec-step.active span { color: var(--ink); }

.tut-lines { display: flex; flex-direction: column; gap: 8px; }
.tut-line-item { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 9px; padding: 8px 11px; }
.tut-line-code code { font: 600 12px var(--mono); color: var(--ink); display: block; margin-bottom: 3px; white-space: pre-wrap; }
.tut-line-desc { font-size: 12.5px; color: var(--ink); }

.quiz-opts { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 13px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: 500 13.5px var(--body);
  cursor: pointer; transition: all .15s;
}
.quiz-opt-btn:hover { border-color: var(--accent); }
.quiz-letter {
  width: 26px; height: 26px; border-radius: 7px; background: var(--surface-2);
  border: 1px solid var(--line); display: grid; place-items: center;
  font: 700 12px var(--mono); color: var(--kw); flex-shrink: 0;
}
.quiz-opt-btn.correct { border-color: var(--done); background: var(--done-soft); }
.quiz-opt-btn.correct .quiz-letter { background: var(--done); border-color: var(--done); color: #fff; }
.quiz-opt-btn.wrong { border-color: var(--open); background: var(--open-soft); }
.quiz-opt-btn.wrong .quiz-letter { background: var(--open); border-color: var(--open); color: #fff; }

/* Variant Tiers & Progression Locks */
.var-tiers-box {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 12px;
}
.var-tier-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.var-tier-lbl { font-size: 12.5px; color: var(--muted); }
.var-legend { border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 2px; font-size: 11.5px; }
.var-pill {
  min-width: 44px; padding: 0 8px; gap: 3px; font-size: 11.5px;
}
.var-pill.var-pill-warm { border-color: rgba(16, 185, 129, 0.35); }
.var-pill.locked {
  opacity: 0.48; background: var(--code-bg); border-style: dashed;
  color: var(--muted); cursor: not-allowed; font-size: 11px;
}
.node-item.locked { opacity: 0.62; border-style: dashed; }
.stage-box.locked-stage { opacity: 0.82; border-left: 4px solid var(--line); }

/* DataLemur-Style Task Specification (📌 Polecenie + 📋 Wymagania i założenia + 🎯 Example Output) */
.dl-spec-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 12px;
}
.dl-prompt-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 12px 14px;
}
.dl-sec-hdr {
  font: 700 12.5px var(--body);
  color: var(--kw);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 5px;
}
.dl-prompt-body {
  font-size: 14.5px;
  color: var(--ink);
  line-height: 1.55;
}
.dl-assumptions-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent-2);
  border-radius: 12px;
  padding: 11px 14px;
}
.dl-assumptions-box .dl-sec-hdr {
  color: var(--agg);
}
.dl-assumptions-list {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.55;
}
.dl-assumptions-list li {
  margin-bottom: 5px;
}
.dl-assumptions-list li:last-child {
  margin-bottom: 0;
}
.dl-assumptions-list code {
  font: 600 12px var(--mono);
  background: var(--surface);
  color: var(--al);
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
}

/* Wymagania kolumnowe w osobnym wierszu (Punkt 5) */
.dl-cols-sublist-title {
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ink);
}
.dl-cols-sublist {
  margin: 6px 0 8px;
  padding-left: 20px;
  list-style: disc;
}
.dl-cols-sublist li {
  margin-bottom: 6px;
  line-height: 1.45;
  color: var(--ink);
}
.dl-alias-tag {
  font: 700 10px var(--mono);
  text-transform: uppercase;
  background: var(--mid-soft);
  color: var(--mid);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(245, 158, 11, 0.4);
  margin-left: 4px;
  display: inline-block;
}
.dl-alias-tip {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-size: 12.5px;
  color: var(--ink);
  line-height: 1.45;
}

/* SoloLearn Navigation & Progress Bar (Punkty 1, 6, 10) */
.task-nav-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.back-path-btn {
  font-weight: 700;
  font-size: 14px;
  padding: 9px 18px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  min-height: 42px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.back-path-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.sololearn-theory-btn {
  font-weight: 600;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  cursor: pointer;
}
.sololearn-progress-wrap {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 13px;
  margin-bottom: 14px;
}
.sololearn-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 7px;
  font-size: 12px;
}
.sololearn-step-badge {
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.sololearn-tier-badge {
  font-size: 11.5px;
  color: var(--muted);
}
.sololearn-pct {
  font-weight: 700;
  color: var(--muted);
  font-family: var(--mono);
}
.sololearn-bar {
  height: 6px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}
.sololearn-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 99px;
  transition: width 0.3s ease;
}
.task-page-title {
  font: 700 18px/1.3 var(--head);
  margin: 0 0 12px;
  color: var(--ink);
}

/* Dwustopniowy podgląd tabeli (Poziom 1: Kolumny, Poziom 2: Wiersze) (Punkt 11) */
.example-input-fold {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.example-input-summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  user-select: none;
}
.example-input-summary::-webkit-details-marker { display: none; }
.example-input-summary::after { content: "▼"; font-size: 9px; color: var(--muted); }
.example-input-fold[open] .example-input-summary::after { content: "▲"; }
.example-input-fold-body {
  margin-top: 8px;
}

/* Animacja płynnego wejścia zadania (Punkt 10) */
@keyframes taskTransitionEnter {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
.task-transition-enter {
  animation: taskTransitionEnter 0.28s ease-out both;
}

/* Example Output & Example Input Preview Boxes */
details.example-output-fold {
  background: var(--surface-2);
  border: 1px solid rgba(16, 185, 129, 0.42);
  border-left: 4px solid var(--done);
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 12.5px;
}
details.example-output-fold summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--done);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
details.example-output-fold summary::-webkit-details-marker { display: none; }
details.example-output-fold summary::after { content: "▼"; font-size: 10px; color: var(--muted); }
details.example-output-fold[open] summary::after { content: "▲"; }
.example-output-body {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.example-output-more {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.example-input-box {
  margin-top: 8px;
}
.example-input-hdr {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}
.col-type-badge {
  font: 500 10px var(--mono);
  color: var(--muted);
  background: var(--code-bg);
  padding: 1px 4px;
  border-radius: 4px;
  margin-left: 4px;
  opacity: 0.88;
}
.helper-col-btn:hover .col-type-badge {
  color: #fff;
  background: rgba(0, 0, 0, 0.25);
}

/* SQLBolt-Style 3-Point Live Validation Checklist */
.val-checklist {
  margin-top: 12px;
  padding: 10px 13px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.val-hdr {
  font: 700 12px var(--body);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}
.val-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.val-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  border: 1px solid var(--line);
  background: var(--code-bg);
}
.val-item.ok {
  border-color: rgba(16, 185, 129, 0.45);
  background: var(--done-soft);
  color: var(--ink);
}
.val-item.bad {
  border-color: rgba(239, 68, 68, 0.45);
  background: var(--open-soft);
  color: var(--ink);
}

/* 3-Step Progressive Hints ("Gimme a Hint" 1/3 -> 2/3 -> 3/3) */
.hint-stepper-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.hint-step-item {
  background: var(--surface-2);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-left: 4px solid var(--mid);
  border-radius: 11px;
  padding: 10px 13px;
}
.hint-step-item.trap-step {
  border-color: rgba(239, 68, 68, 0.45);
  border-left-color: var(--open);
  background: var(--open-soft);
}
.hint-step-hdr {
  font: 700 12px var(--body);
  color: var(--mid);
  margin-bottom: 4px;
}
.hint-step-item.trap-step .hint-step-hdr {
  color: var(--open);
}
.hint-step-body {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* 8-Line Step-by-Step Cheat Sheet */
.cheat-8-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cheat-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--code-bg);
  border: 1px solid var(--line);
  font-size: 12px;
}
.cheat-row.used {
  border-color: rgba(79, 117, 255, 0.5);
  background: rgba(79, 117, 255, 0.09);
}
.cheat-num {
  font: 700 11.5px var(--mono);
  color: var(--muted);
  width: 18px;
}
.cheat-kw-btn {
  font: 700 11.5px var(--mono);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--kw);
  cursor: pointer;
  transition: all .15s;
}
.cheat-kw-btn:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.cheat-kw-btn.active {
  border-color: var(--accent);
  background: rgba(79, 117, 255, 0.22);
}
.cheat-syn {
  font: 500 11.5px var(--mono);
  color: var(--str);
}
.cheat-desc {
  color: var(--muted);
  font-size: 12px;
}
.cheat-tag {
  color: var(--done);
  font-size: 11px;
  margin-left: 4px;
}
.cheat-lesson-extra {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

/* Next Task CTA Button */
.next-step-cta {
  width: 100%;
  min-height: 44px;
  font-size: 14px;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.28);
}

/* Interactive SQL Pipeline Simulator (Slide 2) */
.sql-sim-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--code-bg);
  border: 1px solid rgba(16, 185, 129, 0.45);
}
.sql-sim-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.sim-pills-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-bottom: 10px;
}
.sim-arr { color: var(--muted); font-size: 12px; }
.sim-step-pill {
  font: 600 11px var(--mono);
  padding: 5px 9px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: all .18s;
}
.sim-step-pill.done {
  border-color: rgba(16, 185, 129, 0.45);
  color: var(--done);
}
.sim-step-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}
.sim-stage-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.sim-clause-code {
  font: 700 12.5px var(--mono);
  color: var(--kw);
}
.sim-tbl {
  max-height: 170px;
  margin-top: 4px;
}

/* Tester Modal & Leaderboard Highlight */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(7, 11, 20, 0.78);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 12px; z-index: 45;
  box-sizing: border-box;
  overflow-y: auto;
}
.modal-card {
  width: 100%; max-width: 430px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px; padding: 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
}
.stage-quiz-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(7, 11, 20, 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.stage-quiz-modal {
  width: min(100%, 520px);
  max-height: min(90dvh, 760px);
  overflow-y: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.stage-quiz-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.stage-quiz-header h2 { margin: 2px 0 0; font-size: 20px; }
.stage-quiz-kicker, .stage-quiz-progress {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.stage-quiz-close {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 17px;
  cursor: pointer;
}
.stage-quiz-content { padding-top: 14px; }
.stage-quiz-question { margin: 8px 0 14px; font-size: 17px; line-height: 1.4; }
.stage-quiz-options { display: grid; gap: 8px; }
.stage-quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.stage-quiz-option:disabled { opacity: 1; cursor: default; }
.stage-quiz-option.correct { border-color: var(--done); background: var(--done-soft); }
.stage-quiz-option.wrong { border-color: var(--open); background: var(--open-soft); }
.stage-quiz-explanation {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  line-height: 1.5;
}
.stage-quiz-explanation.correct { border-color: var(--done); background: var(--done-soft); }
.stage-quiz-explanation.wrong { border-color: var(--open); background: var(--open-soft); }
.stage-quiz-result { padding: 12px 0 4px; text-align: center; }
.stage-quiz-result-icon { font-size: 38px; }
.stage-quiz-result h3 { margin: 4px 0; font-size: 21px; }
.stage-quiz-result p { margin: 8px 0 14px; }
.stage-quiz-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 8px 0 16px;
  padding: 11px 12px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: rgba(79, 117, 255, 0.1);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.stage-quiz-card.passed { border-color: var(--done); background: var(--done-soft); }
.stage-quiz-card-icon { font-size: 22px; }
.stage-quiz-card-copy { display: grid; flex: 1; gap: 1px; }
.stage-quiz-card-copy small, .stage-quiz-status { color: var(--muted); font-size: 12px; }
.stage-quiz-card.passed .stage-quiz-status { color: var(--done); font-weight: 700; }
@media (max-width: 390px) {
  .stage-quiz-backdrop { padding: 8px; }
  .stage-quiz-modal { padding: 14px; border-radius: 14px; }
  .stage-quiz-question { font-size: 16px; }
  .stage-quiz-option { padding: 9px; gap: 8px; font-size: 14px; }
  .stage-quiz-status { max-width: 92px; text-align: right; }
}
tr.lb-me td { background: var(--done-soft); color: var(--ink); }

/* ==========================================================================
   STANDARD v11: AS BADGE, STEP DROPDOWN, QUICK-BAR, TEACH-FIRST
   ========================================================================== */
.sql-as-badge {
  display: inline-block;
  padding: 1px 7px;
  margin: 0 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #1e1302;
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.35);
  vertical-align: middle;
}

/* Przełącznik kroków i dropdown ZADANIE X z Y */
.step-nav-cluster {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-card, rgba(255,255,255,0.04));
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 4px;
}
.step-nav-btn {
  background: transparent;
  border: none;
  color: var(--txt);
  font-size: 11.5px;
  padding: 3px 7px;
  cursor: pointer;
  border-radius: 999px;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.step-nav-btn:hover:not(:disabled) {
  background: var(--bg-hover, rgba(255,255,255,0.1));
}
.step-nav-btn:disabled, .step-nav-btn.disabled {
  opacity: 0.25;
  cursor: not-allowed;
}
.sololearn-step-badge.step-dropdown-btn {
  background: transparent;
  border: none;
  color: #38bdf8;
  font-weight: 800;
  font-size: 11.5px;
  padding: 2px 6px;
  cursor: pointer;
}
.sololearn-step-badge.step-dropdown-btn:hover {
  text-decoration: underline;
}
.task-dropdown-menu {
  margin-top: 8px;
  background: var(--surface, #1e293b);
  border: 1.5px solid #38bdf8;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.45);
  max-height: 270px;
  overflow-y: auto;
  animation: fadeIn 0.15s ease-out;
}
.task-dropdown-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--txt-muted);
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}
.task-dropdown-close {
  background: transparent;
  border: none;
  color: var(--txt-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
}
.task-dropdown-items {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.task-dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--txt);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}
.task-dd-item:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.12);
  border-color: #38bdf8;
}
.task-dd-item.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  font-weight: 700;
}
.task-dd-item.locked {
  opacity: 0.45;
  cursor: not-allowed;
}
.task-dd-icon {
  font-size: 13px;
  flex-shrink: 0;
}
.task-dd-code {
  font-weight: 800;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--line);
  color: #38bdf8;
  flex-shrink: 0;
}
.task-dd-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Kontekstowy Quick-Bar nad edytorem */
.sql-quick-bar-wrap {
  margin-bottom: 8px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
}
.quick-bar-label {
  font-size: 11.5px;
  color: var(--txt-muted);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.sql-quick-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.quick-chip-btn {
  flex: 0 0 auto;
  background: var(--surface, #1e293b);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 9px;
  font-family: var(--mono, monospace);
  font-size: 12px;
  font-weight: 600;
  color: #38bdf8;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.quick-chip-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  transform: translateY(-1px);
}
.quick-chip-btn.kw-as {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.45);
}
.quick-chip-btn.quick-tbl-chip {
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.45);
}
.quick-chip-btn.quick-col-chip {
  color: #e2e8f0;
  border-color: rgba(226, 232, 240, 0.28);
}

/* Zasada Teach-First: boks nowego elementu */
.teach-first-box {
  margin-bottom: 12px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.09), rgba(99, 102, 241, 0.09));
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-left: 4px solid #38bdf8;
  border-radius: 8px;
  padding: 10px 14px;
}
.teach-first-hdr {
  font-size: 13px;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 4px;
}
.teach-first-desc {
  font-size: 12.5px;
  color: var(--txt);
  margin: 0 0 6px;
  line-height: 1.45;
}
.teach-first-code {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  padding: 4px 8px;
  display: inline-block;
}
.teach-first-code code {
  font-family: var(--mono, monospace);
  font-size: 12px;
  color: #a5f3fc;
}

/* Wskaźnik interaktywności */
.interactive-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border: 1px dashed rgba(56, 189, 248, 0.45);
  border-radius: 8px;
  padding: 6px 10px;
  margin: 6px 0 8px;
}

/* ==========================================================================
   STANDARD v12: KOLOROWANIE SKŁADNI DBEAVER, UX, NAWIGACJA I SAMOUCZEK
   ========================================================================== */
.sql-kw {
  color: #ff9e3b;
  font-weight: 700;
}
.sql-fn {
  color: #c084fc;
  font-weight: 600;
}
.sql-str {
  color: #4ade80;
}
.sql-num {
  color: #38bdf8;
}
.sql-comment {
  color: #64748B;
  font-style: italic;
}
.sql-alias {
  color: #facc15;
  background: rgba(250, 204, 21, 0.14);
  border-radius: 3px;
}
:root[data-theme="light"] .sql-kw { color: #c2410c; }
:root[data-theme="light"] .sql-fn { color: #7e22ce; }
:root[data-theme="light"] .sql-str { color: #15803d; }
:root[data-theme="light"] .sql-num { color: #0369a1; }
:root[data-theme="light"] .sql-alias {
  color: #854d0e;
  background: rgba(234, 179, 8, 0.22);
}

/* Zabezpieczenie identycznej geometrii znaków w warstwie <pre id="sqlhl"> względem <textarea id="answer"> */
#sqlhl .sql-kw,
#sqlhl .sql-fn,
#sqlhl .sql-str,
#sqlhl .sql-num,
#sqlhl .sql-comment,
#sqlhl .sql-alias {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  letter-spacing: 0;
  word-spacing: 0;
  padding: 0;
  margin: 0;
  border: 0;
}

.teach-first-code code {
  color: var(--ink);
}
.cheat-syn {
  color: var(--ink);
}

/* Pulsowanie obramowania nieklikniętych elementów interaktywnych na slajdach */
@keyframes pulseInteractiveBorder {
  0%, 100% {
    border-color: rgba(56, 189, 248, 0.45);
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.25);
  }
  50% {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
  }
}
.pulse-unclicked {
  animation: pulseInteractiveBorder 2s infinite ease-in-out;
}
.order-pill {
  cursor: pointer;
  transition: all 0.15s ease;
}
.order-pill:hover {
  border-color: #38bdf8;
  color: var(--ink);
}
.order-pill.inspected {
  outline: 2px solid #facc15;
}
.exec-step {
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.15s ease;
}
.exec-step:hover {
  border-color: #38bdf8;
  opacity: 1;
}
.exec-step.inspected {
  outline: 2px solid #facc15;
  opacity: 1;
}
.clause-explain-box {
  margin-top: 8px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.4);
  font-size: 12.5px;
  line-height: 1.5;
}

/* Animacja zmiany zadania (600 ms) oraz pasek "Teraz rozwiązujesz" i pigułka odblokowania 5/8 */
@keyframes taskStepFlash {
  0% {
    border-color: #facc15;
    box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.35), 0 0 18px rgba(56, 189, 248, 0.45);
    transform: translateY(-1px);
  }
  60% {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
  }
  100% {
    border-color: var(--line);
    box-shadow: none;
    transform: translateY(0);
  }
}
.task-step-flash {
  animation: taskStepFlash 0.6s ease-out;
}

.task-now-solving-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  margin-bottom: 10px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(79, 117, 255, 0.16), rgba(56, 189, 248, 0.08));
  border: 1px solid rgba(79, 117, 255, 0.45);
  font-size: 13px;
  color: var(--ink);
}

.unlock-progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
}
.unlock-progress-pill.unlocked {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.5);
  color: var(--done);
}
.unlock-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.udot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(245, 158, 11, 0.5);
  display: inline-block;
}
.udot.on {
  background: #facc15;
  border-color: #facc15;
  box-shadow: 0 0 4px rgba(250, 204, 21, 0.7);
}

/* Przyciski nawigacji mobilnej pod kciuk (Ścieżka i Rekrutacja) */
.back-path-btn {
  min-height: 42px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 13.5px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1.5px solid var(--accent);
  color: var(--ink);
}
.sololearn-theory-btn {
  min-height: 42px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 13px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
}
.lemur-back-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 12px;
  cursor: pointer;
  text-align: left;
  font: 700 14px var(--body);
  box-shadow: 0 6px 18px rgba(79, 117, 255, 0.28);
  transition: transform 0.12s ease, filter 0.15s ease;
}
.lemur-back-banner:hover {
  filter: brightness(1.07);
}
.lemur-back-banner:active {
  transform: scale(0.99);
}
.lemur-back-sub {
  font-size: 12.5px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.22);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Sufler błędu przecinka przed FROM w PGlite */
.pg-error-sufler-pill {
  margin-bottom: 8px;
  padding: 7px 11px;
  border-radius: 8px;
  background: rgba(250, 204, 21, 0.16);
  border: 1px solid rgba(250, 204, 21, 0.55);
  color: #fde047;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
}
:root[data-theme="light"] .pg-error-sufler-pill {
  color: #854d0e;
  background: #fef9c3;
}

/* Wymagania i założenia: nierozbijalna pigułka wyliczeń przed AS */
.dl-cols-sublist li {
  margin-bottom: 7px;
}
.req-col-row {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
  max-width: 100%;
}
.req-calc-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(192, 132, 252, 0.15);
  border: 1px solid rgba(192, 132, 252, 0.42);
  color: #e9d5ff;
  font: 600 11.5px var(--mono);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
:root[data-theme="light"] .req-calc-pill {
  color: #6b21a8;
  background: #f3e8ff;
}

/* Naprawa kart i nagłówków pod-lekcji (1.1, 1.2) na Mapie Ścieżki dla ekranów 360px-375px */
.stage-box,
.node-list,
.node-item {
  min-width: 0;
  overflow-wrap: break-word;
}
.node-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 12px;
}
.node-item > div:first-child {
  min-width: 0;
  width: 100%;
}
.node-hdr-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
.node-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}
.node-num-badge {
  font: 700 12px var(--mono);
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 1px 6px;
  border-radius: 6px;
  flex-shrink: 0;
}
.node-title-txt {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.35;
  color: var(--ink);
  min-width: 0;
  overflow-wrap: break-word;
}
.node-prog-badge {
  flex-shrink: 0;
  font: 700 11.5px var(--mono);
  padding: 2px 8px;
  border-radius: 999px;
}

/* Przesuwany Samouczek Powitalny SoloLearn (4 karty + PWA) */
.onboarding-open-btn {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(139, 92, 246, 0.18));
  border: 1.5px solid #38bdf8;
  color: var(--ink);
  font-weight: 700;
}
.onboarding-modal-card {
  width: 100%;
  max-width: min(480px, calc(100vw - 24px));
  box-sizing: border-box;
  overflow-x: hidden;
  padding: 16px;
  touch-action: pan-y;
}
.onboarding-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 10px 0 14px;
}
.ob-dot,
.onboarding-dot {
  width: 28px;
  height: 7px;
  border-radius: 99px;
  background: var(--line);
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ob-dot.active,
.onboarding-dot.active {
  width: 42px;
  background: #38bdf8;
}
.ob-dot.done,
.onboarding-dot.done {
  background: var(--done);
}
.onboarding-slide-body {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  min-height: 250px;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-break: break-word;
}
.pwa-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--code-bg);
  border: 1px solid rgba(56, 189, 248, 0.35);
  font-size: 12.5px;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* v12.1: Przyciski Cofnij i Wyczyść w Quick-Barze oraz zwijana wskazówka składni */
.quick-bar-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.qb-act-btn {
  appearance: none;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #e2e8f0;
  font-family: var(--sans, sans-serif);
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.qb-act-btn:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: #38bdf8;
}
.qb-act-btn:active {
  transform: scale(0.97);
}
.qb-act-btn.qb-clear-btn {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.4);
  color: #fda4af;
}
.qb-act-btn.qb-clear-btn:hover {
  background: rgba(244, 63, 94, 0.22);
  border-color: #f43f5e;
}
:root[data-theme="light"] .qb-act-btn {
  color: #0f172a;
  background: rgba(2, 132, 199, 0.1);
  border-color: rgba(2, 132, 199, 0.35);
}
:root[data-theme="light"] .qb-act-btn.qb-clear-btn {
  color: #be123c;
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.35);
}

.mini-syntax-tip-wrap {
  margin-top: 6px;
}
.mini-syntax-tip-btn {
  appearance: none;
  background: rgba(250, 204, 21, 0.12);
  border: 1px dashed rgba(250, 204, 21, 0.5);
  color: #fde047;
  font-family: var(--sans, sans-serif);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.mini-syntax-tip-btn:hover {
  background: rgba(250, 204, 21, 0.2);
  border-color: #facc15;
}
:root[data-theme="light"] .mini-syntax-tip-btn {
  color: #854d0e;
  background: #fef9c3;
  border-color: #ca8a04;
}

/* ==========================================================================
   ZERO-SCROLL SPLIT UI (v12.2):
   1. Zwarty 2-liniowy pasek nawigacji zadania (<= 76px)
   2. Karta Kontekstu z 3 zakładkami (📌 Zadanie | 📊 Tabela | 🎯 Wzór i pomoc)
   3. Wizualny Pasek Kolumn Wyniku (.req-meta-strip + .req-cols-pipeline)
   4. Tryb Układanki Tap-to-Build dla rozgrzewek R1–R2 (.warmup-puzzle-box)
   ========================================================================== */

.card.task-solve-card {
  padding: 10px 12px;
}

@keyframes stepFlashPulse500 {
  0% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.55);
    border-color: #38bdf8;
  }
  100% {
    box-shadow: 0 0 0 6px rgba(56, 189, 248, 0);
    border-color: var(--line);
  }
}

.card.task-solve-card.task-step-flash {
  animation: stepFlashPulse500 0.5s ease-out;
}

/* 1. Zwarty Pasek Nawigacji Zadania (<= 76px wysokości łącznie) */
.compact-task-topbar {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  max-height: 74px;
  padding: 4px 6px;
  margin-bottom: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-sizing: border-box;
}

.compact-nav-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 36px;
  min-height: 36px;
}

.compact-top-btn.btn {
  height: 34px;
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.compact-step-cluster {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.compact-step-cluster .step-nav-btn {
  width: 28px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 11px;
  border-radius: 7px;
}

.compact-step-btn.sololearn-step-badge {
  height: 32px;
  min-height: 32px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.compact-nav-row2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 22px;
  min-height: 22px;
  padding: 0 2px;
}

.compact-lesson-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.compact-unlock-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.compact-unlock-badge.unlock-progress-pill {
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 99px;
  line-height: 1.3;
}

.compact-micro-bar {
  width: 46px;
  height: 4px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
}

.compact-micro-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--done));
  transition: width 0.3s ease;
}

/* 2. Trzy Zakładki Kontekstowe nad Edytorem (Zero-Scroll Task Card) */
.ctx-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 8px;
  overflow: hidden;
}

.ctx-tabs-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  background: rgba(15, 23, 42, 0.45);
  border-bottom: 1px solid var(--line);
}

:root[data-theme="light"] .ctx-tabs-bar {
  background: rgba(226, 232, 240, 0.65);
}

.ctx-tab-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: 700 12px var(--body);
  height: 31px;
  padding: 0 6px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.14s ease;
}

.ctx-tab-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}

.ctx-tab-btn.active {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--accent);
  box-shadow: 0 1px 6px rgba(79, 117, 255, 0.22);
}

.ctx-tab-body {
  padding: 8px 10px;
}

.ctx-card .dl-spec-wrap {
  margin: 0;
  gap: 6px;
}

.ctx-card .dl-prompt-box {
  padding: 7px 10px;
  margin: 0;
  border-radius: 9px;
}

.ctx-card .dl-sec-hdr {
  font-size: 11px;
  margin-bottom: 2px;
}

.ctx-card .dl-prompt-body {
  font-size: 13px;
  line-height: 1.42;
}

.ctx-card .dl-assumptions-box.req-strip-box {
  padding: 7px 9px;
  margin: 0;
  border-radius: 9px;
}

/* Kompaktowa pigułka 🆕 Nowy element w Zakładce 1 */
details.teach-first-box.teach-first-pill {
  margin: 0;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.32);
}

details.teach-first-box.teach-first-pill summary.teach-first-hdr {
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

details.teach-first-box.teach-first-pill summary.teach-first-hdr::-webkit-details-marker {
  display: none;
}

.teach-first-more {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  flex-shrink: 0;
}

details.teach-first-box.teach-first-pill .teach-first-body {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(16, 185, 129, 0.3);
}

/* 3. Wizualny Pasek Kolumn Wyniku (Result Columns Pipeline) */
.req-meta-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
}

.req-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  line-height: 1.35;
}

.req-meta-chip b {
  color: #38bdf8;
  font-family: var(--mono);
  font-size: 11.5px;
}

:root[data-theme="light"] .req-meta-chip b {
  color: #0369a1;
}

.req-cols-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 5px;
}

.req-cols-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
}

.req-cols-caption {
  font-size: 11px;
  color: var(--muted);
}

.req-cols-pipeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.req-col-pill {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px 4px 5px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid rgba(56, 189, 248, 0.38);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--body);
  font-size: 12px;
  transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
}

.req-col-pill:hover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
}

.req-col-pill:active {
  transform: scale(0.96);
}

.req-col-pill code {
  font: 700 12px var(--mono);
  color: #facc15;
  background: transparent;
  padding: 0;
  border: 0;
}

:root[data-theme="light"] .req-col-pill code {
  color: #b45309;
}

.req-col-pill.req-col-pill-alias {
  border-color: rgba(250, 204, 21, 0.45);
  background: rgba(250, 204, 21, 0.06);
}

.req-col-idx {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: rgba(79, 117, 255, 0.22);
  color: #93c5fd;
  font: 700 10.5px var(--mono);
  flex-shrink: 0;
}

:root[data-theme="light"] .req-col-idx {
  background: #dbeafe;
  color: #1d4ed8;
}

/* Zakładka 2 i 3 — inline tabela i wzór */
.inline-schema-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.example-output-inline-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.example-output-hdr-inline {
  font-size: 12.5px;
  color: var(--ink);
}

.ctx-help-acts.acts {
  margin: 6px 0 8px;
  gap: 6px;
}

/* 4. Tryb Układanki Tap-to-Build dla rozgrzewek R1–R2 (.warmup-puzzle-box) */
.warmup-puzzle-box {
  background: rgba(79, 117, 255, 0.07);
  border: 1px solid rgba(79, 117, 255, 0.35);
  border-radius: 11px;
  padding: 7px 9px;
  margin-bottom: 6px;
}

.warmup-puzzle-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--ink);
  margin-bottom: 6px;
}

.warmup-puzzle-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.puzzle-block-btn {
  appearance: none;
  background: var(--surface);
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-bottom: 2px solid rgba(79, 117, 255, 0.55);
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease, border-color 0.15s ease;
}

.puzzle-block-btn code {
  font: 600 12.5px var(--mono);
  background: transparent;
  border: 0;
  padding: 0;
}

.puzzle-block-btn:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.puzzle-block-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.puzzle-block-btn.used,
.puzzle-block-btn:disabled {
  opacity: 0.32;
  cursor: default;
  border-style: dashed;
  transform: none;
}

.task-solve-card .sql-quick-bar-wrap {
  margin-bottom: 4px;
  padding: 5px 8px;
}

.task-solve-card .acts {
  margin-top: 8px;
  gap: 6px;
}

@media (max-width: 480px) {
  .card.task-solve-card {
    padding: 8px 9px;
  }
  .compact-top-btn.btn {
    padding: 0 8px;
    font-size: 11.5px;
  }
  .compact-step-btn.sololearn-step-badge {
    padding: 0 7px;
    font-size: 11.5px;
  }
  .ctx-tab-btn {
    font-size: 11.5px;
    padding: 0 4px;
  }
  #answer {
    min-height: 118px;
  }
}

/* ==========================================================================
   v13 UX & Visual Lift Additions
   ========================================================================== */

/* Alias / Calc Column Pills & Popover */
.req-col-pill.req-col-pill-alias,
.req-col-pill-alias {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  background: rgba(245, 158, 11, 0.14) !important;
  border: 1px solid #f59e0b !important;
  color: #fef08a !important;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.22);
  transition: all 0.15s ease;
}
.req-col-pill.req-col-pill-alias:hover,
.req-col-pill.req-col-pill-alias.active,
.req-col-pill-alias:hover,
.req-col-pill-alias.active {
  background: rgba(245, 158, 11, 0.24) !important;
  border-color: #fbbf24 !important;
  transform: translateY(-1px);
}
.alias-info-icon {
  font-size: 11px;
  opacity: 0.9;
}
.alias-guide-caption {
  font-size: 11.5px;
  color: #fbbf24;
  margin-top: 5px;
  margin-bottom: 2px;
  display: block;
}
.alias-calc-popover {
  position: relative;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  animation: fadeIn 0.15s ease-out;
}
.alias-popover-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12.5px;
}
.alias-popover-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
}
.alias-popover-close:hover {
  color: var(--ink);
}
.alias-popover-body {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink);
}
.alias-popover-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}
.alias-popover-insert-btn {
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.alias-popover-insert-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* Table Sample Toggle Button */
.tbl-sample-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  justify-content: center;
  margin-top: 6px;
}
.tbl-sample-toggle-btn:hover {
  background: rgba(79, 117, 255, 0.08);
  border-color: var(--accent);
}

/* Onboarding Interactive Table */
.onb-interactive-tbl th.onb-th {
  transition: background-color 0.15s ease;
  user-select: none;
}
.onb-interactive-tbl th.onb-th:hover {
  background: rgba(79, 117, 255, 0.15) !important;
}
.onb-interactive-tbl tr.onb-tr {
  transition: background-color 0.15s ease;
  user-select: none;
}
.onb-interactive-tbl tr.onb-tr:hover {
  background: rgba(34, 197, 94, 0.1) !important;
}
.col-highlighted {
  background: rgba(59, 130, 246, 0.22) !important;
  color: #93c5fd !important;
  font-weight: 600;
}
.row-highlighted td {
  background: rgba(34, 197, 94, 0.2) !important;
  color: #86efac !important;
  font-weight: 600;
}
.onb-explain-box {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  animation: fadeIn 0.15s ease-out;
}
.onb-explain-box.col-box {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #bfdbfe;
}
.onb-explain-box.row-box {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #bbf7d0;
}
.onb-explain-box.hint-box {
  background: var(--surface-2);
  border: 1px dashed var(--line);
}

/* Guest Banner & Continue Learning Card */
.guest-auth-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.4);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #fef08a;
}
.guest-auth-btn {
  background: #eab308;
  color: #000;
  font-weight: 700;
  border: none;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
}
.continue-learning-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.18), rgba(249, 115, 22, 0.08));
  border: 1.5px solid #f97316;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.continue-learning-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.25);
}
.continue-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.continue-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #f97316;
}
.continue-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.continue-sub {
  font-size: 12px;
  color: var(--muted);
}
.continue-btn {
  flex-shrink: 0;
  background: #f97316;
  border-color: #f97316;
  color: #fff;
  font-weight: 600;
}
.continue-btn:hover {
  background: #ea580c;
}

/* Path Map Visual Timeline & Nodes */
.node-item.current-node {
  border-color: var(--accent) !important;
  background: linear-gradient(135deg, rgba(79, 117, 255, 0.14), rgba(168, 85, 247, 0.08)) !important;
  box-shadow: 0 0 0 2px rgba(79, 117, 255, 0.35), 0 4px 16px rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
}
.node-item.mastered {
  border-color: rgba(34, 197, 94, 0.35);
}
.node-state-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
}
.node-state-pill.done {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #4ade80;
}
.node-state-pill.current {
  background: rgba(79, 117, 255, 0.2);
  border: 1px solid var(--accent);
  color: #93c5fd;
  animation: pulseGlow 2s infinite;
}
.node-state-pill.open {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
}
.node-state-pill.locked {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

/* Diagnoza Success CTA */
.diag-next-btn {
  width: 100%;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 18px;
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
  transition: all 0.15s ease;
}
.diag-next-btn:hover {
  background: #16a34a;
  transform: translateY(-1px);
}

/* ==========================================================================
   v13.1 Global UI/UX, Contrast & Resilience System
   ========================================================================== */

/* 1. Wysoki kontrast kafelków w układance i Quick-Barze (Tryb jasny i ciemny) */
.puzzle-block-btn,
.quick-chip-btn,
.puzzle-chip,
.qb-chip {
  color: #f8fafc !important;
  background: #1e293b !important;
  border: 1px solid #475569 !important;
  font-weight: 600 !important;
}
.puzzle-block-btn:hover:not(:disabled),
.quick-chip-btn:hover,
.puzzle-chip:hover,
.qb-chip:hover {
  background: #334155 !important;
  border-color: #64748b !important;
}
.puzzle-block-btn.used,
.puzzle-block-btn:disabled {
  opacity: 0.35 !important;
  pointer-events: none !important;
  border-color: #334155 !important;
}
.puzzle-block-btn .sql-kw,
.quick-chip-btn .sql-kw,
.puzzle-chip .sql-kw,
.qb-chip .sql-kw {
  color: #fbbf24 !important;
  font-weight: 700 !important;
}
.puzzle-block-btn .sql-fn,
.quick-chip-btn .sql-fn,
.puzzle-chip .sql-fn,
.qb-chip .sql-fn {
  color: #d8b4fe !important;
  font-weight: 700 !important;
}
.puzzle-block-btn .sql-alias,
.quick-chip-btn .sql-alias,
.puzzle-chip .sql-alias,
.qb-chip .sql-alias {
  color: #fde047 !important;
  font-weight: 700 !important;
}

/* 2. Dwustopniowy akordeon dla wielu tabel (>= 2 tabel w zadaniu) */
.multi-table-accordion-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--bg-card);
  overflow: hidden;
}
.tbl-accordion-hdr {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}
.tbl-accordion-hdr:hover {
  background: rgba(255, 255, 255, 0.07);
}
.tbl-acc-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tbl-col-cnt {
  font-size: 11.5px;
  color: var(--muted);
}
.tbl-acc-arrow {
  font-size: 11.5px;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}
.tbl-accordion-body {
  padding: 10px 12px;
}

/* 3. Globalna ochrona układu i nagłówków na ekranach mobilnych (360px–414px) */
.view, .app, .card, .task-card-zero-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.acts, .req-cols-pipeline, .ctx-tabs-bar {
  flex-wrap: wrap;
}
.topbar, .top-bar, .app-header, .brand, .top-stats {
  flex-wrap: nowrap;
}
.card h2, .card h3, .brand-title {
  word-break: normal;
  overflow-wrap: break-word;
}

/* 4. Interaktywne okienka górnego paska (PG16, XP, Streak) */
.topbar-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 9999;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease-out;
}
.topbar-modal-card {
  background: var(--bg-surface, #1e293b);
  border: 1px solid var(--border, #334155);
  border-radius: 12px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  box-sizing: border-box;
  pointer-events: auto;
  z-index: 9999;
}
.topbar-modal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #334155);
  background: rgba(255, 255, 255, 0.02);
}
.topbar-modal-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--fg, #f8fafc);
  font-size: 16px;
  cursor: pointer;
  padding: 6px 10px;
  min-height: 38px;
  min-width: 38px;
  border-radius: 6px;
  pointer-events: auto;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.topbar-modal-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}
.topbar-modal-action-close {
  min-height: 38px !important;
  pointer-events: auto !important;
  z-index: 9999;
}
.topbar-modal-body {
  padding: 16px;
}

/* ==========================================================================
   v13.2: WYRÓŻNIENIE NAZW TABEL, SLOT POPOVERA ALIASU I PORÓWNANIA SOLOLEARN
   ========================================================================== */
.schema-table-name-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.45);
  font-family: var(--mono);
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.25;
}
.schema-table-desc {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 400;
}

#alias-help-popover-slot {
  width: 100%;
}
.alias-code-pill {
  display: inline-block;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.92em;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
  white-space: nowrap;
}
.alias-code-pill.alias-target {
  background: rgba(250, 204, 21, 0.16);
  border-color: rgba(250, 204, 21, 0.45);
  color: #fde047;
}
.alias-exact-formula {
  margin: 8px 0;
  padding: 8px 12px;
  background: var(--code-bg, #0d1117);
  border: 1px solid var(--border, #334155);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink, #f8fafc);
}
.alias-popover-src-btn,
.alias-popover-insert-btn {
  min-height: 36px;
  font-weight: 600;
}

.sololearn-cmp-box {
  margin: 8px 0;
  padding: 9px 12px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.5;
}
.sololearn-cmp-title {
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 6px;
  font-size: 12.5px;
}
.sololearn-cmp-bad {
  padding: 6px 8px;
  margin-bottom: 5px;
  background: rgba(239, 68, 68, 0.08);
  border-left: 3px solid #f87171;
  border-radius: 4px;
}
.sololearn-cmp-good {
  padding: 6px 8px;
  background: rgba(34, 197, 94, 0.1);
  border-left: 3px solid #4ade80;
  border-radius: 4px;
}
.sololearn-cmp-item {
  padding: 4px 0;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.16);
}
.sololearn-cmp-item:last-child {
  border-bottom: none;
}

/* ==========================================================================
   v14.0: CZYSTE 2-WIERSZOWE KARTY POD-LEKCJI NA MAPIE ŚCIEŻKI (MIMO / DATACAMP)
   ========================================================================== */
.node-item.path-node-clean {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
  padding: 12px 14px;
  width: 100%;
  box-sizing: border-box;
}
.node-clean-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}
.node-clean-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.node-clean-row2 {
  width: 100%;
  display: block;
  text-align: left;
}
.node-clean-row2 .node-title-txt {
  display: block;
  width: 100%;
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.38;
  color: var(--ink);
  word-break: normal;
  overflow-wrap: break-word;
}
.node-clean-bar {
  width: 100%;
  height: 5px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
  margin-top: 2px;
}
.node-clean-bar > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--done));
  transition: width 0.3s ease;
}








/* ==========================================================================
   v14.5: Bottom Sheet zadań/lekcji, Anty-Spojler AS, Ramki Rang 1–8, Baner PWA
   ========================================================================== */

/* 1. Bottom Sheet przełącznika zadań (renderowany w <body>, poza sticky nagłówkiem) */
.task-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 0.15s ease-out;
}
.task-sheet-card {
  width: 100%;
  max-width: 560px;
  max-height: 82vh;
  max-height: 82dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.45);
  animation: taskSheetUp 0.2s ease-out;
}
@keyframes taskSheetUp {
  from { transform: translateY(40px); opacity: 0.4; }
  to { transform: translateY(0); opacity: 1; }
}
.task-sheet-grip {
  width: 42px;
  height: 4px;
  border-radius: 4px;
  background: var(--line);
  margin: 2px auto 8px;
}
.task-sheet-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 4px;
}
.task-sheet-section {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 10px 0 6px;
}
.task-sheet-stage {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  margin: 8px 0 2px;
}
.task-sheet-card .task-dd-item { min-height: 40px; }
.task-sheet-card .task-dd-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.task-sheet-cnt {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
body.task-sheet-open { overflow: hidden; }

/* 2. Anty-Spojler: okienko AS bez gotowej formuły */
.alias-exact-formula.alias-no-spoiler {
  white-space: normal;
  font-family: var(--body);
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: transparent;
}
.alias-calc-popover-src { margin: 4px 0 6px; }
.quick-chip-btn.quick-op-chip { font-weight: 700; min-width: 34px; }
.quick-chip-btn.quick-alias-chip { border-style: dashed; }

/* 3. Ramki Rang 1–8 */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 17px;
  line-height: 1;
  flex: 0 0 auto;
  background: var(--surface-2);
  border: 3px solid transparent;
  box-sizing: border-box;
  vertical-align: middle;
}
.rank-badge.rank-badge-sm {
  width: 26px;
  height: 26px;
  font-size: 13px;
  border-width: 2px;
}
.rank-badge-slot { display: inline-flex; align-items: center; cursor: pointer; }
.rank-badge-slot:empty { display: none; }

/* Ranga 1–2: stalowo-miedziana */
.rank-frame-1,
.rank-frame-2 {
  border-color: transparent;
  background:
    linear-gradient(var(--surface-2), var(--surface-2)) padding-box,
    linear-gradient(135deg, #8a96a3 0%, #b87333 55%, #6b7785 100%) border-box;
}
.rank-frame-2 {
  background:
    linear-gradient(var(--surface-2), var(--surface-2)) padding-box,
    linear-gradient(135deg, #b87333 0%, #d9a066 45%, #8a96a3 100%) border-box;
}

/* Ranga 3–4: srebrno-szafirowa z delikatnym cieniem */
.rank-frame-3,
.rank-frame-4 {
  background:
    linear-gradient(var(--surface-2), var(--surface-2)) padding-box,
    linear-gradient(135deg, #e5e7eb 0%, #c0c7d1 40%, #1e4fd8 100%) border-box;
  box-shadow: 0 0 6px rgba(37, 99, 235, 0.35);
}
.rank-frame-4 {
  background:
    linear-gradient(var(--surface-2), var(--surface-2)) padding-box,
    linear-gradient(135deg, #f3f4f6 0%, #0f52ba 60%, #c0c7d1 100%) border-box;
  box-shadow: 0 0 9px rgba(15, 82, 186, 0.5);
}

/* Ranga 5–6: podwójna złoto-szmaragdowa z metalicznym gradientem */
.rank-frame-5,
.rank-frame-6 {
  background:
    linear-gradient(var(--surface-2), var(--surface-2)) padding-box,
    linear-gradient(135deg, #f5d76e 0%, #b8860b 30%, #fff1b8 50%, #10b981 75%, #046c4e 100%) border-box;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px #10b981, 0 0 10px rgba(245, 215, 110, 0.45);
}
.rank-badge-sm.rank-frame-5,
.rank-badge-sm.rank-frame-6 {
  box-shadow: 0 0 0 1px var(--surface), 0 0 0 3px #10b981;
}
.rank-frame-6 {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px #d4af37, 0 0 12px rgba(16, 185, 129, 0.55);
}
.rank-badge-sm.rank-frame-6 {
  box-shadow: 0 0 0 1px var(--surface), 0 0 0 3px #d4af37;
}

/* Ranga 7–8: animowana, pulsująca neonowo-fioletowo-złota */
.rank-frame-7,
.rank-frame-8 {
  background:
    linear-gradient(var(--surface-2), var(--surface-2)) padding-box,
    linear-gradient(135deg, #a855f7 0%, #ec4899 35%, #fbbf24 70%, #a855f7 100%) border-box;
  animation: rankNeonPulse 1.8s ease-in-out infinite;
}
.rank-frame-8 {
  background:
    linear-gradient(var(--surface-2), var(--surface-2)) padding-box,
    conic-gradient(from 0deg, #fbbf24, #a855f7, #22d3ee, #ec4899, #fbbf24) border-box;
  animation: rankNeonPulse 1.4s ease-in-out infinite;
}
@keyframes rankNeonPulse {
  0%, 100% { box-shadow: 0 0 4px rgba(168, 85, 247, 0.6), 0 0 8px rgba(251, 191, 36, 0.3); }
  50% { box-shadow: 0 0 10px rgba(168, 85, 247, 0.95), 0 0 18px rgba(251, 191, 36, 0.65); }
}
@media (prefers-reduced-motion: reduce) {
  .rank-frame-7, .rank-frame-8 { animation: none; box-shadow: 0 0 10px rgba(168, 85, 247, 0.8); }
}

/* 4. Baner PWA na dole Mapy Ścieżki (tylko telefon) */
.pwa-install-banner {
  display: none;
  align-items: center;
  gap: 8px;
  margin: 12px 0 4px;
  padding: 8px 10px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.pwa-install-txt { flex: 1; min-width: 0; }
.pwa-install-close {
  flex: 0 0 auto;
  min-width: 32px;
  min-height: 32px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}
@media (max-width: 820px), (pointer: coarse) {
  .pwa-install-banner { display: flex; }
}
@media (display-mode: standalone) {
  .pwa-install-banner { display: none !important; }
}


/* ==========================================================================
   v15.0: Fanfary/Konfetti Quizów, Bramka Quizu, Rejestr Luk (g1–g13), Gemini API
   ========================================================================== */

/* 1. Zablokowana karta Quizu Działu i animacja fanfar/konfetti po zdaniu */
.stage-quiz-card.locked {
  border-color: var(--line);
  background: var(--surface-2);
  opacity: 0.78;
}
.stage-quiz-card.locked .stage-quiz-status {
  color: var(--muted);
  font-weight: 600;
}
.stage-quiz-modal {
  position: relative;
  overflow-x: hidden;
}
.stage-quiz-modal.quiz-celebration {
  border: 2px solid #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25), 0 0 32px rgba(245, 158, 11, 0.45), 0 18px 40px rgba(0, 0, 0, 0.55);
  animation: quizGoldGlow 1.8s ease-in-out infinite;
}
@keyframes quizGoldGlow {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25), 0 0 24px rgba(245, 158, 11, 0.35), 0 18px 40px rgba(0, 0, 0, 0.5);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.45), 0 0 42px rgba(251, 191, 36, 0.65), 0 18px 44px rgba(0, 0, 0, 0.55);
  }
}
.quiz-confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}
.confetti-piece {
  position: absolute;
  top: -14px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  opacity: 0.92;
  animation: confettiFall 2.6s linear infinite;
}
@keyframes confettiFall {
  0% {
    transform: translateY(-10px) rotate(0deg);
    opacity: 1;
  }
  85% {
    opacity: 0.95;
  }
  100% {
    transform: translateY(420px) rotate(540deg);
    opacity: 0;
  }
}
.stage-quiz-result {
  position: relative;
  z-index: 3;
}
.quiz-trophy-pulse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  font-size: 42px;
  margin: 4px auto 8px;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.28) 0%, rgba(245, 158, 11, 0.06) 70%);
  border: 2px solid rgba(251, 191, 36, 0.65);
  animation: trophyPulse 1.3s ease-in-out infinite;
}
@keyframes trophyPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 10px rgba(251, 191, 36, 0.45); }
  50% { transform: scale(1.1); box-shadow: 0 0 24px rgba(251, 191, 36, 0.85); }
}
.quiz-celebration-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 10px 0 14px;
}
.quiz-xp-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  color: #1f1600;
  background: linear-gradient(135deg, #fde047, #f59e0b);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}
.quiz-unlock-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  color: var(--done);
  background: var(--done-soft);
  border: 1px solid var(--done);
}
@media (prefers-reduced-motion: reduce) {
  .confetti-piece, .quiz-trophy-pulse, .stage-quiz-modal.quiz-celebration { animation: none; }
}

/* 2. Zakładka Rejestr Luk (g1–g13) i Trener Luk */
.gap-summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.gap-card {
  padding: 12px;
  margin-top: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.gap-card.gap-open {
  border-color: rgba(239, 68, 68, 0.45);
}
.gap-card.gap-mastered {
  border-color: rgba(16, 185, 129, 0.45);
}
.gap-card-hdr {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}
.gap-card-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}
.gap-id-tag {
  display: inline-block;
  padding: 1px 6px;
  margin-right: 6px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  background: rgba(79, 117, 255, 0.16);
  color: var(--accent);
  border: 1px solid rgba(79, 117, 255, 0.35);
}
.gap-bar-wrap {
  margin: 8px 0 6px;
}
.gap-bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 4px;
}
.gap-bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}
.gap-bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}
.gap-bar > i.lvl-0, .gap-bar > i.lvl-1 { background: linear-gradient(90deg, #ef4444, #f59e0b); }
.gap-bar > i.lvl-2 { background: linear-gradient(90deg, #f59e0b, #38bdf8); }
.gap-bar > i.lvl-3, .gap-bar > i.lvl-4 { background: linear-gradient(90deg, #10b981, #34d399); }
.gap-compare-grid {
  display: grid;
  gap: 6px;
  margin: 8px 0 10px;
}
.gap-ex-bad, .gap-ex-good {
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  overflow-x: auto;
}
.gap-ex-bad {
  background: rgba(239, 68, 68, 0.08);
  border-left: 3px solid #f87171;
}
.gap-ex-good {
  background: rgba(16, 185, 129, 0.1);
  border-left: 3px solid #34d399;
}
.gap-card-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.gap-practice-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: rgba(79, 117, 255, 0.12);
  border: 1px solid rgba(79, 117, 255, 0.35);
}

/* 3. Karta Google Gemini API w Konto & AI */
.gemini-steps-box {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.gemini-steps-list {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink);
}
.gemini-status-box {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.45;
  border: 1px solid var(--line);
}
.gemini-status-box.ok {
  background: var(--done-soft);
  border-color: var(--done);
  color: var(--ink);
}
.gemini-status-box.err {
  background: var(--open-soft);
  border-color: var(--open);
  color: var(--ink);
}
.gemini-status-box.loading {
  background: rgba(79, 117, 255, 0.12);
  border-color: var(--accent);
  color: var(--ink);
}

/* ==========================================================================
   v15.1: STABILIZACJA MOBILNA 360px–420px, KARTA SAMOUCZKA I PRZEWIJANY RANKING
   ========================================================================== */
.tutorial-card-badge,
.tut-card-inner > .chip {
  white-space: normal;
  line-height: 1.35;
  max-width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
}

.leaderboard-scroll-wrap {
  max-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (max-width: 420px) {
  .topbar,
  .top-bar,
  .app-header {
    flex-wrap: nowrap;
    gap: 4px;
    padding: calc(6px + env(safe-area-inset-top, 0px)) 8px 6px;
  }
  .topbar .brand,
  .app-header .brand {
    flex-wrap: nowrap;
    gap: 4px;
    min-width: 0;
    flex-shrink: 1;
  }
  .topbar .brand-badge,
  .app-header .brand-badge {
    width: 24px;
    height: 24px;
    font-size: 10.5px;
    border-radius: 6px;
  }
  .topbar .brand-title,
  .app-header .brand-title {
    font-size: 13px;
    white-space: nowrap;
  }
  .topbar .top-stats,
  .app-header .top-stats {
    flex-wrap: nowrap;
    gap: 4px;
    flex-shrink: 0;
  }
  .topbar .pill-stat,
  .topbar .pill-pg,
  .app-header .pill-stat,
  .app-header .pill-pg {
    font-size: 11px;
    padding: 3px 6px;
    white-space: nowrap;
  }
  .topbar .btn-theme,
  .app-header .btn-theme {
    padding: 3px 6px;
    min-height: 26px;
    font-size: 12px;
  }
}
