/* ===================================================================
   Homerun Learn to Play — styles.css
   Design tokens and shared chrome match the Homerun Baseball Ottawa
   visual identity (same brand tokens as Homerun Lineup / the marketing
   site) — do not alter the five brand hex values below.
   =================================================================== */

:root {
  /* Homerun Baseball Ottawa brand palette — do not alter these five values */
  --brand-navy:   #062448;
  --brand-navy-2: #14294d;
  --brand-red:    #a3301f;
  --brand-red-2:  #8d2418;
  --brand-cream:  #f6f3ec;
  --brand-white:  #ffffff;
  --ink-muted:    #4a5568;

  /* Teaching colours — field diagrams ONLY, never brand chrome */
  --teach-ball:    #dc2626;
  --teach-base:    #facc15;
  --teach-backup:  #16a34a;
  --teach-unit-if: #0d9488;
  --teach-unit-of: #ea580c;
  --teach-battery: #374151;

  /* Derived surfaces */
  --color-bg:            var(--brand-cream);
  --color-surface:       var(--brand-white);
  --color-surface-alt:   #fbf9f4;
  --color-border:        #d8d3c6;
  --color-text:          var(--brand-navy);
  --color-muted:         var(--ink-muted);
  --color-primary:       var(--brand-navy);
  --color-primary-hover: var(--brand-navy-2);
  --color-accent:        var(--brand-red);
  --color-accent-hover:  var(--brand-red-2);

  --radius:    6px;
  --radius-lg: 10px;
  --shadow-card: 0 1px 3px rgba(6, 36, 72, 0.10);
  --shadow-pop:  0 6px 20px rgba(6, 36, 72, 0.18);

  --text-xs:   0.70rem;
  --text-sm:   0.82rem;
  --text-base: 0.90rem;
  --text-md:   1.00rem;
  --text-lg:   1.10rem;
  --text-xl:   1.40rem;
  --text-2xl:  1.75rem;
  --text-3xl:  2.25rem;

  --space-1: 0.25rem;  --space-2: 0.5rem;   --space-3: 0.75rem;
  --space-4: 1rem;     --space-5: 1.5rem;   --space-6: 2rem;   --space-8: 3rem;

  --maxw: 1100px;

  /* Six tier accents — navy → red progression; each is contrast-safe for white text */
  --tier-rookie:  #0a3d6b;
  --tier-sandlot: #062448;
  --tier-diamond: #14294d;
  --tier-select:  #4a2040;
  --tier-elite:   #8d2418;
  --tier-promind: #a3301f;
}

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

html {
  margin: 0;
  padding: 0;
  max-width: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  overflow-x: hidden;
}

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

@media screen {
  body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }
  #app-main {
    flex: 1 0 auto;
  }
  .app-bar,
  .app-footer {
    flex-shrink: 0;
  }
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

table {
  max-width: 100%;
}

p, li, h1, h2, h3, h4, h5, h6, td, th, label, button, a {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

::selection {
  background: var(--brand-navy);
  color: var(--brand-white);
}

/* ---------------- Typography ---------------- */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 0.4em 0;
  line-height: 1.25;
  color: var(--brand-navy);
  font-weight: 700;
}

h1 { font-size: var(--text-2xl); }
h2 {
  font-size: var(--text-xl);
  border-bottom: 2px solid var(--brand-navy);
  padding-bottom: 0.3em;
}
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }

p { margin: 0.4em 0; }

a {
  color: var(--brand-navy);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover { color: var(--brand-navy-2); }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(6, 36, 72, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

ul, ol { margin: 0.4em 0 0.6em; padding-left: 1.4rem; }
li { margin-bottom: 0.3rem; }

/* ---------------- Focus ---------------- */
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--brand-red);
  outline-offset: 2px;
}

/* Cream ring on navy surfaces so the focus mark stays ≥ 3:1 */
.app-bar :focus-visible,
.hero :focus-visible,
.nav-btn:focus-visible,
.hero .btn:focus-visible {
  outline-color: var(--brand-cream);
}

/* ---------------- Forms (shared with existing modal / feedback) ---------------- */
button,
input,
select,
textarea {
  font-family: inherit;
  font-size: var(--text-base);
  line-height: 1.3;
}

button {
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--color-primary);
  background: var(--color-primary);
  color: var(--brand-white);
  border-radius: var(--radius);
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  -webkit-tap-highlight-color: transparent;
}
button:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

input[type="text"],
input[type="search"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  background: var(--brand-white);
}
textarea {
  min-height: 6.5rem;
  resize: vertical;
}

/* ---------------- Skip link ---------------- */
.skip-link {
  position: absolute;
  top: -48px;
  left: 0;
  background: var(--brand-navy);
  color: var(--brand-white);
  padding: 0.55rem 1rem;
  font-size: var(--text-base);
  font-weight: 700;
  z-index: 400;
  border-radius: 0 0 var(--radius) 0;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: top 0.15s ease;
}
.skip-link:focus,
.skip-link:focus-visible {
  top: 0;
  color: var(--brand-white);
  outline: 2px solid var(--brand-cream);
  outline-offset: 2px;
}

