:root {
  --bg: #0b0f14;
  --panel: rgba(12, 17, 23, 0.85);
  --border: rgba(255, 255, 255, 0.12);
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #6ee7b7;
  --twitch: #9146ff;
  --danger: #f87171;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  overflow: hidden;
  user-select: none;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 0;
  transition: filter 0.25s ease, transform 0.25s ease;
}

/* NCNC mirroring: the handicap the streamer plays under is applied here too. */
#map.ncnc-greyscale {
  filter: grayscale(1);
}
#map.ncnc-sepia {
  filter: sepia(1);
}
#map.ncnc-greyscale.ncnc-sepia {
  filter: grayscale(1) sepia(1);
}
#map.ncnc-upsidedown {
  transform: rotate(180deg);
}

#scanlines {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  display: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.25) 0px,
    rgba(0, 0, 0, 0.25) 1px,
    transparent 1px,
    transparent 3px
  );
}
#scanlines.on {
  display: block;
}

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 3px #000;
}

.brand small {
  display: block;
  font-weight: 400;
  color: var(--muted);
}

.spacer {
  flex: 1;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  backdrop-filter: blur(6px);
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.pill.live {
  color: var(--accent);
  border-color: rgba(110, 231, 183, 0.4);
}

.pill.closed {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.4);
}

.dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

button {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

button:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.3);
}

button.twitch {
  background: var(--twitch);
  border-color: transparent;
  font-weight: 600;
}

.user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user img {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 2px solid var(--color, var(--accent));
}

.user .name {
  font-weight: 600;
  text-shadow: 0 1px 3px #000;
}

input[type='color'] {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: none;
  cursor: pointer;
}

.bottombar {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: min(28rem, calc(100% - 1.5rem));
  padding: 0 0 0.9rem;
}

#guess {
  width: 100%;
  padding: 0.9rem;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #06231a;
  background: var(--accent);
  border: none;
  border-radius: 0.9rem;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.5);
  transition: transform 0.1s ease;
}

#guess:disabled {
  background: rgba(255, 255, 255, 0.14);
  color: var(--muted);
  cursor: not-allowed;
}

#guess:active:not(:disabled) {
  transform: scale(0.97);
}

.hint {
  margin-top: 0.4rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  text-shadow: 0 1px 3px #000;
}

#toast {
  position: absolute;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  padding: 0.6rem 1rem;
  border-radius: 0.6rem;
  border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(6px);
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
}

#toast.show {
  opacity: 1;
}

#toast.error {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.4);
}

.leaflet-container {
  background: #0b0f14;
}
