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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #ffffff;
  background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.4)),
              url("assets/20260201_135446.jpg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  min-height: 100vh;
  padding: 80px 20px 20px 20px;
}

/* ── NAVBAR ── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(255,255,255,0.08);
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-logo {
  height: 32px;
  width: auto;
  background: #1e5eff;
  border-radius: 8px;
  padding: 4px;
}

.brand-text {
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 14px;
  color: #ffffff;
  text-transform: uppercase;
}

.brand-origin {
  font-weight: 300;
  opacity: 1;
}

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

.nav-tab {
  padding: 7px 18px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  background: transparent;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
}

.nav-tab:hover {
  color: white;
  border-color: rgba(255,255,255,0.4);
}

.nav-tab.active {
  background: #1e5eff;
  border-color: #1e5eff;
  color: white;
}

/* ── PAGE ── */
.page {
  display: none;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 0;
}

.page.active {
  display: block;
}

/* ── GLASS CARD ── */
.card {
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 18px;
  padding: 18px;
}

.card-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #ffffff;
  margin-bottom: 16px;
}

.section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #ffffff;
  margin-bottom: 8px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #ffffff;
  font-size: 13px;
  letter-spacing: 1px;
  opacity: 0.35;
}

/* ── SETUP — SESSION INFO ── */
.setup-meta {
  margin-bottom: 20px;
}

.meta-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.meta-row:last-child {
  margin-bottom: 0;
}

.meta-row input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 12px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #ffffff;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

.meta-row input::placeholder {
  color: #ffffff;
  opacity: 0.6;
}

.meta-row input:focus {
  background: rgba(255,255,255,0.2);
}

/* ── SETUP — ROSTER ── */
.roster-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.roster-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #ffffff;
  margin-bottom: 10px;
}

.roster-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 3px;
}

.roster-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 10px 12px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.1);
  color: #ffffff;
}

.roster-table thead th:first-child {
  border-radius: 6px 0 0 6px;
}

.roster-table thead th:last-child {
  border-radius: 0 6px 6px 0;
}

.col-no  { width: 52px; }
.col-pos { width: 64px; }
.col-name { }

.roster-table td {
  padding: 2px 2px;
  height: 36px;
}

.roster-table input {
  width: 100%;
  height: 32px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: #ffffff;
  padding: 6px 8px;
  border-radius: 6px;
  outline: none;
  font-size: 12px;
  font-family: inherit;
  display: block;
}

.roster-table input:focus {
  border-color: #1e5eff;
}

.roster-table input::placeholder {
  color: #ffffff;
  opacity: 0.3;
}

/* ── SUBSTITUTES DIVIDER ── */
.sub-divider {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #ffffff;
  margin: 8px 0 4px 0;
}

.start-btn {
  width: 100%;
  padding: 12px 24px;
  border-radius: 14px;
  border: none;
  background: #1e5eff;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: 0.3s;
  font-family: inherit;
}

.start-btn:hover {
  background: #0077ee;
  transform: scale(1.02);
}

/* ── TAGGING PAGE ── */
.tag-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  align-items: start;
}

.video-source-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.source-btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  background: transparent;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
}

.source-btn.active {
  background: #1e5eff;
  border-color: #1e5eff;
  color: #ffffff;
}

.video-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.video-input-row input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: rgba(255,255,255,0.1);
  color: #ffffff;
  font-size: 12px;
  outline: none;
  font-family: inherit;
}

.video-input-row input::placeholder {
  color: #ffffff;
  opacity: 0.6;
}

.video-input-row input:focus {
  background: rgba(255,255,255,0.15);
}

.load-btn {
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
}

.load-btn:hover {
  background: rgba(255,255,255,0.25);
}

#videoWrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: rgba(0,0,0,0.5);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#videoWrapper video,
#videoWrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 12px;
}

.video-placeholder {
  color: #ffffff;
  opacity: 0.35;
  font-size: 13px;
  letter-spacing: 1px;
}

.log-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.export-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  background: transparent;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
}

.export-btn:hover {
  border-color: #1e5eff;
  color: #1e5eff;
}

/* ── EVENT LOG TABLE ── */
.log-table-wrap {
  max-height: 280px;
  overflow-y: auto;
}

.log-table-wrap::-webkit-scrollbar { width: 4px; }
.log-table-wrap::-webkit-scrollbar-track { background: transparent; }
.log-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.log-table thead th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #ffffff;
  padding: 0 10px 10px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  white-space: nowrap;
}

.log-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: background 0.15s;
}

