/* ============================================================
   BrightMind Athletics — shared styles
   Aesthetic: court-side instrument panel. Dark slate, amber accent
   (squash ball under court lights), monospace for data.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg:        #0e1116;   /* court floor at night */
  --panel:     #161b22;   /* raised panel */
  --panel-2:   #1c232d;   /* input wells */
  --line:      #2a323d;   /* hairlines */
  --ink:       #e6edf3;   /* primary text */
  --ink-dim:   #8b96a5;   /* secondary text */
  --amber:     #ffb000;   /* the squash ball */
  --amber-dim: #b87d00;
  --green:     #3fb950;   /* success / streak alive */
  --red:       #f85149;   /* error / streak broken */
  --blue:      #58a6ff;   /* neutral nudge */
  --radius:    10px;
  --display: 'Sora', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  /* Column layout lets the credit footer sit at the bottom of the viewport
     even when the page content is short (see .site-credit margin-top). */
  display: flex;
  flex-direction: column;
}

h1, h2, h3, .display { font-family: var(--display); letter-spacing: -0.01em; }

a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout shells ---------- */
.auth-wrap {
  display: flex; align-items: center; justify-content: center;
  flex: 1 0 auto; padding: 24px;
}
/* body is a flex column, so these shells need an explicit width: with only
   margin:0 auto a flex item shrink-wraps to its content instead of filling up
   to max-width (which left the top bar and content floating narrow and centred
   on desktop). */
.app-wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 20px 80px; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; width: 100%; max-width: 960px; margin: 0 auto;
  border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--display); font-weight: 700; font-size: 18px; display: flex; align-items: center; color: inherit; text-decoration: none; }
a.brand:hover { opacity: 0.85; }
.brand .dot { color: var(--amber); }
.brand-logo { width: 1.4em; height: 1.4em; border-radius: 5px; flex-shrink: 0; display: block; margin-right: 9px; }
.brand-auth { justify-content: center; }
.nav { position: relative; display: flex; gap: 12px; align-items: center; }
.nav button {
  background: none; border: 1px solid var(--line); color: var(--ink-dim);
  padding: 6px 12px; border-radius: 8px; cursor: pointer; font-family: var(--mono);
  font-size: 13px;
}
.nav button:hover { border-color: var(--amber); color: var(--amber); }

/* Hamburger toggle: collapses the nav links into a dropdown so the top bar
   stays compact no matter how many sections a role can see. */
.nav-toggle {
  display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
  width: 40px; height: 34px; padding: 0 9px; flex-shrink: 0;
}
.nav-toggle-bar {
  display: block; width: 100%; height: 2px; border-radius: 2px;
  background: var(--ink-dim); transition: transform .2s ease, opacity .2s ease, background .2s ease;
}
.nav-toggle:hover .nav-toggle-bar { background: var(--amber); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Dropdown panel that holds the actual links */
.nav-menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 60;
  display: none; flex-direction: column; align-items: stretch; min-width: 200px;
  padding: 8px; gap: 2px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
}
.nav-menu.open { display: flex; }
.nav-menu a {
  color: var(--ink-dim); font-size: 14px; padding: 9px 12px; border-radius: 8px;
}
.nav-menu a:hover { color: var(--ink); background: var(--panel-2); text-decoration: none; }
.nav-menu a.active { color: var(--ink); background: var(--panel-2); }
.nav-menu button {
  margin-top: 6px; padding-top: 12px; width: 100%;
  border: none; border-top: 1px solid var(--line); border-radius: 0;
  text-align: left;
}
.nav-menu button:hover { border-color: var(--line); color: var(--amber); }

/* identity chip in the top bar */
.user-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; margin-right: 4px; }
.user-chip:empty, .user-chip .user-name:empty { display: none; }
.user-name { color: var(--ink); }
.user-role {
  font-size: 11px; padding: 2px 8px; border-radius: 20px; text-transform: capitalize;
  background: var(--panel-2); color: var(--amber); border: 1px solid var(--amber-dim);
}
.user-role:empty { display: none; }

