/* agentsclub - main stylesheet
   Load order: tokens.css → kit.css → style.css
   Tailwind-compatible utility classes for the project.
*/

/* ── Typography utilities ────────────────────────────────── */
mark {
  background: linear-gradient(transparent 60%, var(--accent-2) 60% 92%, transparent 92%);
  color: inherit; padding: 0 .04em;
}

/* ── Wordmark ───────────────────────────────────────────── */
.wordmark {
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.05em;
  line-height: 1;
  color: #000;
  display: inline-block;
  white-space: nowrap;
  text-decoration: none;
  padding-right: .05em;
}
.dark .wordmark,
[data-theme="dark"] .wordmark { color: var(--fg-1); }

.wordmark.wm-lg { font-size: 34px; }
.wordmark.wm-sm { font-size: 19px; }

/* ── Layout ────────────────────────────────────────────── */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--s-6);
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--s-8);
  align-items: start;
}
@media (max-width: 900px) {
  .page { grid-template-columns: 1fr; }
  .col-side { display: none; }
}

/* No sidebar to show while GAMIFICATION_UI is off (see views/course.php) */
.page.page-solo { grid-template-columns: 1fr; }

.col-main { display: flex; flex-direction: column; gap: var(--s-6); }
.col-side  { display: flex; flex-direction: column; gap: var(--s-4); }

.stage {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--s-8) var(--s-6);
  min-height: 60vh;
}

/* ── Global nav ─────────────────────────────────────────── */
.global-nav {
  position: sticky;
  top: 0; z-index: 100;
  border-bottom: 1px solid var(--border-1);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 var(--s-6);
  gap: var(--s-4);
}
.global-nav .nav-logo { display: flex; align-items: center; gap: var(--s-3); text-decoration: none; }
.global-nav .nav-logo img { height: 32px; }
.global-nav .nav-spacer { flex: 1; }
.global-nav .nav-stats { display: flex; align-items: center; gap: var(--s-3); }
.global-nav .nav-stat {
  display: flex; align-items: center; gap: 5px;
  font: 700 15px/1 var(--font-ui); padding: 6px 12px;
  background: var(--surface); border: 1px solid var(--border-1);
  border-radius: var(--r-full); box-shadow: var(--shadow-xs);
}
/* Topbar icons: Phosphor light-weight outline, gentle gray. */
.topbar-icon { color: var(--fg-3); font-size: 16px; vertical-align: -2px; }
.iconbtn .topbar-icon { color: inherit; font-size: 20px; vertical-align: middle; }

.global-nav .dropdown { position: relative; }
.global-nav .dropdown-trigger {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; cursor: pointer;
  font: 600 14px/1 var(--font-ui); color: var(--fg-1);
  padding: 6px 12px; border-radius: var(--r-md);
  transition: background .12s;
}
.global-nav .dropdown-trigger:hover { background: var(--surface-2); }
/* Portret konta w starym pasku - wygląd przeniesiony 1:1 ze stylów inline,
   które stały w navbar-global.php do issue #109. Jedna reguła dla obu gałęzi
   `app_av_html()`: tło i kolor widać pod inicjałami, zdjęcie przykrywa
   krążek w całości. */
.global-nav .nav-av {
  width: 28px; height: 28px; border-radius: 50%; flex: none; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
  font: 700 12px/1 var(--font-ui);
}
.global-nav .nav-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.global-nav .dropdown-trigger .dropdown-username {
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.global-nav .dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--surface); border: 1px solid var(--border-1);
  border-radius: var(--r-md); box-shadow: var(--shadow-md);
  min-width: 200px; z-index: 200;
}
.global-nav .dropdown-menu hr { border: none; border-top: 1px solid var(--border-1); margin: 4px 0; }
.global-nav .dropdown-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; box-sizing: border-box;
  padding: 10px 16px; font: var(--body-sm); color: var(--fg-1);
  text-decoration: none; text-align: left;
  background: none; border: none; cursor: pointer;
  transition: background .12s;
}
.global-nav .dropdown-row:hover { background: var(--surface-2); }
.global-nav .dropdown-row-danger { color: var(--danger); }
.global-nav .dropdown-row-danger:hover { background: var(--danger-soft); }
.global-nav .dropdown-row-stat { cursor: default; }
.global-nav .dropdown-row-stat b { margin-left: auto; }
.global-nav .dropdown-mobile-extra { display: none; }

@media (max-width: 640px) {
  .global-nav { padding: 0 var(--s-3); gap: var(--s-2); }
  .global-nav .nav-desktop-extra { display: none; }
  .global-nav .dropdown-trigger .dropdown-username { max-width: 84px; }
  .global-nav .dropdown-menu { min-width: 220px; }
  .global-nav .dropdown-mobile-extra { display: block; }
}

/* ── Lesson nav ─────────────────────────────────────────── */
.lesson-nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: var(--s-4);
  padding: 0 var(--s-6); height: 56px;
  border-bottom: 1px solid var(--border-1);
}
.lesson-nav .ln-progress {
  flex: 1; display: flex; flex-direction: column; align-items: center;
}
.lesson-nav .ln-progress .track { width: 100%; max-width: 400px; height: 10px; }

