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

:root {
  --bg: #0e1117;
  --bg2: #161b22;
  --bg3: #1c2128;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-dim: #484f58;
  --header-h: 52px;
  --footer-h: 46px;
  --col-w: 310px;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

/* ── HEADER ─────────────────────────────────────────── */
.header {
  height: var(--header-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  position: relative;
  z-index: 10;
}

.header-left { display: flex; align-items: center; gap: 10px; }

.f1-logo {
  background: #e10600;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 4px;
  font-style: italic;
}

.header-titles { display: flex; align-items: baseline; gap: 8px; }

h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.season-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 7px;
}

/* ── TICKER ─────────────────────────────────────────── */
.ticker-wrap {
  flex: 1;
  overflow: hidden;
  min-width: 0;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent);
  cursor: default;
}

.ticker-track {
  display: flex;
  width: max-content;
  animation: ticker-scroll 50s linear infinite;
}
/* pause on hover handled via JS (Safari fix) */

@keyframes ticker-scroll {
  0%   { transform: translateX(var(--ts, 100vw)); }
  100% { transform: translateX(var(--te, -100%)); }
}

.ticker-half {
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-muted);
  padding-right: 80px;
}

.t-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-right: 8px;
}
.t-sep   { margin: 0 6px; color: var(--text-dim); }
.t-div   { margin: 0 24px; color: var(--text-dim); }
.t-pos   { color: var(--text-muted); margin-right: 3px; font-size: 11px; }
.t-code  { font-weight: 700; color: var(--text); }
.t-pts   { color: #e10600; font-weight: 600; margin-left: 3px; font-size: 11px; }
.t-cname { font-weight: 600; color: var(--text); }

.header-right { display: flex; align-items: center; gap: 8px; }

.header-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── NEXT SESSION ────────────────────────────────────── */
.next-session {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  white-space: nowrap;
  cursor: default;
}

.ns-flag {
  font-size: 8px;
  color: var(--text-dim);
  transition: color .3s;
}
.ns-flag.live  { color: #3fb950; animation: pulse 1.2s ease infinite; }
.ns-flag.soon  { color: #e3b341; }

.ns-text {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.ns-text strong {
  color: var(--text);
  font-weight: 600;
}
.ns-text .ns-live-badge {
  color: #3fb950;
  font-weight: 700;
  letter-spacing: .4px;
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background 0.3s;
  flex-shrink: 0;
}
.status-dot.live  { background: #3fb950; }
.status-dot.error { background: #f85149; }
.status-dot.spin  { background: #e3b341; animation: pulse 1s infinite; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

.refresh-info {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}


/* ── COLUMNS WRAPPER ─────────────────────────────────── */
.columns-wrapper {
  height: calc(100vh - var(--header-h) - var(--footer-h));
  overflow: hidden;
  position: relative;
}

.columns-scroll {
  display: flex;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 0;
  scroll-snap-type: x proximity;
}

.columns-scroll::-webkit-scrollbar { height: 6px; }
.columns-scroll::-webkit-scrollbar-track { background: var(--bg); }
.columns-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.columns-scroll::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── COLUMN ─────────────────────────────────────────── */
.column {
  flex: 0 0 var(--col-w);
  width: var(--col-w);
  height: 100%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  scroll-snap-align: start;
}

.column-header {
  flex-shrink: 0;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  position: relative;
  overflow: hidden;
}

.column-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--team-color);
  opacity: .12;
}

.column-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.team-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-color-bar {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--team-color);
  flex-shrink: 0;
  margin-right: 7px;
}

.team-name-row { display: flex; align-items: center; }

.article-count {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255,255,255,.07);
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 500;
  flex-shrink: 0;
}

.team-drivers {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-drivers span {
  color: var(--team-color);
  filter: brightness(1.3);
  font-weight: 500;
}

/* ── ARTICLES LIST ───────────────────────────────────── */
.column-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.column-body::-webkit-scrollbar { width: 4px; }
.column-body::-webkit-scrollbar-track { background: transparent; }
.column-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.no-articles {
  padding: 24px 14px;
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
  line-height: 1.6;
}

/* ── ARTICLE CARD ────────────────────────────────────── */
.article {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  cursor: pointer;
  transition: background .12s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.article:hover { background: rgba(255,255,255,.04); }
.article:active { background: rgba(255,255,255,.07); }

.article-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.article-source {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--team-color);
  filter: brightness(1.2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}

.article-time {
  font-size: 10.5px;
  color: var(--text-dim);
  white-space: nowrap;
  margin-left: auto;
}

.article-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-title:hover { color: #fff; }

.article-img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  border-radius: 6px;
  margin-top: 8px;
  display: block;
  background: var(--bg3);
}

/* ── ARTICLE ROW (title + like button) ──────────────── */
.article-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 0;
}

.article-row .article-title {
  flex: 1;
  margin-bottom: 0;
}

.like-btn {
  flex-shrink: 0;
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  color: var(--text-dim);
  border-radius: 20px;
  padding: 3px 7px 3px 6px;
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  font-weight: 500;
  transition: color .15s, background .15s, border-color .15s;
  line-height: 1;
  margin-bottom: 1px;
}
.like-btn:hover {
  color: var(--text-muted);
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.15);
}
.like-btn.liked {
  color: #e10600;
  background: rgba(225,6,0,.12);
  border-color: rgba(225,6,0,.25);
}
.like-btn.liked svg { fill: #e10600; }

@keyframes like-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}
.like-btn.pop { animation: like-pop .25s ease; }

/* ── LOADING / ERROR ─────────────────────────────────── */
.loading-screen, .error-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-muted);
  font-size: 13px;
}

.loading-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: #e10600;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-icon { font-size: 32px; }

.error-screen button {
  background: #e10600;
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  transition: opacity .15s;
}
.error-screen button:hover { opacity: .85; }

.hidden { display: none !important; }

/* ── COLUMN LOADING STATE ─────────────────────────────── */
.skeleton {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.skel-line {
  height: 10px;
  border-radius: 4px;
  background: var(--bg3);
  margin-bottom: 6px;
  animation: shimmer 1.4s ease infinite;
  background-size: 200% 100%;
  background-image: linear-gradient(90deg, var(--bg3) 25%, var(--border) 50%, var(--bg3) 75%);
}
.skel-line.short { width: 40%; }
.skel-line.med   { width: 65%; }
.skel-line.tall  { height: 13px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── FOOTER ──────────────────────────────────────────── */
.footer {
  height: var(--footer-h);
  background: var(--bg2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 16px;
  flex-shrink: 0;
  gap: 10px;
}

.footer-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.footer-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.footer-email a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color .15s;
}
.footer-email a:hover { color: var(--text); }

/* ── DONATE BUTTONS ──────────────────────────────────── */
.donate-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
}
.donate-btn:hover  { opacity: .88; }
.donate-btn:active { transform: scale(.97); }

.donate-bmc {
  background: #FFDD00;
  color: #000;
}
.donate-pp {
  background: #003087;
  color: #fff;
}

.donate-lg {
  padding: 10px 18px;
  font-size: 14px;
  border-radius: 10px;
  justify-content: center;
  width: 100%;
}

/* ── MOBILE FLOATING SUPPORT BUTTON ─────────────────── */
.mobile-support-btn {
  display: none;
  position: fixed;
  bottom: 18px;
  right: 16px;
  z-index: 90;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  padding: 8px 13px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  transition: all .15s;
}
.mobile-support-btn:hover { background: var(--border); color: var(--text); }

/* ── SUPPORT POPUP ───────────────────────────────────── */
.support-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  backdrop-filter: blur(2px);
}

.support-popup {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 16px 16px 0 0;
  width: 100%;
  padding: 20px 20px 32px;
  animation: slide-up .25s ease;
}
@keyframes slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.support-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.support-popup-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.support-popup-close {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 50%;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s;
}
.support-popup-close:hover { background: var(--border); }

.support-popup-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
}