/* ---------------- App bar ---------------- */
.app-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  background: var(--brand-navy);
  color: var(--brand-white);
  padding: 0.6rem 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.app-logo {
  height: 64px;
  width: 64px;
  max-width: 64px;
  display: block;
  background: var(--brand-white);
  border-radius: 50%;
  padding: 4px;
  flex: 0 0 auto;
  object-fit: contain;
}
.app-bar-title {
  flex: 1 1 12rem;
  min-width: 0;
}
.app-bar-title h1 {
  font-size: 1.15rem;
  margin: 0;
  color: var(--brand-white);
  border: none;
  padding: 0;
  line-height: 1.2;
}
.app-bar-sub {
  display: block;
  font-size: var(--text-sm);
  color: var(--brand-cream);
  opacity: 0.9;
}
.app-nav {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  width: 100%;
}
.nav-btn {
  background: rgba(255, 255, 255, 0.12);
  color: var(--brand-white);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius);
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  font-size: var(--text-base);
  font-weight: 600;
  min-height: 44px;
  min-width: 44px;
}
.nav-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.55);
  color: var(--brand-white);
}
.nav-btn.active {
  background: var(--brand-white);
  color: var(--brand-navy);
  border-color: var(--brand-white);
  font-weight: 700;
}
.nav-btn-readme {
  background: var(--brand-cream);
  border-color: var(--brand-cream);
  color: var(--brand-navy);
}
.nav-btn-readme:hover {
  background: var(--brand-white);
  border-color: var(--brand-white);
  color: var(--brand-navy);
}
.nav-btn-readme.active {
  background: var(--brand-white);
  color: var(--brand-navy);
  border-color: var(--brand-white);
}

/* ---------------- Main / views ---------------- */
#app-main {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 1rem;
}

.view {
  display: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem 1.5rem;
  margin: 0 auto 1.5rem;
  max-width: var(--maxw);
  min-width: 0;
}
.view.active {
  display: block;
}

#view-home {
  background: transparent;
  border: none;
  padding: 0;
  max-width: none;
  border-radius: 0;
  margin-bottom: 0;
}

#path-root,
#chapter-root,
#quiz-root,
#iq-root,
#review-root,
#glossary-root,
#home-continue,
#home-tier-rail {
  min-width: 0;
}
#home-continue:empty,
#home-tier-rail:empty {
  display: none;
}

/* ---------------- Buttons / generic ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.15rem;
  font-weight: 600;
  font-size: var(--text-base);
  line-height: 1.3;
  text-decoration: none;
  border-radius: var(--radius);
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--brand-white);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: var(--brand-white);
}
.btn-accent {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--brand-white);
}
.btn-accent:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: var(--brand-white);
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--brand-navy);
  color: var(--brand-navy);
}
.btn-ghost:hover {
  background: rgba(6, 36, 72, 0.06);
  color: var(--brand-navy);
}
.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: var(--text-sm);
  min-height: 44px;
}
.btn-secondary {
  background: var(--brand-white);
  color: var(--brand-navy);
  border: 1px solid var(--brand-navy);
}
.btn-secondary:hover {
  background: #efeadd;
  color: var(--brand-navy);
  border-color: var(--brand-navy);
}

.card,
.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.card { padding: 1rem 1.15rem; }
.panel { padding: 0; overflow: hidden; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--brand-navy);
  color: var(--brand-white);
  min-height: 1.5rem;
  white-space: nowrap;
}

.badge-rosette {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--brand-navy);
  color: var(--brand-cream);
  border: 3px solid var(--brand-cream);
  box-shadow: 0 0 0 3px var(--brand-navy);
  flex: 0 0 auto;
  overflow: hidden;
}
.badge-rosette img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.hint {
  color: var(--color-muted);
  font-size: var(--text-sm);
  margin: 0 0 1rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.empty-state {
  text-align: center;
  color: var(--color-muted);
  font-size: var(--text-base);
  padding: 2rem 1rem;
  background: var(--color-surface-alt);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
}
.empty-state p { margin: 0.35rem 0; }

.progress-bar {
  height: 8px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
  width: 100%;
}
.progress-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand-navy);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.toast {
  background: var(--brand-navy);
  color: var(--brand-white);
  padding: 0.7rem 1.15rem;
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 600;
  box-shadow: var(--shadow-pop);
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 100%;
}

#toast-root {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 220;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: min(90vw, 420px);
  pointer-events: none;
}
#toast-root .toast { pointer-events: auto; }
#toast-root:empty { display: none; }

#modal-root:empty { display: none; }

/* Floating feedback button: below modal (z-index 100), above page chrome. */
.feedback-fab {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0.55rem 0.95rem;
  background: var(--brand-red);
  color: var(--brand-white);
  border: none;
  border-radius: 999px;
  box-shadow: var(--shadow-pop);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}
