:root {
    --bg: #10132a;
    --bg-2: #1b1f3b;
    --panel: #1c2044;
    --accent: #ffb020;
    --accent-2: #4dd0e1;
    --text: #f0f2ff;
    --muted: #a9aed6;
    --heading-font: 'Baloo 2', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background:
        radial-gradient(1px 1px at 8% 15%, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 22% 60%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1.5px 1.5px at 38% 25%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 55% 80%, rgba(255,255,255,0.35), transparent),
        radial-gradient(1.5px 1.5px at 68% 10%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 80% 55%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 92% 30%, rgba(255,255,255,0.45), transparent),
        radial-gradient(1.5px 1.5px at 12% 85%, rgba(255,255,255,0.35), transparent),
        linear-gradient(180deg, var(--bg-2), var(--bg));
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, .logo, .play-button, .start-button {
    font-family: var(--heading-font);
}

.site-header {
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.2);
}

.logo {
    color: var(--accent);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-decoration: none;
    text-transform: uppercase;
}

main {
    flex: 1;
    padding: 24px;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
}

.site-footer {
    text-align: center;
    padding: 16px;
    color: var(--muted);
    font-size: 0.85rem;
}

/* ---------- aplikacja ---------- */
.de-root {
    --de-red: #ff5d6c;
    --de-green: #3ddc97;
    --de-yellow: #ffd23f;
    --de-blue: #4dabf7;
    --de-card: #232852;
    max-width: 640px;
    margin: 0 auto;
    padding: 12px 16px 48px;
    width: 100%;
}
.de-root h1 { font-size: 1.7rem; margin: 6px 0 10px; line-height: 1.15; }
.de-root h3 { margin: 18px 0 8px; }
.de-loading { text-align: center; color: var(--muted); padding: 40px 0; }
.de-sub { color: var(--muted); margin: 0 0 14px; }
.de-note { color: var(--muted); font-size: 0.88rem; margin: 4px 0; }
.de-note.ok { color: var(--de-green); }
.de-err { color: var(--de-red); min-height: 1.2em; margin: 6px 0; font-size: 0.95rem; }
.de-hero { font-size: 3.6rem; line-height: 1; margin: 8px 0; }