/* segmented toggle (e.g. This week / All time) */
.toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.toggle-btn {
  background: none; border: none; color: var(--ink-dim); cursor: pointer;
  font-family: var(--mono); font-size: 12px; padding: 6px 12px;
}
.toggle-btn + .toggle-btn { border-left: 1px solid var(--line); }
.toggle-btn.active { background: var(--amber); color: #1a1200; }
.toggle-btn:not(.active):hover { color: var(--amber); }

/* ---------- Panels ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
}
.panel + .panel, .panel + .grid-2, .grid-2 + .panel, .grid-2 + .grid-2 { margin-top: 18px; }
.panel-title {
  font-family: var(--display); font-weight: 600; font-size: 13px;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--amber);
  margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}
.panel-title::before {
  content: ''; width: 6px; height: 6px; background: var(--amber);
  border-radius: 50%;
}

/* Small round "i" button that pins to the right edge of a panel title. */
.info-btn {
  margin-left: auto; flex: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: none; border: 1px solid var(--line); color: var(--ink-dim);
  font-family: var(--display); font-size: 12px; font-weight: 700; font-style: italic;
  line-height: 1; cursor: pointer; text-transform: none; letter-spacing: 0;
  display: flex; align-items: center; justify-content: center;
}
.info-btn:hover { border-color: var(--amber); color: var(--amber); }

/* Explanatory copy inside an info modal. */
.info-body { font-size: 13.5px; color: var(--ink); line-height: 1.6; margin-top: 10px; }
.info-body h4 {
  font-family: var(--display); font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--amber); margin: 18px 0 6px;
}
.info-body p { margin: 0 0 10px; color: var(--ink-dim); }
.info-body ul { margin: 0 0 10px; padding-left: 18px; color: var(--ink-dim); }
.info-body li { margin-bottom: 4px; }
.info-body b { color: var(--ink); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
label { display: block; font-size: 13px; color: var(--ink-dim); margin-bottom: 6px; }

input[type=text], input[type=email], input[type=password],
input[type=number], input[type=time], select, textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--ink); padding: 11px 12px; border-radius: 8px;
  font-family: var(--mono); font-size: 14px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--amber);
}
textarea { resize: vertical; min-height: 64px; }
select { cursor: pointer; }

.duration-row { display: flex; align-items: center; gap: 8px; }
.duration-row input { width: 88px; }
.duration-row span { color: var(--ink-dim); font-size: 13px; margin-right: 6px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Sliders ---------- */
.slider-row { margin-bottom: 16px; }
.slider-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 6px;
}
.slider-head label { margin: 0; }
.slider-val {
  font-family: var(--mono); font-weight: 600; font-size: 16px; color: var(--amber);
  min-width: 28px; text-align: right;
}
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px;
  background: var(--line); border-radius: 2px; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px;
  background: var(--amber); border-radius: 50%; cursor: pointer;
  border: 3px solid var(--bg);
}
input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px; background: var(--amber); border-radius: 50%;
  cursor: pointer; border: 3px solid var(--bg);
}
.slider-scale {
  display: flex; justify-content: space-between; font-size: 11px;
  color: var(--ink-dim); margin-top: 4px;
}

/* ---------- Buttons ---------- */
.btn {
  width: 100%; background: var(--amber); color: #1a1200; border: none;
  padding: 13px; border-radius: 8px; font-family: var(--display); font-weight: 600;
  font-size: 15px; cursor: pointer; transition: background .15s;
}
.btn:hover { background: #ffc333; }
.btn:disabled { background: var(--panel-2); color: var(--ink-dim); cursor: not-allowed; }
.btn-ghost {
  background: none; border: 1px solid var(--line); color: var(--ink);
}
.btn-ghost:hover { border-color: var(--amber); background: none; }

/* ---------- Consent gate ---------- */
.consent {
  display: flex; gap: 12px; align-items: flex-start; padding: 16px;
  background: var(--panel-2); border: 1px solid var(--amber-dim); border-left: 3px solid var(--amber);
  border-radius: 8px; margin-bottom: 16px; cursor: pointer;
}
.consent input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--amber); flex-shrink: 0; }
.consent span { font-size: 14px; color: var(--ink); line-height: 1.45; }
.consent .consent-label { display: block; font-weight: 600; color: var(--amber); margin-bottom: 3px; letter-spacing: 0.02em; }