.feedback-fab:hover,
.feedback-fab:focus {
  background: var(--brand-red-2);
  border: none;
  color: var(--brand-white);
}
.feedback-fab:focus-visible {
  outline: 2px solid var(--brand-cream);
  outline-offset: 2px;
}
.feedback-fab-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  display: block;
}
.feedback-fab-label {
  white-space: nowrap;
}

@media (max-width: 767px) {
  .feedback-fab {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    right: 0.75rem;
    bottom: 1rem;
  }
  .feedback-fab-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .feedback-fab {
    transition: none;
  }
}
body.reduced-motion .feedback-fab {
  transition: none;
}

.hidden { display: none !important; }

/* ===================================================================
   HOME
   =================================================================== */

.hero {
  position: relative;
  isolation: isolate;
  background-color: var(--brand-navy);
  background-image: url("brand/diamond-golden-hour.jpg");
  background-size: cover;
  background-position: center;
  color: var(--brand-cream);
  overflow: hidden;
  min-height: 18rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 1rem 2.75rem;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(6, 36, 72, 0.82) 0%,
    rgba(6, 36, 72, 0.90) 100%
  );
  z-index: 0;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("brand/pattern-brand-tile.jpg");
  background-repeat: repeat;
  opacity: 0.08;
  pointer-events: none;
  z-index: 1;
}
.hero-inner {
  position: relative;
  z-index: 2;
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}
.hero-crest {
  width: 96px;
  height: 96px;
  max-width: 96px;
  display: block;
  background: var(--brand-white);
  border-radius: 50%;
  padding: 6px;
  object-fit: contain;
  flex: 0 0 auto;
}
.hero-title {
  font-size: var(--text-2xl);
  color: var(--brand-cream);
  border-bottom: none;
  padding-bottom: 0;
  margin: 0.2rem 0 0;
  max-width: 22ch;
}
.hero-motto {
  font-size: var(--text-md);
  font-style: italic;
  color: var(--brand-cream);
  margin: 0;
  max-width: 36ch;
  opacity: 0.95;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  margin-top: 0.75rem;
}
.hero .btn-ghost {
  background: transparent;
  border-color: var(--brand-cream);
  color: var(--brand-cream);
}
.hero .btn-ghost:hover {
  background: rgba(246, 243, 236, 0.14);
  color: var(--brand-cream);
  border-color: var(--brand-white);
}

.home-body {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.5rem 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.continue-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  background: var(--brand-white);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--brand-red);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1rem 1.2rem;
  min-width: 0;
}
.continue-card p { margin: 0.15rem 0; }

.tier-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.tier-rail-item {
  flex: 1 1 9.5rem;
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: var(--brand-navy);
  color: var(--brand-white);
  border: none;
  border-radius: var(--radius);
  text-align: left;
  cursor: pointer;
  font-weight: 600;
  font-size: var(--text-sm);
}
.tier-rail-item:hover {
  filter: brightness(1.08);
  color: var(--brand-white);
}

.quick-links {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.quick-link-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  width: 100%;
  text-align: left;
  background: var(--brand-white);
  color: var(--brand-navy);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1rem 1.1rem;
  min-height: 44px;
  min-width: 0;
  cursor: pointer;
}
.quick-link-card:hover {
  border-color: var(--brand-navy);
  background: var(--color-surface-alt);
  color: var(--brand-navy);
}
.quick-link-title {
  font-weight: 700;
  font-size: var(--text-md);
  color: var(--brand-navy);
}
.quick-link-blurb {
  font-size: var(--text-sm);
  color: var(--color-muted);
  font-weight: 400;
}

/* ===================================================================
   PATH — tier accordion + chapter cards
   =================================================================== */

.tier-accordion {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  margin-bottom: 0.75rem;
  overflow: hidden;
  --tier-accent: var(--brand-navy);
}
.tier-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 44px;
  padding: 0.7rem 1rem;
  background: var(--tier-accent, var(--brand-navy));
  color: var(--brand-white);
  border: none;
  border-radius: 0;
  cursor: pointer;
  text-align: left;
  font-weight: 700;
  font-size: var(--text-md);
}
.tier-head:hover {
  filter: brightness(1.06);
  color: var(--brand-white);
  background: var(--tier-accent, var(--brand-navy));
}
.tier-head.open {
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}
.tier-body {
  display: none;
  padding: 1rem;
  background: var(--color-surface-alt);
}
.tier-head.open + .tier-body,
.tier-accordion.open .tier-body {
  display: block;
}

.tier-ring {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}
.tier-ring svg {
  width: 48px;
  height: 48px;
  max-width: 48px;
  display: block;
  transform: rotate(-90deg);
}

