/* TheHoopersDojo — matrix theme: black primary, matrix-green accent.
   Palette: near-black #0d0f12, off-white text #f5f5f5, neon green #00e676.
   Hard rule: green-on-black only — NEVER green-on-white or light-on-light.
   Min touch target 44px. High contrast everywhere. */

:root {
  --bg: #0d0f12;
  --bg-raised: #16191e;
  --bg-card: #1b1f26;
  --bg-input: #101318;
  --text: #f5f5f5;
  --text-dim: #b8bec7;
  --text-faint: #8b939e;
  --accent: #00e676;
  --accent-dark: #00b35c;
  --accent-soft: rgba(0, 230, 118, 0.12);
  --border: #2b313a;
  --danger: #ff5252;
  --success: #00e676;
  --tabbar-h: 64px;
  --header-h: 58px;
  --radius: 12px;
  --tap: 44px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100%;
}

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  padding-top: env(safe-area-inset-top);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
}
.brand {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.brand .accent-word { color: var(--accent); }
.role-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}
.header-spacer { flex: 1; }
.icon-btn {
  min-width: var(--tap);
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 0 10px;
}
.icon-btn:active { background: var(--bg-card); }

/* ---------- Layout ---------- */
.view { flex: 1; padding: 14px 14px calc(var(--tabbar-h) + 24px); max-width: 860px; width: 100%; margin: 0 auto; }
.view.no-tabs { padding-bottom: 24px; }
.screen-title { font-size: 24px; font-weight: 800; margin: 6px 0 14px; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); margin: 22px 0 10px; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card.tappable { cursor: pointer; width: 100%; text-align: left; color: var(--text); font: inherit; display: block; }
.card.tappable:active { background: var(--bg-raised); border-color: var(--accent); }
.row-head { display: flex; align-items: center; gap: 10px; }
.row-head .grow { flex: 1; min-width: 0; }
.player-name { font-weight: 700; font-size: 17px; }
.player-meta { color: var(--text-dim); font-size: 13px; margin-top: 2px; }
.stat-pill {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 800;
  font-size: 15px;
  white-space: nowrap;
  text-align: center;
}
.stat-pill small { display: block; font-size: 10px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
  background: var(--bg-card);
  border-color: var(--border);
  width: 100%;
}
.btn:active { transform: scale(0.99); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #141414; }
.btn-primary:active { background: var(--accent-dark); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 40px; padding: 8px 12px; font-size: 14px; width: auto; }
.btn-row { display: flex; gap: 10px; margin: 14px 0; }
.btn-row .btn { flex: 1; }
.big-log-btn {
  min-height: 64px;
  font-size: 20px;
  border-radius: 16px;
  margin: 10px 0 18px;
}

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; color: var(--text); }
.field .hint { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="time"], input[type="number"], input[type="url"], select, textarea {
  width: 100%;
  min-height: var(--tap);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 16px;
  padding: 10px 12px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
textarea { min-height: 96px; resize: vertical; }
input[type="range"] { width: 100%; accent-color: var(--accent); min-height: var(--tap); }
.checkbox-list { display: flex; flex-direction: column; gap: 4px; }
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 16px;
}
.checkbox-row input[type="checkbox"] { width: 24px; height: 24px; accent-color: var(--accent); flex: none; }
.searchbar { margin-bottom: 12px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.chip {
  flex: none;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #141414; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  white-space: nowrap;
}
.badge.private { background: #23262c; color: var(--text-dim); }
.badge.player { background: var(--accent-soft); color: var(--success); border-color: var(--success); }
.badge.player_and_parents { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.badge.archived { background: transparent; color: var(--text-faint); }
.badge.todo { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.badge.done { background: var(--accent-soft); color: var(--success); border-color: var(--success); }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  background: var(--bg-raised);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  min-height: var(--tabbar-h);
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  padding: 6px 2px;
}
.tab .ticon { font-size: 20px; line-height: 1; }
.tab.active { color: var(--accent); }

/* ---------- Feed / list items ---------- */
.workout-item, .note-item, .feed-item, .sheet-item { border-left: 3px solid var(--accent); }
.workout-item { border-left-color: var(--accent); }
.meta { color: var(--text-dim); font-size: 13px; }
.empty { text-align: center; color: var(--text-dim); padding: 30px 10px; }
.empty .big { font-size: 40px; display: block; margin-bottom: 8px; }
.quote-text { font-size: 18px; font-style: italic; line-height: 1.5; }
.quote-attr { color: var(--text-dim); margin-top: 8px; text-align: right; }
.video-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; margin-top: 10px; }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 640px) { .modal-backdrop { align-items: center; } }
.modal {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  width: 100%; max-width: 640px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
}
@media (min-width: 640px) { .modal { border-bottom: 1px solid var(--border); border-radius: 18px; } }
.modal-title { font-size: 20px; font-weight: 800; margin: 0 0 14px; }
.temp-pass {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 26px; font-weight: 800;
  background: var(--bg-input);
  border: 2px dashed var(--accent);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  color: var(--accent);
  letter-spacing: 1px;
  margin: 12px 0;
  user-select: all;
}
.warning-box {
  background: rgba(255, 82, 82, 0.1);
  border: 1px solid var(--danger);
  color: var(--text);
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
  margin-bottom: 12px;
}

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
}
.login-card { width: 100%; max-width: 420px; }
.login-logo { text-align: center; font-size: 30px; font-weight: 800; margin-bottom: 6px; }
.login-logo .accent-word { color: var(--accent); }
.login-sub { text-align: center; color: var(--text-dim); margin-bottom: 24px; font-size: 14px; }
.error-box {
  background: rgba(255, 82, 82, 0.12);
  border: 1px solid var(--danger);
  color: #ffb3b3;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
  font-size: 14px;
}

