.mb { max-width: 520px; margin: 0 auto; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color: #1d1d1f; }
.mb [hidden] { display: none !important; }
.mb button { font: inherit; cursor: pointer; border: 0; border-radius: 12px; padding: 12px 16px; background: #e8e8ed; color: #1d1d1f; }
.mb button:disabled { opacity: .4; cursor: default; }
.mb input { font: inherit; font-size: 18px; padding: 10px 12px; border: 1px solid #c7c7cc; border-radius: 10px; width: 100%; box-sizing: border-box; background: #fff; color: #1d1d1f; }

.mb select { font: inherit; font-size: 18px; font-weight: 600; padding: 10px 12px; border: 1px solid #c7c7cc; border-radius: 10px; width: 100%; box-sizing: border-box; background: #fff; color: #1d1d1f; margin-top: 4px; }
.mb-wybor { display: grid; gap: 8px; }
.mb-gora { position: sticky; top: 0; z-index: 5; background: #fff; padding: 8px 0 10px; border-bottom: 1px solid #e5e5ea; margin-bottom: 14px; }
.mb-bieg { display: block; font-size: 13px; font-weight: 600; color: #6e6e73; }
.mb-bieg input { margin-top: 4px; font-weight: 600; }
.mb-licz { margin: 8px 0; font-size: 15px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mb .mb-glos { flex: none; padding: 6px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; background: #e8f5e9; color: #1b5e20; }
.mb .mb-glos.off { background: #f5f5f7; color: #6e6e73; }
#mb-licz.mb-rozjazd { color: #c62828; }
#mb-kol { color: #b26a00; font-weight: 500; }
.mb-zakladki { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mb-zakladki button.on { background: #1d1d1f; color: #fff; }

.mb-zegar { font-variant-numeric: tabular-nums; font-size: 56px; font-weight: 700; text-align: center; margin: 6px 0 14px; letter-spacing: -1px; }
.mb .mb-start { display: block; width: 100%; background: #2e7d32; color: #fff; font-size: 28px; font-weight: 700; padding: 22px; margin-bottom: 12px; }
.mb .mb-meta { display: block; width: 100%; height: 38vh; min-height: 200px; background: #c62828; color: #fff; font-size: 48px; font-weight: 800; letter-spacing: 2px; margin-bottom: 12px; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.mb .mb-meta:active { background: #8e1c1c; }
.mb-rzad { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mb .mb-cofnij { width: 100%; margin-top: 8px; }
.mb .mb-koniec { margin-top: 8px; background: #1d1d1f; color: #fff; font-weight: 600; }
.mb-info { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: #f5f5f7; color: #6e6e73; font-size: 15px; }
.mb-info b { color: #1d1d1f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-info span { flex: none; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.mb-info.trwa { background: #e8f5e9; }
.mb-info.trwa span { color: #2e7d32; }
.mb-info.koniec span { color: #6e6e73; }
.mb-zegar.stop { color: #6e6e73; }
.mb-lista { font-variant-numeric: tabular-nums; font-size: 22px; padding-left: 2.6em; margin: 14px 0 0; }
.mb-lista li { padding: 6px 0; border-bottom: 1px solid #f0f0f3; }
.mb-lista li::marker { color: #6e6e73; font-weight: 600; }
.mb-lista li.nowy { font-weight: 700; }

/* Ramka musi mieć szerokość już w chwili startu kamery - biblioteka z niej liczy rozmiar obrazu */
#mb-kamera { display: none; width: 100%; border-radius: 12px; overflow: hidden; background: #000; }
#mb-kamera.on { display: block; min-height: 240px; }
/* Zabezpieczenie przed stylami motywu, które potrafią zmniejszyć lub ukryć <video> */
#mb-kamera video { display: block !important; width: 100% !important; height: auto !important; max-width: none !important; object-fit: cover; }
#mb-kamera img { display: none !important; }
.mb .mb-kam { display: block; width: 100%; background: #1d1d1f; color: #fff; font-size: 20px; font-weight: 600; padding: 16px; margin: 10px 0; }
.mb-wynik { min-height: 92px; border-radius: 12px; background: #f5f5f7; padding: 12px 14px; display: flex; flex-direction: column; justify-content: center; gap: 2px; border-left: 6px solid #c7c7cc; }
.mb-wynik.ok { background: #e8f5e9; border-left-color: #2e7d32; }
.mb-wynik.uwaga { background: #fff4e5; border-left-color: #ef8a00; }
.mb-wynik.zly { background: #fdecea; border-left-color: #c62828; }
.mb-nr { font-size: 32px; font-variant-numeric: tabular-nums; }
.mb-kto { font-size: 20px; font-weight: 600; }
.mb-szkola, .mb-szary { color: #6e6e73; }
.mb-uwaga { font-weight: 600; color: #b3261e; margin-top: 4px; }
.mb-reczny { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }

.mb-blad { position: fixed; left: 12px; right: 12px; bottom: 16px; z-index: 9999; background: #1d1d1f; color: #fff; padding: 14px 16px; border-radius: 12px; font-size: 15px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.mb-stopka { text-align: center; margin-top: 24px; font-size: 14px; }
.mb-login { max-width: 380px; margin: 0 auto; }
.mb-do-aplikacji { text-align: center; font-weight: 600; }

/* ===== Aplikacja webowa (/meta-app/): własna strona bez motywu ===== */
html:has(body.mb-app) { background: #fff; }
body.mb-app { margin: 0; background: #fff; color: #1d1d1f; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(12px, env(safe-area-inset-left)); }
body.mb-app * { box-sizing: border-box; }
.mb-naglowek { display: flex; align-items: center; gap: 8px; max-width: 520px; margin: 0 auto; padding: 10px 0 2px; font: 700 17px system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
.mb-naglowek img { border-radius: 7px; }
.mb-naglowek span { flex: 1; }
.mb-naglowek button { font: 700 14px system-ui, sans-serif; border: 0; border-radius: 999px; padding: 7px 14px; background: #ffcc00; color: #000; cursor: pointer; }
.mb-naglowek button[hidden] { display: none; }
.mb-brak { padding: 24px 4px; font-size: 17px; }
body.mb-app .mb-blad { bottom: calc(16px + env(safe-area-inset-bottom)); }
body.mb-app .mb-stopka { padding-bottom: 12px; }

/* Wybór obiektywu i test dźwięku/kamery */
.mb-obiektyw { display: block; font-size: 13px; font-weight: 600; color: #6e6e73; margin: -2px 0 10px; }
.mb-obiektyw select { font-size: 16px; font-weight: 500; }
.mb-test { position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.mb-test[hidden] { display: none !important; }
.mb-test-okno { background: #fff; color: #1d1d1f; width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); font-size: 15px; }
.mb-test-okno h2 { margin: 0 0 6px; font-size: 20px; }
.mb-test-rzad { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.mb-test-rzad span { flex: 1; min-width: 90px; font-weight: 600; }
.mb .mb-test-okno button { padding: 10px 14px; }
.mb .mb-test-okno .mb-wybierz { background: #e8f5e9; color: #1b5e20; }
.mb-t-ok { color: #2e7d32; } .mb-t-zle { color: #c62828; }
.mb-test-okno details { margin: 8px 0; } .mb-test-okno summary { font-weight: 600; cursor: pointer; }
.mb-test-okno ol { padding-left: 1.3em; } .mb-test-okno li { margin: 4px 0; }
#mb-t-info { white-space: pre-wrap; background: #f5f5f7; border-radius: 10px; padding: 10px; font-size: 13px; }
.mb .mb-test-zamknij { width: 100%; background: #1d1d1f; color: #fff; font-weight: 600; }
.mb .mb-od-nowa { display: block; width: 100%; margin-top: 8px; background: #fff4e5; color: #8a4b00; font-weight: 600; }

/* Logowanie hasłem zawodów */
.mb-logowanie { text-align: center; padding: 28px 4px 12px; }
.mb-logowanie[hidden] { display: none !important; }
.mb-logowanie .mb-logo { border-radius: 22px; }
.mb-logowanie h1 { font-size: 24px; margin: 14px 0 4px; }
.mb-logowanie form { display: grid; gap: 10px; margin: 18px auto 8px; max-width: 360px; }
.mb-logowanie input { font-size: 24px; font-weight: 700; text-align: center; letter-spacing: 3px; padding: 14px; }
.mb .mb-wejdz { background: #ffcc00; color: #000; font-size: 20px; font-weight: 800; padding: 14px; }
.mb-blad-logowania { color: #c62828; font-weight: 600; min-height: 1.4em; }
.mb-konto { font-size: 14px; margin-top: 18px; }
.mb-naglowek small { display: block; font-size: 12px; font-weight: 600; color: #6e6e73; }
.mb-naglowek small:empty { display: none; }
