:root {
  --bg: #0d0d0f;
  --box: #161618;
  --box2: #1c1c1f;
  --line: #2a2a2e;
  --text: #e4e4e6;
  --dim: #8b8b93;
  --blue: #4aa3ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Verdana, Geneva, sans-serif;
  font-size: 14px;
}

a { color: var(--blue); }

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }

/* header */
header.site {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}
header.site .bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { font-weight: bold; color: var(--text); text-decoration: none; font-size: 16px; }
nav.site { display: flex; align-items: center; gap: 16px; }
nav.site a { color: var(--dim); text-decoration: none; }
nav.site a:hover { color: var(--text); }

/* intro */
.hero { padding: 40px 0 10px; text-align: center; }
.hero h1 { font-size: 24px; margin: 0 0 8px; }
.hero p { color: var(--dim); margin: 0; }

/* game boxes */
.games {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  padding: 30px 0 60px;
}
.game-card {
  display: block;
  width: 240px;
  border: 1px solid var(--line);
  background: var(--box);
  text-decoration: none;
  color: var(--text);
}
.game-card:hover { border-color: var(--blue); }
.game-card .art {
  height: 120px;
  background: #101012;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.game-card .art img { max-width: 80%; max-height: 80%; }
.game-card .meta { padding: 10px 12px; }
.game-card .meta h3 { margin: 0 0 4px; font-size: 14px; }
.game-card .meta .count { color: var(--dim); font-size: 12px; }

/* tables */
.toolbar { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 24px 0 12px; }
.toolbar h2 { font-size: 18px; margin: 0; }
.toolbar .spacer { flex: 1; }
input.search {
  background: var(--box);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 7px 9px;
  font-size: 13px;
  font-family: inherit;
}
input.search:focus { outline: none; border-color: var(--blue); }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 24px;
}
table.data th {
  text-align: center;
  padding: 8px 10px;
  background: var(--box2);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: 12px;
  color: var(--dim);
}
table.data th.no-sort { cursor: default; }
table.data td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}
table.data tr:hover td { background: var(--box); }
td.rank { width: 50px; }
td.time { white-space: nowrap; }
td.ticks { white-space: nowrap; color: var(--dim); }
td.links { white-space: nowrap; }
tr.run.me td { background: rgba(74, 163, 255, 0.08); }
tr.run.me td.player { color: var(--blue); }
.pill {
  font-size: 11px;
  border: 1px solid var(--line);
  padding: 2px 6px;
  margin-right: 5px;
  color: var(--dim);
  text-decoration: none;
  display: inline-block;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.pill:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.pill.demo { color: var(--blue); }
.pill.video { color: var(--blue); }
.pill.pending { color: var(--dim); }
.pill.demo:hover, .pill.video:hover { border-color: var(--blue); color: var(--blue); }

/* Mobile responsive dropdown */
@media (max-width: 600px) {
  .hist-panel {
    min-width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    left: 50%;
    transform: translateX(-50%);
  }
  .hist-panel.open {
    transform: translateX(-50%) translateY(0);
  }
  table.data {
    font-size: 12px;
  }
  table.data th, table.data td {
    padding: 6px 4px;
  }
}

.section-title { margin: 26px 0 8px; font-size: 13px; color: var(--dim); text-align: center; }
.empty { color: var(--dim); padding: 30px 0; text-align: center; }

footer.site {
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 12px;
  padding: 20px 0 40px;
  margin-top: 40px;
}
footer.site .wrap { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }

/* history dropdown */
td.history { white-space: nowrap; text-align: center; }
.hist-dropdown { position: relative; display: inline-block; }
.hist-toggle {
  font-size: 11px;
  border: 1px solid var(--line);
  padding: 2px 6px;
  color: var(--dim);
  background: var(--box);
  cursor: pointer;
}
.hist-toggle:hover { border-color: var(--blue); color: var(--blue); }
.hist-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 320px;
  max-width: 480px;
  background: var(--box2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px;
  z-index: 50;
  text-align: left;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  margin-top: 4px;
  opacity: 0;
  transform: translateX(-50%) translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}
.hist-panel::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid var(--line);
}
.hist-panel.open {
  display: block;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.hist-toggle {
  position: relative;
  z-index: 1;
}
.hist-toggle .arrow {
  display: inline-block;
  transition: transform 0.15s ease;
  font-size: 8px;
  vertical-align: middle;
  margin-left: 2px;
}
.hist-dropdown.open .arrow {
  transform: rotate(180deg);
}
.hist-item {
  display: flex;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  align-items: center;
  flex-wrap: wrap;
}
.hist-item:last-child { border-bottom: none; }
.hist-date { color: var(--dim); white-space: nowrap; }
.hist-time { color: var(--text); font-family: monospace; white-space: nowrap; }
.hist-ticks { color: var(--dim); font-family: monospace; white-space: nowrap; }
.hist-pills { display: flex; gap: 4px; flex-wrap: wrap; }
