/*
 * Główne style aplikacji PHP Zaimplantowani — podejście mobile-first.
 *
 * Zależy od: tokens.css (zmienne CSS muszą być załadowane wcześniej).
 *
 * Konwencja klas:
 *   .btn / .btn-brand / .btn-ghost    — przyciski
 *   .card                              — biała karta z obramowaniem
 *   .tile                              — kafelek nawigacyjny (≥76px)
 *   .input / .form-row                 — formularze
 *   .navbar / .navbar-inner            — górny pasek
 *   .container                         — centrowany kontener max 1100px
 *   .stack-{n}                         — pionowy odstęp (--sp-n)
 *   .text-center / .text-sm / .text-lg — klasy pomocnicze dla tekstu
 *
 * Układ oparty na flexboxie, mobile-first (>768px = tablet, >1024px = desktop).
 */

/* ── Resetowanie stylów ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-page);
    color: var(--text-body);
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1 0 auto;
}

h1, h2, h3, h4 {
    color: var(--text-heading);
    margin: 0 0 var(--sp-3) 0;
    line-height: 1.25;
}

h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
h4 { font-size: var(--fs-base); font-weight: 600; }

p {
    margin: 0 0 var(--sp-3) 0;
}

a {
    color: var(--coral);
    text-decoration: none;
}
a:hover { color: var(--coral-hover); text-decoration: underline; }

img { max-width: 100%; height: auto; }

hr {
    border: none;
    border-top: 1px solid var(--border-coral);
    margin: var(--sp-5) 0;
}

/* ── Kontener ──────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--sp-4);
}

@media (min-width: 768px) {
    .container { padding: 0 var(--sp-5); }
}

/* ── Pasek nawigacji (odwzorowanie 1:1 z MPM navbar.tsx) ────── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-coral);
    box-shadow: 0 1px 0 rgba(237, 213, 200, .5), 0 2px 8px rgba(42, 10, 6, .04);
}

/* RZĄD 1: logo wyśrodkowane; hamburger absolutnie z lewej, kontrolki z prawej.
   Szerokość kontenera jak Tailwind `container` (mx-auto, progi 640–1536). */
.navbar-inner {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 8px auto 0;   /* mt-2 jak MPM (pozycjonuje logo+kontrolki); rząd 2
                             podciągany osobno ujemnym marginesem niżej */
    padding: 12px;        /* py-3 px-3 */
    display: flex;
    align-items: center;
    justify-content: center;
}
@media (min-width: 640px)  { .navbar-inner { padding-left: 16px; padding-right: 16px; } }
@media (min-width: 768px)  { .navbar-inner { max-width: 768px; } }
@media (min-width: 1024px) { .navbar-inner { max-width: 1024px; padding-left: 24px; padding-right: 24px; } }
@media (min-width: 1280px) { .navbar-inner { max-width: 1280px; } }
@media (min-width: 1536px) { .navbar-inner { max-width: 1536px; } }

/* Logo — spiętrzone na małych ekranach, w rzędzie od md; skala jak MPM (32→48→54→68). */
.navbar-logos {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
@media (min-width: 768px) { .navbar-logos { flex-direction: row; gap: 16px; } }

.navbar-logos img {
    height: 32px;
    width: auto;
    object-fit: contain;
}
@media (min-width: 768px)  { .navbar-logos img { height: 48px; } }
@media (min-width: 1024px) { .navbar-logos img { height: 54px; } }
@media (min-width: 1280px) { .navbar-logos img { height: 68px; } }

/* Logotyp wg motywu: wariant *-dark pokazywany tylko w trybie ciemnym (html.dark). */
.logo-dark { display: none; }
html.dark .logo-light { display: none; }
html.dark .logo-dark { display: inline-block; }

/* Selektor języków — styl zakładek identyczny z menu MPM (gap-2, px-3 py-2,
   text-md, font-medium, hover/aktywne = bg-muted). Zostają tylko kolorowe
   ikony flag — reszta jak MPM/Raporty/Profil/Wyloguj. */
.navbar-lang-selector,
.navbar-menu {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}

.navbar-lang-btn,
.navbar-menu-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: var(--fs-base);
    font-weight: 500;
    color: var(--text-muted);
    border-radius: var(--r-md);
    text-decoration: none;
    transition: all 100ms ease;
    white-space: nowrap;
}
.navbar-lang-btn img { display: block; border-radius: 2px; width: auto; height: 16px; }
.navbar-menu-link svg { display: block; width: 16px; height: 16px; flex-shrink: 0; }
.navbar-lang-btn:hover,
.navbar-menu-link:hover {
    color: var(--text-heading);
    background: var(--bg-muted);
    text-decoration: none;
}
.navbar-lang-btn--active,
.navbar-menu-link--active {
    color: var(--text-heading);
    background: var(--bg-muted);
}

