/* =========================================================
   TakeIQTest Engine — refined UI (mobile-first, a11y, dark/light)
   ========================================================= */

/* ------------------ Tokens (CSS variables) ------------------ */
:root{
  color-scheme: light dark;
  --tqe-font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Arial, "Apple Color Emoji","Segoe UI Emoji";

  /* Palette (light) */
  --tqe-bg:#ffffff;
  --tqe-surface:#ffffff;
  --tqe-elev:#f6f7f9;
  --tqe-text:#111827;
  --tqe-muted:#6b7280;
  --tqe-border:#e5e7eb;
  --tqe-primary:#2563eb;          /* blue-600 */
  --tqe-ring:#2563eb;
  --tqe-primary-contrast:#ffffff;

  --tqe-success:#16a34a;
  --tqe-success-bg:#ecfdf5;
  --tqe-danger:#dc2626;
  --tqe-danger-bg:#fef2f2;
  --tqe-warning:#b45309;
  --tqe-warning-bg:#fffbeb;

  --tqe-shadow:0 1px 2px rgba(0,0,0,.06), 0 1px 1px rgba(0,0,0,.03);
  --tqe-shadow-lg:0 8px 16px rgba(0,0,0,.08), 0 3px 6px rgba(0,0,0,.05);

  --tqe-radius:16px;
  --tqe-radius-sm:12px;
  --tqe-radius-xs:10px;
  --tqe-gap:14px;

  --fs-sm:clamp(.9rem,.85rem + .2vw,.98rem);
  --fs-md:clamp(1.06rem,1rem + .4vw,1.18rem);
  --fs-lg:clamp(1.22rem,1.08rem + .9vw,1.6rem);
}
@media (prefers-color-scheme: dark){
  :root{
    --tqe-bg:#0b0f13;
    --tqe-surface:#0f141a;
    --tqe-elev:#141a22;
    --tqe-text:#e5e7eb;
    --tqe-muted:#9ca3af;
    --tqe-border:#263141;
    --tqe-primary:#60a5fa;        /* blue-400 */
    --tqe-ring:#60a5fa;
    --tqe-primary-contrast:#0b0f13;

    --tqe-success:#34d399;
    --tqe-success-bg:#0d1f1a;
    --tqe-danger:#f87171;
    --tqe-danger-bg:#1c1313;
    --tqe-warning:#fbbf24;
    --tqe-warning-bg:#211a0a;

    --tqe-shadow:0 1px 2px rgba(0,0,0,.35), 0 1px 1px rgba(0,0,0,.25);
    --tqe-shadow-lg:0 12px 22px rgba(0,0,0,.45), 0 3px 6px rgba(0,0,0,.35);
  }
}