/* ── Settings bar ───────────────────────────────────────── */
.settings-bar {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-6);
  border-bottom: 1px solid var(--border-1);
  font: var(--body-sm);
  color: var(--fg-3);
  background: var(--canvas);
}
.settings-bar .sb-sep { width: 1px; height: 20px; background: var(--border-1); margin: 0 var(--s-2); }
.settings-bar .sb-breadcrumb { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.settings-bar .iconbtn { width: auto; padding: 0 10px; gap: 5px; }

/* ── Terminal panel (global drawer) ────────────────────── */
.tp-overlay {
  position: fixed; inset: 0; z-index: 299;
  background: rgba(28,26,23,.35);
  backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .25s;
}
.tp-overlay.tp-visible { opacity: 1; }

.terminal-panel {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 300;
  height: 58vh; min-height: 320px; max-height: 700px;
  background: var(--ink);
  border-top: 1px solid var(--border-1);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,.22);
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
}
.terminal-panel.tp-visible { transform: translateY(0); }

.tp-bar {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 10px 16px; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.tp-dots { display: flex; gap: 6px; }
.tp-dot  { width: 12px; height: 12px; border-radius: 50%; }
.tp-title-text {
  flex: 1; text-align: center;
  font: 600 13px/1 var(--font-mono); color: var(--ink-fg); opacity: .55;
  margin-right: 54px; /* balance the dots width */
}
.tp-close {
  position: absolute; right: 12px; top: 8px;
  width: 30px; height: 30px; border-radius: var(--r-md);
  border: none; background: transparent;
  color: var(--ink-fg); opacity: .5; cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .15s, background .15s;
}
.tp-close:hover { opacity: 1; background: rgba(255,255,255,.08); }

.tp-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.tp-body .termwin {
  flex: 1; border-radius: 0; box-shadow: none;
  border: none; background: transparent;
}

/* ── IDE panel (global drawer) ──────────────────────────── */
.ide-panel {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 300;
  height: 68vh; min-height: 400px; max-height: 800px;
  background: var(--ink);
  border-top: 1px solid var(--border-1);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,.22);
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
}
.ide-panel.ip-visible { transform: translateY(0); }

.ip-overlay {
  position: fixed; inset: 0; z-index: 299;
  background: rgba(28,26,23,.35);
  backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .25s;
}
.ip-overlay.ip-visible { opacity: 1; }

.ip-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.ip-body .idewin {
  flex: 1; height: auto; border-radius: 0; box-shadow: none;
}

/* ── Section headers ────────────────────────────────────── */
.section-h { display: flex; align-items: baseline; gap: var(--s-4); margin-bottom: var(--s-2); }
.section-h h2 { font: var(--h2); color: var(--fg-1); margin: 0; }
.section-h .muted { font: var(--body-sm); color: var(--fg-3); }

/* ── Module card ────────────────────────────────────────── */
.module-card {
  padding: var(--s-6);
  display: flex; gap: var(--s-5); align-items: center;
  cursor: pointer; transition: box-shadow .15s, transform .1s;
  text-decoration: none; color: inherit;
}
.module-card:hover { box-shadow: var(--shadow-hard); transform: translateY(-1px); }
.module-card.locked { opacity: .6; cursor: default; }
.mc-body { flex: 1; min-width: 0; }
.mc-title { font: var(--h4); color: var(--fg-1); margin: 0 0 var(--s-2); }
.mc-meta { font: var(--body-sm); color: var(--fg-3); margin: 0 0 var(--s-3); }
.mc-prog { display: flex; align-items: center; gap: var(--s-3); }
.mc-prog .track { flex: 1; height: 8px; }
.mc-prog .prog-txt { font: 600 13px/1 var(--font-ui); color: var(--fg-2); white-space: nowrap; }

.module-card.done-expand { padding: 0; display: block; }
.module-card.done-expand > summary {
  padding: var(--s-6);
  display: flex; gap: var(--s-5); align-items: center;
  cursor: pointer; list-style: none;
}
.module-card.done-expand > summary::-webkit-details-marker { display: none; }
.module-card.done-expand > summary::after {
  content: '▾'; margin-left: var(--s-3); color: var(--fg-3); transition: transform .15s; flex-shrink: 0;
}
.module-card.done-expand[open] > summary::after { transform: rotate(180deg); }
.mc-lessons { padding: 0 var(--s-6) var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); }