/* Kontrolki A + motyw — absolutnie z prawej, wyśrodkowane w pionie (jak MPM:
   absolute right-3 sm:right-4 lg:right-6). */
.navbar-toggles {
    position: absolute;
    top: 47%;
    right: 12px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
}
@media (min-width: 640px)  { .navbar-toggles { right: 16px; } }
@media (min-width: 1024px) { .navbar-toggles { right: 24px; } }

/* Przełączniki: A (rozmiar czcionki) i motyw (Sun/Moon) — 36×36 jak MPM. */
.theme-toggle,
.fontsize-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: all 100ms ease;
    flex-shrink: 0;
}
.theme-toggle:hover,
.fontsize-toggle:hover {
    color: var(--text-heading);
    background: var(--bg-muted);
}
.theme-toggle .theme-toggle-moon { display: none; }
html.dark .theme-toggle .theme-toggle-sun { display: none; }
html.dark .theme-toggle .theme-toggle-moon { display: inline-block; }

/* Litera „A" — wielkość zmieniana per krok przez JS (jak MPM). */
.fontsize-letter {
    font-weight: 700;
    line-height: 1;
    font-size: 14px;
}

/* Hamburger — absolutnie z lewej; ukryty od lg (jak MPM MobileNav lg:hidden). */
.navbar-hamburger {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer;
}
@media (min-width: 640px)  { .navbar-hamburger { left: 16px; } }
@media (min-width: 1024px) { .navbar-hamburger { display: none; } }

.navbar-hamburger span {
    display: block;
    height: 2px;
    background: var(--text-muted);
    border-radius: 2px;
}

/* RZĄD 2: selektor języków (odpowiednik menu MPM). Panel wysuwany < lg (rozwijany
   hamburgerem), wyśrodkowany rząd od lg (py-1.5 jak MPM). */
.navbar-subnav {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    border-top: 1px solid var(--border-coral);
}
.navbar-subnav.open {
    display: flex;
}

@media (min-width: 1024px) {
    .navbar-subnav {
        display: flex !important;
        flex-direction: row;
        justify-content: center;
        gap: 4px;
        padding: 6px 0;     /* py-1.5 (góra+dół, jak MPM) */
        border-top: none;
        margin-top: -6px;   /* kompensuje mt-2 navbar-inner: menu bliżej logo,
                               header nie zawyżony, a logo zostaje na miejscu */
    }
}


.navbar-subtitle {
    background-color: var(--bg-muted);
    color: var(--text-secondary);
    font-size: var(--fs-sm);
    padding: var(--sp-3) var(--sp-4);
    text-align: center;
}

/* ── Przyciski ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    min-height: var(--btn-h);
    padding: 0 var(--sp-5);
    background-color: var(--bg-card);
    color: var(--text-body);
    border: 1px solid var(--border-coral);
    border-radius: var(--r-md);
    font-size: var(--fs-base);
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 120ms ease, border-color 120ms ease, transform 80ms ease;
}
.btn:hover { border-color: var(--coral); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
    outline: 2px solid var(--coral);
    outline-offset: 2px;
}

.btn-brand {
    background-color: var(--coral);
    color: var(--coral-fg);
    border-color: var(--coral);
    font-weight: 700;
}
.btn-brand:hover {
    background-color: var(--coral-hover);
    border-color: var(--coral-hover);
    color: var(--coral-fg);
    text-decoration: none;
}

.btn-ghost {
    background-color: transparent;
    border-color: var(--border-coral);
}
.btn-ghost:hover { background-color: var(--coral-dim); }

.btn-block {
    display: flex;
    width: 100%;
}

/* ── Karty ─────────────────────────────────────────────────── */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-coral);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
    box-shadow: var(--shadow-sm);
}

