:root {
  --bg:           #080808;
  --bg-alt:       #0e0e0e;
  --text:         #c8c8c8;
  --muted:        #555;
  --heading:      #f0f0f0;
  --accent:       #00e87a;
  --accent-dim:   rgba(0, 232, 122, 0.12);
  --accent-border:rgba(0, 232, 122, 0.25);
  --border:       rgba(255, 255, 255, 0.07);
  --shadow:       0 0 0 1px rgba(255,255,255,0.04), 0 4px 24px rgba(0,0,0,0.6);
  --error:        #ff6b6b;
  --error-dim:    rgba(255, 107, 107, 0.14);

  --mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;

  font: 16px/1.6 var(--sans);
  color: var(--text);
  background: var(--bg);
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }

#app {
  width: 720px;
  max-width: 100%;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

h1, h2, h3 { font-family: var(--mono); color: var(--heading); line-height: 1.15; margin: 0 0 0.5em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.accent { color: var(--accent); }
.muted { color: var(--muted); font-size: 0.85em; }

header { text-align: center; margin-bottom: 28px; }
header .brand { font-family: var(--mono); font-size: 1.6em; font-weight: 700; color: var(--heading); }
header .tagline { color: var(--muted); font-size: 0.95em; margin-top: 4px; }

footer { text-align: center; margin-top: 40px; }
footer a { color: var(--muted); text-decoration: underline; }

.card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.center { text-align: center; }

button, .btn {
  font: inherit;
  font-family: var(--mono);
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  display: inline-block;
}
button:hover, .btn:hover { background: rgba(0, 232, 122, 0.2); text-decoration: none; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.secondary { background: transparent; color: var(--text); border-color: var(--border); }
button.secondary:hover { border-color: var(--muted); background: rgba(255,255,255,0.04); }

input[type="text"], select {
  font: inherit;
  font-family: var(--mono);
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
}
input[type="text"]:focus, select:focus { outline: none; border-color: var(--accent-border); }

.playlist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 400px; overflow-y: auto; }
.playlist-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent;
}
.playlist-row:hover { background: var(--accent-dim); border-color: var(--accent-border); }
.playlist-row img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--border); }
.playlist-row .name { flex: 1; font-weight: 600; color: var(--heading); }
.playlist-row .count { color: var(--muted); font-size: 0.85em; }

.session-code {
  font-family: var(--mono);
  font-size: 2.2em;
  letter-spacing: 0.15em;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
}

/* Bingo card grid */
.bingo-grid {
  display: grid;
  gap: 3px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.bingo-square {
  background: var(--bg-alt);
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px;
  font-size: 0.72em;
  line-height: 1.25;
  color: var(--text);
  position: relative;
  overflow: hidden;
}
.bingo-square.free { background: var(--accent-dim); color: var(--accent); font-weight: 700; }
.bingo-square.marked { background: var(--accent-dim); box-shadow: inset 0 0 0 2px var(--accent); color: var(--heading); }
.bingo-square img.cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.85; }

/* Full-width gradient strip anchored to the bottom, not a floating pill
   — a fixed-opacity pill reads fine on a dark cover but disappears
   against a busy/light one. A gradient that goes fully opaque at the
   very bottom guarantees contrast regardless of what's under it. */
.bingo-square .label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 1;
  padding: 14px 6px 6px;
  background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.85) 55%, rgba(0,0,0,0.92));
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
.bingo-square:not(:has(img.cover)) .label {
  position: static;
  background: none;
  padding: 0;
  text-shadow: none;
  color: inherit;
}

.facet-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  font-size: 0.85em;
  line-height: 1;
}
.facet-badge.facet-title { background: var(--accent-dim); color: var(--accent); }
.facet-badge.facet-artist { background: rgba(255, 200, 0, 0.15); color: #ffc800; }
.bingo-square .facet-badge {
  position: absolute; top: 4px; left: 4px; z-index: 2;
  box-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.card-legend { font-size: 0.8em; margin-bottom: 10px; }
.card-legend .facet-badge { vertical-align: -3px; margin: 0 2px; }

.bingo-square.tappable { cursor: pointer; }
.bingo-square.tappable:hover { outline: 1px solid var(--accent-border); outline-offset: -1px; }

.bingo-square.marked::after {
  content: '✓';
  position: absolute; top: 4px; right: 4px; z-index: 2;
  color: #fff; font-weight: 700;
  background: var(--accent);
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75em;
  box-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.bingo-banner {
  text-align: center; padding: 16px; margin-top: 12px;
  background: var(--accent-dim); border: 1px solid var(--accent-border);
  border-radius: 8px; color: var(--accent); font-family: var(--mono); font-weight: 700;
  font-size: 1.3em;
}

/* Caller screen */
.caller-now {
  text-align: center;
  padding: 32px 16px;
}
.caller-now .track-title { font-size: 1.8em; font-weight: 700; color: var(--heading); }
.caller-now .track-artist { color: var(--muted); margin-top: 4px; }
.caller-now img { width: 160px; height: 160px; border-radius: 10px; margin: 0 auto 16px; display: block; box-shadow: var(--shadow); }

.called-history { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.called-chip {
  font-size: 0.75em; padding: 4px 8px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border); color: var(--muted);
}

.error-box {
  background: var(--error-dim); border: 1px solid var(--error);
  color: var(--error); border-radius: 8px; padding: 12px 14px; font-size: 0.9em;
}

.toggle-row { display: flex; align-items: center; gap: 8px; }

@media (max-width: 480px) {
  .bingo-square { font-size: 0.62em; }
}
