/* --- OPTIONAL: small safety defaults --- */
.hidden { display: none !important; }

/* =========================
   Global Layout (mobile-first)
========================= */
html, body {
  margin: 0;
  padding: 0;
}

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

body {
  font-family: 'Montserrat', 'Roboto', sans-serif;
  background: #000;
  color: #fff;
  display: block;
  width: 100%;
  padding: 4px;           /* minimal side padding */
  font-size: 22px;        /* BIG base font on mobile */
  line-height: 1.5;
}

.hidden { display: none !important; }
.dimmed { opacity: 0.4; }

/* =========================
   Headings & Instructions
========================= */
h1 {
  font-size: 28px;
  text-align: center;
  margin: 6px 0 14px;
}

h2 {
  font-size: 24px;
  margin: 0 0 12px;
}

h3 {
  font-size: 20px;
  margin: 12px 0 8px;
}

.instructionsCard {
  background: #111;
  border-radius: 0;
  padding: 10px 8px;
  margin-bottom: 10px;
  width: 100%;
}

.instructionsCard h3 {
  margin-top: 0;
  font-size: 18px;
}

.instructionsCard ol {
  padding-left: 22px;
  margin: 6px 0 0;
  font-size: 16px;
}

/* legacy .instructions if used anywhere */
.instructions {
  margin-top: 10px;
  font-size: 16px;
  color: #ccc;
  line-height: 1.4;
}

/* =========================
   Buttons
========================= */
.button {
  padding: 8px 16px;
  border-radius: 8px;
  background: #444;
  color: #ffd700;
  border: 1px solid #ffd700;
  cursor: pointer;
  margin: 6px 4px 6px 0;
  font-weight: 600;
  font-size: 18px;
}

.button:hover {
  opacity: 0.85;
}

.secondaryButton {
  background: #222;
  border-color: #777;
  color: #fff;
}

.primaryButton {
  background: #7b2cbf;
  border-color: #e9c46a;
  color: #fff;
}

/* Smaller utility button (Filters, Review Goals) */
.smallButton {
  padding: 4px 10px;
  font-size: 14px;
  margin: 0;
}

/* Text-like link button */
.linkButton {
  background: none;
  border: none;
  color: #e9c46a;
  padding: 0;
  margin-top: 4px;
  font-size: 16px;
  cursor: pointer;
  text-decoration: underline;
}

/* Expand/collapse button */
.expand-btn {
  margin-top: 8px;
  display: inline-block;
  padding: 8px 16px;
  background: #333;
  color: #fff;
  border: 1px solid #444;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
  transition: 0.2s;
}

.expand-btn:hover {
  background: #444;
}

.expand-btn.expanded {
  background: #555;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
}

/* =========================
   Container
========================= */
.container {
  width: 100%;
  max-width: none;
  background: #000;       /* same as body – no "grey card" with black edges */
  padding: 8px 4px;
  border-radius: 0;
  margin-top: 10px;
}

/* =========================
   Metric Headers & Text
========================= */
.metricHeader {
  margin-top: 18px;
}

.metricHeader label {
  font-weight: 600;
  color: #ccc;
  display: block;
  margin-bottom: 4px;
  font-size: 20px;        /* bigger labels */
}

/* Stat + Goal text row */
.valuesRow {
  display: flex;
  justify-content: space-between;
  font-size: 20px;        /* bigger stat text */
  margin-bottom: 6px;
}

.statLabel {
  color: #ffffff;
  font-weight: 600;
}

.goalLabel {
  color: #ffd700;
  font-weight: 600;
}

/* Efficiency goal text */
#effGoalText {
  color: #ffd700 !important;
}

/* Accuracy & Pen box */
.acc-pen-box {
  margin: 10px 0;
  padding: 12px;
  border-left: 3px solid gold;
  background: rgba(255, 215, 0, 0.08);  /* clear coloured background */
  border-radius: 8px;
}

.subLabel {
  font-size: 16px;
  color: #ccc;
  margin-bottom: 6px;
  font-style: italic;
}

/* =========================
   Inputs: PIN, text, textarea, selects
========================= */
input[type="text"],
textarea,
select {
  width: 100%;
  max-width: 100%;
  padding: 8px 10px;
  margin-top: 4px;
  border-radius: 6px;
  border: 1px solid #444;
  background: #111;
  color: #fff;
  font-size: 18px;
}