/* ── Lesson card (inside an expanded module) ─────────────── */
.lesson-card {
  display: grid; grid-template-columns: 1.7fr 1fr; gap: 0;
  border: 1px solid var(--border-1); border-radius: var(--r-xl);
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.lesson-card:hover { border-color: var(--ink, var(--fg-1)); box-shadow: var(--shadow-hard); }
.lesson-card.locked:hover { box-shadow: none; }
.lesson-card.current { border-color: var(--primary); }
.lesson-card.locked { opacity: .6; }
.lc-main { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.lc-title { font: var(--h4); color: var(--fg-1); margin: 0; }
.lc-desc { font: var(--body-sm); color: var(--fg-3); margin: 0; }
.lc-meta { display: inline-flex; align-items: center; gap: var(--s-2); font: 600 12.5px/1 var(--font-ui); color: var(--fg-3); margin-top: var(--s-1); }
.lc-dot { width: 8px; height: 8px; border-radius: var(--r-full); flex-shrink: 0; }
.lc-dot.easy { background: var(--success); }
.lc-dot.medium { background: var(--warning); }
.lc-dot.hard { background: var(--danger); }
.lc-sep { width: 3px; height: 3px; border-radius: var(--r-full); background: var(--fg-3); opacity: .6; }
.lc-cta { align-self: flex-start; margin-top: var(--s-2); }
.lc-cta.locked { background: none; box-shadow: none; color: var(--fg-3); text-transform: none; letter-spacing: normal; font-weight: 600; padding: 0; }
.lc-cta.locked .ph-lock { font-size: 15px; vertical-align: -1px; }
.lc-steps {
  border-left: 1px solid var(--border-1); padding: var(--s-5);
  display: flex; flex-direction: column; gap: 2px; background: var(--surface-2);
}
.lc-steps-h { font: 700 12px/1 var(--font-ui); color: var(--fg-3); margin-bottom: var(--s-3); }
.lc-step { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-2) 0; border-top: 1px solid var(--border-1); }
.lc-step:first-of-type { border-top: none; }
.lc-step .n {
  flex-shrink: 0; width: 20px; height: 20px; border: 1.5px solid var(--fg-1);
  display: flex; align-items: center; justify-content: center;
  font: 700 11px/1 var(--font-ui); color: var(--fg-1); margin-top: 1px;
}
.lc-step .t { font: var(--body-sm); color: var(--fg-2); line-height: 1.4; }

@media (max-width: 640px) {
  .lesson-card { grid-template-columns: 1fr; }
  .lc-steps { border-left: none; border-top: 1px solid var(--border-1); }
}

/* ── Continue banner ────────────────────────────────────── */
.continue-banner {
  padding: var(--s-6) var(--s-8);
  background: var(--primary-soft);
  border: 1px solid var(--primary-ring);
  border-radius: var(--r-xl);
  display: flex; align-items: center; gap: var(--s-6);
}
.cb-info { flex: 1; }
.cb-kicker { font: var(--overline); color: var(--primary); margin-bottom: var(--s-2); }
.cb-title { font: var(--h3); color: var(--fg-1); margin: 0 0 var(--s-1); }
.cb-sub { font: var(--body-sm); color: var(--fg-2); margin: 0; }

@media (max-width: 640px) {
  .continue-banner { flex-direction: column; align-items: stretch; }
  .continue-banner .btn { width: 100%; justify-content: center; }
}

/* ── Slide styles ───────────────────────────────────────── */
.slide-h1 {
  font: var(--h1); letter-spacing: -0.02em; color: var(--fg-1);
  margin: var(--s-3) 0 var(--s-6);
}
.slide-lead {
  font: var(--read-lead); color: var(--fg-2);
  margin: 0 0 var(--s-6);
}
.slide-body {
  font: var(--read-body); color: var(--fg-1);
  margin: 0 0 var(--s-4);
}
.slide-body code {
  font: var(--mono-body); background: var(--surface-2);
  padding: 2px 6px; border-radius: var(--r-xs);
  color: var(--primary);
}
.slide-callout {
  display: flex; align-items: flex-start; gap: var(--s-3);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border-left: 2px solid var(--primary);
  padding: var(--s-4); margin: var(--s-6) 0;
  font: var(--body); color: var(--fg-1);
}
.slide-callout code { font: var(--mono-body); color: var(--primary); }

.slide-footer {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4) 0;
}
.slide-footer .spacer { flex: 1; }

/* ── Accordion ──────────────────────────────────────────── */
.accordion-list { display: flex; flex-direction: column; gap: var(--s-2); }
.accordion-item {
  border: 1px solid var(--border-1); border-radius: var(--r-md);
  overflow: hidden;
}
.accordion-header {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  cursor: pointer; background: var(--surface);
  font: 600 16px/1.3 var(--font-ui); color: var(--fg-1);
  border: none; width: 100%; text-align: left;
  transition: background .12s;
}
.accordion-header:hover { background: var(--surface-2); }
.accordion-header .ac-icon { font-size: 20px; }
.accordion-header .ac-chevron { margin-left: auto; color: var(--fg-3); transition: transform .2s; }
.accordion-item.open .ac-chevron { transform: rotate(180deg); }
.accordion-body {
  padding: var(--s-4) var(--s-5);
  font: var(--mono-body); color: var(--fg-2);
  background: var(--surface-2);
  border-top: 1px solid var(--border-1);
  display: none;
}
.accordion-item.open .accordion-body { display: block; }

/* ── Quiz ───────────────────────────────────────────────── */
.slide-quiz { max-width: 620px; }
.quiz-q { font: var(--h2); color: var(--fg-1); margin: var(--s-4) 0 var(--s-6); }
.quiz-opts { display: flex; flex-direction: column; gap: var(--s-3); }
.quiz-opt {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4) var(--s-5); border-radius: var(--r-md);
  border: 2px solid var(--border-2); background: var(--surface);
  cursor: pointer; font: var(--body); color: var(--fg-1);
  text-align: left; transition: border-color .12s, background .12s;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.quiz-opt.sel { border-color: var(--primary); background: var(--primary-soft); }
