:root {
    --bg-dark: #0b0f19;
    --bg-panel: #131a2a;
    --bg-card: #182236;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --accent: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.25);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #26334d;
    --radius: 14px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.65;
    min-height: 100vh;
}

/* MODALE */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 15, 0.85);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.modal-card.wide {
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.modal-desc {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin: 12px 0 20px;
}

input[type="text"] {
    width: 100%;
    padding: 13px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #0f172a;
    color: var(--text-main);
    font-size: 1rem;
    margin-bottom: 14px;
    outline: none;
}

input[type="text"]:focus {
    border-color: var(--accent);
}

.modal-footer-link {
    margin-top: 16px;
    text-align: center;
}

.btn-link {
    background: none;
    color: var(--accent);
    font-size: 0.85rem;
    text-decoration: underline;
    padding: 4px;
}

/* UKAD GÓWNY */
.app-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: 100vh;
}

.sidebar {
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border);
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.brand-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--accent);
    background: rgba(56, 189, 248, 0.12);
    padding: 4px 10px;
    border-radius: 99px;
    margin-bottom: 6px;
}

.brand h1 {
    font-size: 1.65rem;
    font-weight: 800;
}

.brand .accent {
    color: var(--accent);
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* KARTA UCZNIA I CZASU */
.student-card {
    background: #0f172a;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.88rem;
}

.student-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #1e293b;
}