.chapter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.chapter-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  text-align: left;
  background: var(--brand-white);
  color: var(--brand-navy);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 0.9rem 1rem;
  cursor: pointer;
  font-family: inherit;
}
.chapter-card:hover {
  border-color: var(--brand-navy);
  background: var(--brand-white);
  color: var(--brand-navy);
}
.chapter-card.complete {
  border-left: 4px solid var(--brand-navy);
}
.chapter-card.recommended {
  border-left: 4px solid var(--brand-red);
  box-shadow: var(--shadow-pop);
}
.chapter-card.visited {
  background: var(--color-surface-alt);
}
.chapter-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.7rem;
  font-size: var(--text-xs);
  color: var(--color-muted);
  width: 100%;
}
.chapter-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--tier-accent, var(--brand-navy));
  color: var(--brand-white);
}
.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--brand-navy);
  color: var(--brand-white);
  font-size: var(--text-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-height: 1.4rem;
}

/* Tier accent modifiers (navy → red). White text on each. */
.tier-rookie  { --tier-accent: var(--tier-rookie); }
.tier-sandlot { --tier-accent: var(--tier-sandlot); }
.tier-diamond { --tier-accent: var(--tier-diamond); }
.tier-select  { --tier-accent: var(--tier-select); }
.tier-elite   { --tier-accent: var(--tier-elite); }
.tier-promind { --tier-accent: var(--tier-promind); }

.tier-head.tier-rookie,
.tier-rail-item.tier-rookie,
.chapter-badge.tier-rookie,
[data-tier="rookie"] { --tier-accent: var(--tier-rookie); }

.tier-head.tier-sandlot,
.tier-rail-item.tier-sandlot,
.chapter-badge.tier-sandlot,
[data-tier="sandlot"] { --tier-accent: var(--tier-sandlot); }

.tier-head.tier-diamond,
.tier-rail-item.tier-diamond,
.chapter-badge.tier-diamond,
[data-tier="diamond"] { --tier-accent: var(--tier-diamond); }

.tier-head.tier-select,
.tier-rail-item.tier-select,
.chapter-badge.tier-select,
[data-tier="select"] { --tier-accent: var(--tier-select); }

.tier-head.tier-elite,
.tier-rail-item.tier-elite,
.chapter-badge.tier-elite,
[data-tier="elite"] { --tier-accent: var(--tier-elite); }

.tier-head.tier-promind,
.tier-rail-item.tier-promind,
.chapter-badge.tier-promind,
[data-tier="promind"] { --tier-accent: var(--tier-promind); }

.tier-rail-item.tier-rookie,
.tier-rail-item.tier-sandlot,
.tier-rail-item.tier-diamond,
.tier-rail-item.tier-select,
.tier-rail-item.tier-elite,
.tier-rail-item.tier-promind,
.tier-rail-item[data-tier] {
  background: var(--tier-accent);
  color: var(--brand-white);
}

/* ===================================================================
   CHAPTER READER
   =================================================================== */

.chapter-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}
.chapter-objectives {
  margin: 0;
  padding: 0.85rem 1rem 0.85rem 1.6rem;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
}
.chapter-objectives li { margin-bottom: 0.35rem; }
.chapter-progress {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.section {
  margin: 0 0 1.5rem;
  min-width: 0;
}
.section-heading {
  font-size: var(--text-lg);
  color: var(--brand-navy);
  margin: 0 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--color-border);
}
.section-prose {
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text);
  max-width: 42rem;
}
.section-prose p { margin: 0.45rem 0; }

/* Every HRL_SVG diagram sizes from its viewBox: width 100%, height derived.
   The root <svg> deliberately carries no height attribute — "auto" is invalid
   there — so the aspect ratio is resolved here instead. */
.hrl-svg {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}
.hrl-svg-tierHero { border-radius: var(--radius-lg); }

.section-diagram {
  margin: 0.75rem 0 0.5rem;
  padding: 0.75rem;
  background: var(--brand-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  max-width: 100%;
}
.section-diagram svg {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  color: var(--brand-navy);
}
.diagram-caption {
  font-size: var(--text-sm);
  color: var(--color-muted);
  font-style: italic;
  margin: 0.4rem 0 0;
  text-align: center;
}

/* Teaching colours — field diagrams only */
.section-diagram [data-role="ball"],
.section-diagram [data-teach="ball"] {
  fill: var(--teach-ball);
  stroke: var(--teach-ball);
}
.section-diagram [data-role="base"],
.section-diagram [data-teach="base"] {
  fill: var(--teach-base);
  stroke: var(--brand-navy);
}
.section-diagram [data-role="backup"],
.section-diagram [data-teach="backup"] {
  fill: var(--teach-backup);
  stroke: var(--teach-backup);
}
.section-diagram [data-role="unit-if"],
.section-diagram [data-teach="unit-if"] {
  fill: var(--teach-unit-if);
  stroke: var(--teach-unit-if);
}
.section-diagram [data-role="unit-of"],
.section-diagram [data-teach="unit-of"] {
  fill: var(--teach-unit-of);
  stroke: var(--teach-unit-of);
}
.section-diagram [data-role="battery"],
.section-diagram [data-teach="battery"] {
  fill: var(--teach-battery);
  stroke: var(--teach-battery);
}

/* Hotspot answer feedback. The <g> does not paint; hit shapes carry
   colour plus a thicker stroke so the cue is not colour-only. */
.hrl-hotspot.correct .hrl-hotspot-hit {
  fill: var(--teach-backup);
  fill-opacity: 0.28;
  stroke: var(--teach-backup);
  stroke-width: 3;
}
.hrl-hotspot.wrong .hrl-hotspot-hit {
  fill: var(--teach-ball);
  fill-opacity: 0.28;
  stroke: var(--teach-ball);
  stroke-width: 3;
}
.hrl-hotspot.selected .hrl-hotspot-hit {
  stroke-width: 4;
}

.keypoints {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
  background: var(--color-surface-alt);
  border-top: 3px solid var(--brand-navy);
  border-radius: 0 0 var(--radius) var(--radius);
}
.keypoints li {
  position: relative;
  padding: 0.35rem 0 0.35rem 1.35rem;
  margin-bottom: 0.2rem;
  color: var(--color-text);
  font-size: var(--text-base);
}
.keypoints li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--brand-navy);
  font-weight: 700;
}