textarea {
  resize: vertical;
}

/* PIN row status text */
#status {
  margin-left: 6px;
  font-size: 16px;
}

/* =========================
   Sliders (with purple stat bar)
========================= */
input[type=range] {
  width: 100%;
  height: 10px;
  border-radius: 5px;
  margin-bottom: 8px;
  background: #444; /* JS will overwrite with stat bar fill */
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid #e9c46a;
  background: radial-gradient(
    circle,
    rgba(0,0,0,0) 60%,
    #e9c46a 63%
  );
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid #e9c46a;
  background: radial-gradient(circle, rgba(0,0,0,0) 60%, #e9c46a 63%);
  cursor: pointer;
}

/* =========================
   Tooltip
========================= */
.tooltip {
  display: inline-block;
  position: relative;
  margin-left: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #888;
  color: #000;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  line-height: 18px;
  cursor: help;
}

.tooltip span {
  visibility: hidden;
  width: 200px;
  background-color: #333;
  color: #fff;
  text-align: left;
  padding: 6px 8px;
  border-radius: 6px;
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  font-size: 13px;
}

.tooltip:hover span {
  visibility: visible;
}

/* =========================
   Total score
========================= */
.total {
  margin: 6px 0 10px;
  font-weight: 700;
  font-size: 24px;
  text-align: center;
}

.total.good { color: #ffd700; }
.total.bad  { color: #ff4d4d; }

/* =========================
   Reflection / Focus
========================= */
.reflection {
  margin-top: 16px;
  padding-top: 8px;
  border-top: 1px solid #333;
}

.fieldLabel {
  display: block;
  margin-top: 8px;
  font-size: 18px;
}

.sw-fields {
  margin-top: 8px;
}

/* =========================
   Stat Explorer
========================= */
.stat-explorer {
  margin-top: 18px;
  padding-top: 10px;
  border-top: 1px solid #333;
}

.stat-explorer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 18px;
  flex-wrap: wrap;
}

.stat-explorer-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-explorer-controls select {
  font-size: 16px;
}

/* Game cards */
.stat-explorer-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game-card {
  background: #181818;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 16px;
}

.game-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.play-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #e9c46a;
  text-decoration: none;
  font-size: 16px;
  line-height: 1;
  color: #e9c46a;
}

.play-icon:hover {
  background: #e9c46a;
  color: #000;
}

.game-card h4 {
  margin: 0 0 4px;
  font-size: 18px;
}

.game-card a {
  color: #e9c46a;
}

/* =========================
   Coach Dashboard
========================= */
#coachSection {
  margin-top: 16px;
  width: 100%;
  background: #111;
  padding: 12px 8px 18px;
  border-radius: 0;
}

#teamFilter {
  width: 100%;
  margin-bottom: 8px;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 6px;
  font-size: 15px;
}

th, td {
  border: 1px solid grey;
  padding: 6px 4px;
  text-align: center;
}

th {
  cursor: pointer;
  background: #222;
  color: #fff;
}

/* Goal colours */
.goalMet       { color: lime; }
.goalNotMet    { color: red; }
.goalAlmostMet { color: yellow; }

/* =========================
   Loading spinner (small inline one)
========================= */
.loading-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #555;
  border-top-color: #ffd700;
  animation: spin 0.8s linear infinite;
  margin-right: 6px;
  vertical-align: text-bottom;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================
   Global loading overlay with YouTube video
========================= */
.global-loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

.loading-video-wrapper {
  position: absolute;
  inset: 0;
}

.loading-video {
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none; /* don't intercept clicks */
}

.global-loading-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 16px 20px;
  border-radius: 16px;
  background: rgba(10,10,10,0.75);
  border: 1px solid #e9c46a;
  box-shadow: 0 12px 30px rgba(0,0,0,0.8);
  max-width: 280px;
  width: 80%;
}

.global-loading-text {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.global-loading-subtext {
  font-size: 14px;
  color: #ccc;
  opacity: 0.9;
}

/* ============= Coach overlay page ============= */
.coach-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.96);
  z-index: 999;          /* above normal content */
  overflow-y: auto;
  padding-top: 50px;     /* leave space for top bar */
}

.coach-inner {
  max-width: 900px;
  margin: 0 auto 40px;
  padding: 12px 12px 20px;
  background: #111;
  border-radius: 12px;
}