/* Pasek podsumowujący wynik w percepcji mowy. */
.mpm-achv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    gap: var(--sp-3);
}
.mpm-achv-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--sp-3);
    border: 1px solid var(--border-coral);
    border-radius: var(--r-md);
    background-color: var(--bg-surface);
    text-align: center;
}
.mpm-achv-value {
    font-size: var(--fs-xl);
    font-weight: 700;
    color: var(--coral);
    font-variant-numeric: tabular-nums;
}
.mpm-achv-label {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
}
/* Gwiazdki progów mają różne rozmiary (48-108 px), więc wyrównujemy je do wspólnej linii
   podstawy — przy align-items: center mniejsze "pływałyby" w środku rzędu. Zawijanie
   z odstępem między wierszami trzyma rząd wewnątrz karty na wąskich ekranach. */
.mpm-achv-stars {
    display: flex;
    align-items: flex-end;
    gap: var(--sp-2);
    flex-wrap: wrap;
    max-width: 100%;
}
.mpm-achv-stars .achv-star { max-width: 100%; }
.mpm-achv-stars .achv-star svg { max-width: 100%; height: auto; }

/* Lista danych teleadresowych na stronie Kontakt. Etykieta nad wartością
   na wąskich ekranach, dwie kolumny od 640 px. */
.contact-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-1) 0;
    margin: 0;
}
.contact-list dt {
    font-size: var(--fs-sm);
    color: var(--text-muted);
}
.contact-list dd {
    margin: 0 0 var(--sp-3) 0;
    color: var(--text-body);
}
.contact-list dd:last-child { margin-bottom: 0; }

@media (min-width: 640px) {
    .contact-list {
        grid-template-columns: minmax(0, 14rem) minmax(0, 1fr);
        column-gap: var(--sp-4);
        align-items: baseline;
    }
    .contact-list dt { grid-column: 1; }
    .contact-list dd { grid-column: 2; margin-bottom: var(--sp-2); }
}

.card-lg {
    padding: var(--sp-6);
    border-width: 2px;
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: var(--fs-lg);
    color: var(--text-heading);
    margin: 0 0 var(--sp-4) 0;
}

/* ── Formularze ────────────────────────────────────────────── */
.form-row {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    margin-bottom: var(--sp-4);
}

.form-row label {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

.input, .form-row input[type="text"], .form-row input[type="number"],
.form-row input[type="password"], .form-row input[type="email"],
.form-row input[type="date"], .form-row select,
.auth-form-inner input[type="number"], .auth-form-inner input[type="password"],
.login-card .input-with-icon input {
    width: 100%;
    height: var(--input-h);
    padding: 0 var(--sp-3);
    background-color: var(--bg-card);
    color: var(--text-body);
    border: 1px solid var(--border-mid);
    border-radius: var(--r-md);
    font-size: var(--fs-base);
    font-family: var(--font-body);
}
.input:focus, .form-row input:focus, .form-row select:focus,
.auth-form-inner input:focus {
    outline: 2px solid var(--coral);
    outline-offset: -1px;
    border-color: var(--coral);
}

/* Pole wieloliniowe. Reguła `.input` zakłada stałą wysokość i pionowo wyśrodkowany tekst
   (`padding: 0 …`), więc w textarea pierwszy wiersz i placeholder przyklejały się do górnej
   krawędzi ramki. Wysokość wynika z atrybutu `rows`. */
textarea.input {
    height: auto;
    min-height: calc(var(--input-h) * 2);
    padding: var(--sp-3);
    line-height: 1.5;
    resize: vertical;
}

/* Szerokość pola daty MUSI być klasą, nie stylem inline: flatpickr przy
   `altInput: true` tworzy nowe pole i kopiuje do niego wyłącznie `class`
   (atrybut `style` przepada). Inline `max-width` znikałby po inicjalizacji,
   pole rozciągało się do `width: 100%` i spychało przycisk do następnej linii. */
.input--date {
    max-width: 200px;
}

/* iOS Safari renderuje natywny input[type=date] (flatpickr na małych ekranach)
   z własną wewnętrzną strukturą segmentów, która przy narzuconym height/padding
   bez wyłączenia natywnego wyglądu potrafi wyjechać poza obrys pola. */
.form-row input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
}