.coachnote {
  background: var(--brand-cream);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--brand-red);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin: 0.75rem 0;
  color: var(--color-text);
}
.coachnote p { margin: 0.3rem 0; }

.example-box {
  background: var(--brand-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.9rem 1.05rem;
  margin: 0.75rem 0;
  box-shadow: var(--shadow-card);
}
.example-box p { margin: 0.3rem 0; }

.divisionnote {
  margin: 0.75rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.5rem;
}
.divisionnote table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  min-width: 16rem;
}
.divisionnote th,
.divisionnote td {
  border: 1px solid var(--color-border);
  padding: 0.45rem 0.6rem;
  text-align: left;
  vertical-align: top;
  color: var(--color-text);
}
.divisionnote th {
  background: var(--brand-navy);
  color: var(--brand-white);
  font-weight: 700;
}

.terms-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.85rem;
  margin: 0.5rem 0 0.25rem;
}
.term-btn {
  display: inline;
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 600;
  color: var(--brand-navy);
  text-decoration: underline dotted;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  cursor: pointer;
  min-height: 0;
  min-width: 0;
  line-height: inherit;
}
.term-btn:hover {
  background: none;
  border: none;
  color: var(--brand-navy-2);
  text-decoration-style: solid;
}

.chapter-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.65rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}
.chapter-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.25rem;
  padding: 1rem;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

/* ===================================================================
   QUIZ / BASEBALL IQ
   =================================================================== */

.quiz-shell {
  max-width: 40rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.quiz-progress-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: center;
  align-items: center;
}
.quiz-dot {
  width: 12px;
  height: 12px;
  padding: 0;
  border-radius: 50%;
  background: var(--color-border);
  border: 2px solid var(--color-border);
  min-height: 12px;
  min-width: 12px;
  display: inline-block;
  vertical-align: middle;
  flex: 0 0 auto;
}
button.quiz-dot {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: none;
  position: relative;
}
button.quiz-dot::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--color-border);
  border: 2px solid var(--color-border);
}
.quiz-dot.current {
  background: var(--brand-white);
  border-color: var(--brand-navy);
  box-shadow: 0 0 0 2px var(--brand-navy);
}
button.quiz-dot.current::after {
  background: var(--brand-white);
  border-color: var(--brand-navy);
  box-shadow: 0 0 0 2px var(--brand-navy);
}
.quiz-dot.correct {
  background: var(--brand-navy);
  border-color: var(--brand-navy);
}
button.quiz-dot.correct::after {
  background: var(--brand-navy);
  border-color: var(--brand-navy);
}
.quiz-dot.wrong {
  background: var(--brand-red);
  border-color: var(--brand-red);
}
button.quiz-dot.wrong::after {
  background: var(--brand-red);
  border-color: var(--brand-red);
}

.quiz-prompt {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--brand-navy);
  margin: 0;
  line-height: 1.35;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.choice-btn {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  background: var(--brand-white);
  color: var(--brand-navy);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.7rem 0.95rem;
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
  font-weight: 600;
  font-size: var(--text-base);
}
.choice-btn:hover {
  border-color: var(--brand-navy);
  background: var(--color-surface-alt);
  color: var(--brand-navy);
}
.choice-btn.selected {
  border-color: var(--brand-navy);
  background: #e8eef5;
  color: var(--brand-navy);
  box-shadow: inset 0 0 0 1px var(--brand-navy);
}
.choice-btn.correct {
  border-color: var(--brand-navy);
  background: #e8eef5;
  color: var(--brand-navy);
}
.choice-btn.correct::after {
  content: " ✓";
  margin-left: auto;
  padding-left: 0.5rem;
  font-weight: 700;
  color: var(--brand-navy);
}
.choice-btn.wrong {
  border-color: var(--brand-red);
  background: #f8e8e4;
  color: var(--brand-navy);
}
.choice-btn.wrong::after {
  content: " ✗";
  margin-left: auto;
  padding-left: 0.5rem;
  font-weight: 700;
  color: var(--brand-red);
}