.support-popup-contact {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 18px;
}
.support-popup-contact .footer-email a {
  color: var(--text-muted);
}
.support-popup-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── HAMBURGER BUTTON ────────────────────────────────── */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 5px;
  flex-shrink: 0;
}
.hamburger-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: background .15s;
}
.hamburger-btn:hover span { background: var(--text); }

/* ── DRAWER ──────────────────────────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 150;
  backdrop-filter: blur(2px);
}

.drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: min(340px, 92vw);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  z-index: 160;
  display: flex;
  flex-direction: column;
  animation: slide-in .22s ease;
}
@keyframes slide-in {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}
.drawer.hidden { display: none !important; }
.drawer-overlay.hidden { display: none !important; }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}
.drawer-close {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 50%;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.drawer-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-tab {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
}
.drawer-tab:hover { background: var(--border); color: var(--text); }
.drawer-tab.active {
  background: var(--border);
  color: var(--text);
  font-weight: 600;
  border-color: var(--text-dim);
}

.drawer-loading {
  font-size: 12px;
  color: var(--text-dim);
  padding: 20px 16px;
}

.drawer-support {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 16px 28px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
  text-align: center;
}
.drawer-support-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.drawer-support-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.drawer-support .donate-lg {
  width: 100%;
  justify-content: center;
}

.drawer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.dr-pos {
  font-size: 12px;
  color: var(--text-dim);
  width: 18px;
  text-align: right;
  flex-shrink: 0;
}
.dr-code {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  width: 36px;
  flex-shrink: 0;
}
.dr-name {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dr-team {
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}
.dr-pts {
  font-size: 12px;
  font-weight: 600;
  color: #e10600;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 768px) {
  .hamburger-btn            { display: flex; }
  .ticker-wrap              { display: none; }
  .refresh-info             { display: none; }
  .header-divider           { display: none; }
  .footer                   { display: none; }
  .mobile-support-btn       { display: flex; }
  .columns-wrapper          { height: calc(100vh - var(--header-h)); }
}

@media (max-width: 600px) {
  :root { --col-w: 280px; }
  h1 { font-size: 14px; }
  .season-badge { display: none; }
}