/* ============= Coach advanced graph ============= */
.coach-advanced-panel {
  margin-top: 10px;
  padding: 10px 10px 12px;
  border-radius: 10px;
  background: #181818;
  border: 1px solid #333;
}

.coach-advanced-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  align-items: flex-end;
}

.coach-control {
  min-width: 160px;
  flex: 1 1 160px;
}

.coach-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  margin-top: 4px;
}

.coach-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

/* Optional: on very small screens, make it edge-to-edge */
@media (max-width: 700px) {
  .coach-inner {
    margin: 0 4px 40px;
    border-radius: 8px;
  }
}

/* =========================
   Desktop / larger screens
========================= */
@media (min-width: 700px) {
  body {
    padding: 24px 24px 40px;
    max-width: 900px;
    margin: 0 auto 40px;
    font-size: 18px;  /* slightly smaller on desktop */
  }

  .container,
  .instructionsCard,
  #coachSection {
    max-width: 700px;
    border-radius: 12px;
    margin-left: auto;
    margin-right: auto;
  }
}

  .stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
  }
  @media (max-width: 480px) {
    .stat-grid {
      grid-template-columns: 1fr;
    }
  }
  .stat-card {
    background: #222;
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .stat-card-label {
    font-size: 0.95rem;
  }
  .stat-card-value {
    font-weight: 600;
    font-size: 0.95rem;
  }
  .stat-card.lowMetric {
    border: 1px solid #e9c46a;
    background: #2b1f0f;
  }
  .stat-card.highMetric {
    border: 1px solid #2a9d8f;
    box-shadow: 0 0 0 1px rgba(42,157,143,0.4);
  }
  .stat-card .subLabel {
    font-size: 0.8rem;
    opacity: 0.8;
  }
  .stat-card.clickable {
    cursor: pointer;
  }

  /* Top bar with coach + help icons */
  .top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 6px 0 8px;
  }
  .top-bar h1 {
    flex: 1;
    text-align: center;
    margin: 0;
  }
  .round-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid #e9c46a;
    background: #111;
    color: #e9c46a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
  }
  .help-wrapper {
    position: relative;
  }
  .help-tooltip {
    position: absolute;
    right: 0;
    top: 32px;
    background: #1e1e1e;
    border-radius: 10px;
    padding: 8px 10px;
    width: 270px;
    font-size: 0.8rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    border: 1px solid #333;
    z-index: 10;
  }
  .help-tooltip h4 {
    margin-top: 0;
    margin-bottom: 6px;
    font-size: 0.9rem;
  }
  .help-tooltip ol {
    padding-left: 18px;
    margin: 0;
  }
  .help-tooltip li {
    margin-bottom: 4px;
  }

  /* Reflection card tweak */
  #reflectionSection {
    background: #181818;
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid #333;
  }
  #reflectionSection h4 {
    margin-top: 0;
    margin-bottom: 6px;
  }
  #reflectionSection .fieldLabel {
    font-size: 0.9rem;
  }
  #reflectionSection textarea {
    width: 100%;
    background: #111;
    border-radius: 6px;
    border: 1px solid #444;
    padding: 6px 8px;
    color: #eee;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 60px;
  }
.coach-chart-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #ccc;
  margin-bottom: 0.5rem;
}

.coach-chart-loading.hidden {
  display: none;
}

.coach-chart-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  animation: coach-spin 0.7s linear infinite;
}

@keyframes coach-spin {
  to { transform: rotate(360deg); }
}

  /* Login layout */
  .login-section {
    display: flex;
    justify-content: center;
    margin-top: 16px;
  }
  #loginSection.hidden {
    display: none !important;
  }
  .login-card {
    background: #181818;
    border-radius: 12px;
    padding: 12px 14px;
    border: 1px solid #333;
    max-width: 360px;
    width: 100%;
    text-align: center;
  }
  .login-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 6px;
  }
  .login-logo {
    height: 32px;
    object-fit: contain;
  }
  .login-plus {
    font-size: 1rem;
    opacity: 0.8;
  }
  .login-title {
    margin: 4px 0 0 0;
    font-size: 1.1rem;
  }
  .login-subtitle {
    margin: 4px 0 8px 0;
    font-size: 0.85rem;
    opacity: 0.8;
  }
  .login-form {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
  }
  @media (max-width: 480px) {
    .login-form {
      flex-direction: column;
      align-items: stretch;
    }
  }