/* ------------------ Scope & base ------------------ */
:where(.tqe-app,#tqe-app,#tqe-main-test,#tqe-practice-test,#tqe-profile,.tqe-container){
  font-family:var(--tqe-font);
  background:var(--tqe-bg);
  color:var(--tqe-text);
  max-width:780px;
  margin:0 auto;
  padding:18px;
}
:where(.tqe-app,#tqe-app) *{ box-sizing:border-box; }

/* Card helper */
.tqe-card{
  background:var(--tqe-surface);
  border:1px solid var(--tqe-border);
  border-radius:var(--tqe-radius);
  box-shadow:var(--tqe-shadow);
}

/* ------------------ Header ------------------ */
.tqe-header{
  display:grid;
  grid-template-columns:1fr auto;
  align-items:end;
  gap:8px 14px;
  margin-bottom:8px;
  color:var(--tqe-muted);
  font-size:var(--fs-sm);
}
.tqe-category{ font-weight:700; color:var(--tqe-text); }
.tqe-timer,.tqe-count{ color:var(--tqe-muted); }

/* ------------------ Progress bar ------------------ */
.tqe-progress{
  --bar-h: 22px;
  position:relative;
  height:var(--bar-h);
  width:100%;
  background:var(--tqe-elev);
  border:1px solid var(--tqe-border);
  border-radius:999px;
  overflow:hidden;
  margin:8px 0 16px;
  display:grid;
  place-items:center;
}
@media (min-width:768px){ .tqe-progress{ --bar-h: 24px; } }
.tqe-progress-bar{
  position:absolute;
  inset:0 auto 0 0;
  width:0%;
  height:100%;
  background:var(--tqe-primary);
  transition:width .25s ease;
}
.tqe-progress .tqe-progress-label,
.tqe-progress .tqe-label,
.tqe-progress > span{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  padding:0 10px;
  font-weight:800;
  font-size:clamp(.82rem,.78rem + .2vw,.92rem);
  letter-spacing:.01em;
  color:var(--tqe-text);
  pointer-events:none;
  text-shadow:0 1px 2px rgba(0,0,0,.35), 0 0 1px rgba(255,255,255,.55);
}

/* ------------------ Pytanie ------------------ */
#tqe-q-title,.tqe-q-title{
  font-size:var(--fs-lg);
  line-height:1.35;
  margin:10px 0 6px;
}
.tqe-meta{ font-size:var(--fs-sm); color:var(--tqe-muted); margin-bottom:2px; }
.tqe-question{ font-size:var(--fs-md); line-height:1.5; margin:10px 0 14px; }

/* ------------------ Odpowiedzi (grid) ------------------ */
.tqe-options,.tqe-answers{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:var(--tqe-gap);
  margin:0 0 12px;
}
@media (max-width:380px){ .tqe-options,.tqe-answers{ grid-template-columns:1fr; } }
@media (min-width:900px){ .tqe-options,.tqe-answers{ grid-template-columns:repeat(4,minmax(0,1fr)); } }

