:root {
  --accent: #e30613;
  --card-opacity: .86;
  --overlay-opacity: .42;
  --bg: #090d18;
  --panel: rgba(15, 23, 42, var(--card-opacity));
  --text: #f8fafc;
  --muted: #cbd5e1;
  --line: rgba(255,255,255,.12);
  --gold: #fbbf24;
  --bg-overlay-rgb: 9, 13, 24;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem clamp(.8rem, 3vw, 2rem);
  background: rgba(6, 10, 19, .90);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.brand { display: flex; gap: .75rem; align-items: center; min-width: 0; max-width: 100%; }
.brand img { flex: 0 0 auto; width: 48px; height: 48px; object-fit: contain; background: rgba(255,255,255,.92); border-radius: 12px; padding: 5px; }
.brand strong { display: block; font-size: clamp(.92rem, 2.2vw, 1.15rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: min(54vw, 780px); }
.brand span { display: block; color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: min(54vw, 780px); }
.main-nav, .admin-nav { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }
.main-nav a, .admin-nav a, .btn {
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.08);
  color: var(--text);
  padding: .65rem .85rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: .9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}
.main-nav a:hover, .admin-nav a:hover, .btn:hover { border-color: rgba(255,255,255,.35); background: rgba(255,255,255,.14); }
.info-banner {
  position: sticky;
  top: 74px;
  z-index: 9;
  padding: .75rem clamp(.8rem, 3vw, 2rem);
  background: linear-gradient(90deg, var(--accent), #f59e0b);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 12px 32px rgba(0,0,0,.25);
}
.page-shell { width: min(1380px, calc(100% - 1.2rem)); margin: 1.1rem auto 2rem; display: grid; gap: 1rem; }
.card { border-radius: 24px; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 20px 60px rgba(0,0,0,.22); }
.glass { background: var(--panel); backdrop-filter: blur(18px); }
.hero { padding: clamp(1rem, 4vw, 2rem); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
h1, h2, h3 { margin: .2rem 0 .45rem; line-height: 1.15; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.45rem, 4.3vw, 3rem); }
h2 { font-size: clamp(1.18rem, 3vw, 1.8rem); }
h3 { font-size: 1.05rem; }
.eyebrow { margin: 0 0 .25rem; color: var(--gold); text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 1000; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.live-status { display: grid; gap: .2rem; justify-items: center; min-width: 155px; padding: 1rem; border-radius: 20px; background: rgba(255,255,255,.08); }
.live-status small { color: var(--muted); font-size: .78rem; }
.pulse { width: 16px; height: 16px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.8); animation: pulse 1.6s infinite; }
.live-status.is-finished .pulse { background: #94a3b8; animation: none; box-shadow: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 14px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.toolbar { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding: 1rem; }
.search-above-menu { order: 0; }
.search-box { display: grid; gap: .35rem; flex: 1; }
.search-box label, .form-grid label { color: #e5e7eb; font-weight: 850; }
input, select, textarea {
  width: 100%;
  margin-top: .35rem;
  padding: .85rem .9rem;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.16);
  color: var(--text);
  background: rgba(5, 9, 18, .72);
  outline: none;
  min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(227,6,19,.2); }
.section-head { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.compact-head { margin-bottom: .75rem; }
.tabs, .team-search-panel, .auth-card, .danger-zone { padding: 1rem; }
.tab-buttons { display: flex; gap: .55rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tab-btn { border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.07); color: var(--text); border-radius: 999px; padding: .75rem 1rem; cursor: pointer; font-weight: 900; }
.tab-btn.active { background: var(--accent); border-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; border-radius: 18px; border: 1px solid rgba(255,255,255,.08); }
.table-wrap.no-x-scroll { overflow-x: hidden; }
.score-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.public-table { min-width: 0; }
.score-table th, .score-table td { padding: .85rem .9rem; text-align: left; border-bottom: 1px solid rgba(255,255,255,.08); vertical-align: middle; }
.score-table th { background: rgba(255,255,255,.07); color: var(--text); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; position: sticky; top: 0; }
.score-table tbody tr:hover { background: rgba(255,255,255,.045); }
.team-row { cursor: pointer; }
.team-row:focus { outline: 2px solid var(--gold); outline-offset: -2px; }
.place { font-size: 1.15rem; font-weight: 1000; color: var(--gold); }
.badge, .status { display: inline-flex; align-items: center; border-radius: 999px; padding: .25rem .55rem; margin-left: .35rem; font-size: .72rem; font-weight: 1000; text-transform: uppercase; letter-spacing: .05em; }
.badge { background: var(--gold); color: #1f2937; }
.status { margin-left: 0; background: rgba(255,255,255,.1); }
.status-ok { background: rgba(34,197,94,.18); color: #86efac; }
.status-dnf { background: rgba(245,158,11,.18); color: #fde68a; }
.status-dsq { background: rgba(239,68,68,.2); color: #fecaca; }
.status-pending { background: rgba(148,163,184,.18); color: #e2e8f0; }
.highlighted-row { outline: 2px solid rgba(251,191,36,.35); background: rgba(251,191,36,.06); }
.hidden { display: none !important; }
.team-details-list { display: grid; gap: .8rem; }
.team-details-grid { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: .75rem; }
.detail-card { padding: .9rem; border-radius: 18px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.09); }
.detail-card strong { display: block; margin-bottom: .25rem; }
.search-card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .5rem; }
.mini-result { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .75rem; align-items: center; padding: .45rem 0; border-top: 1px solid rgba(255,255,255,.08); }
.mini-result span { min-width: 0; overflow-wrap: anywhere; }
.mini-result em { color: var(--muted); font-style: normal; }
.general-mini { border-top: 0; }
.flash-stack { display: grid; gap: .5rem; }
.flash { padding: .9rem 1rem; border-radius: 16px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12); }
.flash-success { border-color: rgba(34,197,94,.4); }
.flash-danger { border-color: rgba(239,68,68,.5); }
.flash-warning { border-color: rgba(245,158,11,.5); }
.admin-nav { padding: .75rem; position: sticky; top: 132px; z-index: 5; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.stat { padding: 1rem; border-radius: 18px; background: rgba(255,255,255,.07); }
.stat strong { display: block; font-size: 2rem; color: var(--gold); }
.audit-list { display: grid; gap: .65rem; }
.audit-row { display: grid; grid-template-columns: 1.2fr 2fr auto; gap: .75rem; padding: .75rem; border-radius: 14px; background: rgba(255,255,255,.06); }
.form-grid { display: grid; gap: .9rem; }
.two-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.checkbox { display: flex; align-items: center; gap: .6rem; }
.checkbox input { width: auto; margin: 0; flex: 0 0 auto; }
.form-actions, .actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-danger { background: #b91c1c; border-color: #ef4444; }
.btn-small { padding: .48rem .7rem; font-size: .78rem; }
.auth-card { max-width: 480px; margin-inline: auto; }
.fieldset { border: 1px solid rgba(255,255,255,.12); border-radius: 18px; padding: 1rem; }
.fieldset legend { padding: 0 .5rem; font-weight: 900; color: var(--gold); }
.inline-fields, .air-grid { display: grid; gap: .7rem; }
.inline-fields { grid-template-columns: repeat(2, 1fr); }
.air-grid { grid-template-columns: 1fr 1fr 1fr; align-items: center; }
.matrix-cell { display: grid; gap: .25rem; min-width: 140px; padding: .35rem; border-radius: 12px; }
.matrix-cell:hover { background: rgba(255,255,255,.08); }
.pdf-frame { width: 100%; height: 78vh; border: 0; border-radius: 18px; background: #fff; }
.footer { width: min(1380px, calc(100% - 1.2rem)); margin: 0 auto 1.2rem; color: var(--muted); display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; font-size: .85rem; }
.mobile-bottom-nav { display: none; }
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1rem; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.62); backdrop-filter: blur(5px); }
.modal-card { position: relative; width: min(920px, 100%); max-height: min(88vh, 900px); overflow: auto; border-radius: 26px; border: 1px solid rgba(255,255,255,.16); box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.modal-head { position: sticky; top: 0; display: flex; align-items: start; justify-content: space-between; gap: 1rem; padding: 1rem; background: rgba(15,23,42,.96); border-bottom: 1px solid rgba(255,255,255,.1); z-index: 1; }
.modal-close { width: 40px; height: 40px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; color: var(--text); background: rgba(255,255,255,.08); font-size: 1.45rem; cursor: pointer; }
.modal-body { padding: 1rem; display: grid; gap: 1rem; }
.summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.summary-strip div { padding: .9rem; border-radius: 18px; background: rgba(255,255,255,.07); }
.summary-strip span { display: block; color: var(--muted); font-size: .8rem; }
.summary-strip strong { display: block; margin-top: .25rem; font-size: 1.15rem; }
.detail-results { display: grid; gap: .75rem; }
.competition-detail { border: 1px solid rgba(255,255,255,.1); border-radius: 20px; overflow: hidden; background: rgba(255,255,255,.05); }
.competition-detail header { display: flex; justify-content: space-between; gap: .75rem; align-items: center; padding: .85rem 1rem; background: rgba(255,255,255,.06); }
.competition-detail dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; }
.competition-detail dl div { display: flex; justify-content: space-between; gap: .75rem; padding: .72rem 1rem; border-top: 1px solid rgba(255,255,255,.08); }
.competition-detail dt { color: var(--muted); }
.competition-detail dd { margin: 0; font-weight: 850; text-align: right; }
body.modal-open { overflow: hidden; }

@media (max-width: 820px) {
  body { padding-bottom: 72px; }
  .topbar { align-items: stretch; flex-direction: column; gap: .65rem; }
  .brand { justify-content: space-between; }
  .brand strong, .brand span { max-width: 58vw; }
  .brand img { width: 42px; height: 42px; }
  .main-nav a, .admin-nav a { flex: 1; text-align: center; padding: .62rem .5rem; font-size: .78rem; }
  .info-banner { top: 139px; font-size: .86rem; }
  .hero, .toolbar, .section-head { flex-direction: column; align-items: stretch; }
  .live-status { justify-items: start; min-width: 0; }
  .tab-buttons { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .45rem; }
  .tab-btn { padding: .72rem .45rem; font-size: .82rem; }
  .score-table { min-width: 680px; }
  .score-table th, .score-table td { padding: .7rem .65rem; }
  .team-details-grid, .stat-grid, .two-cols { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .audit-row { grid-template-columns: 1fr; }
  .admin-nav { top: 200px; }
  .pdf-frame { height: 72vh; }
  .mobile-bottom-nav {
    position: fixed;
    left: .65rem;
    right: .65rem;
    bottom: .65rem;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .45rem;
    padding: .45rem;
    border-radius: 22px;
    background: rgba(6,10,19,.92);
    border: 1px solid rgba(255,255,255,.14);
    box-shadow: 0 18px 48px rgba(0,0,0,.38);
    backdrop-filter: blur(16px);
  }
  .mobile-bottom-nav a { text-align: center; padding: .78rem .35rem; border-radius: 17px; background: rgba(255,255,255,.08); font-weight: 900; font-size: .78rem; }
  .mobile-bottom-nav a:active { background: var(--accent); }
  .summary-strip { grid-template-columns: 1fr; }
  .competition-detail dl { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .page-shell { width: min(100% - .6rem, 1380px); margin-top: .7rem; }
  .card { border-radius: 18px; }
  .tabs, .team-search-panel, .auth-card, .danger-zone, .card.glass { padding: .75rem; }
  h1 { font-size: 1.35rem; }
  h2 { font-size: 1.12rem; }
  .brand { gap: .4rem; }
  .brand img { width: 36px; height: 36px; border-radius: 9px; }
  .brand span { display: none; }
  .main-nav { display: none; }
  .info-banner { top: 61px; }
  .hero { gap: .7rem; }
  .live-status { padding: .75rem; }
  .tab-buttons { grid-template-columns: 1fr; }
  .score-table.responsive-table { min-width: 0; border-collapse: separate; border-spacing: 0 .55rem; }
  .score-table.responsive-table thead { display: none; }
  .score-table.responsive-table tbody { display: grid; gap: .55rem; }
  .score-table.responsive-table tr { display: grid; gap: .35rem; padding: .75rem; border: 1px solid rgba(255,255,255,.1); border-radius: 16px; background: rgba(255,255,255,.055); }
  .score-table.responsive-table td { display: flex; align-items: center; justify-content: space-between; gap: .75rem; border: 0; padding: .18rem 0; text-align: right; }
  .score-table.responsive-table td::before { content: attr(data-label); color: var(--muted); font-weight: 850; text-align: left; }
  .score-table.responsive-table td[data-label="Drużyna"] { display: block; text-align: left; font-size: 1.05rem; }
  .score-table.responsive-table td[data-label="Drużyna"]::before { display: none; }
  .table-wrap.no-x-scroll { border: 0; overflow: visible; }
  .mini-result { grid-template-columns: 1fr; gap: .2rem; }
  .search-card-head { align-items: start; flex-direction: column; }
  .modal { align-items: end; padding: 0; }
  .modal-card { width: 100%; max-height: 90vh; border-radius: 24px 24px 0 0; }
  .modal-head, .modal-body { padding: .85rem; }
  .competition-detail header { align-items: start; flex-direction: column; }
  .air-grid { grid-template-columns: 1fr; }
  .inline-fields { grid-template-columns: 1fr; }
}

/* Poprawki mobilne i szczegóły wyników */
html, body { width: 100%; max-width: 100%; }
img, svg, video { max-width: 100%; }
.score-table.responsive-table { min-width: 0; }
.score-table th, .score-table td { overflow-wrap: anywhere; }
.air-detail-wrap { padding: .9rem 1rem 1rem; overflow-x: auto; }
.air-detail-table { width: 100%; border-collapse: collapse; min-width: 0; }
.air-detail-table th, .air-detail-table td { padding: .55rem .5rem; border-top: 1px solid rgba(255,255,255,.08); text-align: left; }
.air-detail-table th { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; }

@media (max-width: 820px) {
  .admin-nav { position: static; top: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-nav a { width: 100%; min-width: 0; }
  .table-wrap { overflow-x: hidden; }
  .score-table.responsive-table { width: 100%; }
  .form-actions > form { width: 100%; }
  .form-actions > form .btn { width: 100%; }
}

@media (max-width: 640px) {
  body { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding: .6rem .65rem; }
  .info-banner {
    position: sticky;
    top: 57px;
    z-index: 35;
    padding: .62rem .75rem;
    line-height: 1.25;
    max-height: 72px;
    overflow: auto;
  }
  .page-shell { gap: .75rem; }
  .toolbar { gap: .65rem; }
  .toolbar .btn { width: 100%; }
  .tab-buttons { gap: .4rem; }
  .score-table.responsive-table tr { width: 100%; max-width: 100%; }
  .score-table.responsive-table td { min-width: 0; }
  .score-table.responsive-table td > * { max-width: 100%; }
  .score-table.responsive-table td[data-label="Akcje"] { display: grid; grid-template-columns: 1fr; text-align: stretch; }
  .score-table.responsive-table td[data-label="Akcje"]::before { display: block; }
  .actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .actions .btn, .actions form, .actions button { width: 100%; }
  .admin-matrix .matrix-cell { min-width: 0; width: 100%; }
  .mobile-bottom-nav {
    left: .5rem;
    right: .5rem;
    bottom: calc(.5rem + env(safe-area-inset-bottom, 0px));
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .mobile-bottom-nav a { white-space: normal; min-width: 0; line-height: 1.1; }
  .summary-strip strong { overflow-wrap: anywhere; }
  .competition-detail dl div { align-items: start; }
  .air-detail-wrap { padding: .75rem; overflow-x: hidden; }
  .air-detail-table { font-size: .82rem; table-layout: fixed; }
  .air-detail-table th, .air-detail-table td { padding: .45rem .25rem; }
}

/* Aktualizacja: stopka, partnerzy i silniejsze dopasowanie mobilne */
.text-link { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.plus { font-size: 1.15rem; line-height: 1; font-weight: 1000; }
.add-record { gap: .35rem; }
.four-stats { grid-template-columns: repeat(4, 1fr); }
.site-footer { display: grid; gap: .45rem; align-items: center; }
.footer-main { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.footer-cta, .author-link { color: #f8fafc; font-weight: 900; text-decoration: underline; text-underline-offset: 3px; width: fit-content; }
.author-link { color: var(--gold); }
.admin-logo-preview { width: 86px; height: 46px; object-fit: contain; background: rgba(255,255,255,.92); border-radius: 10px; padding: .35rem; }
.admin-logo-preview.large { width: 180px; height: 90px; display: block; margin-top: .5rem; }
.current-logo-box { padding: .9rem; border: 1px solid rgba(255,255,255,.12); border-radius: 18px; background: rgba(255,255,255,.06); }
.no-inner-margin input { margin-top: .35rem; }
.partners-page { padding: clamp(1rem, 3vw, 1.5rem); }
.partners-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; }
.partner-card { display: grid; gap: .75rem; align-content: start; min-width: 0; padding: 1rem; border: 1px solid rgba(255,255,255,.12); border-radius: 22px; background: rgba(255,255,255,.07); text-align: center; transition: transform .18s ease, background .18s ease, border-color .18s ease; }
.partner-card:hover { transform: translateY(-2px); background: rgba(255,255,255,.11); border-color: rgba(255,255,255,.22); }
.partner-logo-box { min-height: 110px; display: grid; place-items: center; padding: .9rem; background: rgba(255,255,255,.94); border-radius: 18px; color: #111827; }
.partner-logo-box img { max-width: 100%; max-height: 88px; object-fit: contain; }
.partner-card strong { overflow-wrap: anywhere; }

@media (max-width: 1024px) {
  .partners-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .four-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .topbar, .info-banner, .page-shell, .footer, .mobile-bottom-nav { max-width: 100vw; }
  .public-table.score-table { min-width: 0; }
  .footer-main { display: grid; gap: .35rem; }
  .partners-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .info-banner {
    position: sticky;
    top: 57px;
    z-index: 42;
    width: 100%;
    max-width: 100vw;
  }
  .hero.card.glass { padding: .8rem; }
  .hero .muted { font-size: .83rem; }
  .live-status { width: 100%; }
  .partners-grid { grid-template-columns: 1fr; }
  .partner-card { grid-template-columns: 1fr; }
  .partner-logo-box { min-height: 104px; }
  .footer { padding: 0 .35rem; margin-bottom: calc(5.8rem + env(safe-area-inset-bottom, 0px)); }
  .footer-cta, .author-link { width: 100%; }
  .four-stats { grid-template-columns: 1fr; }
  .brand strong { max-width: calc(100vw - 112px); }
}

/* v3: dolny pasek aplikacyjny, przypięta wyszukiwarka i formularz czasu */
.status-legend {
  display: grid;
  gap: .45rem;
  margin: 0 0 1rem;
  padding: .9rem 1rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  background: rgba(255,255,255,.06);
}
.status-legend strong { color: #fff; }
.status-legend span { color: var(--muted); }
.help-text { margin: .65rem 0 0; color: var(--muted); font-size: .92rem; }
#timePreview { background: rgba(255,255,255,.08); color: #fff; }
.mobile-bottom-nav svg {
  width: 20px;
  height: 20px;
  display: block;
  margin: 0 auto .2rem;
  fill: currentColor;
}
.mobile-bottom-nav a {
  display: grid;
  place-items: center;
  gap: .12rem;
}
.mobile-bottom-nav span { display: block; }

@media (max-width: 640px) {
  body { padding-bottom: calc(168px + env(safe-area-inset-bottom, 0px)); }
  .search-above-menu {
    position: fixed;
    left: .5rem;
    right: .5rem;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    z-index: 46;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: .45rem;
    padding: .55rem;
    border-radius: 20px;
    background: rgba(6,10,19,.94);
    border: 1px solid rgba(255,255,255,.14);
    box-shadow: 0 18px 48px rgba(0,0,0,.34);
    backdrop-filter: blur(16px);
  }
  .search-above-menu .search-box { min-width: 0; }
  .search-above-menu label { font-size: .72rem; }
  .search-above-menu input {
    min-height: 40px;
    font-size: 16px;
    padding: .65rem .75rem;
  }
  .search-above-menu .btn {
    width: auto;
    min-height: 40px;
    padding: .55rem .7rem;
    font-size: .72rem;
  }
  .mobile-bottom-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .mobile-bottom-nav a {
    padding: .55rem .25rem;
    font-size: .74rem;
  }
  .mobile-bottom-nav svg { width: 19px; height: 19px; }
  .team-search-panel {
    margin-bottom: 5.6rem;
  }
  .score-table.responsive-table td.place {
    font-size: 1.08rem;
    font-weight: 1000;
  }
}


/* v4: uproszczona wyszukiwarka, stała nazwa zawodów w mobile i tryb jasny */
html.theme-light {
  --bg: #f3f4f6;
  --panel: rgba(255, 255, 255, var(--card-opacity));
  --text: #0f172a;
  --muted: #475569;
  --line: rgba(15, 23, 42, .12);
  --gold: #b45309;
  --bg-overlay-rgb: 255, 255, 255;
}
html.theme-light body { background: var(--bg); }
html.theme-light .topbar,
html.theme-light .mobile-bottom-nav,
html.theme-light .search-above-menu {
  background: rgba(255,255,255,.94);
  border-color: rgba(15,23,42,.12);
  box-shadow: 0 18px 48px rgba(15,23,42,.14);
}
html.theme-light .info-banner { color: #fff; }
html.theme-light .card,
html.theme-light .fieldset,
html.theme-light .table-wrap,
html.theme-light .partner-card,
html.theme-light .detail-card,
html.theme-light .status-legend,
html.theme-light .competition-detail,
html.theme-light .current-logo-box {
  border-color: rgba(15,23,42,.12);
}
html.theme-light .glass { backdrop-filter: blur(18px); }
html.theme-light .main-nav a,
html.theme-light .admin-nav a,
html.theme-light .btn,
html.theme-light .tab-btn,
html.theme-light .mobile-bottom-nav a {
  color: var(--text);
  background: rgba(15,23,42,.055);
  border-color: rgba(15,23,42,.14);
}
html.theme-light .main-nav a:hover,
html.theme-light .admin-nav a:hover,
html.theme-light .btn:hover,
html.theme-light .tab-btn:hover,
html.theme-light .mobile-bottom-nav a:hover {
  background: rgba(15,23,42,.09);
  border-color: rgba(15,23,42,.22);
}
html.theme-light .tab-btn.active,
html.theme-light .btn-primary { color: #fff; }
html.theme-light input,
html.theme-light select,
html.theme-light textarea {
  color: var(--text);
  background: rgba(255,255,255,.9);
  border-color: rgba(15,23,42,.16);
}
html.theme-light input::placeholder,
html.theme-light textarea::placeholder { color: #64748b; }
html.theme-light .search-box label,
html.theme-light .form-grid label { color: #1f2937; }
html.theme-light .score-table th { background: rgba(15,23,42,.06); color: var(--text); }
html.theme-light .score-table th,
html.theme-light .score-table td,
html.theme-light .air-detail-table th,
html.theme-light .air-detail-table td { border-color: rgba(15,23,42,.10); }
html.theme-light .score-table tbody tr:hover { background: rgba(15,23,42,.04); }
html.theme-light .detail-card,
html.theme-light .stat,
html.theme-light .audit-row,
html.theme-light .status-legend,
html.theme-light .partner-card,
html.theme-light .competition-detail,
html.theme-light .live-status { background: rgba(15,23,42,.045); }
html.theme-light .highlighted-row { background: rgba(180,83,9,.08); outline-color: rgba(180,83,9,.35); }
html.theme-light .partner-logo-box,
html.theme-light .brand img,
html.theme-light .admin-logo-preview { background: rgba(255,255,255,.96); }
html.theme-light .status-ok { color: #166534; background: rgba(22,101,52,.12); }
html.theme-light .status-dnf { color: #92400e; background: rgba(146,64,14,.12); }
html.theme-light .status-dsq { color: #991b1b; background: rgba(153,27,27,.12); }
html.theme-light .status-pending { color: #334155; background: rgba(51,65,85,.12); }
html.theme-light .footer-cta { color: var(--text); }
html.theme-light .modal-backdrop { background: rgba(15,23,42,.42); }

.search-above-menu {
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
}
.search-above-menu > input { margin-top: 0; }
.score-table.responsive-table td.place::before { display: none !important; }
.score-table.responsive-table td.place {
  justify-content: flex-start;
  text-align: left;
}

@media (max-width: 640px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 49;
    min-height: 57px;
  }
  .brand { flex: 1 1 auto; min-width: 0; }
  .brand strong {
    display: block;
    max-width: calc(100vw - 104px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: .83rem;
    line-height: 1.15;
  }
  .search-above-menu {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
  .search-above-menu > input {
    min-height: 42px;
    margin-top: 0;
    font-size: 16px;
    padding: .68rem .75rem;
  }
  .score-table.responsive-table td.place {
    display: block;
    padding-bottom: .1rem;
    text-align: left;
    font-size: 1.28rem;
    line-height: 1;
  }
}

/* v10: układ wyników jak panel zawodów, bez wyszukiwarki, dynamiczny pasek informacji */
:root {
  --card-radius: 18px;
  --soft-radius: 14px;
  --shadow-soft: 0 16px 40px rgba(0,0,0,.18);
  --shadow-strong: 0 24px 70px rgba(0,0,0,.28);
}

.page-shell {
  width: min(1240px, calc(100% - 24px));
  gap: 14px;
  margin-top: 14px;
}

.card {
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-soft);
}

.glass {
  background: linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.035)), var(--panel);
}

.hero {
  padding: 18px;
  border-radius: 20px;
}

.hero h1 {
  font-size: clamp(1.55rem, 3.2vw, 2.55rem);
  letter-spacing: -.035em;
}

.live-status {
  border-radius: 16px;
  padding: 12px 14px;
  min-width: 148px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.075);
}

.tabs {
  padding: 14px;
  border-radius: 20px;
}

.tab-buttons {
  gap: 8px;
  margin-bottom: 14px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(0,0,0,.16);
  border: 1px solid rgba(255,255,255,.08);
}

.tab-btn {
  border-radius: 12px;
  padding: 10px 14px;
  font-size: .86rem;
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.065);
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.tab-btn:hover { transform: translateY(-1px); }
.tab-btn.active {
  background: linear-gradient(135deg, var(--accent), #f59e0b);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 28px rgba(227,6,19,.25);
}

.section-head {
  margin-bottom: 12px;
  padding: 2px 2px 0;
}
.section-head h2 { margin-bottom: 0; }

.table-wrap {
  border-radius: 16px;
  border-color: rgba(255,255,255,.10);
  background: rgba(0,0,0,.12);
}

.score-table th {
  padding: 12px 14px;
  background: rgba(255,255,255,.075);
  font-size: .74rem;
}

.score-table td {
  padding: 13px 14px;
}

.score-table tbody tr {
  transition: background .16s ease, transform .16s ease;
}
.score-table tbody tr:hover {
  background: rgba(255,255,255,.065);
}

.place {
  min-width: 54px;
  color: #fbbf24;
  font-size: 1.24rem;
  letter-spacing: -.03em;
}

.status {
  padding: .32rem .62rem;
  border-radius: 999px;
  font-size: .68rem;
}

.info-banner {
  display: flex;
  align-items: center;
  gap: .55rem;
  position: sticky;
  top: 74px;
  z-index: 45;
  min-height: 44px;
  padding: .72rem clamp(.85rem, 3vw, 2rem);
  background: linear-gradient(90deg, #b91c1c, var(--accent), #f59e0b, var(--accent));
  background-size: 220% 100%;
  color: #fff;
  font-weight: 1000;
  border-bottom: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 14px 32px rgba(185,28,28,.30);
  animation: infoBannerFlow 4s ease-in-out infinite, infoBannerPulse 1.8s ease-in-out infinite;
}
.info-banner.hidden { display: none !important; }
.info-banner .info-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 0 rgba(255,255,255,.75);
  animation: infoDotPulse 1.15s infinite;
}
.info-banner.banner-changed {
  animation: infoBannerChanged .75s ease-out 1, infoBannerFlow 4s ease-in-out infinite, infoBannerPulse 1.8s ease-in-out infinite;
}
@keyframes infoBannerFlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
@keyframes infoBannerPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.18); }
}
@keyframes infoDotPulse {
  70% { box-shadow: 0 0 0 10px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}
@keyframes infoBannerChanged {
  0% { transform: translateY(-3px); box-shadow: 0 0 0 rgba(255,255,255,0), 0 14px 32px rgba(185,28,28,.30); }
  45% { transform: translateY(0); box-shadow: 0 0 0 6px rgba(255,255,255,.18), 0 18px 44px rgba(185,28,28,.42); }
  100% { box-shadow: 0 14px 32px rgba(185,28,28,.30); }
}

.modal-close {
  background: #dc2626 !important;
  color: #fff !important;
  border-color: rgba(255,255,255,.35) !important;
  font-weight: 1000;
  box-shadow: 0 0 0 0 rgba(220,38,38,.72);
  animation: closePulse 1.35s infinite;
}
.modal-close:hover, .modal-close:focus {
  background: #b91c1c !important;
  transform: scale(1.06);
}
@keyframes closePulse {
  70% { box-shadow: 0 0 0 12px rgba(220,38,38,0); }
  100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
}

/* Wyszukiwarka publiczna usunięta z UI. Zostaje tylko bezpieczny endpoint backendowy do testów. */
.search-above-menu,
.team-search-panel {
  display: none !important;
}

html.theme-light .glass {
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.88));
}
html.theme-light .tab-buttons,
html.theme-light .table-wrap {
  background: rgba(15,23,42,.035);
  border-color: rgba(15,23,42,.10);
}
html.theme-light .score-table th { background: rgba(15,23,42,.055); }
html.theme-light .score-table tbody tr:hover { background: rgba(15,23,42,.045); }
html.theme-light .info-banner { color: #fff; }

@media (max-width: 900px) {
  .page-shell { width: min(100% - 16px, 1240px); gap: 10px; }
  .hero { padding: 14px; }
  .tabs { padding: 10px; }
  .tab-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 5px; }
  .tab-btn { padding: 10px 8px; font-size: .80rem; }
}

@media (max-width: 640px) {
  body { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)) !important; }
  .topbar {
    min-height: 58px;
    padding: .55rem .62rem;
  }
  .brand { gap: .45rem; }
  .brand img { width: 34px; height: 34px; padding: 4px; }
  .brand strong {
    max-width: calc(100vw - 96px);
    font-size: .82rem;
    letter-spacing: -.02em;
  }
  .info-banner {
    top: 58px !important;
    z-index: 46;
    min-height: 42px;
    max-height: 74px;
    padding: .62rem .72rem;
    font-size: .82rem;
    line-height: 1.22;
    overflow-y: auto;
  }
  .hero {
    display: grid;
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 10px;
  }
  .hero h1 { font-size: 1.28rem; }
  .hero .muted { font-size: .80rem; }
  .live-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
  }
  .tab-buttons { grid-template-columns: 1fr; }
  .section-head { margin-bottom: 8px; }
  .compact-head h2 { font-size: 1.12rem; }
  .table-wrap.no-x-scroll { background: transparent; }
  .score-table.responsive-table tbody {
    display: grid;
    gap: 8px;
  }
  .score-table.responsive-table tr {
    display: grid;
    grid-template-columns: 52px 1fr;
    grid-template-areas:
      "place team"
      "place points"
      "place status";
    gap: 4px 10px;
    padding: 11px 12px;
    border-radius: 15px;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.10);
    box-shadow: 0 12px 28px rgba(0,0,0,.16);
  }
  .score-table.responsive-table td {
    display: block;
    padding: 0;
    text-align: left;
    border: 0;
  }
  .score-table.responsive-table td::before { display: none !important; }
  .score-table.responsive-table td.place {
    grid-area: place;
    display: grid;
    place-items: center;
    align-self: stretch;
    min-width: 0;
    width: 48px;
    min-height: 58px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(251,191,36,.24), rgba(227,6,19,.18));
    color: #fbbf24;
    font-size: 1.35rem;
    line-height: 1;
  }
  .score-table.responsive-table td[data-label="Drużyna"] {
    grid-area: team;
    font-size: .98rem;
    line-height: 1.18;
  }
  .score-table.responsive-table td[data-label="Punkty"],
  .score-table.responsive-table td[data-label="Czas / status"],
  .score-table.responsive-table td[data-label="Kategoria"] {
    grid-area: points;
    color: var(--muted);
    font-size: .86rem;
  }
  .score-table.responsive-table td[data-label="Status"] {
    grid-area: status;
  }
  .score-table.responsive-table .status { font-size: .62rem; }
  .mobile-bottom-nav {
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    border-radius: 18px;
    box-shadow: 0 18px 46px rgba(0,0,0,.30);
  }
}