/* ── Kafelek nawigacyjny (≥76px) ───────────────────────────── */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-3);
    margin: var(--sp-4) 0;
}

@media (min-width: 640px) {
    .tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .tile-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--sp-3);
    min-height: var(--touch-min);
    padding: var(--sp-5) var(--sp-4);
    background-color: var(--bg-card);
    color: var(--text-heading);
    border: 2px solid var(--border-coral);
    border-radius: var(--r-lg);
    text-decoration: none;
    text-align: center;
    transition: transform 120ms ease, border-color 120ms ease, background-color 120ms ease;
}
.tile:hover {
    border-color: var(--coral);
    background-color: var(--coral-dim);
    color: var(--text-heading);
    text-decoration: none;
}
.tile:active { transform: scale(0.98); }

.tile img {
    height: 76px;
    width: auto;
    object-fit: contain;
}

@media (min-width: 768px) {
    .tile { min-height: 156px; }
    .tile img { height: 96px; }
}

.tile-label {
    font-size: var(--fs-lg);
    font-weight: 600;
    color: var(--text-heading);
}

.tile-icon-box {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 76px;
    width: 100%;
    max-width: 160px;
    margin: 0 auto;
    border: 2px solid var(--coral);
    background: rgba(200, 90, 62, 0.18);
    border-radius: var(--r-xl);
}

/* Kafel z nieprzeczytaną nowością: napis i ikona świecą kolorem teal. Atrybut `stroke`
   w SVG jest atrybutem prezentacyjnym, więc reguła poniżej ma nad nim pierwszeństwo. */
.tile--glow {
    border-color: var(--teal);
    background-color: var(--teal-dim);
}
.tile--glow:hover {
    border-color: var(--teal);
    background-color: var(--teal-dim);
}
.tile--glow .tile-label {
    color: var(--teal);
    font-weight: 700;
}
.tile--glow .tile-icon-svg {
    stroke: var(--teal);
}
@media (prefers-reduced-motion: no-preference) {
    .tile--glow { animation: tile-glow 2.4s ease-in-out infinite; }
    @keyframes tile-glow {
        0%, 100% { box-shadow: 0 0 0 0 transparent; }
        50%      { box-shadow: 0 0 0 4px var(--teal-dim); }
    }
}

@media (min-width: 768px) {
    .tile-icon-box { height: 96px; }
}

.tile-icon-svg {
    display: block;
    margin: 0 auto;
}

.tile--large {
    min-height: 140px;
    padding: var(--sp-5) var(--sp-6);
}
.tile--large .tile-label {
    font-size: var(--fs-base);
}
@media (min-width: 768px) {
    .tile--large { min-height: 220px; padding: var(--sp-6) var(--sp-8); }
    .tile--large .tile-label { font-size: var(--fs-lg); }
}

.tile-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/* ── Klasy narzędziowe ─────────────────────────────────────── */
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }
.text-sm  { font-size: var(--fs-sm); }
.text-lg  { font-size: var(--fs-lg); }
.text-muted     { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-coral     { color: var(--coral); }
.text-danger    { color: var(--danger); }
.text-teal      { color: var(--teal); }

.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }

.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-5 { margin-bottom: var(--sp-5); }
.mb-6 { margin-bottom: var(--sp-6); }