.de-btn {
    font-family: var(--heading-font);
    font-size: 1.1rem;
    font-weight: 700;
    min-height: 52px;
    padding: 10px 22px;
    border: 0;
    border-radius: 14px;
    color: #1d1a05;
    background: linear-gradient(180deg, #ffd23f, #ffb020);
    box-shadow: 0 4px 0 #b97d08;
    cursor: pointer;
}
.de-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #b97d08; }
.de-btn:disabled { opacity: 0.6; }
.de-btn.ghost { background: transparent; color: var(--text); box-shadow: none; border: 2px solid rgba(255,255,255,0.25); }
.de-link { background: none; border: 0; color: var(--de-blue); text-decoration: underline; cursor: pointer; font: inherit; padding: 4px; }

.de-top { display: flex; justify-content: space-between; align-items: center; min-height: 44px; gap: 8px; }
.de-back { background: none; border: 0; color: var(--muted); font: inherit; font-size: 1rem; padding: 10px 4px; cursor: pointer; }
.de-user { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.95rem; }
.de-count { color: var(--muted); font-weight: 700; }

/* logowanie */
.de-auth { text-align: center; padding-top: 12px; }
.de-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.de-tabs button {
    flex: 1 1 auto; padding: 0 12px; min-height: 46px; border-radius: 12px; border: 2px solid rgba(255,255,255,0.18);
    background: transparent; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer;
}
.de-tabs button.on { background: var(--de-blue); color: #05233a; border-color: var(--de-blue); }
.de-form { text-align: left; background: var(--de-card); border-radius: 18px; padding: 16px; display: grid; gap: 12px; }
.de-form label { display: grid; gap: 6px; font-weight: 600; font-size: 0.95rem; }
.de-form input, .de-input {
    font: inherit; font-size: 16px; /* 16px: iOS nie przybliża strony po fokusie */
    min-height: 50px; padding: 10px 14px; border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.2); background: #11142e; color: var(--text); width: 100%;
}
.de-form input:focus, .de-input:focus { outline: none; border-color: var(--de-blue); }

/* lista lekcji */
.de-lessons { display: grid; gap: 12px; }
.de-lesson {
    display: flex; gap: 14px; align-items: center; text-align: left; width: 100%;
    background: linear-gradient(135deg, #2b3170, #232852); border: 2px solid rgba(255,255,255,0.12);
    border-radius: 18px; padding: 14px; color: var(--text); font: inherit; cursor: pointer;
}
.de-lesson:hover { border-color: var(--de-yellow); }
.de-lesson-ico { font-size: 2.6rem; }
.de-lesson-body { display: grid; gap: 2px; }
.de-lesson-body small { color: var(--de-yellow); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.72rem; }
.de-lesson-body b { font-family: var(--heading-font); font-size: 1.3rem; }
.de-lesson-body em { color: var(--muted); font-style: normal; font-size: 0.92rem; }
.de-dots { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.de-dots i { width: 12px; height: 12px; border-radius: 50%; background: rgba(255,255,255,0.18); }
.de-dots i.ok { background: var(--de-green); }
.de-dots u { text-decoration: none; color: var(--muted); font-size: 0.8rem; margin-left: 4px; }
.de-soon { border-style: dashed; background: transparent; cursor: default; opacity: 0.6; }
.de-soon:hover { border-color: rgba(255,255,255,0.12); }

/* lekcja */
.de-lesson-head { display: flex; gap: 12px; align-items: center; }
.de-lesson-head > span { font-size: 3rem; }
.de-stages { display: grid; gap: 10px; margin: 8px 0 16px; }
.de-stage {
    display: flex; gap: 12px; align-items: center; text-align: left; width: 100%;
    background: var(--de-card); border: 2px solid rgba(255,255,255,0.1); border-radius: 16px;
    padding: 12px 14px; color: var(--text); font: inherit; cursor: pointer; min-height: 64px;
}
.de-stage.done { border-color: var(--de-green); }
.de-stage.locked { opacity: 0.45; cursor: not-allowed; }
.de-stage-n { font-size: 1.8rem; }
.de-stage-body { display: grid; flex: 1; gap: 1px; }
.de-stage-body em { color: var(--muted); font-style: normal; font-size: 0.9rem; }
.de-stage-body small { color: var(--muted); font-size: 0.78rem; }
.de-stage-st { font-weight: 800; font-size: 1.1rem; }
.de-words { background: var(--de-card); border-radius: 14px; padding: 10px 14px; }
.de-words summary { cursor: pointer; font-weight: 700; min-height: 32px; }
.de-words ul, .de-practice ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.de-words li, .de-practice li { display: grid; grid-template-columns: 2rem 1fr auto; gap: 8px; align-items: baseline; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.07); }
.de-words li em, .de-practice li em { color: var(--muted); font-style: normal; }

/* quiz */
.de-bar { height: 10px; background: rgba(255,255,255,0.12); border-radius: 6px; overflow: hidden; margin: 4px 0 12px; }
.de-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--de-green), var(--de-blue)); transition: width .25s; }
.de-stagetitle { color: var(--muted); font-weight: 700; text-align: center; margin-bottom: 8px; }
.de-card { background: var(--de-card); border-radius: 20px; padding: 22px 16px; text-align: center; margin-bottom: 14px; }
.de-emoji { font-size: 4rem; line-height: 1.1; }
.de-q { font-family: var(--heading-font); font-size: 2rem; font-weight: 800; word-break: break-word; line-height: 1.2; }
.de-ask { color: var(--muted); margin-top: 6px; font-size: 0.95rem; }
.de-opts { display: grid; gap: 10px; }
.de-opts.three { grid-template-columns: repeat(3, 1fr); }
.de-opt {
    min-height: 58px; font: inherit; font-size: 1.15rem; font-weight: 700; padding: 10px;
    border-radius: 14px; border: 2px solid rgba(255,255,255,0.18); background: #2d3470; color: var(--text); cursor: pointer;
}
.de-opt:active:not(:disabled) { transform: scale(0.98); }
.de-opt.right { background: var(--de-green); border-color: var(--de-green); color: #04301d; }
.de-opt.wrong { background: var(--de-red); border-color: var(--de-red); color: #3b0309; }
.de-opt.dim { opacity: 0.45; }
.de-type { display: grid; gap: 12px; }
.de-fb { margin-top: 14px; padding: 14px; border-radius: 16px; display: grid; gap: 8px; text-align: center; }
.de-fb.ok { background: rgba(61,220,151,0.16); border: 2px solid var(--de-green); }
.de-fb.bad { background: rgba(255,93,108,0.16); border: 2px solid var(--de-red); }
.de-fb small { color: var(--muted); }

/* wynik */
.de-result { text-align: center; }
.de-score { font-family: var(--heading-font); font-size: 2.6rem; }
.de-score b { color: var(--de-yellow); font-size: 3.4rem; }
.de-result.perfect .de-score b { color: var(--de-green); }
.de-practice { text-align: left; background: var(--de-card); border-radius: 16px; padding: 4px 14px 12px; margin: 12px 0; }
.de-actions { display: grid; gap: 10px; margin-top: 12px; }

@media (min-width: 600px) {
    .de-root { padding-top: 24px; }
    .de-actions { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}
@media (max-width: 380px) {
    .de-q { font-size: 1.7rem; }
    .de-opts.three .de-opt { font-size: 1rem; }
}

.de-pl { display: block; color: var(--muted); font-weight: 400; font-size: 0.8rem; }

.de-umlauts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.de-umlauts button {
    min-height: 52px; font: inherit; font-size: 1.5rem; font-weight: 700; border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.22); background: #2d3470; color: var(--text); cursor: pointer;
    touch-action: manipulation;
}
.de-umlauts button:active { background: var(--de-blue); color: #05233a; }

/* bloki lekcji i obrazki */
.de-block { font-size: 1.15rem; margin: 22px 0 8px; color: var(--de-yellow); }
.de-img { max-width: 100%; max-height: 150px; border-radius: 12px; vertical-align: middle; }
.de-words li > span .de-img, .de-practice li > span .de-img { max-height: 1.6rem; max-width: 2rem; border-radius: 4px; }

/* panel administratora */
.de-root h4 { margin: 14px 0 6px; font-size: 1rem; }
.de-btn.small { min-height: 42px; font-size: 0.95rem; padding: 6px 16px; border-radius: 12px; }
.de-btn.danger { background: linear-gradient(180deg, #ff7b87, #e0434f); box-shadow: 0 4px 0 #8f1f29; color: #fff; }
.de-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.de-adm-bar { display: flex; gap: 8px; margin-bottom: 10px; }
.de-adm-msg { padding: 10px 14px; border-radius: 12px; margin: 10px 0; }
.de-adm-msg.ok { background: rgba(61,220,151,0.15); border: 2px solid var(--de-green); }
.de-adm-msg.bad { background: rgba(255,93,108,0.15); border: 2px solid var(--de-red); }
.de-adm-msg ul { margin: 6px 0 0; padding-left: 18px; font-size: 0.9rem; }
.de-adm-import, .de-adm-block, .de-udetail { background: var(--de-card); border-radius: 16px; padding: 12px 14px; margin-bottom: 14px; }
.de-adm-import h3, .de-adm-block h3, .de-udetail h3 { margin: 0 0 6px; font-size: 1.05rem; }
.de-adm-import input[type=file] { width: 100%; font: inherit; margin: 6px 0; }
.de-adm-import details { margin-top: 8px; }
.de-adm-import summary { cursor: pointer; min-height: 32px; }
.de-adm-import textarea { width: 100%; font: 13px/1.4 ui-monospace, Menlo, monospace; background: #11142e; color: var(--text); border: 2px solid rgba(255,255,255,0.2); border-radius: 10px; padding: 8px; margin: 6px 0; }
.de-pre { background: #11142e; border-radius: 10px; padding: 10px; overflow-x: auto; font-size: 12px; line-height: 1.4; }
.de-adm-bh { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.de-adm-row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid rgba(255,255,255,0.08); flex-wrap: wrap; }
.de-adm-ico { font-size: 1.8rem; }
.de-adm-main { flex: 1 1 160px; display: grid; gap: 1px; min-width: 0; }
.de-adm-main small { color: var(--muted); word-break: break-word; }
.de-adm-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.de-ibtn, .de-adm-tools select {
    min-height: 40px; min-width: 40px; padding: 4px 10px; border-radius: 10px; font: inherit; font-size: 0.9rem; font-weight: 700;
    border: 2px solid rgba(255,255,255,0.22); background: #2d3470; color: var(--text); cursor: pointer; text-decoration: none;
    display: inline-flex; align-items: center; justify-content: center;
}
.de-adm-tools select { max-width: 150px; font-weight: 400; }
.de-ibtn:disabled { opacity: 0.35; cursor: not-allowed; }
.de-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.de-media { background: var(--de-card); border-radius: 14px; padding: 10px; display: grid; gap: 3px; text-align: center; }
.de-media img { width: 100%; height: 100px; object-fit: contain; background: #11142e; border-radius: 8px; }
.de-media small { color: var(--muted); font-size: 0.78rem; word-break: break-word; }
.de-ulist { display: grid; gap: 8px; }
.de-urow { display: grid; gap: 2px; text-align: left; padding: 10px 14px; min-height: 56px; border-radius: 14px; border: 2px solid rgba(255,255,255,0.1); background: var(--de-card); color: var(--text); font: inherit; cursor: pointer; }
.de-urow.on { border-color: var(--de-blue); }
.de-urow small { color: var(--muted); }
.de-badge { font-style: normal; font-size: 0.7rem; background: var(--de-yellow); color: #1d1a05; border-radius: 8px; padding: 1px 7px; vertical-align: middle; }
.de-badge.me { background: var(--de-blue); color: #05233a; }
.de-tablewrap { overflow-x: auto; }
.de-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.de-table th, .de-table td { text-align: left; padding: 5px 8px; border-bottom: 1px solid rgba(255,255,255,0.08); white-space: nowrap; }
.de-table th { color: var(--muted); font-weight: 600; }
.de-inline { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.de-inline input { flex: 1 1 160px; font: inherit; font-size: 16px; min-height: 42px; padding: 6px 12px; border-radius: 10px; border: 2px solid rgba(255,255,255,0.2); background: #11142e; color: var(--text); }
@media (min-width: 760px) { .de-root.wide, .de-root:has(.de-adm-import) { max-width: 860px; } }
.de-adm-import input[type=file]::file-selector-button {
    font: inherit; font-weight: 700; margin-right: 10px; min-height: 40px; padding: 6px 14px; border-radius: 10px;
    border: 2px solid rgba(255,255,255,0.22); background: #2d3470; color: var(--text); cursor: pointer;
}

/* plamka koloru jako podpowiedź (lekcja o kolorach) */
.de-swatch { display: inline-block; width: 88px; height: 88px; border-radius: 50%; border: 4px solid rgba(255,255,255,0.85); box-shadow: 0 4px 0 rgba(0,0,0,0.35); vertical-align: middle; }
.de-words li > span .de-swatch, .de-practice li > span .de-swatch { width: 1.4rem; height: 1.4rem; border-width: 2px; box-shadow: none; }

/* zwroty i odmiana */
.de-q.long { font-size: 1.35rem; }
.de-ask.top { margin: 0 0 8px; font-weight: 700; }
.de-blank { color: var(--de-yellow); }
.de-line { display: block; color: var(--muted); font-weight: 400; font-size: 0.85em; }
.de-words h4 { margin: 12px 0 0; color: var(--de-yellow); font-size: 0.95rem; }
.de-built { min-height: 64px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; padding: 10px; margin-bottom: 12px;
    background: rgba(255,255,255,0.05); border: 2px dashed rgba(255,255,255,0.22); border-radius: 14px; }
.de-built.ok { border-color: var(--de-green); border-style: solid; }
.de-built.bad { border-color: var(--de-red); border-style: solid; }
.de-built-hint { color: var(--muted); font-size: 0.9rem; }
.de-pool { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 14px; }
.de-tile { min-height: 44px; font: inherit; font-size: 1.05rem; font-weight: 700; padding: 6px 14px; border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.18); background: #2d3470; color: var(--text); cursor: pointer; }
.de-tile.gone { visibility: hidden; }
.de-tile:disabled { cursor: default; }
.de-btn:disabled { opacity: 0.45 !important; cursor: default; }

/* przedmioty, panel: wyniki, role */
.de-pick { display: grid; gap: 4px; margin: 8px 0; font-weight: 700; }
.de-pick select, .de-inline select { min-height: 40px; font: inherit; padding: 6px 10px; border-radius: 10px; border: 2px solid rgba(255,255,255,0.18); background: #2d3470; color: var(--text); }
.de-stack { display: grid; gap: 10px; max-width: 460px; }
.de-stack label { display: grid; gap: 4px; font-weight: 700; }
.de-stack input, .de-stack select { min-height: 42px; font: inherit; padding: 8px 10px; border-radius: 10px; border: 2px solid rgba(255,255,255,0.18); background: #151a3a; color: var(--text); }
.de-prog { display: inline-block; width: 90px; height: 8px; border-radius: 4px; background: rgba(255,255,255,0.12); vertical-align: middle; margin-right: 8px; overflow: hidden; }
.de-prog i { display: block; height: 100%; background: var(--de-green); }
.de-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 3px; background: rgba(255,255,255,0.18); }
.de-dot.ok { background: var(--de-green); }
.de-dot.half { background: var(--de-yellow); }
.de-roles { list-style: none; padding: 0; margin: 6px 0 10px; display: grid; gap: 6px; }
.de-roles li { display: flex; gap: 8px; align-items: center; background: rgba(255,255,255,0.05); padding: 6px 10px; border-radius: 10px; }
.de-roles li .de-ibtn { margin-left: auto; }
.de-badge.role { background: #5b3fd0; color: #fff; }
.de-lesson-body small { display: block; }