.quiz-opt.correct { border-color: var(--success); background: var(--success-soft); color: var(--fg-1); }
.quiz-opt.wrong { border-color: var(--danger); background: var(--danger-soft); animation: shake .3s ease; }
.quiz-opt.dim { opacity: .45; }
.quiz-key {
  min-width: 28px; height: 28px; border-radius: var(--r-sm);
  background: var(--surface-2); display: flex; align-items: center; justify-content: center;
  font: 700 13px/1 var(--font-ui); color: var(--fg-2); flex-shrink: 0;
}
.quiz-opt.sel .quiz-key { background: var(--primary); color: #fff; }
.quiz-opt.correct .quiz-key { background: var(--success); color: #fff; }
.quiz-opt.wrong .quiz-key { background: var(--danger); color: #fff; }

.quiz-open-input {
  width: 100%; padding: var(--s-4); border-radius: var(--r-md);
  border: 2px solid var(--border-2); background: var(--surface);
  font: var(--body); color: var(--fg-1); outline: none;
  transition: border-color .12s;
}
.quiz-open-input:focus { border-color: var(--primary); box-shadow: var(--ring-focus); }
.quiz-open-input.correct { border-color: var(--success); background: var(--success-soft); }
.quiz-open-input.wrong { border-color: var(--danger); background: var(--danger-soft); animation: shake .3s ease; }

.quiz-foot {
  margin-top: var(--s-6);
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-4) var(--s-5); border-radius: var(--r-md);
  min-height: 60px; background: var(--surface-2);
  transition: background .2s;
}
.quiz-foot.ok { background: var(--success-soft); }
.quiz-foot.no { background: var(--danger-soft); }
.quiz-feedback { display: flex; align-items: center; gap: var(--s-3); }
.qf-emo { font-size: 24px; }
.qf-sub { font: var(--body-sm); color: var(--fg-2); margin-top: 2px; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ── Terminal window ────────────────────────────────────── */
.termwin {
  background: var(--ink); border-radius: var(--r-xl);
  overflow: hidden; box-shadow: var(--shadow-lg);
  cursor: text; min-height: 360px;
  display: flex; flex-direction: column;
}
.termbar {
  background: var(--ink-2); padding: 12px 16px;
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.tdot { width: 12px; height: 12px; border-radius: var(--r-full); display: inline-block; }
.termtitle {
  font: 500 12px/1 var(--font-mono); color: var(--term-dim);
  margin-left: var(--s-3);
}
.termbody {
  flex: 1; padding: var(--s-4); overflow-y: auto;
  font: var(--mono-body); color: var(--ink-fg);
  scroll-behavior: smooth;
}
.termline { line-height: 1.6; white-space: pre-wrap; word-break: break-all; }
.tout { color: var(--ink-fg); }
.terr { color: var(--danger); }
.tdir { color: var(--term-path); margin-right: var(--s-4); }
.tfile { margin-right: var(--s-4); }
.tcols { display: flex; flex-wrap: wrap; }

.tprompt { display: inline; }
.tp-user { color: var(--term-prompt); }
.tp-dim  { color: var(--term-dim); }
.tp-path { color: var(--term-path); }

.tinput-row { display: flex; align-items: center; }
.tinput {
  background: transparent; border: none; outline: none;
  color: var(--ink-fg); font: var(--mono-body);
  flex: 1; caret-color: var(--term-cursor);
}
.tcmd { color: var(--ink-fg); }

/* ── Terminal + Explorer stacked wrap ───────────────────── */
.term-exp-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.term-exp-wrap .expwin { height: 400px; border-radius: var(--r-xl); }
.term-exp-wrap .termwin { min-height: 320px; border-radius: var(--r-xl); }

/* ── Win11 File Explorer ─────────────────────────────────── */
.expwin {
  background: #f3f3f3;
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  min-height: 360px;
  display: flex;
  flex-direction: column;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #1a1a1a;
  border: 1px solid rgba(0,0,0,0.09);
}

/* Title bar */
.expbar {
  background: #f3f3f3;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(0,0,0,0.07);
}
.edot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.exptitle {
  font: 500 12px/1 'Segoe UI', sans-serif;
  color: #444;
  margin-left: 6px;
  flex: 1;
  text-align: center;
  user-select: none;
}

/* Command bar */
.exp-cmdbar {
  background: #f3f3f3;
  padding: 2px 6px;
  display: flex;
  align-items: center;
  gap: 1px;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  flex-shrink: 0;
}
.exp-cmd-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px 7px;
  border-radius: 5px;
  font: 12px/1 'Segoe UI', sans-serif;
  color: #333;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.exp-cmd-btn:hover { background: rgba(0,0,0,0.07); }
.exp-cmd-btn:active { background: rgba(0,0,0,0.13); }
.exp-cmd-dis { opacity: 0.38; pointer-events: none; }
.exp-cmd-sep {
  width: 1px; height: 18px;
  background: rgba(0,0,0,0.13);
  margin: 0 3px;
  flex-shrink: 0;
}
.exp-cmd-spacer { flex: 1; }

/* Navigation bar */
.exp-navbar {
  background: #f0f0f0;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 3px;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  flex-shrink: 0;
}
.exp-nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  width: 26px; height: 26px;
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  color: #333;
  flex-shrink: 0;
}
.exp-nav-btn:hover:not(:disabled) { background: rgba(0,0,0,0.08); }
.exp-nav-btn:active:not(:disabled) { background: rgba(0,0,0,0.15); }
.exp-nav-btn:disabled { opacity: 0.32; cursor: default; }

.exp-address {
  flex: 1;
  min-width: 0;
  background: #fff;
  border: 1px solid #d4d4d4;
  border-radius: 5px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 3px;
  overflow: hidden;
  min-height: 26px;
  cursor: default;
  user-select: none;
}
.exp-address:hover { border-color: #0078d4; }
.exp-bc-item {
  cursor: pointer;
  color: #1a1a1a;
  font: 12px/1 'Segoe UI', sans-serif;
  padding: 2px 4px;
  border-radius: 3px;
  white-space: nowrap;
  display: flex; align-items: center; gap: 4px;
  flex-shrink: 0;
}
.exp-bc-item:hover { background: rgba(0,120,212,0.1); color: #0067c0; }
.exp-bc-sep { color: #888; font-size: 11px; flex-shrink: 0; }

.exp-search {
  background: #fff;
  border: 1px solid #d4d4d4;
  border-radius: 5px;
  padding: 4px 8px;
  display: flex; align-items: center; gap: 5px;
  width: 130px;
  flex-shrink: 0;
  cursor: text;
}
.exp-search:focus-within { border-color: #0078d4; }
.exp-search input {
  background: none; border: none; outline: none;
  font: 12px/1 'Segoe UI', sans-serif;
  color: #1a1a1a; width: 100%;
}
.exp-search input::placeholder { color: #aaa; }

/* Body */
.exp-body { flex: 1; display: flex; overflow: hidden; min-height: 0; }

.exp-navpane {
  width: 150px; flex-shrink: 0;
  background: #f3f3f3;
  border-right: 1px solid rgba(0,0,0,0.07);
  overflow-y: auto;
  padding: 6px 0 8px;
}
.exp-navpane::-webkit-scrollbar { width: 4px; }
.exp-navpane::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 2px; }

.exp-np-section {
  font: 700 12px/1.2 'Segoe UI', sans-serif;
  color: #777;
  padding: 6px 12px 3px;
  user-select: none;
}
.exp-np-item {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 10px 5px 12px;
  cursor: pointer;
  border-radius: 4px;
  font: 12.5px/1.2 'Segoe UI', sans-serif;
  color: #1a1a1a;
  margin: 1px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}
.exp-np-item span { overflow: hidden; text-overflow: ellipsis; }
.exp-np-item:hover { background: rgba(0,0,0,0.06); }
.exp-np-item.active { background: rgba(0,120,212,0.13); color: #0067c0; }

.exp-content {
  flex: 1; overflow-y: auto; background: #fff; padding: 6px;
  min-width: 0;
}
.exp-content::-webkit-scrollbar { width: 6px; }
.exp-content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }

.exp-empty {
  padding: 32px 16px;
  text-align: center;
  color: #999;
  font: 12px/1.5 'Segoe UI', sans-serif;
  user-select: none;
}

/* File grid */
.exp-grid {
  display: flex; flex-wrap: wrap;
  gap: 2px; align-content: flex-start;
  padding: 2px;
}
.exp-item {
  width: 76px;
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  border: 1px solid transparent;
  user-select: none;
  flex-shrink: 0;
}
.exp-item:hover {
  background: rgba(0,120,212,0.07);
  border-color: rgba(0,120,212,0.18);
}
.exp-item.selected {
  background: rgba(0,120,212,0.14);
  border-color: rgba(0,120,212,0.4);
}
.exp-item-icon { width: 40px; height: 40px; margin-bottom: 5px; flex-shrink: 0; }
.exp-item-icon svg { width: 40px; height: 40px; }
.exp-item-name {
  font: 11.5px/1.3 'Segoe UI', sans-serif;
  color: #1a1a1a;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-width: 72px;
}

/* Status bar */
.exp-statusbar {
  background: #f3f3f3;
  border-top: 1px solid rgba(0,0,0,0.07);
  padding: 3px 12px;
  display: flex; align-items: center; justify-content: space-between;
  font: 11.5px/1.4 'Segoe UI', sans-serif;
  color: #666;
  flex-shrink: 0;
  user-select: none;
}
.exp-view-btns { display: flex; align-items: center; gap: 4px; }

/* ── IDE window ─────────────────────────────────────────── */
.idewin {
  background: var(--ink); border-radius: var(--r-xl);
  overflow: hidden; box-shadow: var(--shadow-lg);
  height: 460px; display: flex; flex-direction: column;
}
.idebar {
  background: var(--ink-2); padding: 12px 16px;
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.idetitle {
  font: 500 12px/1 var(--font-mono); color: var(--term-dim);
  margin-left: var(--s-3);
}
.ide-body {
  flex: 1; display: flex; overflow: hidden; min-height: 0;
}
.ide-sidebar {
  width: 195px; min-width: 120px; flex-shrink: 0;
  background: #1A1714; border-right: 1px solid rgba(255,255,255,.06);
  display: flex; flex-direction: column; overflow: hidden;
}
.ide-exp-header {
  padding: 10px 14px 6px;
  font: 700 12px/1.2 var(--font-ui);
  color: var(--term-dim); flex-shrink: 0;
}
.ide-tree { flex: 1; overflow-y: auto; padding-bottom: var(--s-4); }
.ide-tree-row {
  display: flex; align-items: center; gap: 5px;
  width: 100%; border: none; background: none;
  color: var(--ink-fg); font: var(--mono-body); font-size: 12px;
  text-align: left; cursor: pointer; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; padding: 3px 14px;
  line-height: 1.6;
}
.ide-tree-row:hover { background: rgba(255,255,255,.06); }
.ide-tree-row.active { background: rgba(219,81,29,.22); color: var(--primary); }
.ide-dir-children { display: none; }
.ide-dir.open > .ide-dir-children { display: block; }
.ide-chevron { font-size: 10px; color: var(--term-dim); width: 10px; text-align: center; flex-shrink: 0; }
.ide-icon { font-size: 12px; flex-shrink: 0; }
.ide-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ide-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.ide-tabs {
  display: flex; overflow-x: auto; background: #1A1714;
  border-bottom: 1px solid rgba(255,255,255,.06); flex-shrink: 0;
}
.ide-tabs::-webkit-scrollbar { height: 0; }
.ide-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; cursor: default; white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,.05);
  color: var(--term-dim); font: var(--mono-body); font-size: 12px;
  border-top: 2px solid transparent; user-select: none;
}
.ide-tab.active {
  background: var(--ink); color: var(--ink-fg);
  border-top-color: var(--primary);
}
.ide-tab-name { cursor: pointer; }
.ide-tab-close {
  background: none; border: none; color: var(--term-dim);
  font-size: 15px; line-height: 1; padding: 0 1px; cursor: pointer;
  flex-shrink: 0; opacity: .6;
}
.ide-tab-close:hover { opacity: 1; color: var(--ink-fg); }

.ide-editor { flex: 1; overflow: auto; background: var(--ink); }
.ide-empty {
  padding: var(--s-10); color: var(--term-dim);
  font: var(--mono-body); font-size: 13px; text-align: center;
}
.ide-code-wrap { padding: var(--s-3) 0; }
.ide-line { display: flex; align-items: baseline; }
.ide-line:hover { background: rgba(255,255,255,.025); }
.ide-ln {
  min-width: 44px; padding: 0 14px 0 10px;
  color: var(--term-dim); font: var(--mono-body); font-size: 11px;
  text-align: right; user-select: none; flex-shrink: 0; line-height: 1.65;
}
.ide-code-line {
  color: var(--ink-fg); font: var(--mono-body); font-size: 13px;
  white-space: pre; padding-right: var(--s-6); line-height: 1.65;
}
/* Syntax tokens */
.ide-kw      { color: #C792EA; }
.ide-str     { color: #C3E88D; }
.ide-comment { color: var(--term-dim); font-style: italic; }
.ide-num     { color: #F78C6C; }
.ide-var     { color: #89DDFF; }

/* ── Lesson complete screen ─────────────────────────────── */
.complete {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(23,21,15,.7);
}
.confetti {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
}
.complete-card {
  position: relative; z-index: 1;
  padding: var(--s-8) var(--s-10);
  max-width: 480px; width: 90%;
  text-align: center;
  box-shadow: var(--shadow-pop);
}
.complete-check { font-size: 56px; margin-bottom: var(--s-4); }
.complete-title { font: var(--h1); color: var(--fg-1); margin: 0 0 var(--s-2); }
.complete-sub { font: var(--body); color: var(--fg-2); margin: 0 0 var(--s-4); }
.complete-time { font: 700 20px/1 var(--font-mono); color: var(--fg-3); margin-bottom: var(--s-6); }

.xp-breakdown {
  background: var(--surface-2); border-radius: var(--r-md);
  padding: var(--s-4); margin-bottom: var(--s-6); text-align: left;
}
.xp-line {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--s-2) 0; border-bottom: 1px solid var(--border-1);
  font: var(--body); color: var(--fg-2);
}
.xp-line:last-child { border-bottom: none; }
.xp-total { font: 700 16px/1 var(--font-ui); color: var(--fg-1); }
.xp-amt { font: 700 15px/1 var(--font-mono); color: var(--xp); }

.complete-modprog { text-align: left; margin-bottom: var(--s-6); }
.cmp-row { font: var(--body-sm); color: var(--fg-3); margin-bottom: var(--s-2); }
.complete-actions { display: flex; gap: var(--s-3); justify-content: center; flex-wrap: wrap; }

/* ── XP popup ───────────────────────────────────────────── */
.xp-popup {
  position: fixed; top: 72px; right: var(--s-6);
  background: var(--xp); color: #fff;
  font: 700 18px/1 var(--font-mono);
  padding: var(--s-3) var(--s-5); border-radius: var(--r-full);
  box-shadow: var(--shadow-md); z-index: 300;
  animation: xp-float 2s ease forwards;
  pointer-events: none;
}
@keyframes xp-float {
  0%   { opacity: 0; transform: translateY(10px); }
  15%  { opacity: 1; transform: translateY(0); }
  70%  { opacity: 1; transform: translateY(-10px); }
  100% { opacity: 0; transform: translateY(-30px); }
}

/* ── Achievement modal ──────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(23,21,15,.6);
  display: flex; align-items: center; justify-content: center;
}
.ach-modal {
  padding: var(--s-8); max-width: 380px; width: 90%;
  text-align: center; box-shadow: var(--shadow-pop);
}
.ach-icon { font-size: 52px; margin-bottom: var(--s-4); }
.ach-badge-wrap {
  width: 80px; height: 80px; border-radius: var(--r-full);
  margin: 0 auto var(--s-4);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
}
.ach-badge-wrap.bronze { background: linear-gradient(135deg, var(--tier-bronze), var(--tier-bronze-hi)); }
.ach-badge-wrap.silver { background: linear-gradient(135deg, var(--tier-silver), var(--tier-silver-hi)); }
.ach-badge-wrap.gold   { background: linear-gradient(135deg, var(--tier-gold),   var(--tier-gold-hi)); }

/* ── Daily goal ring ────────────────────────────────────── */
.goal-card {
  display: flex; align-items: center; gap: var(--s-5);
  padding: var(--s-5);
}
.goal-ring { width: 72px; height: 72px; flex-shrink: 0; }
.goal-ring circle { fill: none; stroke-linecap: round; }
.goal-txt h3 { font: var(--h4); color: var(--fg-1); margin: 0 0 var(--s-1); }
.goal-txt p  { font: var(--body-sm); color: var(--fg-2); margin: 0; }

/* ── League widget ──────────────────────────────────────── */
.league-widget { padding: var(--s-5); }
.league-head { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-4); }
.league-head h3 { font: var(--h4); color: var(--fg-1); margin: 0; }
.league-row {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) 0; border-bottom: 1px solid var(--border-1);
  font: var(--body-sm); color: var(--fg-2);
}
.league-row:last-child { border-bottom: none; }
.league-row.me { font-weight: 700; color: var(--primary); background: var(--primary-soft);
  margin: 0 calc(-1 * var(--s-5)); padding: var(--s-2) var(--s-5); }
.league-rank { font: 700 13px/1 var(--font-mono); color: var(--fg-3); min-width: 20px; }
.league-av {
  width: 28px; height: 28px; border-radius: var(--r-full);
  background: var(--primary-soft); color: var(--primary);
  font: 700 11px/1 var(--font-ui); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.league-name { flex: 1; }
.league-xp { font: 700 13px/1 var(--font-mono); color: var(--fg-1); }

/* ── Achievements strip ─────────────────────────────────── */
.ach-strip { padding: var(--s-5); }
.ach-strip h3 { font: var(--h4); color: var(--fg-1); margin: 0 0 var(--s-4); }
.ach-strip-grid { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.ach-chip {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-2);
  padding: var(--s-3); border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border-1);
  min-width: 70px; text-align: center;
  font: 600 11px/1.2 var(--font-ui); color: var(--fg-2);
}
.ach-chip.locked { opacity: .4; filter: grayscale(1); }
.ach-chip-icon {
  width: 40px; height: 40px; border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--fg-on-color);
}
.ach-chip-icon.bronze { background: linear-gradient(135deg, var(--tier-bronze), var(--tier-bronze-hi)); }
.ach-chip-icon.silver { background: linear-gradient(135deg, var(--tier-silver), var(--tier-silver-hi)); }
.ach-chip-icon.gold   { background: linear-gradient(135deg, var(--tier-gold),   var(--tier-gold-hi)); }

/* ── Comments section ───────────────────────────────────── */
.comments-section { max-width: 720px; margin: 0 auto; padding: var(--s-6); }
.comments-toggle {
  display: flex; align-items: center; gap: var(--s-2);
  font: 600 15px/1 var(--font-ui); color: var(--fg-2);
  cursor: pointer; background: none; border: none; padding: 0;
  transition: color .12s;
}
.comments-toggle:hover { color: var(--primary); }
.comments-panel { margin-top: var(--s-5); }
.comment-form textarea {
  width: 100%; border: 1.5px solid var(--border-2); border-radius: var(--r-md);
  padding: var(--s-4); font: var(--body); color: var(--fg-1);
  background: var(--surface); outline: none; resize: vertical; min-height: 80px;
}
.comment-form textarea:focus { border-color: var(--primary); box-shadow: var(--ring-focus); }
.comment-form .form-actions { display: flex; justify-content: flex-end; margin-top: var(--s-3); }

.comment-item { display: flex; gap: var(--s-3); padding: var(--s-4) 0; border-bottom: 1px solid var(--border-1); }
.comment-item:last-child { border-bottom: none; }
.comment-av {
  width: 36px; height: 36px; border-radius: var(--r-full); flex-shrink: 0; overflow: hidden;
  background: var(--primary-soft); color: var(--primary);
  font: 700 13px/1 var(--font-ui); display: flex; align-items: center; justify-content: center;
}
.comment-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.comment-body { flex: 1; }
.comment-meta { font: var(--body-sm); color: var(--fg-3); margin-bottom: var(--s-1); }
.comment-meta strong { color: var(--fg-1); }
.comment-text { font: var(--body); color: var(--fg-1); margin: 0; }

/* ── Note modal ─────────────────────────────────────────── */
.note-modal { padding: var(--s-6); max-width: 480px; width: 90%; }
.note-modal h3 { font: var(--h3); color: var(--fg-1); margin: 0 0 var(--s-2); }
.note-modal p  { font: var(--body-sm); color: var(--fg-3); margin: 0 0 var(--s-4); }
.note-modal textarea {
  width: 100%; min-height: 160px; border: 1.5px solid var(--border-2);
  border-radius: var(--r-md); padding: var(--s-4); resize: vertical;
  font: var(--body); color: var(--fg-1); background: var(--surface); outline: none;
}
.note-modal textarea:focus { border-color: var(--primary); box-shadow: var(--ring-focus); }
.note-actions { display: flex; justify-content: flex-end; gap: var(--s-3); margin-top: var(--s-4); }

/* ── Level up modal ─────────────────────────────────────── */
.levelup { padding: var(--s-8); max-width: 380px; width: 90%; text-align: center; box-shadow: var(--shadow-pop); }
.levelup-badge { font-size: 56px; margin-bottom: var(--s-4); }
.lvl-xp {
  font: 700 20px/1 var(--font-mono); color: var(--xp);
  margin: var(--s-4) 0;
}

/* ── Login / register pages ─────────────────────────────── */
.auth-page {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: var(--canvas); padding: var(--s-6);
}
.auth-card { padding: var(--s-8); max-width: 420px; width: 100%; }
.auth-card h1 { font: var(--h2); color: var(--fg-1); margin: 0 0 var(--s-6); text-align: center; }
.auth-card .auth-logo { display: flex; justify-content: center; margin-bottom: var(--s-6); }
.auth-card .auth-logo img { height: 40px; }
.form-group { margin-bottom: var(--s-5); }
.form-group label { display: block; font: var(--label); color: var(--fg-2); margin-bottom: var(--s-2); }
.form-group input {
  width: 100%; padding: var(--s-4); border: 1.5px solid var(--border-2);
  border-radius: var(--r-md); font: var(--body); color: var(--fg-1);
  background: var(--surface); outline: none; transition: border-color .12s;
}
.form-group input:focus { border-color: var(--primary); box-shadow: var(--ring-focus); }
.form-group select {
  width: 100%; padding: var(--s-4); padding-right: calc(var(--s-4) + 22px);
  border: 1.5px solid var(--border-2); border-radius: var(--r-md);
  font: var(--body); color: var(--fg-1); background-color: var(--surface);
  outline: none; cursor: pointer; transition: border-color .12s;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2375706A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--s-4) center; background-size: 14px;
}
.form-group select:focus { border-color: var(--primary); box-shadow: var(--ring-focus); }
.form-group select:hover { border-color: var(--fg-3); }
.dark .form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238B857A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.auth-sep { text-align: center; font: var(--body-sm); color: var(--fg-3); margin: var(--s-5) 0; }
.auth-switch { text-align: center; font: var(--body-sm); color: var(--fg-2); margin-top: var(--s-4); }
.auth-switch a { color: var(--primary); text-decoration: none; font-weight: 600; }
.oauth-btn {
  width: 100%; padding: var(--s-4); border: 1.5px solid var(--border-2);
  border-radius: var(--r-md); background: var(--surface); font: 600 15px/1 var(--font-ui);
  color: var(--fg-1); cursor: pointer; display: flex; align-items: center; justify-content: center;
  gap: var(--s-3); margin-bottom: var(--s-3); transition: background .12s, border-color .12s;
}
.oauth-btn:hover { background: var(--surface-2); border-color: var(--primary); }

/* ── Flash message ──────────────────────────────────────── */
.flash {
  padding: var(--s-4); border-radius: var(--r-md);
  font: var(--body-sm); margin-bottom: var(--s-4);
}
.flash-error   { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); }
.flash-success { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }

/* ── Utility ─────────────────────────────────────────────── */
.w-full { width: 100%; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.font-sm { font-size: 14.5px; }
.font-md { font-size: 16px; }
.font-lg { font-size: 17.5px; }
.font-xl { font-size: 19px; }

/* ── Cookie banner ───────────────────────────────────────── */
/* Deliberately a fixed white surface (not a themed token) so it visually
   cuts itself off from the page underneath it in both light and dark mode. */
.cookie-banner {
  position: fixed; left: var(--s-4); right: var(--s-4); bottom: var(--s-4); z-index: 500;
  max-width: 640px; margin: 0 auto;
  background: #FFFFFF; border: 1px solid var(--border-2); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: var(--s-5);
  display: flex; align-items: center; justify-content: center; text-align: center;
  gap: var(--s-4); flex-wrap: wrap;
}
.cookie-banner p {
  flex: 1 1 320px; margin: 0; font: var(--body-sm); color: #3A362E;
}
.cookie-banner p a { color: var(--primary); font-weight: 600; }
/* Zawartość przypinamy razem z powierzchnią. `.btn-primary` (kit.css) jedzie
   z --primary, a ciemny motyw rozjaśnia ten pomarańcz do #F26430 i przy okazji
   miesza krawędź candy z bielą - na białym banerze biały napis na nim spada
   do ~2,8:1, a cień robi się jaśniejszy od lica. Przycisk nie znika jak w V2
   (tam --btn-bg w ciemnym to czysta biel), ale przyczyna jest ta sama, więc
   i lekarstwo: przypięte tokeny na banerze, a nie przepisane właściwości
   przycisku. Link z reguły wyżej dostaje to samo.
   Wartości muszą być jasnymi wartościami z v2/bridge.css (to on, nie
   tokens.css, ma ostatnie słowo na stronach legacy) - inaczej przypięcie
   przemalowuje baner także w jasnym motywie. */
.cookie-banner {
  --primary:       #DB511D;
  --primary-hover: color-mix(in srgb, #DB511D 86%, black);
  --primary-press: color-mix(in srgb, #DB511D 72%, black);
}

/* ── Site footer ─────────────────────────────────────────── */
.site-footer {
  flex-shrink: 0; margin-top: auto;
  text-align: center;
  padding: var(--s-6) var(--s-4);
  font: var(--caption);
  color: var(--fg-3);
}

/* ── Strony prawne (regulamin, polityka prywatności) ──────────
   head.php nie ładuje v2/base.css, więc jego `a{color:inherit}`
   tu nie działa i linki dostawały domyślny błękit UA - nieczytelny
   na ciemnym tle. */
.legal a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.legal a:hover { color: var(--primary-hover); }
