:root {
  --bg: #0b0d12;
  --surface: #141822;
  --surface-2: #1c2230;
  --border: #273044;
  --text: #f3f5f8;
  --muted: #9aa6bd;
  --accent: #ff4d2e;
  --accent-hover: #ff6448;
  --warn-bg: #facc15;
  --warn-border: #fde047;
  --warn-text: #111318;
  --expired-bg: rgba(255, 77, 46, 0.16);
  --expired-border: rgba(255, 77, 46, 0.5);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header {
  background: linear-gradient(180deg, #151a26 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  padding: 20px 0 16px;
}

.header-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
}

h1 {
  margin: 0;
  font-size: clamp(1.35rem, 3.8vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.cutoff-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
  font-size: 0.9rem;
  font-weight: 600;
}

.cutoff-banner.expired {
  background: var(--expired-bg);
  border-color: var(--expired-border);
  color: #ff9c8a;
}

.cutoff-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.controls {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 13, 18, 0.94);
  backdrop-filter: blur(10px);
  padding: 14px 0 10px;
  border-bottom: 1px solid rgba(39, 48, 68, 0.6);
}

.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#search-input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
}

#search-input:focus,
#class-select:focus,
#sort-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

#class-select,
#sort-select {
  flex: 0 1 auto;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
}

.meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 0.84rem;
  color: var(--muted);
}

.link-btn {
  background: none;
  border: none;
  color: #8bb4ff;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}

.runs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  padding: 18px 0 28px;
}

.run-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.player-slot {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #06080c;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-slot video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

.watch-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(20, 24, 34, 0.9);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

.watch-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.class-tag {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: #cfd8ea;
  padding: 3px 9px;
  border-radius: 6px;
  font-weight: 700;
}

.run-time {
  color: var(--muted);
  white-space: nowrap;
}

.racer-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  word-break: break-word;
}

.card-actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
  padding-top: 4px;
}

.btn-download {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
}

.btn-download:hover {
  background: var(--accent-hover);
}

.btn-share {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.status-panel {
  margin: 24px 0;
  padding: 28px 18px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 18px 16px 36px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
