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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-hover: #222;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --text-muted: #777;
  --accent: #c8a84b;
  --accent-dark: #a8893a;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

/* ── Header ── */

header {
  padding: 1.5rem 2rem 1rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

#header-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
}

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
}

#about-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}

#about-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

#search {
  display: block;
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.8rem;
  border-radius: 6px;
  font-size: 0.875rem;
  outline: none;
  margin-bottom: 0.8rem;
  transition: border-color 0.15s;
}

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

#search::placeholder {
  color: var(--text-muted);
}

#player-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.3rem 0.8rem;
  border-radius: 99px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.4;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 600;
}

/* ── Grid ── */

main {
  padding: 1.5rem 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  align-content: start;
}

.clip-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  user-select: none;
}

.clip-card:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.card-player {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.card-team {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.card-description {
  font-size: 0.83rem;
  color: var(--text);
  line-height: 1.45;
}

.card-tags {
  margin-top: 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.tag {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 5rem 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Modal ── */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
}

.modal-content {
  position: relative;
  width: 92vw;
  max-width: 1100px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 96vh;
}

.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 10;
  background: rgba(0, 0, 0, 0.55);
  border: none;
  color: #fff;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.8);
}

#modal-video {
  width: 100%;
  max-height: 72vh;
  background: #000;
  display: block;
  outline: none;
}

.modal-info {
  padding: 0.9rem 1.25rem 1rem;
  flex-shrink: 0;
}

.modal-player {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.modal-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.modal-description {
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 0.8rem;
}

.modal-controls {
  display: flex;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem;
  border-top: 1px solid var(--border);
}

.ctrl-btn {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.55rem 0.25rem;
  font-size: 1rem;
  cursor: pointer;
  min-height: 2.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.ctrl-btn:hover, .ctrl-btn:active {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.ctrl-play {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-size: 1.1rem;
}

.ctrl-play:hover, .ctrl-play:active {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.modal-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 0.7rem;
}

.modal-keys span {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-family: ui-monospace, 'SF Mono', monospace;
}

/* ── About modal ── */

.about-content {
  max-width: 560px;
  width: 92vw;
}

.about-body {
  padding: 2rem 1.5rem 1.75rem;
}

.about-body h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1rem;
}

.about-body p {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 0.9rem;
}

.about-body p:last-child {
  margin-bottom: 0;
}

/* ── Responsive ── */

@media (max-width: 600px) {
  header {
    padding: 1rem;
  }

  main {
    padding: 1rem;
  }

  .modal-content {
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  #modal-video {
    max-height: 56vw;
  }

  .modal-keys {
    display: none;
  }
}