.py-4 { padding-top: var(--sp-4); padding-bottom: var(--sp-4); }
.py-5 { padding-top: var(--sp-5); padding-bottom: var(--sp-5); }
.py-6 { padding-top: var(--sp-6); padding-bottom: var(--sp-6); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }

.hidden { display: none; }
@media (min-width: 768px) { .md\:hidden { display: none; } .md\:flex { display: flex; } }

/* ── Ekran logowania ───────────────────────────────────────── */
.login-card {
    max-width: 420px;
    margin: var(--sp-6) auto;
    background-color: var(--bg-card);
    border: 2px solid var(--border-coral);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
    box-shadow: var(--shadow-md);
}

.login-card h1 {
    text-align: center;
    margin-bottom: var(--sp-5);
}

.login-card .input-with-icon,
.auth-form-inner .input-with-icon {
    position: relative;
    margin-bottom: var(--sp-3);
}

.login-card .input-with-icon img,
.auth-form-inner .input-with-icon img {
    position: absolute;
    left: var(--sp-3);
    top: 50%;
    transform: translateY(-50%);
    width: 28px !important;
    height: 28px !important;
    object-fit: contain;
    filter: brightness(0) opacity(0.45);
    pointer-events: none;
}

.login-card .input-with-icon input,
.auth-form-inner .input-with-icon input {
    padding-left: 52px;
}

/* ── Karta statusu (potwierdzenie/błąd) — render_status() ──── */
.status-card {
    max-width: 34rem;
    margin: var(--sp-6) auto;
    text-align: center;
}
.status-card .status-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--sp-4);
    display: block;
}
.status-card--ok  .status-icon { color: var(--teal); }
.status-card--err .status-icon { color: var(--danger); }
.status-card h1 { margin-bottom: var(--sp-3); }
.status-card p  { color: var(--text-muted); margin-bottom: var(--sp-5); }

/* ── Baner wersji demonstracyjnej ──────────────────────────── */
.demo-banner {
    background-color: var(--danger-dim);
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: var(--r-md);
    padding: var(--sp-4);
    font-weight: 700;
    font-size: var(--fs-md);
    margin: var(--sp-4) 0;
    text-align: center;
}

.demo-hint {
    background-color: var(--bg-muted);
    color: var(--text-secondary);
    border-radius: var(--r-md);
    padding: var(--sp-5);
    margin: var(--sp-3) 0 var(--sp-5);
    font-size: var(--fs-md);
    font-weight: 600;
    line-height: 1.6;
    text-align: left;
}

/* ── Komunikaty (alerty) ───────────────────────────────────── */
.alert {
    padding: var(--sp-4);
    border-radius: var(--r-md);
    border: 1px solid;
    margin: var(--sp-4) 0;
    font-size: var(--fs-md);
    line-height: 1.6;
}

.alert-warning {
    background-color: var(--danger-dim);
    color: var(--danger);
    border-color: var(--danger);
}

/* ── Statystyki i postęp ───────────────────────────────────── */
.stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    align-items: center;
    padding: var(--sp-4);
    background-color: var(--bg-muted);
    border-radius: var(--r-md);
    margin: var(--sp-3) 0;
}

.stats-row .score {
    font-size: var(--fs-xl);
    color: var(--coral);
    font-weight: 700;
}

/* ── Osiągnięcia (widget pod kaflami) ──────────────────────── */
:root      { --achv-gold: #f6b40a; --achv-gold-edge: #d99908; }
html.dark  { --achv-gold: #fbc340; --achv-gold-edge: #e0a800; }

.achv {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--sp-5);
}
.achv-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2) var(--sp-5);
}
.achv-score {
    font-size: calc(var(--fs-hero) * 1.7);
    font-weight: 800;
    line-height: 1;
    color: var(--coral);
}
.achv-score-text { text-align: left; }
.achv-score-label {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--text-heading);
}
.achv-summary {
    font-size: var(--fs-base);
    color: var(--text-secondary);
}
.achv-stars {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--sp-3);
}
.achv-star { display: inline-flex; }
.achv-star svg { display: block; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .20)); }