/* Flash red when the user tries to sign up without accepting. */
.consent.invalid {
  border-color: var(--red); border-left-color: var(--red);
  background: rgba(248, 81, 73, 0.08);
  animation: consent-shake 0.4s ease;
}
.consent.invalid .consent-label { color: var(--red); }
@keyframes consent-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ---------- Tabs (login/signup) ---------- */
.tabs { display: flex; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1; padding: 10px; text-align: center; cursor: pointer; color: var(--ink-dim);
  font-family: var(--display); font-weight: 600; font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--amber); border-bottom-color: var(--amber); }

/* ---------- Stat / streak ---------- */
.streak-panel {
  text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.streak-num {
  font-family: var(--display); font-weight: 700; font-size: 56px; line-height: 1;
  color: var(--amber); display: flex; align-items: center; justify-content: center; gap: 10px;
}
.streak-label { color: var(--ink-dim); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 6px; }

/* ---------- Log list ---------- */
.log-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.log-row:last-child { border-bottom: none; }
.log-date { color: var(--ink-dim); }
.log-type { color: var(--ink); }
/* Clickable entries (open the detail modal). */
.log-row.clickable { cursor: pointer; margin: 0 -10px; padding: 11px 10px; border-radius: 6px; }
.log-row.clickable:hover { background: var(--panel-2); }
.badge {
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  background: var(--panel-2); color: var(--amber); border: 1px solid var(--amber-dim);
}
.badge.win  { color: var(--green); border-color: var(--green); }
.badge.loss { color: var(--red);   border-color: var(--red); }

/* ---------- Matches KPI tiles ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 560px) { .kpi-grid { grid-template-columns: 1fr 1fr; } }
.kpi {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 14px 10px; text-align: center;
}
.kpi-num { font-family: var(--mono); font-size: 24px; font-weight: 600; color: var(--amber); }
.kpi-label {
  color: var(--ink-dim); font-size: 11px; margin-top: 4px;
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* ---------- Log detail modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .62); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 44px 16px; overflow-y: auto;
}
.modal-card {
  position: relative; width: 100%; max-width: 460px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: 1px solid var(--line); color: var(--ink-dim);
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { border-color: var(--amber); color: var(--amber); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 4px; padding-right: 32px; }
.modal-head > div { flex: 1; min-width: 0; }
.modal-title { font-family: var(--display); font-weight: 700; font-size: 18px; }
.modal-date { color: var(--ink-dim); font-size: 13px; margin-top: 2px; }
.note-text {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 13px; color: var(--ink); white-space: pre-wrap;
  word-break: break-word; margin-top: 8px;
}
.modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.modal-actions .btn { width: auto; flex: 1; }
.btn-danger { background: none; border: 1px solid var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #1a0000; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--panel); border: 1px solid var(--amber); color: var(--ink);
  padding: 13px 22px; border-radius: 10px; font-family: var(--display); font-weight: 600;
  opacity: 0; transition: all .3s; pointer-events: none; z-index: 50;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Messages ---------- */
.msg { font-size: 13px; margin-top: 12px; text-align: center; min-height: 18px; }
.msg.error { color: var(--red); }
.msg.ok { color: var(--green); }

.hint { color: var(--ink-dim); font-size: 13px; margin-top: 4px; }
.section-hidden { display: none; }
.page-title { font-size: 24px; font-weight: 700; margin: 26px 0 4px; }
.page-sub { color: var(--ink-dim); font-size: 14px; margin: 0 0 18px; }
.page-sub:empty { display: none; }
.detail-sub {
  font-family: var(--display); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-dim);
  margin-bottom: 10px;
}

/* ---------- Coach: add player + roster ---------- */
.add-row { display: flex; gap: 10px; align-items: stretch; }
.add-row input { flex: 1; }
@media (max-width: 480px) { .add-row { flex-direction: column; } .add-row .btn { width: 100%; } }

