* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif; }
body { background: #000; color: #eaeaea; }

.cache-notice {
  background: #ff6b35;
  color: #fff;
  padding: 12px;
  margin-bottom: 16px;
  border-radius: 6px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
}

.view-toggle {
  margin: 12px 0;
  text-align: center;
}
.view-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #ccc;
  cursor: pointer;
}
.view-toggle input[type="checkbox"] {
  transform: scale(1.2);
}

#slideshow {
  position: fixed; inset: 0;
  background-size: cover;
  background-position: center center;
  filter: brightness(0.85);
  transition: background-image 0.6s ease-in-out;
}
.overlay {
  position: fixed;
  top: 0;
  right: 0;
  width: 40vw;
  height: 100vh;
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: blur(6px);
  border-left: 1px solid rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column; /* stack header + results */
}

.overlay header {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  background: rgba(10,10,10,0.9);
  z-index: 10;
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.results {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  max-height: calc(100vh - 100px); /* Ensure container has defined height for scrolling */
}

header h1 { margin: 0 0 6px; font-weight: 700; font-size: clamp(20px, 2vw, 28px); }
header .sub { color: #9aa3ad; font-size: 12px; margin-bottom: 12px; }
.update-indicator {
  background: rgba(0, 180, 255, 0.2);
  border: 1px solid rgba(0, 180, 255, 0.4);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 11px;
  color: #00b4ff;
  margin-top: 8px;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
.results .race { margin-bottom: 24px; padding-top: 32px }
.race-header { display: flex; justify-content: space-between; align-items: baseline; }
.race-header h2 { margin: 0; font-size: 18px; }
.race-header .time { font-size: 14px; color: #aaa; }
.race-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
.race-table th, .race-table td { border: 1px solid #444; padding: 6px; text-align: left; }
.column-header {
  display: grid;
  grid-template-columns: 1fr 1fr 3fr 2fr 1.5fr 2fr 1.5fr;
  gap: 8px;
  margin-top: 16px;
  padding: 8px 12px;
  background: rgba(60, 60, 60, 0.3);
  border: 1px solid #555;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #ccc;
}
.column-header div:nth-child(n+4) {
  text-align: end;
}
.highlight { background: rgba(0, 180, 255, 0.2); font-weight: bold; }

.visual {
  margin: 10px 0;
  background: #ffffff;
  padding: 10px;
  border-radius: 4px;
  overflow-x: auto; /* if SVG is wider than container */
}
.visual svg {
  max-width: 100%;
  height: auto;
}


.photo-slideshow {
  position: fixed;
  top: 0; left: 0;
  width: 60vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: 4px;
  background: #000;
  padding: 2px;
}

.photo-slot {
  position: relative;
  overflow: hidden;
}

.photo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0; left: 0;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.photo-slot img.active {
  opacity: 1;
}

/* Optimized for 1366x768 tent display */
@media screen and (width: 1366px) and (height: 768px) {
  header h1 { font-size: 24px; }
  .race-table { font-size: 13px; }
  .race-table th, .race-table td { padding: 5px; }
  .results { padding: 16px; }
}

