:root {
  --bg: #0e1014;
  --panel: #171a21;
  --cell: #1f232c;
  --line: #2a2f3a;
  --text: #e8e9ec;
  --muted: #8b93a3;
  --accent: #e8912d;
  --mine: #5cc8ff;
  --all: #2fbf71;
  --clash: #ff6b6b;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--mine); }
[hidden] { display: none !important; }

.top, main {
  max-width: 980px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 18px;
  padding-bottom: 8px;
}

h1 { font-size: 22px; margin: 0; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 26px 0 10px; }
main { padding-bottom: 80px; }

.account { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.me-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 4px; }
.link:hover { color: var(--text); }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--line); display: grid; place-items: center;
  font-weight: 600; font-size: 14px; object-fit: cover;
}

/* login */
.login { text-align: center; padding: 70px 0; color: var(--muted); }
.steam-btn {
  display: inline-block; margin-top: 14px; padding: 12px 22px; border-radius: 6px;
  background: linear-gradient(#2a475e, #1b2838); color: #fff; text-decoration: none;
  font-weight: 600; border: 1px solid #3d6c8d;
}
.steam-btn:hover { background: linear-gradient(#335a77, #213246); }

/* players */
.players { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.player {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
}
.player.you { border-color: var(--mine); }
.player.pending { opacity: .55; }
.avoid-btn {
  margin-left: 4px; padding: 3px 9px; border-radius: 999px; cursor: pointer;
  background: none; border: 1px solid var(--line); color: var(--muted); font: inherit; font-size: 12px;
}
.avoid-btn:hover { color: var(--text); border-color: var(--muted); }
.avoid-btn.on { color: var(--clash); border-color: var(--clash); }
.conflicts { margin-top: 10px; font-size: 13px; color: var(--muted); display: grid; gap: 2px; }
.conflicts .clash-line::before { content: "🚫 "; }
.detail .warn { color: var(--clash); }
.cell.clash::after {
  content: ""; position: absolute; top: 3px; right: 3px; width: 5px; height: 5px;
  border-radius: 50%; background: var(--clash);
}
.player-name { font-size: 14px; font-weight: 600; }
.player-sub { font-size: 12px; color: var(--muted); }

/* best times */
.best { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.best-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 10px; text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); color: var(--text); font: inherit;
}
.best-item:hover { border-color: var(--muted); }
.best-item.all { border-color: var(--all); background: color-mix(in srgb, var(--all) 12%, var(--panel)); }
.best-day { font-size: 13px; color: var(--muted); }
.best-time { font-size: 18px; font-weight: 700; }
.best-who { text-align: right; min-width: 0; }
.best-count { font-weight: 700; color: var(--accent); }
.best-item.all .best-count { color: var(--all); }
.best-names { font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); margin: 0; }

/* grid */
.hint { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.status { color: var(--text); margin-left: 6px; }
.grid-wrap { overflow-x: auto; padding-bottom: 4px; }
.grid {
  display: grid;
  grid-template-columns: 44px repeat(7, minmax(38px, 1fr));
  gap: 3px;
  min-width: 330px;
  user-select: none;
  -webkit-user-select: none;
}
.dayhead { text-align: center; color: var(--muted); padding-bottom: 4px; display: flex; flex-direction: column; line-height: 1.2; }
.dayhead .dow { font-size: 12px; }
.dayhead .dom { font-size: 15px; font-weight: 600; }
.dayhead.today { color: var(--accent); }
.hour { font-size: 11px; color: var(--muted); text-align: right; padding-right: 4px; align-self: center; font-variant-numeric: tabular-nums; }
.hour.midnight { color: var(--text); }
.midnight { margin-top: 6px; }

.cell {
  position: relative;
  height: 30px; border-radius: 5px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, .9);
  background: color-mix(in srgb, var(--accent) calc(var(--n, 0) * 80%), var(--cell));
  transition: background-color .12s;
}
.cell:hover { filter: brightness(1.2); }
.cell.mine { box-shadow: inset 0 0 0 2px var(--mine); }
.cell.all { background: var(--all); }
.cell.hl { outline: 2px solid #fff; outline-offset: 1px; }
.cell.past { opacity: .2; cursor: default; filter: none; }

.detail {
  position: sticky; bottom: 0; margin-top: 12px; padding: 12px 14px; font-size: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
.detail .free { color: var(--text); }
.muted { color: var(--muted); }

/* server-rendered message pages */
.message { max-width: 560px; padding-top: 60px; }
.message code { background: var(--panel); padding: 2px 6px; border-radius: 4px; }