.player-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 10px; margin: 0 -10px; border-bottom: 1px solid var(--line);
  cursor: pointer; border-radius: 8px;
}
.player-row:last-child { border-bottom: none; }
.player-row:hover { background: var(--panel-2); }
.player-row.selected { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--amber); }
.player-id { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.player-name { color: var(--ink); }
.player-email { color: var(--ink-dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-meta { color: var(--ink-dim); font-size: 12px; white-space: nowrap; }
/* The athlete's linked coach/parent, shown under their email. */
.player-rel { color: var(--ink-dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.row-x {
  background: none; border: 1px solid var(--line); color: var(--ink-dim);
  width: 26px; height: 26px; border-radius: 6px; cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.row-x:hover { border-color: var(--red); color: var(--red); }
@media (max-width: 420px) { .player-row .player-meta { display: none; } }

/* ---------- Friends: head-to-head streak line ---------- */
.cmp-streak {
  font-family: var(--display); font-weight: 600; font-size: 15px;
  color: var(--amber); margin-bottom: 12px; display: flex; align-items: center; gap: 6px;
}

/* ---------- Player: linked coach & parent ---------- */
.conn-row { display: flex; gap: 12px; padding: 8px 0; }
.conn-row + .conn-row { border-top: 1px solid var(--line); }
.conn-label { color: var(--ink-dim); min-width: 72px; }
.conn-val { color: var(--ink); flex: 1; min-width: 0; }

/* ---------- Coach: teams ---------- */
.team-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-top: 12px; }
.team-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.team-name { font-family: var(--display); font-weight: 600; flex: 1; }
.team-members { display: flex; flex-wrap: wrap; gap: 8px; }
.team-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 4px 6px 4px 12px;
}
.chip-x {
  background: none; border: none; color: var(--ink-dim); cursor: pointer; font-size: 11px;
  width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.chip-x:hover { color: var(--red); }
.chart-box { position: relative; height: 280px; }
.chart-box.tall { height: 340px; }
.chart-box.compact { height: 220px; }
.empty { color: var(--ink-dim); text-align: center; padding: 30px; font-size: 14px; }

/* ---------- Recommendations (Insights) ---------- */
.rec-list { display: flex; flex-direction: column; gap: 12px; }
.rec-card {
  display: flex; gap: 13px; align-items: flex-start;
  background: var(--panel-2); border: 1px solid var(--line);
  border-left: 3px solid var(--accent, var(--line));
  border-radius: 10px; padding: 14px 16px;
}
.rec-card.warn   { --accent: var(--amber); }
.rec-card.danger { --accent: var(--red); }
.rec-card.info   { --accent: var(--blue); }
.rec-card.good   { --accent: var(--green); }
.rec-icon { font-size: 22px; line-height: 1.2; flex-shrink: 0; }
.rec-title { font-weight: 600; color: var(--ink); font-size: 15px; margin-bottom: 3px; }
.rec-body { color: var(--ink-dim); font-size: 13.5px; line-height: 1.55; }

/* ============================================================
   Mobile / small screens
   ============================================================ */
@media (max-width: 680px) {
  /* The dropdown keeps the bar compact, so it stays a single row on mobile. */
  .topbar { padding: 14px 16px; }

  .app-wrap { padding: 0 14px 64px; }
  .page-title { font-size: 21px; margin-top: 20px; }
  .page-sub { font-size: 13px; }
  .panel { padding: 18px 16px; }
  .panel + .panel, .panel + .grid-2, .grid-2 + .panel, .grid-2 + .grid-2 { margin-top: 14px; }
  .panel-title { flex-wrap: wrap; row-gap: 8px; }

  .chart-box { height: 240px; }
  .chart-box.tall { height: 300px; }
  .chart-box.compact { height: 200px; }
  .auth-wrap { padding: 18px; }

  /* 16px inputs stop iOS from auto-zooming the page on focus. */
  input[type=text], input[type=email], input[type=password],
  input[type=number], input[type=time], select, textarea { font-size: 16px; }
}

@media (max-width: 380px) {
  .brand { font-size: 16px; }
  /* Free up room for the brand + hamburger by dropping the role pill. */
  .user-chip .user-role { display: none; }
}

/* ============================================================
   Landing / home page (index.html)
   ============================================================ */
.landing { flex: 1 0 auto; max-width: 960px; width: 100%; margin: 0 auto; padding: 0 20px; }

/* "Log in" call-to-action inside the landing dropdown */
.nav-menu a.landing-login {
  color: var(--amber); margin-top: 6px; padding-top: 12px;
  border-top: 1px solid var(--line); border-radius: 0;
}
.nav-menu a.landing-login:hover { background: var(--panel-2); color: var(--amber); }

/* On desktop the landing bar has plenty of room, so lay the links out inline
   instead of hiding them behind the hamburger. Mobile (<=680px) still gets the
   compact dropdown, and the authenticated app pages are untouched. */
@media (min-width: 681px) {
  .topbar-landing .nav-toggle { display: none; }
  .topbar-landing .nav-menu {
    position: static; display: flex; flex-direction: row; align-items: center;
    min-width: 0; gap: 4px; padding: 0;
    background: none; border: none; border-radius: 0; box-shadow: none;
  }
  .topbar-landing .nav-menu a { padding: 8px 12px; }
  .topbar-landing .nav-menu a.landing-login {
    margin-top: 0; margin-left: 6px; padding: 8px 14px;
    border: 1px solid var(--line); border-radius: 8px;
  }
  .topbar-landing .nav-menu a.landing-login:hover { border-color: var(--amber); }
}

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 64px 0 52px; }
.hero-eyebrow {
  display: inline-block; font-family: var(--display); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--amber);
  border: 1px solid var(--amber-dim); border-radius: 20px; padding: 5px 14px; margin-bottom: 22px;
}
.hero-title {
  font-family: var(--display); font-weight: 700; font-size: 52px; line-height: 1.05;
  letter-spacing: -0.02em; margin-bottom: 18px;
}
.hero-sub {
  color: var(--ink-dim); font-size: 16px; line-height: 1.6;
  max-width: 560px; margin: 0 auto 30px;
}
.hero-cta { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.btn.hero-btn {
  width: auto; display: inline-block; padding: 14px 30px; text-decoration: none;
  box-shadow: 0 8px 30px rgba(255, 176, 0, .15);
}
.btn.hero-btn:hover { text-decoration: none; }
.hero-link { color: var(--ink-dim); font-size: 14px; }
.hero-link:hover { color: var(--amber); }

/* ---------- Sections ---------- */
.landing-section { padding: 48px 0; border-top: 1px solid var(--line); }
.section-head { text-align: center; margin-bottom: 34px; }
.section-title { font-size: 30px; font-weight: 700; letter-spacing: -0.01em; }
.section-lead { color: var(--ink-dim); font-size: 15px; max-width: 560px; margin: 12px auto 0; line-height: 1.6; }

/* ---------- Feature grid ---------- */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; transition: border-color .15s, transform .15s;
}
.feature-card:hover { border-color: var(--amber-dim); transform: translateY(-2px); }
.feature-icon {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 14px;
}
.feature-card h3 { font-family: var(--display); font-weight: 600; font-size: 16px; margin-bottom: 6px; }
.feature-card p { color: var(--ink-dim); font-size: 14px; line-height: 1.55; }

/* ---------- Install cards ---------- */
.install-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.install-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
}
.install-head {
  font-family: var(--display); font-weight: 600; font-size: 15px; color: var(--ink);
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.install-badge { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); flex-shrink: 0; }
.install-steps { list-style: none; counter-reset: step; }
.install-steps li {
  position: relative; padding: 0 0 14px 40px; color: var(--ink-dim); font-size: 14px; line-height: 1.5;
}
.install-steps li:last-child { padding-bottom: 0; }
.install-steps li strong { color: var(--ink); font-weight: 600; }
.install-steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: -1px; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-2); border: 1px solid var(--amber-dim); border-radius: 50%;
  color: var(--amber); font-family: var(--display); font-weight: 600; font-size: 13px;
}
.kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; padding: 0 5px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; color: var(--ink);
}
.install-note { text-align: center; color: var(--ink-dim); font-size: 13px; margin-top: 18px; }
.install-note strong { color: var(--ink); }