.quiz-explain {
  background: var(--color-surface-alt);
  border-left: 4px solid var(--brand-navy);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.85rem 1rem;
  font-size: var(--text-base);
  color: var(--color-text);
}
.quiz-explain p { margin: 0.3rem 0; }

.quiz-result {
  text-align: center;
  padding: 1.25rem 0.5rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.score-ring {
  width: 120px;
  height: 120px;
  display: grid;
  place-items: center;
  position: relative;
}
.score-ring > * {
  grid-area: 1 / 1;
}
.score-ring svg {
  width: 120px;
  height: 120px;
  max-width: 120px;
  display: block;
  transform: rotate(-90deg);
}

.bbiq-score {
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--brand-navy);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin: 0;
}
.bbiq-band {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.8rem;
  background: var(--brand-navy);
  color: var(--brand-white);
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.topic-breakdown {
  width: 100%;
  text-align: left;
  margin-top: 0.5rem;
  padding: 0.85rem 1rem;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}
.topic-breakdown svg {
  display: block;
  width: 100%;
  max-width: 28rem;
  height: auto;
  margin: 0.5rem auto 0;
}

.answer-review {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.5rem;
}
.answer-review > * {
  background: var(--brand-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
}

/* ===================================================================
   WIDGETS
   =================================================================== */

.widget {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--brand-white);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin: 0.75rem 0 1rem;
}
.widget-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  background: var(--brand-navy);
  color: var(--brand-white);
  font-weight: 700;
  font-size: var(--text-sm);
}
.widget-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem;
  min-width: 0;
}
.widget-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}
.widget-status {
  font-size: var(--text-sm);
  color: var(--color-muted);
  min-height: 1.25em;
}

.token {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0.35rem 0.65rem;
  background: var(--brand-navy);
  color: var(--brand-white);
  border: 2px solid var(--brand-navy);
  border-radius: var(--radius);
  cursor: grab;
  font-weight: 700;
  font-size: var(--text-sm);
  user-select: none;
  touch-action: none;
  transition: box-shadow 0.12s ease, transform 0.12s ease;
}
.token:hover {
  background: var(--brand-navy-2);
  border-color: var(--brand-navy-2);
  color: var(--brand-white);
}
.token.selected {
  box-shadow: 0 0 0 3px var(--brand-red);
  cursor: grabbing;
}
.token.placed {
  cursor: default;
  opacity: 0.92;
  box-shadow: var(--shadow-card);
}

.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0.4rem;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface-alt);
  color: var(--color-muted);
  font-size: var(--text-sm);
  text-align: center;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.dropzone.over {
  border-color: var(--brand-navy);
  border-style: solid;
  background: #e8eef5;
  color: var(--brand-navy);
}
.dropzone.correct {
  border-style: solid;
  border-color: var(--brand-navy);
  background: #e8eef5;
  box-shadow: inset 0 0 0 1px var(--brand-navy);
  color: var(--brand-navy);
}
.dropzone.wrong {
  border-style: solid;
  border-color: var(--brand-red);
  background: #f8e8e4;
  box-shadow: inset 0 0 0 1px var(--brand-red);
  color: var(--brand-navy);
}

/* ===================================================================
   HELP & GUIDE
   =================================================================== */

.readme-content {
  max-width: 760px;
}
.readme-section {
  margin-bottom: 2rem;
}
.readme-section h3 {
  font-size: var(--text-lg);
  margin-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.2rem;
}
.readme-section p,
.readme-section ul,
.readme-section ol {
  margin: 0.3rem 0 0.5rem;
  line-height: 1.6;
  font-size: var(--text-base);
  color: var(--color-text);
}
.readme-section ul,
.readme-section ol { padding-left: 1.4rem; }
.readme-section li { margin-bottom: 0.3rem; }

.help-values {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  list-style: none;
  padding: 0.5rem 0 0.75rem;
  margin: 0.5rem 0 1rem;
}
.help-value {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: 5.5rem;
}
.help-value-icon {
  width: 64px;
  height: 64px;
  max-width: 64px;
  object-fit: contain;
  border-radius: var(--radius);
  background: var(--brand-white);
  border: 1px solid var(--color-border);
}
.help-value-name {
  font-weight: 700;
  color: var(--brand-navy);
  font-size: var(--text-sm);
}

.roots-list {
  padding-left: 1.4rem;
  margin: 0.4rem 0 0.85rem;
}
.roots-list li { margin-bottom: 0.25rem; }

.help-roots-img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  margin: 0.75rem 0 0.25rem;
  border: 1px solid var(--color-border);
}

#version-footer {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin: 0.75rem 0;
}