/* ------------------ Przyciski odpowiedzi ------------------ */
.tqe-option{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:70px;
  padding:16px 14px;
  background:var(--tqe-surface);
  border:1px solid var(--tqe-border);
  border-radius:var(--tqe-radius);
  cursor:pointer;
  text-align:center;
  word-break:break-word;
  white-space:normal;
  font-weight:800;
  font-size:var(--fs-md);
  line-height:1.25;
  color:var(--tqe-text);
  box-shadow:var(--tqe-shadow);
  user-select:none;
  transition:transform .06s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.tqe-option:hover{
  background:var(--tqe-primary);
  transform:translateY(-1px);
  border-color:color-mix(in srgb, var(--tqe-border) 60%, var(--tqe-text));
}
.tqe-option:active{ transform:translateY(0); }
.tqe-option[disabled], .tqe-option:disabled{ opacity:.6; cursor:not-allowed; }

.tqe-option.selected,
.tqe-option.is-selected,
.tqe-option[aria-pressed="true"]{
  border-color:var(--tqe-ring);
  box-shadow:0 0 0 4px color-mix(in srgb, var(--tqe-ring) 22%, transparent);
}
.tqe-option.correct, .tqe-option.is-correct{
  background:var(--tqe-success-bg);
  border-color:var(--tqe-success);
}
.tqe-option.wrong, .tqe-option.is-wrong{
  background:var(--tqe-danger-bg);
  border-color:var(--tqe-danger);
}

/* focus a11y */
.tqe-option:focus-visible,
.tqe-buttons button:focus-visible,
.tqe-btn:focus-visible{
  outline:3px solid var(--tqe-ring);
  outline-offset:3px;
}

/* ------------------ Sticky footer (CTA) ------------------ */
.tqe-body{ margin-bottom:100px; }
.tqe-footer{
  position:sticky;
  bottom:0;
  z-index:10;
  padding:12px 0 10px;
  background:linear-gradient(to top, color-mix(in srgb, var(--tqe-bg) 96%, transparent), transparent);
  backdrop-filter:saturate(120%) blur(4px);
  border-top:1px solid var(--tqe-border);
}
.tqe-status{ font-size:var(--fs-sm); color:var(--tqe-bg); margin-bottom:8px; }
.tqe-actions{ display:flex; gap:10px; }

/* Buttons (shared) */
.tqe-btn, .tqe-buttons button, .tqe-next, .tqe-skip{
  appearance:none;
  display:inline-flex; align-items:center; justify-content:center;
  min-height:60px; width:100%;
  padding:12px 16px;
  border:1px solid var(--tqe-border);
  border-radius:calc(var(--tqe-radius) + 2px);
  background:var(--tqe-elev);
  color:var(--tqe-text);
  font-weight:900;
  font-size:clamp(1.03rem,.98rem + .3vw,1.12rem);
  cursor:pointer;
  box-shadow:var(--tqe-shadow-lg);
  transition:transform .06s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.tqe-buttons{ display:flex; gap:10px; }
.tqe-btn:hover, .tqe-buttons button:hover, .tqe-skip:hover{
  background:var(--tqe-primary);
  border-color:color-mix(in srgb, var(--tqe-border) 55%, var(--tqe-text));
  transform:translateY(-1px);
}
.tqe-btn:active, .tqe-buttons button:active{ transform:translateY(0); }
.tqe-btn:disabled, .tqe-buttons button:disabled{ opacity:.6; cursor:not-allowed; }

/* Primary */
.tqe-next{
  background:var(--tqe-primary);
  color:var(--tqe-primary-contrast);
  border-color:color-mix(in srgb, var(--tqe-primary) 65%, var(--tqe-border));
}
.tqe-next:hover{
  background:color-mix(in srgb, var(--tqe-primary) 90%, black);
  border-color:var(--tqe-primary);
}

/* ------------------ Explanation / notices ------------------ */
.tqe-explanation{
  background:var(--tqe-warning-bg);
  border:1px solid color-mix(in srgb, var(--tqe-warning) 45%, var(--tqe-warning-bg));
  color:color-mix(in srgb, var(--tqe-warning) 25%, var(--tqe-text));
  padding:14px 16px;
  margin-top:10px;
  font-size:var(--fs-sm);
  border-radius:var(--tqe-radius-xs);
  box-shadow:var(--tqe-shadow);
}

/* ------------------ Results ------------------ */
.tqe-results{
  background:var(--tqe-surface);
  border:1px solid var(--tqe-border);
  border-radius:var(--tqe-radius);
  padding:18px;
  margin-top:18px;
  box-shadow:var(--tqe-shadow);
}
.tqe-results p{ margin:.5em 0; }

/* ------------------ Tables (profile / history) ------------------ */
.tqe-progress-table{
  width:100%; border-collapse:collapse; margin:18px 0;
  background:var(--tqe-surface); border:1px solid var(--tqe-border);
  border-radius:var(--tqe-radius); overflow:hidden; box-shadow:var(--tqe-shadow);
}
.tqe-progress-table th, .tqe-progress-table td{
  border-bottom:1px solid var(--tqe-border);
  padding:12px 14px; text-align:left; font-size:var(--fs-sm);
}
.tqe-progress-table th{
  background:var(--tqe-elev); color:var(--tqe-muted); font-weight:700;
}
.tqe-progress-table tr:last-child td{ border-bottom:0; }
.tqe-progress-table td small{ color:var(--tqe-muted); }

/* ------------------ Profile cards/charts ------------------ */
#tqe-profile .tqe-prof-wrap{ display:block; }
#tqe-profile .tqe-prof-filters{
  display:flex; gap:12px; flex-wrap:wrap; margin:10px 0 14px;
  color:var(--tqe-muted); font-size:var(--fs-sm);
}
#tqe-profile select{
  appearance:none; background:var(--tqe-surface); color:var(--tqe-text);
  border:1px solid var(--tqe-border); border-radius:var(--tqe-radius-xs);
  padding:8px 10px; box-shadow:var(--tqe-shadow);
}
#tqe-profile .tqe-prof-stats{
  display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:14px; margin:12px 0;
}
#tqe-profile .tqe-stat{
  background:var(--tqe-surface); border:1px solid var(--tqe-border);
  border-radius:var(--tqe-radius); padding:12px 14px; box-shadow:var(--tqe-shadow);
}
#tqe-profile .tqe-stat-title{
  font-size:12px; color:var(--tqe-muted); margin-bottom:6px;
  letter-spacing:.02em; text-transform:uppercase;
}
#tqe-profile .tqe-stat-value{ font-size:22px; font-weight:800; }
#tqe-profile .tqe-prof-charts{ display:grid; grid-template-columns:1fr; gap:16px; }
@media (min-width:900px){ #tqe-profile .tqe-prof-charts{ grid-template-columns:1fr 1fr; } }
#tqe-profile .tqe-chart-card{
  background:var(--tqe-surface); border:1px solid var(--tqe-border);
  border-radius:var(--tqe-radius); padding:10px; box-shadow:var(--tqe-shadow);
}
#tqe-profile .tqe-chart-header{ display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
#tqe-profile .tqe-chart-title{ font-weight:700; }
#tqe-profile .tqe-chart-sub{ font-size:12px; color:var(--tqe-muted); }
#tqe-profile .tqe-prof-skel{
  padding:8px 12px; border:1px dashed var(--tqe-border);
  border-radius:var(--tqe-radius-xs); margin-bottom:10px; color:var(--tqe-muted);
}
#tqe-profile canvas{ max-width:100%; height:auto; display:block; }