/* ---------- Team ---------- */
.team-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 640px; margin: 0 auto; }
.team-member {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.member-avatar {
  width: 68px; height: 68px; margin: 0 0 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 700; font-size: 24px; color: #1a1200;
  background: linear-gradient(135deg, var(--amber), var(--amber-dim));
}
.member-name { font-family: var(--display); font-weight: 600; font-size: 18px; }
.member-role {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--amber);
  margin-top: 8px; line-height: 1.6; max-width: 200px;
}
.member-bio { color: var(--ink-dim); font-size: 14px; line-height: 1.55; margin: 12px 0 14px; }
.member-link { font-size: 14px; margin-top: 14px; }

/* ---------- Closing CTA ---------- */
.landing-cta { text-align: center; padding: 56px 0 64px; border-top: 1px solid var(--line); }
.landing-cta .section-title { margin-bottom: 22px; }

/* ---------- Landing responsive ---------- */
@media (max-width: 760px) {
  .feature-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .landing { padding-left: 16px; padding-right: 16px; }
  .hero { padding: 44px 0 40px; }
  .hero-title { font-size: 38px; }
  .hero-sub { font-size: 15px; }
  .section-title { font-size: 24px; }
  .install-grid, .team-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .feature-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 32px; }
}

/* ---------- Site credit footer ---------- */
.site-credit {
  max-width: 960px;
  width: 100%;
  /* margin-top:auto pushes the footer to the bottom of the flex-column body,
     so it stays visible even when the page above it is short. */
  margin: auto auto 0;
  padding: 20px;
  border-top: 1px solid var(--line);
  color: var(--ink-dim);
  font-size: 12px;
  text-align: center;
}
/* Amber + underline from the start so the credit link reads as a link,
   not just on hover. */
