@font-face {
  font-family: "JetBrains Mono";
  src: local("JetBrains Mono"), url("../fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: local("JetBrains Mono Bold"), url("../fonts/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #0e0e14;
  --fg: #a9b1d6;
  --fg-dim: #565f89;
  --fg-bright: #c0caf5;
  --accent: #7aa2f7;
  --hot: #e0af68;
  --live: #9ece6a;
  --quiet: #bb9af7;
  --warm: #ff9e64;
  --panel: #13141c;
  --line: #292e42;
  --error: #f7768e;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.5 "JetBrains Mono", ui-monospace, monospace;
  overflow: hidden;
}

.stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

canvas {
  image-rendering: pixelated;
  cursor: grab;
  touch-action: none;
  outline: none;
}
canvas.dragging { cursor: grabbing; }

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgb(0 0 0 / 0.14) 2px 3px);
}

.hud {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: end;
  justify-content: space-between;
  padding: 28px 20px 16px;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgb(from var(--bg) r g b / 0.85) 55%);
}
.hud > * { pointer-events: auto; }

.stats b, #total, #cities { color: var(--fg-bright); font-weight: 700; }
.nowrap { white-space: nowrap; }
.hint { color: var(--fg-dim); margin-left: 12px; }

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  background: var(--hot);
  vertical-align: 1px;
  animation: blink 1.4s steps(2, jump-none) infinite;
}
.dot.live { background: var(--live); }
.dot.quiet { background: var(--quiet); animation-duration: 3s; }
@keyframes blink { 50% { opacity: 0.25; } }

.btn, .link {
  font: inherit;
  color: var(--fg-bright);
  background: none;
  border: 0;
  padding: 4px 0;
  cursor: pointer;
}
.btn:hover, .btn:focus-visible { color: var(--hot); outline: none; }
.btn.primary { color: var(--accent); }
.link { color: var(--fg-dim); text-decoration: underline dotted; margin-left: 10px; padding: 0; }
.link:hover, .link:focus-visible { color: var(--fg-bright); outline: none; }

.panel {
  width: min(440px, calc(100vw - 32px));
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 20px 22px;
  box-shadow: 6px 6px 0 rgb(0 0 0 / 0.5);
}
.panel::backdrop { background: rgb(14 14 20 / 0.55); }
.panel h2 { margin: 0 0 8px; font-size: 14px; color: var(--fg-bright); }
.panel .fine { margin: 0 0 16px; color: var(--fg-dim); }

@media (max-width: 560px) {
  .hint { display: none; }
  .hud { padding: 12px 16px; }
}

canvas.pointing { cursor: pointer; }

.share { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; justify-content: flex-end; }
.share .link { margin: 0; text-decoration: none; }
.share .link:hover, .share .link:focus-visible { text-decoration: underline dotted; }
.meetups-btn { color: var(--live); }
#share-open.on { color: var(--live); }

.zoom {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.zoom .btn { padding: 6px 4px; }

.tip {
  position: fixed;
  z-index: 5;
  max-width: 280px;
  padding: 6px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--fg-bright);
  pointer-events: none;
  box-shadow: 4px 4px 0 rgb(0 0 0 / 0.5);
}
.tip .more { color: var(--fg-dim); }

.card {
  position: fixed;
  z-index: 4;
  top: 16px;
  right: 56px;
  width: min(340px, calc(100vw - 32px));
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 14px 16px;
  box-shadow: 6px 6px 0 rgb(0 0 0 / 0.5);
}
.card .close { float: right; margin: 0 0 6px 10px; }
.event + .event, .place + .event { border-top: 1px dashed var(--line); margin-top: 14px; padding-top: 14px; }
.event img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; margin: 6px 0 10px; image-rendering: auto; }
.event h3, .place h3 { margin: 4px 0; font-size: 14px; color: var(--fg-bright); overflow-wrap: anywhere; }
.event p, .place p { margin: 4px 0; }
.event .when { color: var(--fg); }
.event .where { color: var(--fg); }
.event .meta, .place .meta { color: var(--fg-dim); }
.event .tag { color: var(--live); font-weight: 700; }
.event.past .tag { color: var(--fg-dim); }
.event .btn { display: inline-block; margin-top: 8px; text-decoration: none; white-space: nowrap; }