/* ------------------ Guest results panel ------------------ */
.tqe-guest-panel{
  margin-top:1rem; padding:1rem; background:var(--tqe-surface);
  border:1px solid var(--tqe-border); border-radius:var(--tqe-radius); box-shadow:var(--tqe-shadow);
}
.tqe-guest-panel h3{ margin:0 0 .75rem; font-size:1.05rem; }
.tqe-guest-empty{ margin:.5rem 0; opacity:.85; color:var(--tqe-muted); }
.tqe-guest-table{ width:100%; border-collapse:collapse; }
.tqe-guest-table th,.tqe-guest-table td{ padding:.55rem; border-bottom:1px solid var(--tqe-border); text-align:left; font-size:var(--fs-sm); }
.tqe-guest-actions{ margin-top:.75rem; display:flex; gap:.5rem; flex-wrap:wrap; }
.tqe-btn-small,.tqe-btn-clear,.tqe-btn-sync{
  padding:.5rem .75rem; border:1px solid var(--tqe-border); border-radius:10px;
  background:var(--tqe-elev); color:var(--tqe-text); cursor:pointer;
  box-shadow:var(--tqe-shadow);
  transition:background-color .15s ease, border-color .15s ease, transform .06s ease;
}
.tqe-btn-small:hover,.tqe-btn-clear:hover,.tqe-btn-sync:hover{
  background:var(--tqe-surface);
  border-color:color-mix(in srgb, var(--tqe-border) 55%, var(--tqe-text));
}
.tqe-btn-small:active,.tqe-btn-clear:active,.tqe-btn-sync:active{ transform:translateY(1px); }