/* ---------- Misc ---------- */
.back-link {
  display: inline-flex; align-items: center;
  min-height: var(--tap);
  background: none; border: none; color: var(--accent);
  font-size: 16px; font-weight: 700; cursor: pointer; padding: 6px 0;
}
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.q-block { margin-bottom: 16px; }
.q-prompt { font-weight: 700; margin-bottom: 6px; }
.q-answer { background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--text); white-space: pre-wrap; }
.totals-row { display: flex; gap: 10px; margin: 12px 0; }
.totals-row .stat-pill { flex: 1; padding: 12px; font-size: 20px; }
.picker-row { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.picker-row select { flex: 1; }
.visibility-toggle { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.note-visibility-label { font-size: 12px; color: var(--text-faint); margin-top: 10px; }

/* =====================================================================
   V2 — Schedule & accountability.
   Palette rule holds: white text on black; type colors used as accent
   borders/badges only, never as text on light backgrounds.
   ===================================================================== */

/* ---------- Mandatory check-in banner ---------- */
.checkin-banner {
  border: 2px solid var(--danger);
  background: rgba(255, 82, 82, 0.12);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.cb-text { font-weight: 800; font-size: 17px; color: var(--text); margin-bottom: 10px; }
.cb-btn { width: 100%; }
.checkin-status { margin: 10px 0; }
.label-sm { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-dim); margin-top: 10px; }

/* ---------- Block-type chips + occurrence cards ---------- */
.tchip {
  display: inline-block;
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px;
  border-radius: 999px; padding: 4px 10px;
  border: 1px solid var(--border);
  color: #fff; background: var(--bg-raised);
  white-space: nowrap;
}
.tchip.training  { border-color: #00e676; background: rgba(0, 230, 118, 0.14); }
.tchip.team      { border-color: #4da3ff; background: rgba(77, 163, 255, 0.14); }
.tchip.recovery  { border-color: #c39bff; background: rgba(195, 155, 255, 0.14); }
.tchip.academic  { border-color: #ffd54f; background: rgba(255, 213, 79, 0.14); }
.tchip.life      { border-color: #bdbdbd; background: rgba(189, 189, 189, 0.14); }

.occ { border-left: 3px solid var(--border); }
.occ-training { border-left-color: #00e676; }
.occ-team     { border-left-color: #4da3ff; }
.occ-recovery { border-left-color: #c39bff; }
.occ-academic { border-left-color: #ffd54f; }
.occ-life     { border-left-color: #bdbdbd; }
.occ-side { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; text-align: right; }

/* ---------- Check-in status badges ---------- */
.badge.ci-done    { background: rgba(0, 230, 118, 0.14); color: var(--success); border-color: var(--success); }
.badge.ci-partial { background: rgba(255, 213, 79, 0.14); color: #ffd54f; border-color: #ffd54f; }
.badge.ci-missed  { background: rgba(255, 82, 82, 0.14); color: var(--danger); border-color: var(--danger); }
.badge.ci-pending { background: transparent; color: var(--text-dim); }

/* ---------- Week view ---------- */
.day-block { margin-bottom: 14px; }
.day-head { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; margin-bottom: 8px; color: var(--text); }
.day-count {
  margin-left: auto; font-size: 12px; font-weight: 700;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: 999px; padding: 2px 9px;
}
.day-empty { padding: 4px 2px 10px; }
.week-nav { display: flex; gap: 10px; margin: 10px 0 14px; }
.week-nav .btn { flex: 1; }
.week-range { text-align: center; font-weight: 800; font-size: 15px; color: var(--text); }
.upnext { border: 2px solid var(--accent); }

/* ---------- Progress bars, spots, scores ---------- */
.progress {
  height: 10px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 999px;
  overflow: hidden; margin-top: 8px;
}
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.2s; }
.spot-row { margin-top: 12px; }
.spot-name { font-weight: 700; font-size: 15px; }
.spot-count { font-weight: 800; font-size: 15px; color: var(--accent); white-space: nowrap; }
.score-wrap { text-align: center; }
.score-big { font-size: 42px; font-weight: 800; color: var(--text); line-height: 1; }
.score-mid { font-size: 26px; font-weight: 800; color: var(--text); }

/* ---------- Logger: segmented mode toggle + partner mode ---------- */
.seg-row { display: flex; gap: 8px; margin: 10px 0; }
.seg-row .btn { flex: 1; }
.partner-toggle { margin-bottom: 10px; }
.partner-btns { display: flex; gap: 12px; margin: 10px 0; }
.partner-btn {
  flex: 1; min-height: 72px;
  font-size: 24px; font-weight: 800;
  border-radius: 16px; border: 2px solid var(--border);
  background: var(--bg-raised); color: var(--text); cursor: pointer;
}
.partner-btn.make { border-color: var(--accent); color: var(--accent); }
.partner-btn.make:active { background: var(--accent-soft); }
.partner-btn.miss { border-color: var(--danger); color: var(--danger); }
.partner-btn.miss:active { background: rgba(255, 82, 82, 0.12); }
.partner-btn span { display: block; font-size: 32px; margin-top: 4px; }

/* ---------- Block form ---------- */
.radio-row { display: flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; font-size: 16px; }
.radio-row input[type="radio"] { width: 22px; height: 22px; accent-color: var(--accent); }

/* ---------- Assigned-workout builder spot rows ---------- */
.spot-form-row { display: grid; grid-template-columns: 1fr 1fr 110px 44px; gap: 8px; margin-bottom: 8px; align-items: center; }
.spot-form-row input { min-height: var(--tap); }
@media (max-width: 560px) { .spot-form-row { grid-template-columns: 1fr 1fr; } }

/* ---------- Per-spot stats ---------- */
.sess-series { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.sess-row { display: flex; align-items: center; gap: 8px; }
.sess-bar { flex: 1; margin-top: 0; }
.sess-pct { font-weight: 800; min-width: 48px; text-align: right; }
.stat-spot { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.stat-spot:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.stat-latest { text-align: center; }
.trend-up   { color: var(--success); font-weight: 800; }
.trend-flat { color: var(--text-dim); font-weight: 800; }
.trend-down { color: var(--danger); font-weight: 800; }
.trend-na   { color: var(--text-faint); font-weight: 600; }

/* ---------- Check-in photos ---------- */
.chk-photo {
  width: 72px; height: 72px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--border); background: var(--bg-input);
}
input[type="file"] { color: var(--text-dim); font-size: 14px; }

/* ---------- Misc V2 ---------- */
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- Shot Chart ---------- */
.shot-svg { width: 100%; height: auto; display: block; background: #000; border: 1px solid var(--border); border-radius: 12px; }
.shot-svg text { font-family: inherit; }

/* ---------- Google-Calendar-style Schedule grid ---------- */
.gcal-toolbar { display: flex; gap: 10px; align-items: center; margin: 14px 0 10px; }
.gcal-toolbar .gcal-switch { flex: 1; margin: 0; }
.gcal-nav { display: flex; gap: 10px; margin: 0 0 14px; }
.gcal-nav .btn { flex: 1; }
.gcal-range { text-align: center; font-weight: 800; font-size: 15px; margin-bottom: 10px; }
.gcal-head { display: flex; }
.gcal-gutter { width: 48px; flex: none; }
.gcal-dayhead { flex: 1; text-align: center; padding-bottom: 8px; min-width: 0; }
.gcal-dow { font-size: 11px; letter-spacing: 1px; color: var(--text-dim); font-weight: 700; }
.gcal-date { font-size: 20px; font-weight: 800; width: 34px; height: 34px; line-height: 34px; margin: 2px auto 0; border-radius: 50%; }
.gcal-date.today-circle { background: #8ab4f8; color: #111; }
.gcal-body { position: relative; }
.gcal-hline { position: absolute; left: 48px; right: 0; border-top: 1px solid rgba(255, 255, 255, 0.10); }
.gcal-hlabel { position: absolute; left: 0; width: 44px; text-align: right; font-size: 11px; color: var(--text-dim); }
.gcal-col { position: absolute; top: 0; border-left: 1px solid rgba(255, 255, 255, 0.08); }
.gcal-event { position: absolute; border-radius: 8px; padding: 3px 5px; overflow: hidden; cursor: pointer; box-sizing: border-box; }
.gcal-ev-title { font-size: 12px; font-weight: 800; line-height: 1.2; }
.gcal-ev-time { font-size: 10px; opacity: 0.85; }
.gcal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 55; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.gcal-backdrop.open { opacity: 1; pointer-events: auto; }
.gcal-drawer { position: fixed; left: 0; top: 0; bottom: 0; width: 288px; max-width: 86vw; background: #141414; border-right: 1px solid var(--border); z-index: 56; transform: translateX(-105%); transition: transform 0.2s; overflow-y: auto; padding: 16px; box-sizing: border-box; }
.gcal-drawer.open { transform: none; }
.gcal-drawer-head { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 17px; margin-bottom: 14px; }
.gcal-leg-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.gcal-dot { width: 16px; height: 16px; border-radius: 4px; flex: none; }
.gcal-colorpick { width: 32px; height: 28px; padding: 0; border: 1px solid var(--border); background: transparent; flex: none; }
.gcal-nameedit { flex: 1; min-width: 0; background: #1e1e1e; border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 6px 8px; font-size: 14px; }
.gcal-addcat { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
