:root {
  --bg: #101014;
  --bg-elevated: #17171d;
  --border: #2a2a33;
  --text: #f2f1f6;
  --text-dim: #9998a8;
  --accent: #ff3d5a;

  --score-0: #3a3f4b;
  --score-1: #2f6f8f;
  --score-2: #d6a92c;
  --score-3: #ff7a1a;
  --score-4: #ff2d4d;

  --now-color: #38e0e0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #191119 0%, var(--bg) 100%);
  padding: 24px clamp(16px, 4vw, 40px);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: space-between;
  align-items: flex-end;
}

.title-block h1 {
  margin: 0 0 6px 0;
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
  max-width: 520px;
}

.legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-dim);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: opacity 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.legend-item:hover {
  border-color: var(--band-color, #45455a);
  transform: translateY(-1px);
}

.legend-item.inactive {
  opacity: 0.35;
}

.legend-item.inactive:hover {
  opacity: 0.6;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}

.page-top {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.page-top .day-tabs,
.page-top .legend {
  padding-left: clamp(16px, 4vw, 40px);
  padding-right: clamp(16px, 4vw, 40px);
}

.day-tabs {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  padding-bottom: 8px;
}

.legend {
  padding-top: 0;
  padding-bottom: 12px;
}

.day-tab {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.day-tab:hover { color: var(--text); border-color: #45455a; }

.day-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.howto-banner {
  padding: 14px clamp(16px, 4vw, 40px);
  max-width: 900px;
}

.howto-banner p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.5;
}

main {
  padding: 0 clamp(16px, 4vw, 40px) 60px;
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
}

.ranking-panel, .schedule-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  min-width: 0;
}

.ranking-panel h2, .schedule-panel h2 {
  margin: 0 0 4px 0;
  font-size: 17px;
}

.panel-hint {
  margin: 0 0 14px 0;
  color: var(--text-dim);
  font-size: 12.5px;
}

.ranking-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rank-empty {
  color: var(--text-dim);
  font-size: 13px;
  padding: 16px 10px;
  text-align: center;
}

.rank-item {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.1s ease;
}

.rank-item:hover {
  border-color: #45455a;
  transform: translateX(2px);
}

.rank-pos {
  color: var(--text-dim);
  font-weight: 700;
  font-size: 12px;
}

.rank-info { min-width: 0; }

.rank-name {
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-meta {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-score {
  font-weight: 800;
  font-size: 14px;
  padding: 3px 9px;
  border-radius: 999px;
  color: #101014;
  min-width: 34px;
  text-align: center;
}

.rank-signal {
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--now-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.act-block-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 13px;
  height: 13px;
  line-height: 13px;
  font-size: 9px;
  text-align: center;
  border-radius: 50%;
  background: rgba(8, 8, 11, 0.55);
  pointer-events: none;
}

.schedule-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.schedule-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.schedule-scroll::-webkit-scrollbar {
  display: none;
}

.now-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--now-color);
  z-index: 8;
  pointer-events: none;
  display: none;
}

.now-line-dot {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--now-color);
  box-shadow: 0 0 0 4px rgba(56, 224, 224, 0.25);
}

.now-line-label {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: var(--now-color);
  color: #06222a;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
}

.scroll-indicator {
  position: relative;
  height: 8px;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
}

.scroll-indicator-thumb {
  position: absolute;
  top: -1px;
  bottom: -1px;
  min-width: 24px;
  border-radius: 999px;
  background: var(--accent);
  transition: left 0.05s linear;
  pointer-events: none;
}

.scroll-indicator-label {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}

.schedule-grid {
  display: grid;
  grid-template-columns: 90px 1fr;
  row-gap: 6px;
  min-width: 1500px;
}

.time-axis {
  display: contents;
}

.time-axis-spacer { }

.time-axis-track {
  position: relative;
  height: 22px;
  font-size: 10px;
  color: var(--text-dim);
}

.time-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  border-left: 1px solid var(--border);
  padding-left: 4px;
  height: 100%;
}

.stage-row {
  display: contents;
}

.stage-label {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-dim);
  padding-right: 8px;
  position: sticky;
  left: 0;
  background: var(--bg-elevated);
}

.stage-track {
  position: relative;
  height: 46px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.act-block {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 0 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: #0c0c10;
  white-space: nowrap;
  text-overflow: ellipsis;
  border: 1px solid rgba(0,0,0,0.15);
  transition: filter 0.1s ease, transform 0.1s ease;
}

.act-block:hover {
  filter: brightness(1.15);
  transform: scale(1.02);
  z-index: 5;
}

.act-block.dimmed {
  opacity: 0.12;
  pointer-events: none;
}

.tooltip {
  position: fixed;
  z-index: 50;
  max-width: 260px;
  background: #1e1e26;
  border: 1px solid #34343f;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.tooltip.visible { opacity: 1; }

.tt-title {
  font-weight: 800;
  font-size: 13.5px;
  margin-bottom: 2px;
}

.tt-meta {
  color: var(--text-dim);
  margin-bottom: 6px;
}

.tt-score {
  display: inline-block;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  color: #101014;
  margin-bottom: 6px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(8, 8, 11, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: #1a1a20;
  border: 1px solid #34343f;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(8px);
  transition: transform 0.15s ease;
}

.modal-overlay.visible .modal-card {
  transform: translateY(0);
}

.modal-card .tt-title {
  font-size: 18px;
  padding-right: 24px;
}

.modal-card .tt-meta {
  font-size: 13px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
  border-color: #45455a;
}

.modal-reasoning {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 4px 0 18px;
}

.modal-disclaimer {
  margin: 16px 0 0;
  font-size: 10.5px;
  color: var(--text-dim);
  text-align: center;
}

.vote-section {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 14px;
}

.vote-section:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.vote-question {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.vote-hint {
  font-size: 12px;
  color: var(--text-dim);
}

.vote-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.vote-btn {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  padding: 9px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.vote-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.vote-chosen {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.vote-result {
  display: block;
  font-size: 11.5px;
  color: var(--text-dim);
}

.vote-result-muted {
  opacity: 0.7;
}

footer {
  padding: 20px clamp(16px, 4vw, 40px) 50px;
  color: var(--text-dim);
  font-size: 11.5px;
  line-height: 1.5;
}

footer a { color: var(--text-dim); }