/* ------------------ Motion & print ------------------ */
@media (prefers-reduced-motion:reduce){
  .tqe-option,.tqe-buttons button,.tqe-progress-bar,.tqe-btn{ transition:none !important; }
}
@media print{
  :where(.tqe-app,#tqe-app,#tqe-main-test,#tqe-practice-test,#tqe-profile){ background:#fff; color:#000; box-shadow:none; }
  .tqe-footer{ position:static; backdrop-filter:none; }
  .tqe-btn,.tqe-option{ box-shadow:none; }
}

/* ========================= Practice (override) ========================= */
.tqe-prac-app{
  --opt-min: 56px;
  --opt-min-lg: 72px;
  --opt-radius: 14px;
}
.tqe-prac-app .tqe-prac-options{
  display:grid !important;
  gap: 12px !important;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
  margin: 8px 0 12px;
}
@media (max-width:480px){
  .tqe-prac-app .tqe-prac-options{ grid-template-columns:1fr !important; }
}
.tqe-prac-app .tqe-opt,
.tqe-prac-app .tqe-opt.button{
  appearance:none !important;
  display:flex !important;
  align-items:center; justify-content:center;
  width:100%;
  min-height: var(--opt-min);
  padding: 12px 14px !important;
  font: inherit !important;
  font-weight: 800 !important;
  font-size: var(--fs-md, 1rem) !important;
  line-height: 1.25;
  text-align: center !important;
  white-space: normal !important;
  word-break: break-word;
  background: #fff;
  color: #000;
  border: 2px solid var(--tqe-border) !important;
  border-radius: var(--opt-radius) !important;
  box-shadow: var(--tqe-shadow) !important;
  text-shadow: none !important;
  filter: none !important;
  cursor: pointer;
  transition: transform .06s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
@media (min-width:880px){ .tqe-prac-app .tqe-opt{ min-height: var(--opt-min-lg); } }
.tqe-prac-app .tqe-opt:hover{   background:var(--tqe-primary); transform: translateY(-1px); }
.tqe-prac-app .tqe-opt:active{ transform: translateY(0); }
.tqe-prac-app .tqe-opt:disabled{
  opacity:1 !important;
  filter:none !important;
  cursor:not-allowed !important;
}
.tqe-prac-app .tqe-opt.is-selected{
  border-color: var(--tqe-ring) !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--tqe-ring) 22%, transparent) !important;
}
.tqe-prac-app .tqe-opt.is-correct,
.tqe-prac-app .tqe-opt.correct{
  background: var(--tqe-success-bg) !important;
  border-color: var(--tqe-success) !important;
  box-shadow: inset 0 0 0 2px var(--tqe-success) !important;
  outline: 2px solid var(--tqe-success) !important;
  outline-offset: -2px;
}
.tqe-prac-app .tqe-opt.is-wrong,
.tqe-prac-app .tqe-opt.wrong{
  background: var(--tqe-danger-bg) !important;
  border-color: var(--tqe-danger) !important;
  box-shadow: inset 0 0 0 2px var(--tqe-danger) !important;
  outline: 2px solid var(--tqe-danger) !important;
  outline-offset: -2px;
}
.tqe-prac-app .tqe-opt.is-correct::after{
  content: "✓"; font-weight: 900; margin-left: .5rem; color: var(--tqe-success);
}
.tqe-prac-app .tqe-opt.is-wrong::after{
  content: "✕"; font-weight: 900; margin-left: .5rem; color: var(--tqe-danger);
}
.tqe-prac-app .tqe-opt:focus-visible,
.tqe-prac-app .tqe-reveal:focus-visible,
.tqe-prac-app .tqe-next:focus-visible{
  outline:3px solid var(--tqe-ring) !important;
  outline-offset:3px !important;
}
.tqe-prac-app .tqe-prac-header{
  display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap;
  gap:.1rem 1rem; margin-bottom:.6rem; color:var(--tqe-muted); font-size:var(--fs-sm);
}
.tqe-prac-app .tqe-prac-meta{ display:flex; gap:.3rem; flex-wrap:wrap; }
.tqe-prac-app .tqe-prac-badge{ font-weight:800; color:var(--tqe-text); }
.tqe-prac-app .tqe-prac-meta-item + .tqe-prac-meta-item::before{ content:"•"; margin:0 .4rem; opacity:.45; }
.tqe-prac-app .tqe-prac-auto{ display:flex; align-items:center; gap:.45rem; font-size:.95em; }
.tqe-prac-app #tqe-prac-question .tqe-q-text{ font-size: var(--fs-lg); line-height:1.35; margin: 38px 0 36px; color: #000; }
.tqe-prac-app .tqe-prac-ctrl{ display:flex; gap:10px; flex-wrap:wrap; margin-top:6px; }
.tqe-prac-app .tqe-reveal, .tqe-prac-app .tqe-next, .tqe-prac-app .tqe-back-profile{
  appearance:none;
  display:inline-flex; align-items:center; justify-content:center;
  min-height:60px; width:100%;
  padding:12px 16px;
  border:1px solid var(--tqe-border);
  border-radius:calc(var(--tqe-radius, 12px) + 2px);
  background:var(--tqe-elev);
  color:var(--tqe-text);
  font-weight:900;
  font-size:clamp(1.03rem,.98rem + .3vw,1.12rem);
  cursor:pointer;
  box-shadow:var(--tqe-shadow-lg);
  transition: transform .06s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.tqe-prac-app .tqe-reveal:hover,
.tqe-prac-app .tqe-next:hover,
.tqe-prac-app .tqe-back-profile:hover{
    background:var(--tqe-primary);
  border-color:color-mix(in srgb, var(--tqe-border) 55%, var(--tqe-text));
  transform:translateY(-1px);
}
.tqe-prac-app .tqe-reveal:disabled,
.tqe-prac-app .tqe-next:disabled{ opacity:.6; cursor:not-allowed; }
.tqe-prac-app .tqe-next{
  background:var(--tqe-primary);
  color:var(--tqe-primary-contrast);
  border-color:color-mix(in srgb, var(--tqe-primary) 65%, var(--tqe-border));
}
.tqe-prac-app .tqe-next:hover{  background:var(--tqe-primary) 90%, black); border-color:var(--tqe-primary); }
.tqe-prac-app #tqe-prac-expl,
.tqe-prac-app .tqe-explanation{
  grid-column:1 / -1;
  background:var(--tqe-warning-bg);
  border:1px solid color-mix(in srgb, var(--tqe-warning) 45%, var(--tqe-warning-bg));
  color:color-mix(in srgb, var(--tqe-warning) 25%, var(--tqe-text));
  padding:14px 16px;
  margin-top:10px;
  font-size:var(--fs-sm);
  border-radius:var(--tqe-radius-xs);
  box-shadow:var(--tqe-shadow);
}
.tqe-prac-app .tqe-prac-ctrl #tqe-prac-expl,
.tqe-prac-app .tqe-prac-ctrl .tqe-explanation{
  display:block;
  width:100%;
  margin-top:10px;
}
.tqe-prac-app #tqe-prac-status{ margin-top:6px; font-size:var(--fs-sm); color:var(--tqe-muted); }
.tqe-prac-app #tqe-prac-expl-zone{ width:100%; }
.tqe-prac-app #tqe-prac-expl-zone .tqe-explanation{ display:block; width:100%; height: 100px; }

