@font-face {
  font-family: 'Recursive';
  src: url('../fonts/recursive.woff2') format('woff2');
  font-weight: 100 1000;
  font-style: normal;
  font-display: block;
}

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

:root {
  --bg:          #070709;
  --card-bg:     rgba(15, 15, 20, 0.70);
  --card-border: #2a2a35;
  --cd-bg:       #0f0f14;
  --text-primary:   #e0e0e0;
  --text-secondary: #8f8f9a;
  --text-muted:     #555560;
  --urgent-yellow: #facc15;
  --urgent-red:    #d32f2f;
}

html {
  background-color: var(--bg);
  background-image: radial-gradient(rgba(146, 162, 189, 0.12) 1px, transparent 1px);
  background-size: 24px 24px;
  min-height: 100%;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}
body {
  font-family: 'Recursive';
  color: var(--text-primary);
  padding: 1.25rem clamp(0.5rem, 2vw, 1rem);
}

.page { max-width: min(1280px, 100vw); margin: 0 auto; padding-left: clamp(0.5rem, 2vw, 1rem); padding-right: clamp(0.5rem, 2vw, 1rem); }

/* ── Top bar ── */
.topbar {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 16px;
  margin-bottom: calc(2.5rem - 14px);
}
.site-title {
  font-size: 22px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.8px;
  line-height: 1.1;
  text-align: left;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: calc(1.5rem - 3px);
}
.tab {
  background: #0f0f14;
  border: 0.5px solid #1e1e28;
  border-radius: 3px;
  padding: 8px 16px;
  font-family: 'Recursive';
  font-size: 15px;
  font-weight: 600;
  color: #555560;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  letter-spacing: 0.2px;
}
.tab:hover { color: #999; }
.tab.active                    { background: #1a1a22; border-color: #333340; color: #fff;     border-bottom: 2px dashed #fff;     }
.tab[data-tab="bronze"].active { background: #1a1a22; border-color: #333340; color: #cd7f32; border-bottom: 2px dashed #cd7f32; }
.tab[data-tab="silver"].active { background: #1a1a22; border-color: #333340; color: #94a3b8; border-bottom: 2px dashed #94a3b8; }
.tab[data-tab="gold"].active   { background: #1a1a22; border-color: #333340; color: #e8a800; border-bottom: 2px dashed #e8a800; }

/* ── Timezone picker ── */
.tz-wrapper { position: relative; flex-shrink: 0; margin-top: 4px; }
.tz-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--card-bg); border: 0.5px solid #333;
  border-radius: 4px; padding: 7px 12px;
  font-family: 'Recursive';
  font-size: 12px; color: #d4d4d4; cursor: pointer;
  white-space: nowrap; transition: border-color 0.15s;
}
.tz-btn:hover { border-color: #666; color: #fff; }
.tz-btn svg { width: 13px; height: 13px; fill: #888; flex-shrink: 0; }
.tz-chevron { width: 10px; height: 10px; fill: #666; transition: transform 0.2s; }
.tz-wrapper.open .tz-chevron { transform: rotate(180deg); }
.tz-dropdown {
  display: none; position: absolute; top: calc(100% + 6px); right: 0;
  background: #16161e; border: 0.5px solid #333; border-radius: 5px;
  min-width: 230px; z-index: 200; box-shadow: 0 12px 32px rgba(0,0,0,0.8); overflow: hidden;
}
.tz-wrapper.open .tz-dropdown { display: block; }
.tz-search {
  width: 100%; background: #0f0f14; border: none;
  border-bottom: 0.5px solid #1e1e28; color: #fff;
  font-family: 'Recursive';
  font-size: 12px; padding: 9px 12px; outline: none;
}
.tz-search::placeholder { color: var(--text-muted); }
.tz-list {
  max-height: 220px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: #222 transparent;
}
.tz-list::-webkit-scrollbar { width: 4px; }
.tz-list::-webkit-scrollbar-track { background: transparent; }
.tz-list::-webkit-scrollbar-thumb { background: #222; border-radius: 4px; }
.tz-list::-webkit-scrollbar-thumb:hover { background: #444; }
.tz-option {
  padding: 9px 12px; font-size: 12px; color: #e0e0e0; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.tz-option:hover { background: #1e1e26; color: #fff; }
.tz-option.selected { color: #60a5fa; }
.tz-option .tz-offset { color: #8f8f9a; font-size: 11px; flex-shrink: 0; }
.tz-option.selected .tz-offset { color: #3a5f8a; }

/* ── Topbar right cluster (My DLC + timezone) ── */
.topbar-right { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.topbar-right .tz-wrapper { margin-top: 0; }
.tz-current-time {
  font-size: 12px;
  color: #555560;
  font-variant-numeric: tabular-nums;
  font-variation-settings: 'MONO' 1;
  white-space: nowrap;
}

/* ── My DLC dropdown ── */
#mydlc-dropdown { min-width: 180px; max-width: calc(100vw - 2rem); left: auto; right: 0; max-height: 70vh; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: #222 transparent;
}
#mydlc-dropdown::-webkit-scrollbar { width: 4px; }
#mydlc-dropdown::-webkit-scrollbar-track { background: transparent; }
#mydlc-dropdown::-webkit-scrollbar-thumb { background: #222; border-radius: 4px; }
.mydlc-group-label {
  font-size: 10px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.6px; padding: 10px 12px 4px; font-weight: 700;
}
.mydlc-row {
  display: flex; gap: 8px; padding: 7px 12px; cursor: pointer;
  align-items: center;
  border-top: 0.5px solid #1e1e28;
}
.mydlc-row:first-of-type { border-top: none; }
.mydlc-row:hover { background: #1e1e26; }
.mydlc-row input { margin: 0; accent-color: #60a5fa; flex-shrink: 0; cursor: pointer; }
.mydlc-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.mydlc-row-name { font-size: 12px; color: #e0e0e0; font-weight: 600; }
.mydlc-row.owned .mydlc-row-name { color: #60a5fa; }

/* ── Status bar ── */
.status {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 12px;
  margin-bottom: 1.5rem;
}
.status-row { display: flex; align-items: center; gap: 6px; }
.status-row + .status-row { padding-left: 13px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; }
.dot.live   { background: #4ade80; box-shadow: 0 0 6px #4ade80; }
.dot.error  { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
.status-label { color: #555560; }
.status-value { color: #555560; }

/* ── Cards grid ── */
.cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: calc(3rem - 14px);
}
@media (max-width: 1280px) { .cards { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px)  { .cards { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 580px)  { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .cards { grid-template-columns: 1fr; max-width: 280px; margin-left: auto; margin-right: auto; } }
@media (max-width: 380px)  { .cards { grid-template-columns: 1fr; max-width: 260px; margin-left: auto; margin-right: auto; } }

/* ── Card ── */
.card {
  position: relative;
  background: var(--card-bg);
  border: 0.5px solid var(--card-border);
  border-radius: 3px; overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.card.urgent {
  border: 0.5px solid var(--urgent-yellow);
  box-shadow: 0 0 0 0.5px var(--urgent-yellow);
}
.card.urgent-red {
  border: 0.5px solid var(--urgent-red);
  box-shadow: 0 0 0 0.5px var(--urgent-red);
}

/* ── Tooltip session-format rows (reused by duration breakdown tooltip) ── */
.format-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 14px; color: #e0e0e0;
}
.format-row .fmt-label { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.format-row .fmt-val { font-variant-numeric: tabular-nums; }

/* ── Slot chips (reused by upcoming-slots tooltip) ── */
.slot-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.slot-chip {
  background: var(--cd-bg);
  border: 0.5px solid var(--card-border);
  border-radius: 3px;
  padding: 4px 6px;
  font-size: 12px; font-weight: 600;
  color: #e0e0e0;
  font-variant-numeric: tabular-nums;
  font-variation-settings: 'MONO' 1;
  text-align: center;
}

.card-header { padding: 12px 16px 10px; border-bottom: 0.5px solid var(--card-border); }

/* ── Tier badge ── */
.tier-badge {
  display: inline-flex; align-items: center; justify-content: center;
  height: 18px; box-sizing: border-box;
  font-size: 10px; font-weight: 500;
  padding: 0 8px; border-radius: 2px;
  letter-spacing: 0.6px; text-transform: uppercase; margin-bottom: 7px;
  line-height: 1;
}
.tier-bronze { background: #1e1000; color: #cd7f32; border: 1px dashed currentColor; }
.tier-silver { background: #141820; color: #94a3b8; border: 1px dashed currentColor; }
.tier-gold   { background: #1a1500; color: #e8a800; border: 1px dashed currentColor; }
.tier-       { background: #1a1a1a; color: #666;    border: 1px dashed currentColor; }

/* DLC badge — same shape as tier-badge, color reflects ownership state */
.dlc-grey, .dlc-blue, .dlc-green {
  display: inline-flex; align-items: center; justify-content: center;
  height: 18px; box-sizing: border-box;
  font-size: 10px; font-weight: 500;
  padding: 0 8px; border-radius: 2px;
  letter-spacing: 0.6px; text-transform: uppercase;
  margin-bottom: 7px; margin-left: 6px;
  line-height: 1;
  cursor: default; user-select: none;
  transition: color 0.25s, background 0.25s, border-color 0.25s;
}
.dlc-grey  { background: #141414; color: #666;    border: 0.5px solid #333;    }
.dlc-blue  { background: #142438; color: #bae6fd; border: 0.5px solid #2a6090; }
.dlc-green { background: #102a18; color: #bbf7d0; border: 0.5px solid #247a40; }

/* Race name */
.race-name { font-size: 20px; font-weight: 700; color: #fff; line-height: 1.3; min-height: 2.6em; white-space: pre-line; }
.class-row {
  display: flex; gap: 3.75px 5px; flex-wrap: wrap;
  margin-top: 7px; margin-bottom: 9px;
  align-items: center; align-content: flex-start;
}
.row-break { flex-basis: 100%; height: 0; }
.class-row .tier-badge,
.class-row .dlc-grey,
.class-row .dlc-blue,
.class-row .dlc-green { margin: 0; }

.pill {
  position: relative;
  height: 18px; box-sizing: border-box;
  font-size: 10px; font-weight: 500; padding: 0 9px;
  border-radius: 2px; letter-spacing: 0.6px;
  text-transform: uppercase;
  line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: default; user-select: none;
}
.pill-lmgt3    { background: #0c1e3a; color: #60a5fa; border: 0.5px solid #1e3a5f; }
.pill-hypercar { background: #2e0e0e; color: #f87171; border: 0.5px solid #5f1e1e; }
.pill-lmp2     { background: #1a2e10; color: #86efac; border: 0.5px solid #2e5f1e; }
.pill-lmp3     { background: #2a1a2e; color: #c084fc; border: 0.5px solid #4a2e5e; }
.pill-gte      { background: #0a2429; color: #67e8f9; border: 0.5px solid #155e75; }

.card-body {
  padding: 12px 12px; display: flex;
  flex-direction: column; gap: 12px; flex: 1;
}
.field { display: flex; flex-direction: column; gap: 3px; }
.field-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; color: #8f8f9a; font-weight: 400; }
.field-value { font-size: 18px; font-weight: 500; color: #e0e0e0; line-height: 1.4; font-variation-settings: 'MONO' 1; }
.fmt-info-icon,
.slots-info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px; height: 13px;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: #8f8f9a;
  font-size: 8px;
  font-weight: 600;
  font-style: italic;
  line-height: 1;
  margin-left: 5px;
  cursor: default;
  user-select: none;
  vertical-align: middle;
  text-transform: lowercase;
}
.field-value.track-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
          line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* Countdown */
.countdown-row { display: flex; gap: 6px; margin-top: 2px; }
.cd-block {
  background: #0f0f14;
  border: 0.5px solid var(--card-border);
  border-radius: 2px;
  padding: 7px 10px;
  text-align: center;
  min-width: 0; flex: 0 0 auto;
}
.cd-num {
  font-size: 18px; font-weight: 500; color: #e0e0e0;
  font-variant-numeric: tabular-nums; letter-spacing: -0.5px;
  font-variation-settings: 'MONO' 1;
  display: block;
}
.cd-lbl { font-size: 8px; color: #e0e0e0; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 1px; display: block; }

/* ── Global tooltip ── */
#global-tooltip {
  display: none; position: fixed; z-index: 9999;
  background: #16161e; border: 0.5px solid #333340;
  border-radius: 3px; padding: 12px 14px; min-width: 165px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.8); pointer-events: none;
}
#global-tooltip.visible { display: block; }
.tooltip-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: #8f8f9a; margin-bottom: 8px; }
.tooltip-car {
  font-size: 13px; color: #ffffff; padding: 4px 0;
  border-bottom: 0.5px solid #1e1e28;
  display: flex; align-items: center; gap: 8px;
}
.tooltip-car:last-child { border-bottom: none; padding-bottom: 0; }
.tooltip-car::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; opacity: 0.6; }
#global-tooltip::after  { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 7px solid transparent; border-top-color: #333340; }
#global-tooltip::before { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: #16161e; z-index: 1; }
#global-tooltip.below::after  { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: #333340; }
#global-tooltip.below::before { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: #16161e; }
/* Compact tier tooltip — shows only the tier name, colored to match the pill */
#global-tooltip.tier-tip { min-width: 0; padding: 6px 10px; }
/* Compact pack-contents tooltip (My DLCs dropdown) — narrow baseline,
   but each content line stays on one line; tooltip expands as needed. */
#global-tooltip.pack-tip { min-width: 99px; }
#global-tooltip.pack-tip .tooltip-car { white-space: nowrap; }
#global-tooltip.tier-tip .tooltip-title { margin-bottom: 0; font-size: 11px; letter-spacing: 0.4px; }
#global-tooltip.tier-tip-bronze .tooltip-title { color: #cd7f32; }
#global-tooltip.tier-tip-silver .tooltip-title { color: #94a3b8; }
#global-tooltip.tier-tip-gold   .tooltip-title { color: #e8a800; }

/* ── Skeleton ── */
.skeleton { background: #16161e; border-radius: 3px; animation: pulse 1.4s ease-in-out infinite; }
.skeleton-line { height: 13px; margin: 7px 16px; }
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w40 { width: 40%; }
.skeleton-line.w80 { width: 80%; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.25} }

.empty-state { color: var(--text-muted); font-size: 14px; padding: 2rem 0; }

.page-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.footer { display: flex; flex-direction: column; gap: 3px; text-align: right; font-size: 12px; color: #555560; margin: 0; }
.footer a { color: #555560; text-decoration: none; }
.footer a:hover { color: #8f8f9a; }

.tab-short { display: none; }
.tab-full { display: inline; }

@media (max-width: 580px) {
  .tab { padding: 6px 10px; font-size: 13px; }
  .tab-short { display: inline; }
  .tab-full { display: none; }
  .page-foot { flex-direction: column; align-items: center; gap: 8px; }
  .status { align-items: center; text-align: center; }
  .status-row { display: block; padding-left: 0 !important; }
  .status-row .dot { display: inline-block; vertical-align: middle; margin-right: 4px; }
  .footer { text-align: center; }
  .footer div { display: block; }
}