.achv-progress {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    width: 100%;
    max-width: 640px;
}
.progress {
    flex: 1;
    height: 24px;
    background: var(--bg-muted);
    border: 1px solid var(--border-coral);
    border-radius: var(--r-full);
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--coral);
    border-radius: var(--r-full);
    transition: width .3s ease;
}
.achv-progress-label {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--text-heading);
    white-space: nowrap;
}
.achv-motivator {
    margin: 0;
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--text-secondary);
}
/* Stan pusty (brak wyników) — wygaszona gwiazdka konturowa zamiast wyniku. */
.achv-score--empty {
    display: inline-flex;
    align-items: center;
    color: var(--border-mid);
    line-height: 0;
}
/* Duże, wyśrodkowane logo w treści strony (wylogowanie, strona błędu itp.).
   Stała wysokość ustawiona klasą wygrywa z globalnym resetem img{height:auto},
   więc grafika się nie rozjeżdża. */
.page-logo {
    height: 180px;
    width: auto;
    margin: var(--sp-5) auto 0;
}

/* ── Tabele ───────────────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--sp-3) 0;
}
.table th, .table td {
    padding: var(--sp-3);
    text-align: left;
    border-bottom: 1px solid var(--border-coral);
}
.table th {
    background-color: var(--bg-muted);
    color: var(--text-heading);
    font-weight: 600;
    font-size: var(--fs-sm);
}

/* ── Separator sekcji ──────────────────────────────────────── */
.section-rule {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin: var(--sp-5) 0 var(--sp-4);
}
.section-rule-text {
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}
.section-rule-line {
    flex: 1;
    height: 1px;
    background: var(--border-coral);
}

/* ── Sekcje kafelków ───────────────────────────────────────── */
.tile-section {
    margin-bottom: var(--sp-6);
}
.tile-section-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-3);
}
@media (min-width: 640px) {
    .tile-section-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
    .tile-section-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.tile-section-grid--2col {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}
@media (min-width: 640px) {
    .tile-section-grid--2col { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
.tile-section-grid--3col {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}
@media (min-width: 640px) {
    .tile-section-grid--3col { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}

/* ── Strona logowania — blok hero z identyfikacją ─────────── */
.auth-hero {
    text-align: center;
    margin-bottom: var(--sp-2);
}
.auth-hero-content {
    max-width: 560px;
    margin: 0 auto;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 10px;
    background: var(--uwb-blue-dim);
    border: 1px solid var(--uwb-blue-border);
    border-radius: 100px;
    font-size: var(--fs-sm);
    color: var(--uwb-blue);
    font-weight: 600;
    margin-bottom: var(--sp-4);
    letter-spacing: .02em;
}
.hero-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--uwb-blue);
    animation: pulse 2.4s ease infinite;
    flex-shrink: 0;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .4; transform: scale(.7); }
}
.hero-title {
    font-size: var(--fs-hero);
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.15;
    margin-bottom: var(--sp-3);
    letter-spacing: -.01em;
}
.hero-title span { color: var(--coral); }
.hero-subtitle {
    font-size: var(--fs-md);
    color: var(--text-secondary);
    line-height: 1.7;
    font-weight: 400;
}

/* ── Układ strony logowania (kolumna flex + karta) ────────── */
.auth-layout-breakout {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--sp-2) 0 var(--sp-5);
}
.auth-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 520px;
}
.auth-form-side {
    width: 100%;
    background: var(--bg-card);
    border: 2px solid var(--border-coral);
    border-radius: var(--r-xl);
    padding: var(--sp-7) var(--sp-6);
    box-shadow: var(--shadow-md);
}
.auth-form-inner { width: 100%; }
.auth-heading {
    font-size: var(--fs-xl);
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: var(--sp-2);
    text-align: center;
}
.auth-subheading {
    font-size: var(--fs-base);
    color: var(--text-muted);
    margin-bottom: var(--sp-5);
    line-height: 1.6;
    text-align: center;
}