.panel.list { width: min(560px, calc(100vw - 32px)); max-height: min(720px, calc(100vh - 48px)); }
.panel.list header { display: flex; justify-content: space-between; align-items: baseline; }
.panel.list a { color: var(--accent); }
.panel.list h3 { font-size: 13px; color: var(--live); margin: 14px 0 6px; }
.panel.list summary { cursor: pointer; color: var(--fg-dim); margin: 14px 0 6px; }
.panel.list ul { list-style: none; margin: 0; padding: 0; }
.panel.list li button {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  width: 100%;
  font: inherit;
  text-align: left;
  color: var(--fg);
  background: none;
  border: 0;
  padding: 5px 4px;
  cursor: pointer;
}
.panel.list li button:hover, .panel.list li button:focus-visible { background: var(--line); color: var(--fg-bright); outline: none; }
.panel.list .date { color: var(--hot); }
.panel.list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel.list .city { color: var(--fg-dim); }

@media (max-width: 560px) {
  .card { top: auto; bottom: 90px; right: 16px; max-height: 55vh; }
  .event img { aspect-ratio: 2; }
  .panel.list .city { display: none; }
  .panel.list li button { grid-template-columns: 52px 1fr; }
}

.theme {
  position: fixed;
  top: 12px;
  left: 16px;
  z-index: 3;
  color: var(--fg-dim);
}
.theme select {
  font: inherit;
  color: var(--fg-bright);
  background: var(--bg);
  border: 0;
  border-bottom: 1px dotted var(--fg-dim);
  padding: 2px 0;
  cursor: pointer;
}
.theme select:focus-visible { outline: 1px solid var(--accent); }

.panel.list .prose { list-style: square; padding-left: 18px; }
.panel.list .prose li { margin: 4px 0; }
.panel.list.wide { width: min(720px, calc(100vw - 32px)); }
.command { position: relative; background: var(--bg); border: 1px solid var(--line); padding: 10px 12px; margin: 12px 0; }
.command pre { margin: 0; padding-right: 72px; font: inherit; font-size: 12px; color: var(--fg-bright); white-space: pre-wrap; overflow-wrap: anywhere; }
.command .btn { position: absolute; top: 6px; right: 10px; }
@media (max-width: 560px) {
  .theme { position: static; width: 100%; }
}

.waves { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.wave {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  cursor: pointer;
}
.wave:hover, .wave:focus-visible { border-color: var(--hot); outline: none; transform: translateY(-2px); }
.wave:active { transform: translateY(1px); }
.place [hidden] { display: none; }
.place .here { margin-top: 6px; }
.place .here .link { display: block; margin: 4px 0; color: var(--live); text-align: left; overflow-wrap: anywhere; }

.days-wrap { overflow-x: auto; padding-bottom: 4px; }
.days {
  --cell: 10px;
  display: grid;
  grid-template-columns: 28px repeat(var(--weeks), var(--cell));
  grid-template-rows: 14px repeat(7, var(--cell));
  gap: 2px;
  width: max-content;
}
.days i { width: var(--cell); height: var(--cell); }
.days .weekday, .days .month { font-size: 10px; line-height: var(--cell); color: var(--fg-dim); white-space: nowrap; }
.days .month { line-height: 14px; }
#history .l0 { background: var(--line); }
#history .l1 { background: color-mix(in srgb, var(--quiet) 45%, var(--panel)); }
#history .l2 { background: var(--quiet); }
#history .l3 { background: var(--warm); }
#history .l4 { background: var(--hot); }
.days-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; margin: 6px 0 12px; }
#history .detail { margin: 0; color: var(--fg); }
#history .legend { display: flex; align-items: center; gap: 3px; margin: 0; color: var(--fg-dim); font-size: 11px; }
#history .legend i { display: inline-block; width: 10px; height: 10px; }

.toast {
  position: fixed;
  z-index: 6;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 6px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 4px 4px 0 rgb(0 0 0 / 0.5);
  color: var(--fg-bright);
  white-space: nowrap;
}
.toast .btn { margin-left: 10px; }
@media (max-width: 560px) {
  .toast { top: 92px; }
}