/* header layout */
.tqe-prac-app #tqe-prac-header{ display:flex; flex-direction:column; align-items:flex-start; width:100%; margin:0 0 12px 0; }
.tqe-prac-app #tqe-prac-title{ font-size:28px; line-height:1.2; font-weight:700; color:#111827; margin:0 0 6px 0; }
.tqe-prac-app .tqe-prac-meta-line{ display:block; width:100%; font-size:14px; line-height:1.5; margin:0; }
.tqe-prac-app .tqe-prac-meta-line + .tqe-prac-meta-line{ margin-top:2px; }
.tqe-prac-app .tqe-prac-label{ color:#6b7280; margin-right:6px; }
.tqe-prac-app .tqe-prac-value{ color:#111827; font-weight:500; }
.tqe-prac-app .tqe-prac-switches{ display:flex; align-items:center; gap:16px; flex-wrap:wrap; margin-top:10px; }
.tqe-prac-app .tqe-prac-switches label{ display:inline-flex; align-items:center; gap:8px; font-size:14px; color:#111827; }
@media (max-width: 480px){
  .tqe-prac-app #tqe-prac-title{ font-size:24px; margin-bottom:6px; }
  .tqe-prac-app .tqe-prac-switches{ gap:12px; }
}

/* smooth explanation */
#tqe-prac-expl-zone{ transition: opacity .25s ease, filter .25s ease; contain: layout paint; }
#tqe-prac-expl-zone[style*="display: none"]{ display:none !important; }
#tqe-prac-expl-zone .tqe-explanation{
  overflow:hidden; opacity:0; max-height:0; margin-top:0;
  transition: opacity .25s ease, max-height .35s ease, margin-top .35s ease;
}
#tqe-prac-expl-zone .tqe-explanation.is-on{ opacity:1; margin-top:8px; max-height:1200px; }
#tqe-prac-expl-zone .tqe-explanation *{ max-width:100%; overflow-wrap:anywhere; }

/* ========================= Main test (refined, no !important) ========================= */
.tqe-main-app{
  /* tuningi pod main */
  --opt-min: 60px;
  --opt-min-lg: 76px;
  --opt-radius: 14px;

  /* primary button gradient (jak w Practice) */
  --btn1: #2a5bff;
  --btn2: #1c3fbf;

  /* progress track */
  --track-from: color-mix(in srgb, var(--tqe-elev) 94%, white);
  --track-to:   color-mix(in srgb, var(--tqe-elev) 88%, white);
}
@media (prefers-color-scheme: dark){
  .tqe-main-app{
    --track-from: color-mix(in srgb, var(--tqe-elev) 94%, black);
    --track-to:   color-mix(in srgb, var(--tqe-elev) 88%, black);
  }
}

/* Header */
.tqe-main-app .tqe-header{
  display:flex; align-items:center; justify-content:space-between;
  gap:.6rem 1rem; margin-bottom:.6rem;
  color:var(--tqe-muted); font-size:var(--fs-sm);
}
.tqe-main-app .tqe-count{ font-weight:800; color:var(--tqe-text); }
.tqe-main-app .tqe-timer{ font-variant-numeric: tabular-nums; letter-spacing:.02em; }

/* Progress (label pill – jak w Practice, ale jaśniejszy) */
.tqe-main-app .tqe-progress{
  --bar-h: 22px;
  height: var(--bar-h);
  display:grid; place-items:center;
  margin: 8px 0 16px;
  border-radius: 999px;
  border: 1px solid var(--tqe-border);
  background: linear-gradient(180deg, var(--track-from), var(--track-to));
  box-shadow: var(--tqe-shadow);
  color: var(--tqe-text);
  font-weight: 800;
  font-size: clamp(.82rem,.78rem + .2vw,.92rem);
min-height: 37px;
}

/* Question title */
.tqe-main-app #tqe-q-title{
  font-size: clamp(1.25rem,1.05rem + 1vw,1.6rem);
  line-height: 1.32;
  margin: 16px 0 12px;
  font-weight: 800;
  color: #000;
}

/* Options grid */
.tqe-main-app .tqe-options,
.tqe-main-app .tqe-answers{
  display:grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin: 8px 0 12px;
}
@media (max-width:480px){
  .tqe-main-app .tqe-options,
  .tqe-main-app .tqe-answers{ grid-template-columns:1fr; }
}

/* Option tiles */
.tqe-main-app .tqe-option{
  appearance:none;
  display:flex; align-items:center; justify-content:center;
  width:100%;
  min-height: var(--opt-min);
  padding: 14px 16px;
  background: #fff;
  color: #000;
  border: 2px solid var(--tqe-border);
  border-radius: var(--opt-radius);
  box-shadow: var(--tqe-shadow);
  text-align: center;
  font: inherit; font-weight: 800; font-size: var(--fs-md); line-height:1.25;
  cursor: pointer;
  transition: transform .06s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
@media (min-width:880px){ .tqe-main-app .tqe-option{ min-height: var(--opt-min-lg); } }

.tqe-main-app .tqe-option:hover{
  background: var(--tqe-primary);
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--tqe-border) 60%, var(--tqe-text));
}
.tqe-main-app .tqe-option:active{ transform: translateY(0); }
.tqe-main-app .tqe-option[disabled]{ opacity:.6; cursor:not-allowed; }