.site-credit a { color: var(--amber); text-decoration: underline; }
.site-credit a:hover { text-decoration: none; }

/* ---------- Training stats ---------- */
.train-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  text-align: center; margin-bottom: 20px;
}
.train-stat {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 10px;
}
.train-stat-num { font-family: var(--display); font-weight: 700; font-size: 28px; color: var(--amber); line-height: 1; }
.train-stat-label { color: var(--ink-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 8px; }
.train-chart-head {
  font-family: var(--display); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-dim); margin-bottom: 12px;
}
.train-empty { text-align: center; padding: 8px 0; }

/* ---------- Training index ---------- */
.training-subhead {
  font-family: var(--display); font-weight: 600; font-size: 14px;
  color: var(--ink); margin: 4px 0 14px;
}
.activity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
/* Activity cards reuse .feature-card but are links, so reset the anchor colour
   and add the interactive amber border on hover. */
.activity-card { display: block; color: inherit; }
.activity-card:hover { text-decoration: none; border-color: var(--amber); transform: translateY(-2px); }
.activity-card h3 { color: var(--ink); }
.activity-meta {
  display: inline-block; margin-top: 12px; font-family: var(--mono); font-size: 12px;
  color: var(--amber); letter-spacing: 0.04em;
}

/* ---------- Box breathing ---------- */
.detail-back { display: inline-block; margin: 24px 0 2px; color: var(--ink-dim); font-size: 13px; }
.detail-back:hover { color: var(--amber); text-decoration: none; }
.breathe-durations { max-width: 320px; margin: 0 auto 8px; }
.breathe-durations.is-disabled { opacity: .5; pointer-events: none; }
.breathe-stage { display: flex; justify-content: center; align-items: center; padding: 30px 0 10px; }
.breathe-square {
  position: relative;
  width: min(300px, 74vw); height: min(300px, 74vw);
  border: 2px solid var(--line); border-radius: 8px;
  transition: border-color .4s;
}
/* The border glows amber on the "active" phases so inhale/exhale read at a glance. */
.breathe-square[data-phase="inhale"] { border-color: var(--amber); }
.breathe-square[data-phase="exhale"] { border-color: var(--amber-dim); }
.breathe-square[data-phase="done"]   { border-color: var(--green); }
/* The marker rides the perimeter; JS sets left/top (as %) each frame.
   translate(-50%,-50%) keeps its centre on the edge. */
