/* Chemia - panel.css v1.0 */

#chem-panel{width:100%;max-width:100%;font-family:'Nunito',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;color:#1e293b;--chem-primary:#16a34a;--chem-primary-dark:#15803d;box-sizing:border-box}
#chem-panel *{box-sizing:border-box}

/* -- Hero / logowanie -- */
.chem-hero{text-align:center;padding:2rem 1rem;background:linear-gradient(135deg,#16a34a,#15803d);border-radius:16px;color:#fff;margin-bottom:1.5rem}
.chem-site-badge{display:inline-block;padding:6px 14px;background:rgba(255,255,255,.15);border-radius:999px;font-size:13px;font-weight:700;margin-bottom:12px}
.chem-hero-title{font-size:28px;font-weight:800;margin:0 0 8px}
.chem-hero-sub{font-size:14px;opacity:.9;margin:0 0 16px}
.chem-stats-row{display:flex;justify-content:center;gap:24px;margin-top:16px;flex-wrap:wrap}
.chem-stat{text-align:center}
.chem-stat-num{font-size:24px;font-weight:800}
.chem-stat-lbl{font-size:12px;opacity:.85}
.chem-login-box{max-width:360px;margin:0 auto;background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:1.5rem}
.chem-login-box p{margin:0 0 12px}
.chem-login-box label{display:block;font-size:13px;font-weight:700;margin-bottom:4px;color:#374151}
.chem-login-box input[type=text],.chem-login-box input[type=password]{width:100%;padding:10px 12px;border:1px solid #d1d5db;border-radius:8px;font-family:inherit;font-size:14px;margin-bottom:6px}
.chem-login-box input[type=submit]{width:100%;padding:11px;background:var(--chem-primary,#16a34a);color:#fff;border:none;border-radius:8px;font-weight:800;font-size:14px;cursor:pointer;margin-top:8px}
.chem-login-box input[type=submit]:hover{background:var(--chem-primary-dark,#15803d)}

/* -- Zakladki dzialow -- */
.chem-dzial-switch{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:1.25rem}
#chem-panel .chem-dzial-btn{padding:10px 18px;background:#f1f5f9 !important;border:1px solid #e2e8f0;border-radius:999px;font-family:inherit;font-size:14px;font-weight:700;color:#475569 !important;cursor:pointer;transition:all .15s}
#chem-panel .chem-dzial-btn:hover{background:#e2e8f0}
#chem-panel .chem-dzial-btn.chem-active{background:var(--chem-primary,#16a34a) !important;color:#fff !important;border-color:var(--chem-primary,#16a34a)}

/* -- Karty poziomow -- */
.chem-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:16px;margin-bottom:1.5rem}
.chem-card{position:relative;background:#fff;border:1px solid #e2e8f0;border-radius:14px;padding:1.25rem;cursor:pointer;transition:all .15s;text-align:center}
.chem-card:hover{border-color:var(--chem-primary,#16a34a);box-shadow:0 4px 12px rgba(8,145,178,.12)}
.chem-card.chem-selected{border-color:var(--chem-primary,#16a34a);box-shadow:0 0 0 2px rgba(8,145,178,.2)}
.chem-card-icon{font-size:32px;margin-bottom:6px}
.chem-card-klass{font-size:11px;font-weight:700;color:#94a3b8;text-transform:uppercase;letter-spacing:.03em}
.chem-card-name{font-size:15px;font-weight:800;margin:4px 0}
.chem-card-desc{font-size:12px;color:#64748b;margin-bottom:10px;line-height:1.4}
.chem-card-prog{margin:10px 0}
.chem-prog-row{display:flex;justify-content:space-between;font-size:11px;color:#64748b;margin-bottom:4px}
.chem-bar-wrap{height:6px;background:#e2e8f0;border-radius:999px;overflow:hidden}
.chem-bar{height:100%;background:var(--chem-primary,#16a34a);border-radius:999px;transition:width .3s}
.chem-badge{display:inline-block;padding:4px 12px;border-radius:999px;font-size:11px;font-weight:800}
.chem-badge-active{background:#dcfce7;color:#15803d}
.chem-badge-done{background:#d1fae5;color:#065f46}

/* -- Detal poziomu / lista lekcji -- */
.chem-detail{background:#fff;border:1px solid #e2e8f0;border-radius:14px;padding:1.5rem}
.chem-detail-header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:16px;flex-wrap:wrap;gap:8px}
.chem-detail-title{font-size:20px;font-weight:800}
.chem-detail-klass{font-size:13px;color:#64748b}
.chem-lessons{display:flex;flex-direction:column;gap:8px;margin-bottom:16px}
.chem-lesson-row{display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:10px;background:#f8fafc;cursor:pointer;transition:background .15s}
.chem-lesson-row:hover{background:#f1f5f9}
.chem-l-num{width:28px;height:28px;border-radius:50%;background:#e2e8f0;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:800;color:#475569;flex-shrink:0}
.chem-lesson-row.chem-l-done .chem-l-num{background:#d1fae5;color:#065f46}
.chem-lesson-row.chem-l-active .chem-l-num{background:var(--chem-primary,#16a34a);color:#fff}
.chem-lesson-row.chem-l-locked{opacity:.55;cursor:default}
.chem-l-text{flex:1}
.chem-l-name{font-size:14px;font-weight:700}
.chem-l-meta{font-size:12px;color:#94a3b8}
.chem-l-xp{font-size:12px;font-weight:800;color:var(--chem-primary,#16a34a)}
#chem-panel .chem-continue-btn{width:100%;padding:12px;background:var(--chem-primary,#16a34a) !important;color:#fff !important;border:none;border-radius:10px;font-weight:800;font-size:14px;cursor:pointer}
#chem-panel .chem-continue-btn:hover{background:var(--chem-primary-dark,#15803d)}

/* -- Ekran lekcji (wspolne dla standard/quiz/sim) -- */
.chem-lesson-nav{display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem}
#chem-panel .chem-back-btn{background:none !important;border:none;color:var(--chem-primary,#16a34a) !important;font-weight:700;font-size:14px;cursor:pointer;padding:6px 0}
.chem-lesson-nav-info{font-size:13px;color:#64748b;font-weight:700}
.chem-lesson-header{display:flex;gap:14px;align-items:center;margin-bottom:1.25rem}
.chem-lesson-icon-wrap{font-size:32px;width:56px;height:56px;border-radius:14px;background:#f0fdff;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.chem-lesson-title{font-size:20px;font-weight:800;margin:0}
.chem-lesson-meta-row{display:flex;gap:10px;font-size:12px;color:#64748b;margin-top:4px;flex-wrap:wrap}
.chem-intro{background:#f8fafc;border-radius:10px;padding:14px 16px;font-size:14px;line-height:1.6;margin-bottom:1.25rem}
.chem-lesson-steps-box{background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:1.1rem 1.25rem;margin-bottom:1.25rem}
.chem-lesson-steps-box ul{margin:8px 0 0;padding-left:20px}
.chem-lesson-steps-box li{font-size:13px;line-height:1.6;margin-bottom:6px;color:#374151}
.chem-lesson-task-box{background:#fefce8;border:1px solid #fde68a;border-radius:12px;padding:1.25rem;margin-bottom:1.25rem}
.chem-task-label{font-size:13px;font-weight:800;color:#92400e;margin-bottom:8px}
.chem-task-text{font-size:14px;line-height:1.6;color:#1e293b}
.chem-intro p, .chem-task-text p, .chem-hint p{margin:0 0 10px}
.chem-intro p:last-child, .chem-task-text p:last-child, .chem-hint p:last-child{margin-bottom:0}
.chem-intro ul, .chem-intro ol, .chem-task-text ul, .chem-task-text ol, .chem-hint ul, .chem-hint ol{margin:0 0 10px 20px}
.chem-intro a, .chem-task-text a, .chem-hint a{color:var(--chem-primary,#16a34a);text-decoration:underline}
.chem-intro a:hover, .chem-task-text a:hover, .chem-hint a:hover{color:var(--chem-primary-dark,#15803d)}
#chem-panel .chem-hint-btn{padding:8px 10px;background:#fff !important;border:1px solid #e2e8f0;border-radius:8px;font-family:inherit;font-size:12px;font-weight:700;color:var(--chem-primary,#16a34a) !important;cursor:pointer}
.chem-hint{font-size:12px;color:#92400e;background:#fefce8;border:1px solid #fde68a;border-radius:8px;padding:10px 12px;line-height:1.5}
.chem-lesson-footer{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:1.5rem}
.chem-done-info{font-size:13px;font-weight:700;color:#065f46;background:#d1fae5;padding:8px 14px;border-radius:8px}
#chem-panel .chem-complete-btn{padding:12px 22px;background:var(--chem-primary,#16a34a) !important;color:#fff !important;border:none;border-radius:10px;font-weight:800;font-size:14px;cursor:pointer}
#chem-panel .chem-complete-btn:hover{background:var(--chem-primary-dark,#15803d)}
#chem-panel .chem-next-btn{padding:12px 22px;background:#fff !important;border:1px solid var(--chem-primary,#16a34a);color:var(--chem-primary,#16a34a) !important;border-radius:10px;font-weight:800;font-size:14px;cursor:pointer}

/* -- Sprawdzanie odpowiedzi liczbowej -- */
.chem-answer-check-box{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:14px;padding-top:14px;border-top:1px dashed #e2e8f0}
.chem-answer-check-label{font-size:13px;font-weight:700;color:#374151}
.chem-answer-check-input{width:120px;padding:8px 10px;border:1px solid #d1d5db;border-radius:8px;font-family:inherit;font-size:14px}
.chem-answer-check-unit{font-size:13px;color:#64748b;font-weight:700}
#chem-panel .chem-answer-check-btn{padding:8px 14px;background:var(--chem-primary,#16a34a) !important;color:#fff !important;border:none;border-radius:8px;font-family:inherit;font-size:13px;font-weight:700;cursor:pointer;transition:background .15s}
#chem-panel .chem-answer-check-btn:hover{background:var(--chem-primary-dark,#15803d)}
.chem-answer-check-result{width:100%;font-size:13px;font-weight:700;padding:8px 12px;border-radius:8px}
.chem-answer-check-result.chem-ok{background:#d1fae5;color:#065f46}
.chem-answer-check-result.chem-err{background:#fee2e2;color:#7f1d1d}

/* -- Quiz obrazkowy -- */
#chem-panel .chem-qi-progress{font-size:13px;font-weight:700;color:#64748b !important;margin-bottom:12px}
#chem-panel .chem-qi-card{background:#fff;border:1px solid #e2e8f0;border-radius:14px;padding:1.5rem;margin-bottom:1rem;color:#1e293b}
#chem-panel .chem-qi-question{font-size:16px;font-weight:800;margin-bottom:14px;color:#1e293b !important}
.chem-qi-svg-wrap{margin-bottom:14px;text-align:center}
.chem-qi-svg-wrap svg{max-width:100%;height:auto;border-radius:8px}
.chem-qi-options{display:flex;flex-direction:column;gap:10px}
#chem-panel .chem-qi-option{padding:12px 16px;border:1px solid #e2e8f0;border-radius:10px;background:#f8fafc !important;color:#1e293b !important;cursor:pointer;font-size:14px;font-weight:600;transition:all .15s;text-align:left;font-family:inherit}
#chem-panel .chem-qi-option:hover{border-color:var(--chem-primary,#16a34a);background:#f0fdff !important;color:#1e293b !important}
#chem-panel .chem-qi-option.chem-qi-correct{background:#d1fae5 !important;border-color:#6ee7b7;color:#065f46 !important}
#chem-panel .chem-qi-option.chem-qi-incorrect{background:#fee2e2 !important;border-color:#fca5a5;color:#7f1d1d !important}
.chem-qi-options-locked .chem-qi-option{cursor:default;pointer-events:none}
#chem-panel .chem-qi-feedback{margin-top:14px;padding:12px 16px;border-radius:10px;font-size:13px;font-weight:700}
#chem-panel .chem-qi-feedback.chem-qi-ok{background:#d1fae5 !important;color:#065f46 !important}
#chem-panel .chem-qi-feedback.chem-qi-err{background:#fee2e2 !important;color:#7f1d1d !important}
.chem-qi-actions{display:flex;gap:10px;margin-bottom:1rem}
#chem-panel .chem-qi-result{background:#fff;border:1px solid #e2e8f0;border-radius:14px;padding:2rem;text-align:center;color:#1e293b}
.chem-qi-result-emoji{font-size:40px;line-height:1;margin-bottom:10px}
#chem-panel .chem-qi-result-title{font-size:18px;font-weight:800;color:#1e293b !important;margin-bottom:8px}
#chem-panel .chem-qi-result-sub{font-size:14px;color:#64748b !important;line-height:1.5}
#chem-panel .chem-qi-result.chem-qi-result-ok{background:#f0fdf4;border-color:#86efac}
#chem-panel .chem-qi-result.chem-qi-result-fail{background:#fefce8;border-color:#fde68a}

#chem-panel .chem-run-btn{padding:11px 20px;background:var(--chem-primary,#16a34a) !important;color:#fff !important;border:none;border-radius:10px;font-weight:800;font-size:14px;cursor:pointer}
#chem-panel .chem-run-btn:hover{background:var(--chem-primary-dark,#15803d)}
#chem-panel .chem-reset-btn{padding:11px 20px;background:#fff !important;border:1px solid #e2e8f0;color:#475569 !important;border-radius:10px;font-weight:800;font-size:14px;cursor:pointer}

/* -- Symulacje chemiczne -- */
.chem-sim-box{background:#ffffff;border:1px solid #e2e8f0;border-radius:12px;padding:1.25rem;margin-bottom:1.25rem}
.chem-sim-stage{overflow-x:auto;border:1px solid #e2e8f0;border-radius:10px;background:#f8fafc;padding:8px;display:flex;justify-content:center;margin-bottom:14px}
#chem-sim-canvas{background:#ffffff;border-radius:4px;box-shadow:0 1px 3px rgba(0,0,0,.08);max-width:100%;height:auto}
.chem-sim-controls{display:flex;flex-direction:column;gap:12px;margin-bottom:14px}
.chem-sim-control label{font-size:13px;font-weight:700;color:#374151;display:block;margin-bottom:4px}
.chem-sim-control-val{color:var(--chem-primary,#16a34a);font-weight:800}
.chem-sim-slider{width:100%}
.chem-sim-actions{display:flex;gap:10px;margin-bottom:14px}
.chem-sim-actions .chem-run-btn,.chem-sim-actions .chem-reset-btn{flex:1;max-width:220px}
.chem-sim-readout{display:flex;flex-wrap:wrap;gap:10px}
.chem-sim-readout-row{background:#f0fdf4;border:1px solid #86efac;border-radius:8px;padding:8px 14px;font-size:13px;display:flex;gap:8px;align-items:baseline}
.chem-sim-readout-label{color:#15803d;font-weight:700}
.chem-sim-readout-val{color:#1e293b;font-weight:800}

@media(max-width:640px){
    .chem-lesson-header{flex-direction:column;text-align:center}
    .chem-lesson-footer{flex-direction:column;align-items:stretch}
    .chem-cards{grid-template-columns:1fr 1fr}
}

/* -- Blokady platnych poziomow -- */
.chem-card-locked{opacity:.92}
.chem-lock-overlay{position:absolute;top:10px;right:10px;font-size:18px;background:rgba(0,0,0,.06);border-radius:50%;width:32px;height:32px;display:flex;align-items:center;justify-content:center}
.chem-badge-locked{background:#fee2e2;color:#7f1d1d}
.chem-access-note{font-size:11px;color:#92400e;margin-top:6px}
.chem-detail-locked{text-align:center;padding:2.5rem 1.5rem}
.chem-lock-big{font-size:48px;margin-bottom:10px}
.chem-detail-locked h3{margin:0 0 6px;font-size:18px;font-weight:800}
.chem-detail-locked p{color:#64748b;margin:0 0 16px}

/* -- Komunikat po powrocie z platnosci -- */
.chem-msg{padding:12px 16px;border-radius:10px;font-size:13px;font-weight:700;margin-bottom:1rem}
.chem-msg.chem-ok{background:#d1fae5;color:#065f46}
.chem-msg.chem-err{background:#fee2e2;color:#7f1d1d}

/* -- Modal odblokowania -- */
.chem-modal-overlay{position:fixed;inset:0;background:rgba(15,23,42,.55);z-index:9999;display:flex;align-items:center;justify-content:center;padding:16px}
.chem-modal-box{position:relative;background:#fff;border-radius:16px;padding:2rem;max-width:420px;width:100%;text-align:center;box-shadow:0 20px 50px rgba(0,0,0,.25)}
.chem-modal-close{position:absolute;top:12px;right:14px;background:none;border:none;font-size:22px;color:#94a3b8;cursor:pointer;line-height:1}
.chem-modal-close:hover{color:#475569}
.chem-modal-icon{font-size:40px;margin-bottom:8px}
#chem-unlock-title{font-size:18px;font-weight:800;margin:0 0 4px}
.chem-unlock-price{font-size:14px;color:#64748b;margin:0 0 18px}
.chem-unlock-tabs{display:flex;gap:6px;margin-bottom:18px;background:#f1f5f9;border-radius:10px;padding:4px}
#chem-panel .chem-unlock-tab{flex:1;padding:9px 10px;background:none !important;border:none;border-radius:8px;font-family:inherit;font-size:12.5px;font-weight:700;color:#64748b !important;cursor:pointer}
#chem-panel .chem-unlock-tab.chem-active{background:#fff !important;color:var(--chem-primary,#16a34a) !important;box-shadow:0 1px 3px rgba(0,0,0,.08)}
.chem-unlock-panel p{font-size:13px;color:#475569;margin:0 0 14px}
#chem-panel .chem-btn-checkout{width:100%;padding:12px;background:var(--chem-primary,#16a34a) !important;color:#fff !important;border:none;border-radius:10px;font-weight:800;font-size:14px;cursor:pointer}
#chem-panel .chem-btn-checkout:hover{background:var(--chem-primary-dark,#15803d)}
#chem-panel .chem-btn-checkout:disabled{opacity:.7;cursor:default}
.chem-code-field{width:100%;padding:11px 14px;border:1px solid #d1d5db;border-radius:10px;font-family:inherit;font-size:14px;margin-bottom:12px;text-align:center;letter-spacing:.05em;font-weight:700}
.chem-spinner{display:inline-block;width:13px;height:13px;border:2px solid rgba(255,255,255,.4);border-top-color:#fff;border-radius:50%;margin-right:8px;vertical-align:-2px;animation:chem-spin .6s linear infinite}
@keyframes chem-spin{to{transform:rotate(360deg)}}

/* -- Rysunki/schematy (pole diagram_svg) -- */
.chem-diagram{background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:14px;margin-bottom:1.25rem;text-align:center}
.chem-diagram svg{max-width:100%;height:auto;border-radius:6px}

/* -- Gorny pasek zakladek (Kursy/Postep/Odznaki) -- */
#chem-panel .chem-topbar{display:flex;align-items:center;justify-content:space-between;margin-bottom:1.25rem;border-bottom:1px solid #e2e8f0;padding-bottom:.75rem;gap:8px;flex-wrap:wrap}
#chem-panel .chem-tabs{display:flex;gap:6px}
#chem-panel .chem-tab{font-family:inherit;font-size:13px;font-weight:700;color:#64748b !important;background:transparent !important;cursor:pointer;padding:8px 14px;border-radius:8px;border:none;transition:background .15s}
#chem-panel .chem-tab.chem-active{background:#dcfce7 !important;color:var(--chem-primary,#16a34a) !important}
#chem-panel .chem-tab:hover:not(.chem-active){background:#f1f5f9 !important}
#chem-panel .chem-logout-btn{font-family:inherit;font-size:12px;font-weight:700;color:#64748b !important;background:transparent !important;border:1px solid #e2e8f0;border-radius:8px;padding:6px 14px;cursor:pointer;text-decoration:none}
#chem-panel .chem-logout-btn:hover{background:#fee2e2 !important;color:#7f1d1d !important;border-color:#fca5a5}

/* -- Zakladka: Postep -- */
.chem-prog-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-bottom:1.25rem}
.chem-stat-card{background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px;padding:14px;text-align:center}
.chem-stat-card .chem-stat-num{font-size:22px;font-weight:800;color:#1e293b}
.chem-stat-card .chem-stat-lbl{font-size:11px;color:#64748b;margin-top:2px}
.chem-prog-dzial-label{font-size:13px;font-weight:800;color:var(--chem-primary,#16a34a);text-transform:uppercase;letter-spacing:.5px;margin:18px 0 8px}
.chem-prog-dzial-label:first-of-type{margin-top:0}
.chem-prog-course{background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:12px 14px;margin-bottom:8px}
.chem-prog-course-row{display:flex;justify-content:space-between;font-size:14px;font-weight:700;color:#1e293b;margin-bottom:6px}
.chem-prog-course-pct{font-size:12px;color:#64748b;font-weight:600}

/* -- Zakladka: Odznaki -- */
.chem-badges-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:12px}
.chem-badge-card{background:#fff;border:1px solid #e2e8f0;border-radius:14px;padding:16px;text-align:center;transition:opacity .2s}
.chem-badge-card.chem-locked{opacity:.4;filter:grayscale(1)}
.chem-badge-icon{font-size:30px;margin-bottom:8px}
.chem-badge-name{font-size:13px;font-weight:800;color:#1e293b}
.chem-badge-desc{font-size:11px;color:#64748b;margin-top:4px;line-height:1.4}
.chem-earned-pill{display:inline-block;font-size:10px;font-weight:800;color:#065f46;background:#d1fae5;padding:3px 10px;border-radius:999px;margin-top:8px}

@media(max-width:560px){
    .chem-prog-grid{grid-template-columns:repeat(3,1fr)}
    .chem-badges-grid{grid-template-columns:1fr 1fr}
    #chem-panel .chem-tabs{gap:2px;flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch}
    #chem-panel .chem-tab{padding:7px 10px;font-size:12px;white-space:nowrap;flex-shrink:0}
}