/* Selected state */
.tqe-main-app .tqe-option.is-selected,
.tqe-main-app .tqe-option[aria-pressed="true"]{
  border-color: var(--tqe-ring);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--tqe-ring) 22%, transparent);
}

/* (opcjonalnie) correctness – jeśli pokazujecie w trakcie */
.tqe-main-app .tqe-option.is-correct{
  background: var(--tqe-success-bg);
  border-color: var(--tqe-success);
  box-shadow: inset 0 0 0 2px var(--tqe-success);
}
.tqe-main-app .tqe-option.is-wrong{
  background: var(--tqe-danger-bg);
  border-color: var(--tqe-danger);
  box-shadow: inset 0 0 0 2px var(--tqe-danger);
}

/* Footer + actions */
.tqe-main-app .tqe-footer{
  position: sticky;
  bottom: 0;
  z-index: 20;
  padding: 12px 0 10px;
  border-top: 1px solid var(--tqe-border);
  background: #fff;
  backdrop-filter: saturate(120%) blur(4px);
  display: grid;
  gap: 8px;
}
.tqe-main-app .tqe-actions{ display:flex; gap:10px; }

/* Primary button (Next) */
.tqe-main-app .tqe-next{
  display:inline-flex; align-items:center; justify-content:center;
  min-height:60px; width:100%;
  padding:12px 16px;
  border-radius:14px;
  background: linear-gradient(180deg, var(--btn1), var(--btn2));
  color:#fff;
  border:1px solid rgba(255,255,255,.12);
  font-weight:900; font-size:clamp(1.03rem,.98rem + .3vw,1.12rem);
  box-shadow: 0 12px 28px rgba(32,78,255,.35);
  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.tqe-main-app .tqe-next:hover{ filter:brightness(1.05); transform:translateY(-1px); }
.tqe-main-app .tqe-next:disabled{ opacity:.6; cursor:not-allowed; }

/* Timer – low time pulse */
.tqe-main-app .tqe-timer{ color:var(--tqe-bg); }
.tqe-main-app.tqe-timer-low .tqe-timer{
  color:#ef4444; animation: tqe-blink .6s steps(2, jump-none) infinite;
}
@keyframes tqe-blink{ from{opacity:1} to{opacity:.35} }

/* Results card */
.tqe-main-app .tqe-results{
  background: var(--tqe-surface);
  border: 1px solid var(--tqe-border);
  border-radius: 16px;
  padding: 18px; margin-top: 18px;
  box-shadow: var(--tqe-shadow);
}
.tqe-main-app .tqe-results h2{ color: #fff; margin:0 0 8px; font-size:1.25rem; }
.tqe-main-app .tqe-results p{ margin:.4rem 0; }

/* a11y focus */
.tqe-main-app .tqe-option:focus-visible,
.tqe-main-app .tqe-next:focus-visible{
  outline:3px solid var(--tqe-ring);
  outline-offset:3px;
}



/* żeby anchor dziedziczył wygląd "Pomiń" */
button.tqe-next,
a.tqe-next {
  /* (tu Twoje istniejące reguły przycisku Pomiń) */
}

/* maleńkie dopracowanie dla linka */
.tqe-main-cta-btn {
  text-decoration: none;   /* bez podkreślenia */
  display: inline-flex;    /* zachowuje się jak przycisk */
  align-items: center;
  justify-content: center;
}

.tqe-results-cta { margin-top: 12px; }

.answer-grid {
  display: inline-block;
  border: 1px solid #000;
  padding: 6px;
  margin: 4px;
  line-height: 1.3;
  font-size: 20px;
  text-align: center;
  font-family: monospace;
}
.answer-grid br {
  content: "";
  margin: 0;
}

.answer-grid {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 0 0 1px #444;
}
.answer-grid .filled {
  color: black;
}
.answer-grid .outline {
  color: transparent;
  -webkit-text-stroke: 1px #000;
}