/* ============================================================
   TFDrills — Stylesheet
   Dark, fast, mobile-first. Palette pulled from the TFDrills mark:
   near-black background, fire red, steel blue, white highlights.
   ============================================================ */

:root {
  --bg: #0a0a0d;
  --bg-elevated: #15161b;
  --bg-card: #1b1c22;
  --border: #2a2b33;
  --red: #e11d2e;
  --red-dark: #a3141f;
  --blue: #2f6fed;
  --blue-dark: #1f4dab;
  --white: #f5f6f8;
  --gray: #9a9ca6;
  --gray-dim: #6b6d78;
  --green: #2fbf6e;
  --amber: #e0a72b;
  --radius: 14px;
  --radius-sm: 9px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--white);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  padding-bottom: 76px;
}

a { color: inherit; text-decoration: none; }
ul, ol { margin: 8px 0; padding-left: 20px; }
h1, h2, h3, h4 { margin: 0 0 10px; }

.subtle { color: var(--gray); font-size: 0.88rem; }
.fine-print { color: var(--gray-dim); font-size: 0.78rem; line-height: 1.5; margin-top: 12px; }
.link-small { color: var(--blue); font-size: 0.85rem; cursor: pointer; }

/* ---------------- Boot loader ---------------- */
.boot-loader {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.boot-loader img { width: 96px; opacity: 0.85; }

/* ---------------- Header ---------------- */
.tfd-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 10, 13, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.tfd-header-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-logo { width: 34px; height: 34px; object-fit: contain; }
.brand-text {
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 1.05rem;
  background: linear-gradient(90deg, var(--red), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.header-right { display: flex; align-items: center; gap: 10px; }
.profile-chip {
  font-size: 0.72rem;
  color: var(--gray);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.icon-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
}
.badge-dot {
  position: absolute;
  top: -2px;
  right: -6px;
  background: var(--red);
  color: white;
  font-size: 0.6rem;
  border-radius: 999px;
  padding: 1px 5px;
  font-weight: 700;
}

/* ---------------- Main / layout ---------------- */
.tfd-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}
.page-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.page-header h2 { font-size: 1.2rem; }
.back-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--white);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1rem;
}
.section-title { font-size: 1.15rem; margin: 20px 0 12px; }

/* ---------------- Bottom nav ---------------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1;
  background: none;
  border: none;
  color: var(--gray);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 0 8px;
  cursor: pointer;
  font-family: inherit;
}
.nav-item.active { color: var(--red); }
.nav-icon { font-size: 1.25rem; }
.nav-label { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.02em; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.92rem;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.06s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 0.8rem; }
.btn-primary { background: linear-gradient(90deg, var(--red), var(--red-dark)); color: white; }
.btn-outline { background: var(--bg-elevated); border-color: var(--border); color: var(--white); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--gray); }
.btn-fav-active { background: var(--amber); color: #1a1400; border-color: var(--amber); }
.btn-donate { background: linear-gradient(90deg, var(--green), #1f9457); color: white; }

/* ---------------- Onboarding ---------------- */
.onboarding-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.onboarding-card {
  max-width: 420px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
}
.onboarding-logo { width: 88px; margin-bottom: 12px; }
.onboarding-card h1 { font-size: 1.3rem; }
.onboarding-card form { text-align: left; margin-top: 18px; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 0.82rem; color: var(--gray); margin-bottom: 6px; font-weight: 600; }
.field select, .field input[type="text"], .field input[type="email"], .field textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--white);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font-size: 0.95rem;
  font-family: inherit;
}
.field textarea { resize: vertical; }

.shift-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shift-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
.shift-option input { accent-color: var(--red); }
.shift-option:has(input:checked) { border-color: var(--red); background: rgba(225, 29, 46, 0.12); }

/* ---------------- Dashboard ---------------- */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
}
.dash-card-label { font-size: 0.7rem; color: var(--gray-dim); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.dash-card-main { font-weight: 700; font-size: 0.98rem; margin-bottom: 3px; }
.dash-card-sub { font-size: 0.76rem; color: var(--gray); }

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.panel-header h3 { margin: 0; }

.mission-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.mission-label { flex: 1 1 auto; font-size: 0.82rem; }
.mission-bar { flex: 1 1 80px; height: 6px; background: var(--bg-elevated); border-radius: 999px; overflow: hidden; }
.mission-fill { height: 100%; background: linear-gradient(90deg, var(--red), var(--blue)); }
.mission-count { font-size: 0.76rem; color: var(--gray); width: 34px; text-align: right; }

.mini-video-list { display: flex; flex-direction: column; gap: 8px; }
.mini-video-row { display: flex; justify-content: space-between; font-size: 0.82rem; }
.mini-video-drill { font-weight: 600; }
.mini-video-meta { color: var(--gray); font-size: 0.76rem; }

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.grid-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--white);
  font-family: inherit;
}
.grid-btn:active { border-color: var(--red); }
.grid-btn-icon { font-size: 1.6rem; }
.grid-btn-label { font-size: 0.82rem; font-weight: 700; text-align: center; }

/* ---------------- Drill list / detail ---------------- */
.subcat-title { font-size: 0.85rem; color: var(--gray); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 8px; }
.drill-list { display: flex; flex-direction: column; gap: 8px; }
.drill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
}
.drill-row-name { font-weight: 700; font-size: 0.92rem; }
.drill-row-meta { font-size: 0.76rem; color: var(--gray); margin-top: 2px; }
.fav-star { font-size: 1.3rem; color: var(--gray-dim); cursor: pointer; padding: 4px; }
.fav-star.active { color: var(--amber); }