.log-table tbody tr:hover {
  background: rgba(255,255,255,0.04);
}

.log-table tbody tr:last-child {
  border-bottom: none;
}

.log-table td {
  padding: 9px 10px;
  vertical-align: middle;
  color: #ffffff;
}

.lt-num  { width: 28px; font-size: 11px; }
.lt-time { width: 46px; font-variant-numeric: tabular-nums; font-size: 11px; }
.lt-cat  { width: 90px; }
.lt-desc { }
.lt-notes { max-width: 140px; font-size: 11px; }
.lt-del  { width: 28px; text-align: right; }

.log-cat-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.log-result-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
}

.log-desc-text {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.log-del {
  padding: 2px 7px;
  border-radius: 5px;
  border: none;
  background: rgba(255,255,255,0.05);
  color: #ffffff;
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  transition: 0.2s;
}

.log-del:hover {
  background: rgba(232,93,58,0.25);
  color: #e85d3a;
}

/* ── TAG PANEL ── */
.tag-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step-row {
  display: flex;
  gap: 6px;
  padding: 0 4px;
}

.step-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transition: 0.2s;
}

.step-dot.active { background: #1e5eff; }
.step-dot.done   { background: #ffffff; }

.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.cat-btn {
  padding: 10px 4px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
  text-transform: uppercase;
}

.cat-btn:hover {
  background: rgba(255,255,255,0.1);
}

.cat-btn.selected {
  color: #ffffff;
  border-color: transparent;
}

.event-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.ev-btn {
  padding: 9px 6px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
}

.ev-btn:hover {
  background: #1e5eff;
  border-color: white;
}

.ev-btn.selected {
  background: #1e5eff;
  border-color: #1e5eff;
  color: #ffffff;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.res-btn {
  padding: 9px 4px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
}

.res-btn:hover {
  border-color: rgba(255,255,255,0.6);
}

.res-btn.selected {
  color: #ffffff;
  border-color: transparent;
}

.player-scroll {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 100px;
  overflow-y: auto;
}

.player-scroll::-webkit-scrollbar { width: 3px; }
.player-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
}

.pl-btn {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
}

.pl-btn:hover {
  background: #1e5eff;
  border-color: white;
}

.pl-btn.selected {
  background: #1e5eff;
  border-color: #1e5eff;
  color: #ffffff;
}

/* ── PITCH MAP ── */
.pitch-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 105 / 68;
  border-radius: 12px;
  overflow: hidden;
  cursor: crosshair;
  background: rgba(30,94,60,0.4);
  border: 1px solid rgba(255,255,255,0.15);
}

#pitchCanvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
}

.pitch-hint {
  font-size: 10px;
  color: #ffffff;
  opacity: 0.35;
  margin-top: 6px;
  text-align: center;
}

/* ── NOTES ── */
.notes-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: none;
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  font-size: 12px;
  outline: none;
  font-family: inherit;
  resize: none;
  height: 60px;
}

.notes-input::placeholder {
  color: #ffffff;
  opacity: 0.35;
}

/* ── ANALYSIS PAGE ── */
.analysis-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.filter-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
}

.filter-btn:hover {
  border-color: rgba(255,255,255,0.4);
}

.filter-btn.active {
  background: #1e5eff;
  border-color: #1e5eff;
  color: #ffffff;
}

.heatmap-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 105 / 68;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(20,60,35,0.5);
  border: 1px solid rgba(255,255,255,0.15);
}

#heatmapCanvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
}

.heatmap-legend {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  font-size: 11px;
  color: #ffffff;
}

.legend-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, #1e5eff, #00e5ff, #facc15, #e85d3a);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 14px;
}

.stat-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #ffffff;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -1px;
  color: #ffffff;
}

.stat-sub {
  font-size: 11px;
  color: #ffffff;
  opacity: 0.6;
  margin-top: 2px;
}

.event-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.breakdown-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.breakdown-label {
  flex: 1;
  color: #ffffff;
}

.breakdown-bar-wrap {
  flex: 2;
  height: 5px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
}

.breakdown-bar {
  height: 100%;
  border-radius: 3px;
  background: #1e5eff;
  transition: width 0.4s ease;
}

.breakdown-count {
  min-width: 20px;
  text-align: right;
  color: #ffffff;
  font-size: 11px;
}

/* ── TOAST ── */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e5eff;
  color: #ffffff;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 9999;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .tag-layout      { grid-template-columns: 1fr; }
  .roster-grid     { grid-template-columns: 1fr; }
  .analysis-layout { grid-template-columns: 1fr; }
  body             { padding-top: 100px; }
}