/* ── Fala pod kartą logowania ──────────────────────────────── */
.auth-wave-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-3);
    margin-top: var(--sp-6);
}
.wave-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 96px;
}
.wb {
    width: 5px;
    border-radius: 3px;
    background: var(--coral);
    animation: wbpulse 1.8s ease-in-out infinite;
}
.wb:nth-child(2) { animation-delay: .15s; }
.wb:nth-child(3) { animation-delay: .3s;  background: var(--coral-hover); }
.wb:nth-child(4) { animation-delay: .45s; background: var(--coral-hover); }
.wb:nth-child(5) { animation-delay: .6s; }
.wb:nth-child(6) { animation-delay: .75s; background: var(--teal); }
.wb:nth-child(7) { animation-delay: .9s;  background: var(--teal); }
.wb:nth-child(8) { animation-delay: 1.05s; }
.wb:nth-child(9) { animation-delay: 1.2s; }
@keyframes wbpulse {
    0%, 100% { transform: scaleY(1);   opacity: .65; }
    50%       { transform: scaleY(1.5); opacity: 1; }
}
.auth-quote {
    font-size: var(--fs-base);
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.5;
    text-align: center;
    margin-bottom: 4px;
}
.auth-quote-src {
    font-size: var(--fs-sm);
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: .04em;
    text-align: center;
}

/* ── Blok opisu pod formularzem logowania ──────────────────── */
.auth-description {
    width: 100%;
    max-width: 900px;
    margin: var(--sp-7) auto 0;
    font-size: var(--fs-base);
    color: var(--text-secondary);
    line-height: 1.8;
}
@media (min-width: 1024px) {
    .auth-description { max-width: 100%; }
}
.auth-description p { margin-bottom: var(--sp-4); }
.auth-description p:last-child { margin-bottom: 0; }

/* ── Selektor języka ───────────────────────────────────────── */
.lang-selector {
    display: flex;
    justify-content: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
    margin-bottom: var(--sp-5);
}
.lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px var(--sp-3);
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1.5px solid var(--border-mid);
    border-radius: var(--r-md);
    text-decoration: none;
    transition: all 120ms ease;
    min-height: 40px;
    line-height: 1;
}
.lang-btn:hover {
    border-color: var(--coral);
    color: var(--text-body);
    text-decoration: none;
}
.lang-btn--active {
    background: var(--coral-dim);
    border: 2px solid var(--coral);
    color: var(--coral);
    font-weight: 700;
}

/* ── Grupy formularza (uzupełnienie) ───────────────────────── */
.form-group {
    margin-bottom: var(--sp-4);
}
.form-group:last-child { margin-bottom: 0; }
.form-label {
    display: block;
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--text-body);
    margin-bottom: 7px;
}
.form-label .req { color: var(--coral); margin-left: 2px; }
.form-hint {
    font-size: var(--fs-sm);
    color: var(--text-muted);
    margin-top: var(--sp-1);
}

/* ── Stopka strony (odwzorowanie MPM footer.tsx) ───────────── */
.site-footer {
    background: var(--bg-muted);
    border-top: 1px solid var(--border-coral);
    color: var(--text-muted);
    margin-top: var(--sp-7);
}
/* Kontener jak Tailwind `container` w MPM (mx-auto, progi 640–1536; px-4 lg:px-6) */
.footer-inner {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 39px 16px;                  /* py-10 px-4 */
}
@media (min-width: 768px)  { .footer-inner { max-width: 768px; } }
@media (min-width: 1024px) { .footer-inner { max-width: 1024px; padding-left: 24px; padding-right: 24px; } }
@media (min-width: 1280px) { .footer-inner { max-width: 1280px; } }
@media (min-width: 1536px) { .footer-inner { max-width: 1536px; } }

/* Góra: linki o projekcie (obok siebie) z lewej + copyright z prawej */
.footer-top {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);          /* mb-8 */
}