.random-pool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.random-hit { margin-top: 14px; }

.drill-detail h4 { margin-top: 18px; font-size: 0.92rem; color: var(--blue); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.74rem;
  color: var(--gray);
}
.chip-cat { color: var(--blue); border-color: var(--blue-dark); }
.plain-list li { margin-bottom: 4px; font-size: 0.9rem; line-height: 1.4; }
.standard-text {
  font-size: 0.9rem;
  background: rgba(47, 111, 237, 0.1);
  border-left: 3px solid var(--blue);
  padding: 10px 12px;
  border-radius: 0 8px 8px 0;
}

.timer-box {
  margin-top: 20px;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.timer-display { font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; margin-bottom: 10px; }
.timer-controls { display: flex; gap: 10px; justify-content: center; }

.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }

/* ---------------- Challenges ---------------- */
.callout {
  background: rgba(225, 29, 46, 0.1);
  border: 1px solid var(--red-dark);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.82rem;
  margin: 14px 0;
}
.challenge-drill-name { font-size: 1.1rem; font-weight: 800; }
.challenge-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
}
.challenge-card-top { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.86rem; flex-wrap: wrap; }
.vs { color: var(--red); font-size: 0.72rem; }
.challenge-card-drill { margin-top: 6px; font-weight: 700; color: var(--blue); }
.challenge-card-time { font-size: 0.84rem; margin-top: 4px; }
.challenge-card-msg { font-size: 0.82rem; color: var(--gray); font-style: italic; margin-top: 6px; }
.challenge-card-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.status-pill { font-size: 0.72rem; padding: 3px 10px; border-radius: 999px; text-transform: capitalize; font-weight: 700; }
.status-pending { background: rgba(224, 167, 43, 0.15); color: var(--amber); }
.status-accepted { background: rgba(47, 191, 110, 0.15); color: var(--green); }
.status-declined { background: rgba(154, 156, 166, 0.15); color: var(--gray); }
.challenge-actions { display: flex; gap: 8px; }

/* ---------------- Board ---------------- */
.filter-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.filter-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--gray);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
}
.filter-chip.active { background: var(--red); color: white; border-color: var(--red); }

.board-list { display: flex; flex-direction: column; gap: 8px; }
.board-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
}
.board-row-me { background: rgba(47, 111, 237, 0.12); border: 1px solid var(--blue-dark); }
.board-rank { font-weight: 800; font-size: 1rem; width: 34px; color: var(--gray); }
.board-main { flex: 1; }
.board-crew { font-weight: 700; font-size: 0.9rem; }
.board-badges { font-size: 0.9rem; margin-top: 2px; }
.board-stats { text-align: right; font-size: 0.82rem; }

.activity-feed { display: flex; flex-direction: column; gap: 12px; }
.activity-row { display: flex; gap: 10px; align-items: flex-start; }
.activity-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--red); margin-top: 6px; flex-shrink: 0; }
.activity-text { font-size: 0.86rem; }
.activity-time { font-size: 0.72rem; color: var(--gray-dim); }

/* ---------------- Videos ---------------- */
.search-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--white);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 0.9rem;
  margin-bottom: 12px;
  font-family: inherit;
}
.video-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.video-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.video-thumb {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--red-dark), var(--blue-dark));
  font-size: 1.5rem;
  color: white;
}
.video-card-body { padding: 10px; }
.video-drill { font-weight: 700; font-size: 0.82rem; line-height: 1.3; }
.video-meta { font-size: 0.72rem; color: var(--gray); margin-top: 3px; }
.video-stats { font-size: 0.72rem; color: var(--gray-dim); margin-top: 4px; }

/* ---------------- Missions / Badges ---------------- */
.mission-row-full { margin-bottom: 14px; }
.mission-row-full.mission-complete .mission-row-top { color: var(--green); }
.mission-row-top { display: flex; justify-content: space-between; font-size: 0.88rem; margin-bottom: 6px; }

.badge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.badge-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.badge-icon { font-size: 1.8rem; margin-bottom: 6px; }
.badge-name { font-weight: 700; font-size: 0.85rem; }
.badge-desc { font-size: 0.72rem; color: var(--gray); margin-top: 4px; }

/* ---------------- More / notifications / donate ---------------- */
.more-list { display: flex; flex-direction: column; gap: 4px; }
.more-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: none;
  border: none;
  color: var(--white);
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
}
.more-row:last-child { border-bottom: none; }

.notif-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.notif-row:last-child { border-bottom: none; }
.notif-title { font-weight: 700; font-size: 0.86rem; }
.notif-body { font-size: 0.8rem; color: var(--gray); margin-top: 2px; }
.notif-unread .notif-title::before { content: "● "; color: var(--red); }

.donate-panel { border-color: var(--green); }
.transparency { margin-top: 12px; font-size: 0.82rem; color: var(--gray); }
.transparency summary { cursor: pointer; color: var(--green); font-weight: 600; margin-bottom: 8px; }

/* ---------------- Misc ---------------- */
.empty-state {
  text-align: center;
  color: var(--gray-dim);
  padding: 40px 20px;
  font-size: 0.9rem;
}

#toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: white;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.84rem;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 50;
  white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- Desktop widening ---------------- */
@media (min-width: 720px) {
  .bottom-nav { max-width: 720px; left: 50%; transform: translateX(-50%); border-radius: var(--radius) var(--radius) 0 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}