.btn-mini {
    background: #1e293b;
    color: var(--text-muted);
    padding: 3px 9px;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn-mini:hover {
    color: var(--text-main);
}

.timer-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.dot.active {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.dot.paused {
    background: var(--warning);
}

.idle-hint {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.overall-progress {
    background: var(--bg-card);
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.progress-bar-bg {
    height: 8px;
    background: #0b0f19;
    border-radius: 99px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8, #10b981);
    transition: width 0.4s ease;
}

.chapter-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.chapter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 12px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-main);
    text-align: left;
    cursor: pointer;
    font-size: 0.88rem;
}

.chapter-item:hover:not(.locked) {
    background: var(--bg-card);
}

.chapter-item.active {
    background: var(--bg-card);
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.chapter-item.locked {
    opacity: 0.45;
    cursor: not-allowed;
}

/* MAIN */
.main-content {
    padding: 32px 44px;
    max-width: 980px;
    width: 100%;
    margin: 0 auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 22px;
    gap: 16px;
}

.tag {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    font-weight: 700;
}

.top-bar h2 {
    font-size: 1.75rem;
    margin-top: 4px;
}

.mode-badge {
    padding: 6px 14px;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
}

.mode-standard {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.mode-alt {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.hidden {
    display: none !important;
}

/* KROKI LEKCJI */
.step-indicator-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 14px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 600;
}

.step-dots {
    display: flex;
    gap: 8px;
}

.step-dot {
    width: 28px;
    height: 6px;
    border-radius: 99px;
    background: #0f172a;
}

.step-dot.done {
    background: var(--success);
}

.step-dot.current {
    background: var(--accent);
}

.alert-box {
    background: rgba(245, 158, 11, 0.12);
    border-left: 4px solid var(--warning);
    padding: 15px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    color: #fde68a;
    font-size: 0.93rem;
}

.lesson-content h3 {
    color: var(--accent);
    margin: 0 0 12px;
    font-size: 1.3rem;
}

.lesson-content p {
    margin-bottom: 14px;
    color: #e2e8f0;
}

.lesson-content ul {
    margin: 10px 0 18px 22px;
}

.lesson-content li {
    margin-bottom: 9px;
}

.formula-box {
    background: #0f172a;
    border: 1px solid #334155;
    border-left: 4px solid var(--accent);
    padding: 14px 18px;
    border-radius: 8px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 1rem;
    color: #7dd3fc;
    margin: 14px 0;
}

.analogy-box {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 16px 18px;
    border-radius: 10px;
    margin: 16px 0;
}

.analogy-box strong {
    color: #34d399;
}

/* QUIZ */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.quiz-sub {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.pill {
    background: #0f172a;
    padding: 5px 12px;
    border-radius: 99px;
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
}

.question-block {
    background: #111827;
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.question-title {
    font-weight: 700;
    margin-bottom: 12px;
    font-size: 1.03rem;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 8px;
    border: 1px solid #26334d;
    margin-bottom: 8px;
    cursor: pointer;
}

.option-label:hover {
    background: #1e293b;
    border-color: var(--accent);
}

.option-label input[type="radio"] {
    accent-color: var(--accent);
    width: 17px;
    height: 17px;
}

/* WYNIKI */
.result-box {
    text-align: center;
}

.score-circle {
    width: 115px;
    height: 115px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.9rem;
    font-weight: 800;
    margin: 0 auto 16px;
    border: 5px solid var(--accent);
    background: #0f172a;
}

.score-circle.pass {
    border-color: var(--success);
    color: var(--success);
}

.score-circle.fail {
    border-color: var(--danger);
    color: var(--danger);
}

.breakdown-list {
    text-align: left;
    margin: 22px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.breakdown-item {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.92rem;
    background: #111827;
    border-left: 4px solid var(--border);
}

.breakdown-item.ok {
    border-left-color: var(--success);
}

.breakdown-item.bad {
    border-left-color: var(--danger);
}

/* PANEL RODZICA */
.parent-search-row {
    display: flex;
    gap: 10px;
}

.parent-search-row input {
    margin-bottom: 0;
}

.saved-students-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0;
}

.student-chip {
    background: #0f172a;
    border: 1px solid var(--border);
    color: var(--accent);
    padding: 6px 12px;
    border-radius: 99px;
    font-size: 0.84rem;
}

.parent-report-box {
    background: #0f172a;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-top: 12px;
}

.report-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 16px 0;
}

.stat-box {
    background: var(--bg-card);
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.stat-box .stat-val {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--accent);
    margin-top: 4px;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
    font-size: 0.88rem;
}

.report-table th, .report-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

/* PRZYCISKI */
.action-bar {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 26px;
}

.action-bar.between {
    justify-content: space-between;
}

.action-bar.center {
    justify-content: center;
}

button {
    font-family: inherit;
    font-size: 0.94rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    padding: 11px 20px;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s, background 0.2s;
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.full-width {
    width: 100%;
}

.btn-primary {
    background: var(--accent);
    color: #08101e;
}

.btn-primary:hover:not(:disabled) {
    background: #7dd3fc;
}

.btn-success {
    background: var(--success);
    color: #052e16;
}

.btn-success:hover:not(:disabled) {
    background: #34d399;
}

.btn-secondary {
    background: #26334d;
    color: var(--text-main);
}

.btn-secondary:hover:not(:disabled) {
    background: #334155;
}

@media (max-width: 860px) {
    .app-container {
        grid-template-columns: 1fr;
    }
    .main-content {
        padding: 20px;
    }
    .report-stats-grid {
        grid-template-columns: 1fr;
    }
}
/* === PANEL WYJASNIENIA KROK PO KROKU (DO SKUTKU) === */
.btn-warning {
    background: rgba(245, 158, 11, 0.16);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.45);
    padding: 11px 16px;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-warning:hover {
    background: rgba(245, 158, 11, 0.28);
    border-color: #fbbf24;
}
.deep-help-wrapper {
    margin-top: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.help-level-card {
    background: #0d1628;
    border: 1px solid #334155;
    border-left: 4px solid #f59e0b;
    border-radius: 12px;
    padding: 16px 20px;
    animation: fadeInSlide 0.25s ease-out;
}
.help-level-card.level-2 {
    border-left-color: #a855f7;
    background: #131129;
}
.help-level-card.level-3 {
    border-left-color: #10b981;
    background: #0c1f1d;
}
.help-level-badge {
    display: inline-block;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 9px;
    border-radius: 6px;
    margin-bottom: 8px;
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
}
.help-level-card.level-2 .help-level-badge {
    background: rgba(168, 85, 247, 0.2);
    color: #d8b4fe;
}
.help-level-card.level-3 .help-level-badge {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}
.help-level-card h4 {
    margin: 0 0 8px 0;
    font-size: 1.04rem;
    color: #f8fafc;
}
.help-level-card p, .help-level-card li {
    color: #cbd5e1;
    line-height: 1.65;
    font-size: 0.94rem;
}
.help-level-card ul {
    margin: 8px 0 0 18px;
}
.help-deeper-bar {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.help-deeper-hint {
    font-size: 0.83rem;
    color: #94a3b8;
}
@keyframes fadeInSlide {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}