@media (min-width: 640px) {
    .footer-top {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}
.footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-5);    
    margin-top: 1px;                /* gap-6 — Regulamin i O projekcie obok siebie */
}
.footer-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: var(--fs-base);           /* 16px — wyraźniejsze */
    color: var(--text-muted);
    text-decoration: none;
    transition: color 120ms;
}
.footer-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.footer-link:hover { color: var(--coral); text-decoration: none; }
.footer-copy { font-size: var(--fs-base); color: var(--text-muted); margin-top: 1px; }  /* text-base (16px) jak MPM */

/* Dół: linki prawne po separatorze (z lewej, jak MPM) */
.footer-bottom {
    border-top: 1px solid var(--border-coral);
    padding-top: var(--sp-5);            /* pt-6 */
}
.footer-legal {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-4);
    font-size: 0.75rem;
    margin-top: -1px;                  /* text-xs (12px) jak MPM */
}
.footer-sep { color: var(--border-coral); }
.footer-legal .footer-link { font-size: 0.75rem; gap: 0; }

/* ── Moduł nauki ───────────────────────────────────────────── */
.learn-layout { max-width: 720px; margin: 0 auto; }

.learn-play-btn { font-size: var(--fs-lg); padding: var(--sp-4) var(--sp-7); }

.learn-options {
    display: flex;
    gap: var(--sp-6);
    flex-wrap: wrap;
}
.learn-option-group { flex: 1; min-width: 180px; }
.learn-option-label {
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 var(--sp-3) 0;
}
.learn-radio {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-2);
    cursor: pointer;
    font-size: var(--fs-base);
    color: var(--text-secondary);
}
.learn-radio input[type="radio"] { accent-color: var(--coral); width: 18px; height: 18px; }
.learn-radio:has(input:checked) { color: var(--coral); font-weight: 600; }

.learn-pattern-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-3);
}
.learn-pattern-btn {
    background: var(--bg-card);
    border: 2px solid var(--border-coral);
    border-radius: var(--r-lg);
    padding: var(--sp-2);
    cursor: pointer;
    transition: border-color 120ms, transform 80ms;
    overflow: hidden;
}
.learn-pattern-btn img { width: 100%; height: auto; display: block; border-radius: var(--r-md); }
.learn-pattern-btn:hover { border-color: var(--coral); }
.learn-pattern-btn--active { border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-dim); }
.learn-pattern-btn:active { transform: scale(0.97); }

/* ── reCAPTCHA ─────────────────────────────────────────────── */
/* Domyślna plakietka jest position:fixed, w większości schowana poza
   ekranem (right:-186px) — na mobile (brak :hover) każdy komunikat
   Google renderowany w jej wnętrzu (np. błąd złej domeny) wychodzi poza
   viewport. */
.grecaptcha-badge { visibility: hidden; }

/* ── Wskaźnik oczekiwania na odpowiedź serwera ─────────────── */
/* Aktywny, gdy <body> ma aria-busy="true" — ustawia je skrypt w layout/header.php. */
body[aria-busy="true"],
body[aria-busy="true"] a,
body[aria-busy="true"] button,
body[aria-busy="true"] input,
body[aria-busy="true"] label {
    cursor: progress;
}

.page-progress {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 200;              /* nad navbarem (z-index: 100) */
    background: var(--coral-dim);
    overflow: hidden;
}

body[aria-busy="true"] .page-progress { display: block; }

.page-progress::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 40%;
    background: var(--coral);
    animation: page-progress-slide 1.1s ease-in-out infinite;
}

@keyframes page-progress-slide {
    from { transform: translateX(-100%); }
    to   { transform: translateX(350%); }
}

/* prefers-reduced-motion: pasek pulsuje w miejscu zamiast się przesuwać. */
@media (prefers-reduced-motion: reduce) {
    .page-progress::before {
        width: 100%;
        animation: page-progress-pulse 1.4s ease-in-out infinite;
    }
    @keyframes page-progress-pulse {
        0%, 100% { opacity: 0.35; }
        50%      { opacity: 1; }
    }
}

/* ── Drukowanie ────────────────────────────────────────────── */
@media print {
    .navbar, .navbar-subtitle, .btn, .tile { display: none !important; }
    body { background: white; color: black; }
}