.breathe-marker {
  position: absolute; left: 0; top: 100%;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--amber); transform: translate(-50%, -50%);
  box-shadow: 0 0 12px rgba(255, 176, 0, 0.6);
}
.breathe-center {
  position: absolute; inset: 0; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.breathe-phase { font-family: var(--display); font-weight: 700; font-size: 26px; color: var(--ink); }
.breathe-count { font-family: var(--mono); font-size: 34px; font-weight: 600; color: var(--amber); line-height: 1; min-height: 34px; }
.breathe-remaining { text-align: center; color: var(--ink-dim); font-size: 13px; margin-top: 8px; }
.breathe-controls { display: flex; gap: 12px; margin: 22px auto 0; max-width: 360px; }
.breathe-controls .btn { flex: 1; }

/* ---------- Winning point visualization ---------- */
.viz-toolbar { display: flex; justify-content: flex-end; }
.viz-sound {
  background: none; border: 1px solid var(--line); color: var(--ink-dim);
  font-family: var(--mono); font-size: 12px; padding: 6px 12px; border-radius: 20px;
  cursor: pointer;
}
.viz-sound:hover { border-color: var(--amber); color: var(--amber); }
.viz-stage {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 26px 0 8px;
}
/* A simple amber orb that gently "breathes" (scales) only while .playing,
   so it stops when paused. */
.viz-orb {
  width: min(150px, 44vw); height: min(150px, 44vw); border-radius: 50%;
  background: radial-gradient(circle at 42% 38%, #ffd24d 0%, #ffb000 55%, #d99400 100%);
  box-shadow: 0 0 44px rgba(255, 176, 0, 0.4);
  margin-bottom: 26px;
}
.viz-orb.playing { animation: viz-pulse 5s ease-in-out infinite; }
@keyframes viz-pulse {
  0%, 100% { transform: scale(0.92); }
  50%      { transform: scale(1.06); }
}
.viz-cue { max-width: 460px; }
.viz-title { font-family: var(--display); font-weight: 700; font-size: 24px; color: var(--ink); }
.viz-detail { color: var(--ink-dim); font-size: 15px; line-height: 1.55; margin-top: 10px; }
.viz-progress {
  height: 4px; background: var(--line); border-radius: 2px; overflow: hidden;
  max-width: 460px; margin: 26px auto 0;
}
.viz-progress span {
  display: block; height: 100%; width: 0; background: var(--amber);
  border-radius: 2px; transition: width .3s linear;
}

/* ---------- Ghosting ---------- */
.ghost-config { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.ghost-config .field { margin-bottom: 0; }
.ghost-config.is-disabled { opacity: .55; }
/* The whole stage is the tap target — tapping it after a run cues the next
   direction. */
.ghost-stage {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px 20px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; min-height: 300px; text-align: center; color: inherit;
}
.ghost-stage[data-phase="work"] { border-color: var(--amber); }
.ghost-stage[data-phase="rest"] { border-color: var(--amber-dim); }
.ghost-stage[data-phase="done"] { border-color: var(--green); }
/* The arrow only shows during a work interval. */
.ghost-stage:not([data-phase="work"]) .ghost-arrow { display: none; }
.ghost-arrow { width: min(210px, 58vw); height: min(210px, 58vw); color: var(--amber); }
.ghost-arrow svg { width: 100%; height: 100%; display: block; }
.ghost-label {
  font-family: var(--display); font-weight: 700; font-size: 30px; color: var(--ink);
  text-transform: uppercase; letter-spacing: 0.04em; line-height: 1.1;
}
.ghost-stage[data-phase="rest"] .ghost-label { color: var(--amber); }
.ghost-hint { color: var(--ink-dim); font-size: 13px; }
.ghost-meta {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px;
}
.ghost-chip {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 20px;
  padding: 5px 12px; font-family: var(--mono); font-size: 12px; color: var(--ink-dim);
}
.ghost-chip-time { color: var(--amber); font-weight: 600; }
