:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --ink: #141414;
  --muted: #6b6b6b;
  --border: #e4e4e0;
  --accent: #0f766e;
  --accent-soft: #e6f4f2;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --warn: #c2410c;
  --radius: 10px;
  --font: "Montserrat", system-ui, sans-serif;
  --display: "Montserrat", system-ui, sans-serif;
  --card-font: "Montserrat", system-ui, sans-serif;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
}

h1,
h2 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

h1 {
  font-size: clamp(2.25rem, 5vw, 3rem);
  line-height: 1.1;
}

h2 {
  font-size: 1.35rem;
}

.page {
  width: min(960px, 100% - 2rem);
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.header {
  margin-bottom: 2rem;
  max-width: 36rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.lede {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.load-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .load-form {
    flex-direction: row;
  }
}

input[type="url"],
input[type="number"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  outline: none;
}

input:focus {
  border-color: var(--accent);
}

button {
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  padding: 0.8rem 1.2rem;
  cursor: pointer;
  white-space: nowrap;
  background: var(--accent);
  color: #fff;
}

button:hover:not(:disabled) {
  filter: brightness(0.95);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-dark {
  width: 100%;
  margin-top: 1rem;
  background: var(--ink);
}

.btn-secondary {
  width: 100%;
  margin-top: 0.75rem;
  background: var(--accent-soft);
  color: var(--accent);
}

#open-play-btn {
  margin-top: 0.75rem;
}


.btn-outline {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}

.error {
  margin: 1rem 0 0;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.9rem;
}

.muted {
  color: var(--muted);
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
}

.warn {
  color: var(--warn);
}

.playlist-grid {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

@media (min-width: 860px) {
  .playlist-grid {
    grid-template-columns: 1.15fr 0.85fr;
  }
}

.field-label {
  display: block;
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.track-list-wrap {
  margin-top: 1rem;
  max-height: 18rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.track-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.track-list li {
  display: flex;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.track-list li:last-child {
  border-bottom: none;
}

.track-num {
  width: 1.75rem;
  flex-shrink: 0;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.track-title {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-artist {
  display: block;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#cards-section {
  margin-top: 1.75rem;
}

.cards-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.player-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.player-tabs button {
  padding: 0.45rem 0.8rem;
  font-size: 0.875rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}

.player-tabs button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.bingo-card {
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: #fff;
}

.bingo-card-title {
  padding: 0.85rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: var(--accent-soft);
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
}

.bingo-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.bingo-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.4rem 0.3rem;
  border: 1px solid var(--border);
  text-align: center;
  overflow: hidden;
  font-family: var(--card-font);
}

.bingo-cell.free {
  background: #f3f3f1;
}

.bingo-cell.free span {
  font-family: var(--card-font);
  font-weight: 700;
  color: var(--accent);
  font-size: 1.1rem;
  letter-spacing: 0.04em;
}

.cell-title {
  width: 100%;
  font-size: clamp(0.68rem, 1.7vw, 0.9rem);
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.cell-artist {
  width: 100%;
  font-size: clamp(0.55rem, 1.35vw, 0.72rem);
  font-weight: 500;
  color: var(--muted);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.bingo-cell.long .cell-title {
  font-size: clamp(0.58rem, 1.45vw, 0.78rem);
}

.bingo-cell.xlong .cell-title {
  font-size: clamp(0.5rem, 1.25vw, 0.66rem);
}

.bingo-cell.xlong .cell-artist {
  font-size: clamp(0.45rem, 1.1vw, 0.58rem);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 20, 0.35);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.modal.is-open .modal-backdrop {
  opacity: 1;
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(90vh, 720px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition:
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s ease;
}

.modal.is-open .modal-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.modal-close {
  flex-shrink: 0;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  padding: 0.55rem 0.9rem;
  font-size: 0.875rem;
}

.play-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 1rem 1.25rem;
  margin-bottom: 0.85rem;
}

.hide-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.hide-title input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.now-playing {
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  margin-bottom: 1rem;
}

.now-label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

.now-title {
  margin: 0.35rem 0 0;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.25;
}

.now-artist {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
}

.now-position {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
}

.progress-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.seek {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.play-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.control-btn {
  min-width: 5.5rem;
}

.control-main {
  min-width: 7rem;
  background: var(--ink);
  color: #fff;
}

.control-main.playing {
  background: var(--accent);
}

body.modal-open {
  overflow: hidden;
}