/* ---------------- App footer ---------------- */
.app-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.75rem;
  width: 100%;
  margin-top: 2rem;
  padding: 0.5rem 1rem 4.5rem;
  border-top: 1px solid rgba(6, 36, 72, 0.12);
  font-size: var(--text-sm);
  color: var(--color-muted);
  background: #efebe3;
}
.app-footer-name {
  font-weight: 600;
  color: var(--brand-navy);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.app-footer-version {
  font-variant-numeric: tabular-nums;
  color: var(--color-muted);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
button.app-footer-link,
a.app-footer-link {
  background: none;
  border: none;
  padding: 0 0.25rem;
  font: inherit;
  color: var(--brand-navy);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button.app-footer-link:hover,
a.app-footer-link:hover,
button.app-footer-link:focus,
a.app-footer-link:focus {
  color: var(--brand-red);
  background: none;
  border: none;
}
button.app-footer-link:focus-visible,
a.app-footer-link:focus-visible {
  outline: 2px solid var(--brand-navy);
  outline-offset: 2px;
}

/* ===================================================================
   MODAL (uiModal.js — #util-modal-overlay / .modal-box)
   =================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 36, 72, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--brand-white);
  color: var(--color-text);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  max-width: 520px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(6, 36, 72, 0.3);
  min-width: 0;
}
.modal-box h3,
.modal-title {
  margin-top: 0;
  color: var(--brand-navy);
}
.modal-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 1rem;
  flex-wrap: wrap;
}

body.modal-open { overflow: hidden; }

#util-modal-box {
  max-width: 32rem;
  max-height: 85vh;
  overflow-y: auto;
}

/* ===================================================================
   FEEDBACK / WHAT'S NEW / UPDATES
   (classes already emitted by feedback.js and appUpdates.js)
   =================================================================== */

.feedback-rating {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.star-rating {
  display: flex;
  flex-direction: row;
  gap: 0.15rem;
}
button.star-btn {
  background: none;
  border: none;
  padding: 0.1rem 0.15rem;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  color: #cfc9ba;
  transition: color 0.15s ease;
  min-height: 44px;
  min-width: 44px;
  border-radius: 0;
}
button.star-btn.star-on { color: #e8a317; }
button.star-btn:hover {
  color: #e8a317;
  background: none;
  border: none;
}
button.star-btn:focus-visible {
  outline: 2px solid var(--brand-navy);
  outline-offset: 2px;
}
.star-rating-label {
  font-size: var(--text-sm);
  color: var(--color-muted);
}

.feedback-intro {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin: 0 0 1rem;
}
.feedback-form { margin: 0; }
.feedback-field { margin-bottom: 0.9rem; }
.feedback-field label {
  display: block;
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: 0.25rem;
  color: var(--brand-navy);
}
#feedback-context,
#feedback-category,
#feedback-details {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font: inherit;
  color: var(--color-text);
  background: var(--brand-white);
  min-height: 44px;
}
#feedback-details {
  resize: vertical;
  min-height: 6.5rem;
}
.feedback-counter {
  display: block;
  text-align: right;
  font-size: var(--text-xs);
  color: var(--color-muted);
  margin-top: 0.2rem;
}
.feedback-error {
  color: var(--brand-red);
  font-size: var(--text-sm);
  font-weight: 600;
  margin: 0 0 0.6rem;
}
.feedback-confirm,
.feedback-confirm-note {
  margin: 0 0 0.7rem;
  line-height: 1.5;
  color: var(--color-text);
}
.feedback-truncated-note {
  margin: 0 0 0.7rem;
  font-size: var(--text-sm);
  color: var(--color-muted);
  line-height: 1.5;
}
.feedback-address-line { margin: 0 0 0.7rem; }
.feedback-email,
code.feedback-email {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--text-sm);
  background: rgba(6, 36, 72, 0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  user-select: all;
  color: var(--brand-navy);
}
.feedback-fallback-text {
  width: 100%;
  min-height: 8rem;
  font-size: var(--text-xs);
  margin-top: 0.6rem;
}

.whatsnew-subtitle {
  font-weight: 600;
  margin: 0 0 0.6rem;
  color: var(--brand-navy);
}
.whatsnew-list {
  margin: 0 0 1rem;
  padding-left: 1.3rem;
}
.whatsnew-list li { margin-bottom: 0.4rem; }
.whatsnew-history-link {
  display: inline-block;
  margin-bottom: 0.5rem;
  min-height: 44px;
  line-height: 44px;
}
.update-lead {
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--color-text);
}
.update-reassure {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin: 0 0 0.5rem;
}
.update-status {
  margin: 0;
  font-weight: 600;
  color: var(--brand-navy);
}

/* ===================================================================
   CHANGELOG PAGE (changelog.html shares this stylesheet)
   =================================================================== */

.changelog-page {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}
.changelog-intro,
.changelog-current {
  font-size: var(--text-sm);
  color: var(--color-muted);
}
.changelog-back {
  color: var(--brand-navy);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.changelog-back:hover { text-decoration: underline; }
.changelog-entry {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(6, 36, 72, 0.12);
}
.changelog-entry:last-child { border-bottom: none; }
h2.changelog-version {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: var(--text-xl);
  color: var(--brand-navy);
  border-bottom: none;
  padding-bottom: 0;
}
.changelog-badge {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.changelog-badge-major { background: var(--brand-red); color: var(--brand-white); }
.changelog-badge-minor { background: var(--brand-navy); color: var(--brand-white); }
.changelog-date {
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-muted);
  margin-left: auto;
}
.changelog-title {
  font-weight: 600;
  margin: 0.3rem 0 0.5rem;
  color: var(--color-text);
}
.changelog-highlights { padding-left: 1.3rem; }
.changelog-highlights li { margin-bottom: 0.35rem; }

/* ===================================================================
   REDUCED MOTION
   Honour both the OS preference and the in-app body.reduced-motion toggle.
   =================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* ===================================================================
   RESPONSIVE
   Single column < 768px; two-column path and chapter layouts ≥ 768px.
   Content capped at --maxw. No horizontal body scroll at 360px.
   =================================================================== */

@media (min-width: 768px) {
  .app-nav {
    width: auto;
    margin-left: auto;
    flex: 1 1 auto;
    justify-content: flex-end;
  }

  .quick-links {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .chapter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .chapter-header {
    display: grid;
    grid-template-columns: 1fr minmax(10rem, 16rem);
    gap: 1rem 1.5rem;
    align-items: start;
  }

  .widget-body {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .widget-body > * {
    flex: 1 1 16rem;
    min-width: 0;
  }

  .app-footer > * + *::before {
    content: "·";
    margin-right: 0.75rem;
    color: var(--color-muted);
    pointer-events: none;
    text-decoration: none;
  }
}

@media (min-width: 1024px) {
  #app-main { padding: 1.25rem 1.5rem; }

  .hero {
    min-height: 22rem;
    padding: 3.25rem 1.5rem 3.5rem;
  }
  .hero-title { font-size: var(--text-3xl); max-width: none; }

  .chapter-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (max-width: 767px) {
  #app-main { padding: 0.75rem; }

  .view {
    padding: 0.9rem 0.9rem 1.2rem;
    margin-bottom: 1rem;
    border-radius: var(--radius);
  }

  .hero {
    min-height: 16rem;
    padding: 1.75rem 0.85rem 2rem;
  }
  .hero-title { font-size: var(--text-xl); }
  .hero-crest { width: 80px; height: 80px; max-width: 80px; }
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    width: min(100%, 22rem);
  }
  .hero-actions .btn { width: 100%; }

  .home-body { padding: 1.1rem 0 1.5rem; }

  .app-bar { padding: 0.5rem 0.75rem; gap: 0.55rem; }
  .app-logo { width: 56px; height: 56px; max-width: 56px; }
  .app-bar-title h1 { font-size: 1.02rem; }

  .chapter-nav { flex-direction: column; }
  .chapter-nav .btn,
  .chapter-cta .btn { width: 100%; }

  .modal-box { padding: 1rem 1.05rem; }

  .app-footer {
    gap: 0.35rem 0.65rem;
    padding: 0.65rem 0.75rem 4.75rem;
    text-align: center;
  }
}

@media (max-width: 479px) {
  .changelog-date { margin-left: 0; }
  .tier-rail-item { flex: 1 1 100%; }
}

/* ===================================================================
   PRINT
   Hide chrome. Chapter reader prints on white with a page break
   between sections; diagrams shrink to the page width.
   =================================================================== */

@media print {
  .no-print,
  .app-bar,
  .app-nav,
  .chapter-nav,
  .app-footer,
  .skip-link,
  .hero-actions,
  .modal-overlay,
  #toast-root,
  #modal-root,
  #util-modal-overlay {
    display: none !important;
  }

  html, body {
    background: #fff;
    color: #000;
    overflow: visible;
    font-size: 11pt;
    line-height: 1.4;
  }

  #app-main {
    padding: 0;
    max-width: none;
  }

  .view {
    display: none !important;
    background: #fff;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
    max-width: none;
  }
  .view.active {
    display: block !important;
  }

  h1, h2, h3, h4 {
    color: #000;
    border-color: #000;
  }

  a { color: #000; }

  .hero {
    background: #fff;
    color: #000;
    min-height: 0;
    padding: 0 0 1rem;
  }
  .hero::before,
  .hero::after { display: none; }
  .hero-title,
  .hero-motto { color: #000; }
  .hero-crest {
    background: #fff;
    filter: none;
  }

  .section {
    break-inside: avoid;
    page-break-inside: avoid;
    page-break-after: always;
    break-after: page;
  }
  .section:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  .section-diagram,
  .section-diagram svg,
  .section-diagram img,
  .help-roots-img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .coachnote,
  .example-box,
  .keypoints,
  .widget,
  .chapter-card,
  .continue-card {
    box-shadow: none;
    background: #fff;
    border-color: #999;
  }

  .chapter-cta,
  .widget-actions,
  .widget-head {
    background: #fff;
    color: #000;
  }
}
