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

/* ===== PIN Entry Screen ===== */

.pin-screen {
  position: fixed;
  inset: 0;
  background: #0f1117;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-screen.hidden { display: none; }

.pin-card {
  text-align: center;
  width: 320px;
}

.pin-title {
  color: #58a6ff;
  font-size: 2rem;
  margin-bottom: 32px;
}

.pin-input-wrap {
  position: relative;
  margin-bottom: 16px;
}

.pin-card input[type="password"],
.pin-card input[type="text"] {
  width: 100%;
  padding: 12px 40px 12px 16px;
  font-size: 1rem;
  background: #161b22;
  border: 1px solid #2d333b;
  border-radius: 8px;
  color: #e1e4e8;
  text-align: center;
  letter-spacing: 0.1em;
}

.pin-card input[type="password"]:focus,
.pin-card input[type="text"]:focus {
  outline: none;
  border-color: #58a6ff;
}

.pin-eye-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #6e7681;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

.pin-eye-btn:hover { color: #8b949e; }

.pin-card .btn {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
}

.pin-error {
  color: #f85149;
  font-size: 0.85rem;
  margin-top: 12px;
  min-height: 1.5em;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f1117;
  color: #e1e4e8;
  line-height: 1.5;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #2d333b;
}

header h1 {
  font-size: 1.5rem;
  color: #58a6ff;
}

.header-actions {
  display: flex;
  gap: 8px;
}

/* Stats bar */
.stats {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #161b22;
  border: 1px solid #2d333b;
  border-radius: 8px;
  padding: 16px 20px;
  flex: 1;
}

.stat-card .label {
  font-size: 0.75rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card .value {
  font-size: 1.5rem;
  font-weight: 600;
  color: #e1e4e8;
}

/* Filters */
.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
}

.filters input,
.filters select {
  background: #161b22;
  border: 1px solid #2d333b;
  border-radius: 6px;
  color: #e1e4e8;
  padding: 8px 12px;
  font-size: 0.875rem;
}

.filters input { flex: 1; max-width: 300px; }
.filters input:focus,
.filters select:focus {
  outline: none;
  border-color: #58a6ff;
}

/* Buttons */
.btn {
  background: #238636;
  color: #fff;
  border: 1px solid #2ea043;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.875rem;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover { background: #2ea043; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm {
  padding: 4px 10px;
  font-size: 0.75rem;
}

.btn-secondary {
  background: #21262d;
  border-color: #363b42;
}
.btn-secondary:hover { background: #30363d; }

.btn-blue {
  background: #1f6feb;
  border-color: #388bfd;
}
.btn-blue:hover { background: #388bfd; }

/* Table */
.table-wrap {
  background: #161b22;
  border: 1px solid #2d333b;
  border-radius: 8px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.75rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #2d333b;
}

td {
  padding: 10px 12px;
  font-size: 0.875rem;
  border-bottom: 1px solid #21262d;
}

tr:last-child td { border-bottom: none; }
tr:hover { background: #1c2128; }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-uploaded {
  background: #1b4332;
  color: #2ea043;
}

.badge-pending {
  background: #3b2e00;
  color: #d29922;
}

.badge-none {
  background: #21262d;
  color: #8b949e;
}

/* Recording title link */
a.recording-title-link {
  color: #e1e4e8;
  text-decoration: none;
}
a.recording-title-link:hover {
  color: #58a6ff;
  text-decoration: underline;
}

/* YouTube link */
a.yt-link {
  color: #58a6ff;
  text-decoration: none;
  font-size: 0.75rem;
}
a.yt-link:hover { text-decoration: underline; }

/* Progress overlay */
.progress-bar {
  display: none;
  background: #161b22;
  border: 1px solid #2d333b;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.progress-bar.active { display: block; }

.progress-bar .title {
  font-size: 0.875rem;
  margin-bottom: 8px;
}

.progress-track {
  height: 8px;
  background: #21262d;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-fill {
  height: 100%;
  background: #58a6ff;
  border-radius: 4px;
  transition: width 0.3s;
  width: 0%;
}

.progress-text {
  font-size: 0.75rem;
  color: #8b949e;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: #161b22;
  border: 1px solid #2d333b;
  border-radius: 12px;
  padding: 24px;
  width: 400px;
  max-width: 90vw;
}

.modal h3 { margin-bottom: 16px; }

.modal label {
  display: block;
  font-size: 0.75rem;
  color: #8b949e;
  margin-bottom: 4px;
  margin-top: 12px;
}

.modal input,
.modal select {
  width: 100%;
  background: #0d1117;
  border: 1px solid #2d333b;
  border-radius: 6px;
  color: #e1e4e8;
  padding: 8px 12px;
  font-size: 0.875rem;
}

.modal select[size] {
  height: 200px;
  overflow-y: auto;
}

.modal select[size] option {
  padding: 6px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal select[size] option:checked {
  background: #1f6feb;
  color: #fff;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Duration */
.duration {
  color: #8b949e;
  font-size: 0.8rem;
}

/* Actions cell */
.actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* Team badge */
.badge-team {
  background: #1a2744;
  color: #58a6ff;
}

.team-cell, .date-cell {
  cursor: pointer;
}

.date-cell:hover {
  color: #58a6ff;
}

.team-cell:hover .badge {
  outline: 1px solid #58a6ff;
}

/* Team management rows */
.team-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #21262d;
}

.team-row:last-child { border-bottom: none; }

.team-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.team-playlist {
  font-size: 0.7rem;
  color: #8b949e;
  font-family: monospace;
  display: flex;
  align-items: center;
  gap: 6px;
}

.copy-pl-btn {
  font-size: 0.65rem;
  padding: 1px 6px;
}

/* Bulk action bar */
.bulk-bar {
  display: none;
  align-items: center;
  gap: 8px;
  background: #1a2744;
  border: 1px solid #388bfd;
  border-radius: 8px;
  padding: 8px 16px;
  margin-bottom: 12px;
  font-size: 0.875rem;
}

.bulk-bar.active { display: flex; }

.bulk-bar select {
  background: #161b22;
  border: 1px solid #2d333b;
  border-radius: 6px;
  color: #e1e4e8;
  padding: 4px 8px;
  font-size: 0.8rem;
}

/* Checkbox column */
th:first-child, td:first-child {
  width: 32px;
  text-align: center;
}

input[type="checkbox"] {
  accent-color: #58a6ff;
  cursor: pointer;
}

/* Excluded video rows */
.excluded-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #21262d;
  font-size: 0.85rem;
}

.excluded-row:last-child { border-bottom: none; }

.excluded-row .cat {
  font-size: 0.7rem;
  color: #d29922;
  margin-left: 8px;
}

/* Source badge */
.badge-youtube {
  background: #3b1a1a;
  color: #f85149;
}

.badge-veo {
  background: #1a2744;
  color: #58a6ff;
}

/* Auth banners */
.auth-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.875rem;
}

.auth-banner-warn {
  background: #3b2e00;
  border: 1px solid #d29922;
  color: #f0c040;
}

.auth-banner-error {
  background: #3b1a1a;
  border: 1px solid #f85149;
  color: #f8a0a0;
}

.auth-banner .btn {
  margin-left: auto;
}

.auth-banner-info {
  background: #1a2744;
  border: 1px solid #388bfd;
  color: #8bb9fe;
}

.auth-banner-ok {
  background: #1b4332;
  border: 1px solid #2ea043;
  color: #56d364;
}

/* ===== Recording Detail View ===== */

.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #2d333b;
}

.detail-title-row {
  flex: 1;
}

.detail-title-row h2 {
  font-size: 1.3rem;
  color: #e1e4e8;
  margin-bottom: 6px;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.detail-date {
  color: #8b949e;
  font-size: 0.85rem;
}

.detail-score {
  font-size: 1.1rem;
  font-weight: 700;
  color: #e1e4e8;
  background: #21262d;
  padding: 2px 10px;
  border-radius: 6px;
}

.detail-duration {
  color: #8b949e;
  font-size: 0.85rem;
}

/* YouTube Player */
.detail-player-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.detail-player-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.detail-no-video {
  background: #161b22;
  border: 1px solid #2d333b;
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  color: #8b949e;
  margin-bottom: 16px;
}

/* Event Timeline Bar */
.detail-timeline {
  background: #161b22;
  border: 1px solid #2d333b;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  position: relative;
}

.timeline-periods {
  display: flex;
  margin-bottom: 4px;
  font-size: 0.7rem;
  color: #8b949e;
  position: relative;
  height: 16px;
}

.timeline-period-label {
  position: absolute;
  white-space: nowrap;
}

.timeline-bar {
  position: relative;
  height: 32px;
  background: #21262d;
  border-radius: 4px;
  cursor: pointer;
  overflow: visible;
}

.timeline-playhead {
  position: absolute;
  top: -2px;
  width: 2px;
  height: 36px;
  background: #f0f6fc;
  border-radius: 1px;
  z-index: 3;
  display: none;
  pointer-events: none;
}

.timeline-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  z-index: 2;
  cursor: pointer;
  transition: transform 0.15s;
  border: 1.5px solid #0d1117;
}

.timeline-marker:hover {
  transform: translate(-50%, -50%) scale(1.5);
  z-index: 4;
}

.timeline-marker.type-goal { background: #f85149; }
.timeline-marker.type-kick_shot { background: #f0883e; }
.timeline-marker.type-kick_corner { background: #3fb950; }
.timeline-marker.type-kick_free_kick { background: #a371f7; }
.timeline-marker.type-foul { background: #d29922; }
.timeline-marker.type-throw_in { background: #58a6ff; }
.timeline-marker.type-kick_start { background: #8b949e; width: 6px; height: 6px; }
.timeline-marker.type-ball_goes_out { background: #6e7681; width: 5px; height: 5px; }
.timeline-marker.type-kick_goalie { background: #768390; width: 6px; height: 6px; }
.timeline-marker.type-other { background: #6e7681; width: 6px; height: 6px; }

/* Period separator lines on the timeline bar */
.timeline-period-sep {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: #484f58;
  z-index: 1;
}

.timeline-marker-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #2d333b;
  color: #e1e4e8;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
  pointer-events: none;
  display: none;
  z-index: 10;
}

.timeline-marker:hover .timeline-marker-tooltip {
  display: block;
}

.timeline-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 0.7rem;
  color: #6e7681;
}

.timeline-legend {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.timeline-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: #8b949e;
}

.timeline-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Summary Cards */
.detail-summary {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.summary-card {
  background: #161b22;
  border: 1px solid #2d333b;
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 100px;
  flex: 1;
  text-align: center;
}

.summary-card .label {
  font-size: 0.7rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.summary-card .value {
  font-size: 1.4rem;
  font-weight: 600;
  color: #e1e4e8;
}

.summary-card .sub {
  font-size: 0.7rem;
  color: #6e7681;
}

/* Event Filters */
.detail-events-section {
  background: #161b22;
  border: 1px solid #2d333b;
  border-radius: 8px;
  margin-bottom: 20px;
}

.detail-events-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #2d333b;
}

.detail-events-header h3 {
  font-size: 0.95rem;
  margin: 0;
}

/* Team Toggle Bar — sits between header and event type pills */
.team-toggle-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #2d333b;
  background: #131920;
}

.team-toggle-label {
  font-size: 0.75rem;
  color: #8b949e;
  white-space: nowrap;
}

.team-toggle-group {
  display: inline-flex;
  border: 1px solid #30363d;
  border-radius: 6px;
  overflow: hidden;
}

.team-toggle-btn {
  background: #21262d;
  border: none;
  color: #8b949e;
  padding: 5px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  border-right: 1px solid #30363d;
}

.team-toggle-btn:last-child { border-right: none; }
.team-toggle-btn:hover { color: #c9d1d9; background: #272d35; }

.team-toggle-btn.active {
  background: #1f6feb;
  color: #fff;
  border-color: #388bfd;
}

.detail-event-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 16px;
  border-bottom: 1px solid #2d333b;
}

.event-filter-btn {
  background: #21262d;
  color: #8b949e;
  border: 1px solid #2d333b;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 0.7rem;
  cursor: pointer;
  white-space: nowrap;
}

.event-filter-btn:hover {
  border-color: #484f58;
  color: #c9d1d9;
}

.event-filter-btn.active {
  background: #1f6feb;
  border-color: #388bfd;
  color: #fff;
}

/* Event List */
.detail-events-list {
  max-height: 400px;
  overflow-y: auto;
}

.event-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  border-bottom: 1px solid #21262d;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.1s;
}

.event-row:last-child { border-bottom: none; }
.event-row:hover { background: #1c2128; }

.event-row.active {
  background: #1a2744;
  border-left: 3px solid #58a6ff;
  padding-left: 13px;
}

.event-time {
  color: #58a6ff;
  font-family: monospace;
  min-width: 55px;
  font-size: 0.75rem;
}

.event-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.event-name {
  flex: 1;
  color: #c9d1d9;
}

.event-team {
  font-size: 0.7rem;
  color: #8b949e;
}

.event-seek {
  color: #484f58;
  font-size: 0.7rem;
}

.event-row:hover .event-seek {
  color: #58a6ff;
}

/* Highlights Section (accordion) */
.detail-highlights-section {
  background: #161b22;
  border: 1px solid #2d333b;
  border-radius: 8px;
  margin-bottom: 20px;
}

.highlights-accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}

.highlights-accordion-header:hover { background: #1c2128; border-radius: 8px; }

.highlights-accordion-header h3 {
  font-size: 0.95rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.highlights-count {
  font-size: 0.75rem;
  font-weight: 400;
  color: #8b949e;
}

.accordion-arrow {
  font-size: 0.75rem;
  color: #8b949e;
  transition: transform 0.2s;
}

.accordion-arrow.expanded {
  transform: rotate(90deg);
}

.detail-highlights-list.expanded {
  display: flex !important;
  padding: 0 16px 12px;
}

.detail-highlights-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.highlight-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid #21262d;
  font-size: 0.8rem;
  cursor: pointer;
}

.highlight-row:last-child { border-bottom: none; }
.highlight-row:hover { color: #58a6ff; }

.highlight-time {
  color: #58a6ff;
  font-family: monospace;
  min-width: 55px;
  font-size: 0.75rem;
}

.highlight-type {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 8px;
  background: #21262d;
  color: #8b949e;
}

.highlight-name {
  flex: 1;
  color: #c9d1d9;
}

.highlight-duration {
  color: #6e7681;
  font-size: 0.75rem;
}

/* ===== Game Setup Wizard ===== */

.wizard-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.wizard-overlay.active { display: flex; }

.wizard-panel {
  background: #161b22;
  border: 1px solid #2d333b;
  border-radius: 12px;
  width: 95vw;
  max-width: 900px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wizard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid #2d333b;
}

.wizard-header h3 {
  margin: 0;
  font-size: 1rem;
}

.wizard-player-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 40%;
  background: #000;
  flex-shrink: 0;
}

.wizard-player-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.wizard-no-video {
  padding: 24px;
  text-align: center;
  color: #6e7681;
  font-size: 0.85rem;
  background: #0d1117;
}

/* Step pills */
.wizard-steps {
  display: flex;
  gap: 4px;
  padding: 10px 20px;
  border-bottom: 1px solid #2d333b;
  background: #0d1117;
}

.wizard-step-pill {
  padding: 4px 14px;
  border-radius: 14px;
  font-size: 0.75rem;
  cursor: pointer;
  border: 1px solid #2d333b;
  background: #161b22;
  color: #8b949e;
  white-space: nowrap;
}

.wizard-step-pill:hover {
  border-color: #484f58;
  color: #c9d1d9;
}

.wizard-step-pill.active {
  background: #1f6feb;
  border-color: #388bfd;
  color: #fff;
}

.wizard-step-pill.completed {
  border-color: #2ea043;
  color: #56d364;
}

/* Step content */
.wizard-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  min-height: 200px;
}

/* Step footer */
.wizard-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  border-top: 1px solid #2d333b;
}

.wizard-footer-right {
  display: flex;
  gap: 8px;
}

/* Period rows */
.wizard-period-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #21262d;
  flex-wrap: wrap;
}

.wizard-period-row:last-child { border-bottom: none; }

.wizard-period-info {
  min-width: 180px;
  font-size: 0.85rem;
}

.wizard-period-info .period-time {
  font-family: monospace;
  color: #58a6ff;
  font-size: 0.75rem;
}

.wizard-period-info .period-dur {
  color: #6e7681;
  font-size: 0.75rem;
  margin-left: 8px;
}

.wizard-period-row select {
  background: #0d1117;
  border: 1px solid #2d333b;
  border-radius: 6px;
  color: #e1e4e8;
  padding: 4px 8px;
  font-size: 0.8rem;
}

.wizard-period-row .btn-sm {
  flex-shrink: 0;
}

/* Direction toggles */
.direction-toggle {
  display: inline-flex;
  border: 1px solid #2d333b;
  border-radius: 6px;
  overflow: hidden;
}

.direction-toggle button {
  background: #21262d;
  border: none;
  color: #8b949e;
  padding: 4px 12px;
  font-size: 0.8rem;
  cursor: pointer;
}

.direction-toggle button:first-child {
  border-right: 1px solid #2d333b;
}

.direction-toggle button:hover { color: #c9d1d9; }

.direction-toggle button.active {
  background: #1f6feb;
  color: #fff;
}

/* Goal review rows */
.wizard-goal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #21262d;
  flex-wrap: wrap;
}

.wizard-goal-row:last-child { border-bottom: none; }

.wizard-goal-time {
  font-family: monospace;
  color: #58a6ff;
  font-size: 0.8rem;
  min-width: 55px;
}

.wizard-goal-side {
  font-size: 0.75rem;
  color: #8b949e;
}

.confidence-badge {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
}

.confidence-high { background: #1b4332; color: #56d364; }
.confidence-med { background: #3b2e00; color: #f0c040; }
.confidence-low { background: #3b1a1a; color: #f85149; }

.review-toggle {
  display: inline-flex;
  border: 1px solid #2d333b;
  border-radius: 6px;
  overflow: hidden;
}

.review-toggle button {
  background: #21262d;
  border: none;
  color: #8b949e;
  padding: 3px 10px;
  font-size: 0.7rem;
  cursor: pointer;
}

.review-toggle button:first-child {
  border-right: 1px solid #2d333b;
}

.review-toggle button:hover { color: #c9d1d9; }
.review-toggle button.confirmed { background: #1b4332; color: #56d364; }
.review-toggle button.rejected { background: #3b1a1a; color: #f85149; }

.badge-manual {
  background: #1a2744;
  color: #58a6ff;
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 8px;
}

/* Score confirmation */
.wizard-score-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.wizard-score-row label {
  font-size: 0.85rem;
  color: #8b949e;
  min-width: 80px;
}

.wizard-score-row input[type="number"] {
  width: 70px;
  background: #0d1117;
  border: 1px solid #2d333b;
  border-radius: 6px;
  color: #e1e4e8;
  padding: 6px 10px;
  font-size: 1rem;
  text-align: center;
}

.wizard-score-derived {
  font-size: 0.75rem;
  color: #6e7681;
  margin-top: 4px;
}

.wizard-shootout-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #2d333b;
}

/* Add goal form */
.wizard-add-goal {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #2d333b;
  flex-wrap: wrap;
}

.wizard-add-goal input,
.wizard-add-goal select {
  background: #0d1117;
  border: 1px solid #2d333b;
  border-radius: 6px;
  color: #e1e4e8;
  padding: 4px 8px;
  font-size: 0.8rem;
}

.wizard-add-goal input[type="text"] {
  width: 90px;
}

/* Setup prompt banner on detail page */
.setup-banner {
  background: #1a2744;
  border: 1px solid #388bfd;
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.875rem;
  color: #8bb9fe;
}

.setup-banner .btn {
  margin-left: auto;
}

/* Event review status in detail view */
.event-row.rejected {
  opacity: 0.4;
  text-decoration: line-through;
}

.event-row.user-event .event-name {
  font-style: italic;
}

/* ===== Mobile Responsive ===== */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@media (max-width: 640px) {

  /* --- Foundation: prevent any element from exceeding viewport --- */
  *, *::before, *::after { max-width: 100vw; }
  .container { padding: 10px; max-width: 100%; }

  /* Prevent iOS Safari auto-zoom on input focus (requires >= 16px) */
  input, select, textarea { font-size: 16px !important; }

  /* --- Header: title + buttons fill the width naturally --- */
  header {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
  }
  header h1 { font-size: 1.3rem; flex: 1; }
  .header-actions {
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }
  .header-actions .btn {
    flex: 1 1 auto;
    text-align: center;
    padding: 8px 6px;
    font-size: 0.8rem;
  }

  /* --- Stats: 2x2 grid, full-width cards, readable --- */
  .stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .stat-card { padding: 12px; }
  .stat-card .label { font-size: 0.7rem; }
  .stat-card .value { font-size: 1.4rem; }

  /* --- Filters: stack vertically, full-width --- */
  .filters {
    flex-direction: column;
    gap: 8px;
  }
  .filters input { max-width: none; width: 100%; }
  .filters select { width: 100%; }

  /* --- Table: compact, hides Duration column --- */
  .table-wrap { border-radius: 6px; }
  table { font-size: 0.85rem; }
  th { padding: 8px 6px; font-size: 0.7rem; }
  td { padding: 10px 6px; font-size: 0.85rem; }
  /* Hide non-essential table columns on mobile */
  .col-duration { display: none; }  /* Duration — saves ~70px */
  .col-checkbox { display: none; }  /* Checkboxes — desktop bulk action pattern */
  .col-team { display: none; }      /* Team — visible in detail page, implicit for filtered roles */
  .col-actions { display: none; }   /* Actions — use row tap for detail, buttons too cramped */
  /* Hide YouTube video IDs on mobile — just show the badge */
  td .yt-link { display: none; }

  /* --- Bulk bar --- */
  .bulk-bar {
    flex-wrap: wrap;
    padding: 8px 10px;
    font-size: 0.85rem;
    gap: 6px;
  }

  /* --- Auth/status banners --- */
  .auth-banner {
    flex-wrap: wrap;
    padding: 10px 12px;
    font-size: 0.85rem;
    gap: 8px;
  }
  .auth-banner .btn { margin-left: 0; width: 100%; text-align: center; }

  /* --- Progress bar --- */
  .progress-bar { padding: 10px 12px; }

  /* --- Modals: nearly full-screen on mobile --- */
  .modal {
    width: 94vw !important;
    max-width: 94vw !important;
    padding: 14px;
    max-height: 90vh;
    overflow-y: auto;
  }
  .modal h3 { font-size: 1rem; margin-bottom: 12px; }
  .modal label { margin-top: 8px; }
  .modal-actions { flex-wrap: wrap; gap: 6px; }
  .modal-actions .btn { flex: 1 1 auto; text-align: center; }

  /* Teams modal — stack rows vertically, wrap buttons */
  .team-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .team-playlist { flex-wrap: wrap; gap: 4px; }
  .team-actions { width: 100%; }
  .team-actions .btn { flex: 1; }

  /* --- PIN screen --- */
  .pin-card { width: min(300px, 85vw); }
  .pin-title { font-size: 1.8rem; margin-bottom: 28px; }
  .pin-card .btn { padding: 14px; font-size: 1rem; }

  /* ===== Detail Page ===== */

  /* Detail header — stack naturally */
  .detail-header {
    flex-direction: column;
    gap: 8px;
    padding-bottom: 10px;
    margin-bottom: 12px;
  }
  .detail-title-row h2 { font-size: 1.15rem; }
  .detail-meta { gap: 8px; }
  .detail-meta .btn { padding: 6px 10px; }

  /* Player — fill width, no margin waste */
  .detail-player-wrap { margin-bottom: 10px; border-radius: 6px; }
  .detail-no-video { padding: 24px 12px; margin-bottom: 10px; }

  /* Summary cards — 3-per-row grid, uniform sizing */
  .detail-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 12px;
  }
  .summary-card {
    min-width: 0;
    padding: 10px 6px;
  }
  .summary-card .label { font-size: 0.6rem; }
  .summary-card .value { font-size: 1.15rem; }
  .summary-card .sub { font-size: 0.6rem; }

  /* Team toggle — full-width bar, readable buttons */
  .team-toggle-bar {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .team-toggle-label { font-size: 0.75rem; }
  .team-toggle-group { flex: 1; }
  .team-toggle-btn {
    flex: 1;
    padding: 7px 6px;
    font-size: 0.8rem;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Event filter pills — comfortable touch targets */
  .detail-event-filters { padding: 8px 12px; gap: 6px; }
  .event-filter-btn {
    padding: 5px 10px;
    font-size: 0.75rem;
  }

  /* Event list — touch-friendly rows */
  .detail-events-list { max-height: 50vh; }
  .event-row {
    padding: 10px 12px;
    gap: 8px;
    font-size: 0.85rem;
    min-height: 44px; /* Apple HIG minimum touch target */
  }
  .event-time { min-width: 46px; font-size: 0.8rem; }
  .event-dot { width: 8px; height: 8px; }
  .event-name { font-size: 0.85rem; }
  .event-team { font-size: 0.75rem; }
  .event-seek { display: none; } /* tap is obvious on mobile */

  /* Timeline */
  .detail-timeline { padding: 10px 12px; margin-bottom: 10px; }
  .timeline-bar { height: 36px; }
  .timeline-marker { width: 10px; height: 10px; }
  .timeline-legend { gap: 8px; margin-top: 6px; }
  .timeline-legend-item { font-size: 0.65rem; }
  .timeline-period-label { font-size: 0.6rem; }

  /* Highlights — touch-friendly */
  .detail-highlights-section { padding: 12px; }
  .highlight-row {
    padding: 8px 0;
    gap: 8px;
    font-size: 0.85rem;
    min-height: 44px;
  }
  .highlight-time { min-width: 46px; font-size: 0.8rem; }

  /* Events section container */
  .detail-events-section { border-radius: 6px; margin-bottom: 12px; }
  .detail-events-header { padding: 10px 12px; }
  .detail-events-header h3 { font-size: 0.9rem; }

  /* Setup banner */
  .setup-banner {
    flex-wrap: wrap;
    padding: 10px 12px;
    font-size: 0.85rem;
    gap: 8px;
    margin-bottom: 10px;
  }
  .setup-banner .btn { margin-left: 0; }

  /* ===== Wizard on Mobile ===== */
  .wizard-panel { max-height: 95vh; }
  .wizard-header { padding: 10px 12px; }
  .wizard-header h3 { font-size: 0.95rem; }
  .wizard-steps { flex-wrap: wrap; padding: 8px 12px; gap: 4px; }
  .wizard-step-pill { font-size: 0.75rem; padding: 5px 12px; }
  .wizard-content { padding: 12px; min-height: 150px; }
  .wizard-footer { padding: 8px 12px; }
  .wizard-period-row { gap: 8px; }
  .wizard-period-info { min-width: 100%; font-size: 0.85rem; }
  .wizard-period-row select { width: 100%; }
  .wizard-goal-row { gap: 6px; }
  .wizard-add-goal { gap: 6px; flex-direction: column; }
  .wizard-add-goal input,
  .wizard-add-goal select { width: 100%; }
  .wizard-score-row label { min-width: 70px; }
  .direction-toggle { width: 100%; }
  .direction-toggle button { flex: 1; padding: 8px 6px; font-size: 0.8rem; }
  .review-toggle button { padding: 5px 12px; font-size: 0.75rem; }

  /* Player aspect in wizard — slightly taller on mobile */
  .wizard-player-wrap { padding-bottom: 50%; }
}
