/* Home Field Learning demo (Avery's Show Season): single deliberate light look */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --pitch: #34a06a;
  --pitch-dark: #27835a;
  --pitch-line: rgba(240,255,250,.9);
  --navy: #1a1038;
  --navy-soft: #33236b;
  --cream: #f3f1fb;
  --card: #ffffff;
  --ink: #221a3a;
  --muted: #5f5a78;
  --accent: #7c3aed;
  --gold: #ffb020;
  --radius: 18px;
  --shadow: 0 6px 18px rgba(26,16,56,.18);
}

html { font-size: 16px; }
body {
  font-family: "Avenir Next", "Trebuchet MS", Verdana, system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  display: flex; flex-direction: column;
}

#demoBanner { background: var(--gold); color: #1a1038; font-weight: 800; text-align: center; padding: .5rem .9rem; font-size: .88rem; }

/* ---------- header ---------- */
#topbar {
  background: var(--navy);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1rem;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.logo-btn {
  display: flex; align-items: center; gap: .6rem;
  background: none; border: 0; color: #fff; cursor: pointer;
  font: inherit; font-weight: 800; font-size: 1.15rem; letter-spacing: .3px;
}
.logo-btn .ball { width: 34px; height: 34px; transition: transform .5s; }
.logo-btn:hover .ball { transform: rotate(180deg); }
#scoreboard {
  background: #000; border: 2px solid var(--gold); border-radius: 10px;
  padding: .25rem .8rem; display: flex; align-items: center; gap: .5rem;
  font-variant-numeric: tabular-nums;
}
.score-label { color: var(--gold); font-size: .7rem; font-weight: 800; letter-spacing: 2px; }
#goalCount { color: #7CFC9A; font-weight: 800; font-size: 1.3rem; font-family: "Courier New", monospace; }

/* ---------- main ---------- */
#app { flex: 1; width: 100%; max-width: 1050px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }

.pitch-hero {
  background: linear-gradient(180deg, #1a1038 0%, #33236b 55%, #34a06a 56%, #27835a 100%);
  border-radius: var(--radius);
  padding: 1.6rem 1.4rem 2.4rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 3px solid #7c3aed;
}
.pitch-hero::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 22px; height: 12px;
  background: repeating-linear-gradient(90deg, #27835a 0 24px, #1f6b4a 24px 48px);
  pointer-events: none;
}
.pitch-hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 22px;
  background: repeating-linear-gradient(90deg, #164f37 0 24px, #12492f 24px 48px);
  pointer-events: none;
}
.pitch-hero h1 { font-size: clamp(1.4rem, 4vw, 2.1rem); text-shadow: 0 2px 4px rgba(0,0,0,.35); position: relative; z-index: 1; }
.pitch-hero p { position: relative; z-index: 1; max-width: 34rem; text-shadow: 0 1px 3px rgba(0,0,0,.35); font-weight: 600; }

.season-bar { margin-top: 1rem; position: relative; z-index: 1; }
.season-track {
  background: rgba(0,0,0,.35); border-radius: 99px; height: 22px; overflow: hidden;
  border: 2px solid rgba(255,255,255,.6);
}
.season-fill {
  height: 100%; background: linear-gradient(90deg, var(--gold), var(--accent));
  border-radius: 99px; transition: width .6s ease;
  min-width: 8px;
}
.season-bar small { font-weight: 700; display: block; margin-top: .35rem; }

/* ---------- cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin-top: 1.3rem; }
.subject-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.1rem; cursor: pointer; border: 0; text-align: left; font: inherit;
  border-top: 8px solid var(--sc, var(--pitch));
  transition: transform .15s, box-shadow .15s;
  display: flex; flex-direction: column; gap: .5rem;
}
.subject-card:hover { transform: translateY(-4px); box-shadow: 0 10px 24px rgba(18,35,61,.2); }
.subject-card h2 { font-size: 1.15rem; color: var(--ink); }
.subject-card .jersey { width: 44px; height: 44px; }
.mini-track { background: #e6e9ef; height: 12px; border-radius: 99px; overflow: hidden; }
.mini-fill { height: 100%; background: var(--sc, var(--pitch)); border-radius: 99px; transition: width .4s; }
.subject-card small { color: var(--muted); font-weight: 700; }

/* ---------- week fixtures ---------- */
.crumbs { margin: .2rem 0 1rem; color: var(--muted); font-weight: 700; font-size: .95rem; display:flex; flex-wrap:wrap; gap:.3rem; align-items:center;}
.crumbs button { background: none; border: 0; color: var(--navy-soft); font: inherit; font-weight: 800; cursor: pointer; text-decoration: underline; }
.fixture-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .9rem; }
.fixture {
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: .9rem 1rem;
  border-left: 8px solid var(--sc, var(--pitch)); cursor: pointer; border-top:0; border-right:0; border-bottom:0;
  font: inherit; text-align: left; display: flex; align-items: center; gap: .8rem;
  transition: transform .15s;
}
.fixture:hover { transform: translateY(-3px); }
.matchday {
  background: var(--sc, var(--pitch)); color: #fff; font-weight: 900; border-radius: 10px;
  width: 52px; height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: none; font-size: 1.2rem; line-height: 1;
}
.matchday span { font-size: .55rem; letter-spacing: 1px; }
.fixture h3 { font-size: .98rem; line-height: 1.25; }
.fixture .won { margin-left: auto; flex: none; width: 26px; height: 26px; }

/* ---------- week view ---------- */
.day-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }
.day-tab {
  border: 2px solid var(--sc, var(--pitch)); color: var(--sc, var(--pitch));
  background: #fff; font: inherit; font-weight: 800; border-radius: 99px;
  padding: .45rem .95rem; cursor: pointer; font-size: .92rem;
}
.day-tab.active { background: var(--sc, var(--pitch)); color: #fff; }
.day-tab.done::after { content: " ✓"; }
.day-tab.locked { border-color: var(--muted); color: var(--muted); }

.lesson-panel {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.3rem 1.4rem;
}
.lesson-panel h2 { color: var(--navy); margin-bottom: .6rem; font-size: 1.3rem; }

.content h1, .content h2, .content h3, .content h4 { margin: 1rem 0 .45rem; color: var(--navy); line-height: 1.3; }
.content h3 { font-size: 1.05rem; }
.content p, .content li { margin-bottom: .45rem; }
.content ul, .content ol { padding-left: 1.4rem; margin-bottom: .6rem; }
.content strong { color: var(--navy-soft); }
.content a { color: #1971c2; font-weight: 700; }
.table-wrap { overflow-x: auto; margin: .7rem 0; }
.content table { border-collapse: collapse; min-width: 420px; width: 100%; font-size: .93rem; }
.content th, .content td { border: 1px solid #cdd4de; padding: .45rem .6rem; text-align: left; vertical-align: top; }
.content th { background: #eef2f7; }

.goal-btn {
  margin-top: 1.2rem; background: var(--accent); color: #fff; border: 0; border-radius: 99px;
  font: inherit; font-weight: 900; font-size: 1.05rem; padding: .8rem 1.6rem; cursor: pointer;
  box-shadow: 0 4px 12px rgba(255,143,31,.45);
  display: inline-flex; align-items: center; gap: .55rem;
}
.goal-btn:hover { filter: brightness(1.06); }
.goal-btn.undone { background: #8b95a5; box-shadow: none; }
.goal-btn svg { width: 22px; height: 22px; }

/* coach gate */
.coach-box {
  margin-top: 1rem; border: 2px dashed var(--navy-soft); border-radius: 14px;
  padding: 1rem; background: #eef2f7;
}
.coach-box h3 { color: var(--navy); display: flex; align-items: center; gap: .5rem; }
.coach-box p { color: var(--muted); font-weight: 600; }
.coach-open { background: var(--navy); color: #fff; border: 0; border-radius: 99px; font: inherit; font-weight: 800; padding: .55rem 1.1rem; cursor: pointer; margin-top: .5rem; }

/* guide */
.guide-card { border-top-color: var(--navy) !important; }
.section-list { display: flex; flex-direction: column; gap: 1rem; }
.section-list details {
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 1rem 1.2rem;
}
.section-list summary { font-weight: 900; color: var(--navy); cursor: pointer; font-size: 1.05rem; }

/* goal animation */
#goalFlash {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(18,35,61,.55); z-index: 100; flex-direction: column; gap: 1rem;
}
#goalFlash.show { display: flex; }
#goalFlash .net {
  width: 220px; height: 130px; border: 8px solid #7c3aed; border-radius: 14px;
  background: repeating-linear-gradient(45deg, rgba(124,58,237,.35) 0 14px, rgba(77,208,166,.35) 14px 28px);
}
#goalFlash .flyball { width: 64px; height: 64px; position: absolute; animation: fly .8s ease-out forwards; }
@keyframes fly { from { transform: translate(-260px, 180px) scale(.5) rotate(0); } to { transform: translate(0, -20px) scale(1) rotate(360deg); } }
.goal-word { color: var(--gold); font-size: clamp(2.2rem, 8vw, 4rem); font-weight: 900; text-shadow: 0 3px 0 #000; letter-spacing: 2px; animation: pop .5s ease-out; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- squad & captains ---------- */
.captain { color: var(--navy-soft); font-weight: 800; }
.captain-line { font-style: italic; margin-top: .5rem; font-size: .95rem; }
.squad-box { margin-top: 1.4rem; background: var(--navy); color: #fff; border-radius: var(--radius); padding: 1.2rem 1.3rem; box-shadow: var(--shadow); }
.squad-box h2 { color: var(--gold); }
.squad-box > p { color: #c7d2e2; font-size: .95rem; margin: .3rem 0 .8rem; }
.squad-strip { display: flex; flex-wrap: wrap; gap: .6rem; }
.star-chip { background: #1d3557; border: 1px solid #38507a; border-radius: 12px; padding: .5rem .7rem; display: flex; align-items: center; gap: .55rem; font-size: .82rem; line-height: 1.25; }
.star-avatar { background: var(--gold); color: var(--navy); font-weight: 900; border-radius: 50%; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; flex: none; }
.squad-empty { color: #c7d2e2; font-style: italic; }
.squad-next { color: var(--gold); font-weight: 700; margin-top: .8rem; font-size: .92rem; }

/* ---------- quiz ---------- */
.quiz-score { font-weight: 800; color: var(--muted); margin-bottom: .5rem; }
.quiz-q { font-size: 1.12rem; font-weight: 700; margin-bottom: .8rem; }
.quiz-choices { display: grid; gap: .55rem; }
.quiz-choice { text-align: left; font: inherit; font-size: 1rem; background: #fff; border: 2px solid #cdd4de; border-radius: 12px; padding: .7rem .9rem; cursor: pointer; }
.quiz-choice:hover:not(:disabled) { border-color: var(--navy-soft); }
.quiz-choice.right { border-color: #2f9e44; background: #e6f7ea; font-weight: 800; }
.quiz-choice.wrong { border-color: #d64545; background: #fdecec; }
.quiz-why { margin-top: .8rem; background: #eef2f7; border-radius: 10px; padding: .7rem .9rem; }

/* ---------- chat ---------- */
#chatFab { position: fixed; right: 16px; bottom: 16px; width: 64px; height: 64px; border-radius: 50%; border: 3px solid #fff; background: var(--navy); cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.35); z-index: 90; padding: 4px; }
#chatFab svg { width: 100%; height: 100%; }
#chatFab:hover { transform: scale(1.06); }
#chatPanel { position: fixed; right: 16px; bottom: 90px; width: min(360px, calc(100vw - 32px)); height: min(480px, 70vh); background: #fff; border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.35); z-index: 95; display: flex; flex-direction: column; overflow: hidden; }
#chatPanel[hidden] { display: none; }
.chat-head { background: var(--navy); color: #fff; padding: .7rem .9rem; display: flex; flex-direction: column; position: relative; }
.chat-head strong { font-size: 1.05rem; }
.chat-head span { font-size: .78rem; color: #c7d2e2; }
#chatClose { position: absolute; right: .6rem; top: .6rem; background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; line-height: 1; }
.chat-log { flex: 1; overflow-y: auto; padding: .8rem; display: flex; flex-direction: column; gap: .5rem; background: var(--cream); }
.bubble { max-width: 85%; padding: .55rem .8rem; border-radius: 14px; font-size: .93rem; line-height: 1.4; }
.bubble.bot { background: #fff; border: 1px solid #dde3ec; align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.me { background: var(--navy-soft); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-chips { display: flex; flex-wrap: wrap; gap: .4rem; padding: .5rem .8rem; background: var(--cream); border-top: 1px solid #e2e7ef; }
.chat-chips button { font: inherit; font-size: .78rem; font-weight: 700; background: #fff; border: 1.5px solid var(--navy-soft); color: var(--navy-soft); border-radius: 99px; padding: .3rem .7rem; cursor: pointer; }
.chat-chips button:hover { background: var(--navy-soft); color: #fff; }
.chat-form { display: flex; gap: .5rem; padding: .6rem .8rem; border-top: 1px solid #e2e7ef; background: #fff; }
.chat-form input { flex: 1; font: inherit; font-size: .93rem; border: 2px solid #cdd4de; border-radius: 99px; padding: .45rem .8rem; }
.chat-form input:focus { outline: 2px solid var(--navy-soft); }
.chat-form button { font: inherit; font-weight: 800; background: var(--accent); color: #fff; border: 0; border-radius: 99px; padding: .45rem 1rem; cursor: pointer; }

/* ---------- read aloud ---------- */
.read-btn { display: inline-flex; align-items: center; gap: .45rem; font: inherit; font-weight: 800; font-size: .88rem; background: #eef2f7; color: var(--navy-soft); border: 2px solid var(--navy-soft); border-radius: 99px; padding: .4rem .9rem; cursor: pointer; margin: .2rem 0 .7rem; }
.read-btn svg { width: 18px; height: 18px; }
.read-btn.reading { background: var(--navy-soft); color: #fff; }

/* ---------- season map ---------- */
.map-box { margin: 1.1rem auto 0; max-width: 720px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem 1rem .4rem; }
.map-box h2 { color: var(--navy); font-size: 1.05rem; }
.map-box > p { color: var(--muted); font-weight: 600; font-size: .84rem; margin: .15rem 0 .3rem; }
.map-scroll { overflow-x: auto; }
.map-stop:hover circle { filter: brightness(1.08); }

/* ---------- word training (vocab flashcards) ---------- */
.vocab-intro { color: var(--muted); font-weight: 600; margin-bottom: .9rem; }
.vocab-count { font-weight: 800; color: var(--muted); margin-bottom: .5rem; }
.vocab-card { background: var(--cream); border: 3px solid var(--navy-soft); border-radius: 18px; padding: 2.2rem 1.4rem; text-align: center; cursor: pointer; min-height: 180px; display: flex; flex-direction: column; justify-content: center; gap: .6rem; }
.vocab-card:hover { box-shadow: var(--shadow); }
.vocab-word { font-size: 2rem; font-weight: 900; color: var(--navy); }
.vocab-word.small { font-size: 1.2rem; }
.vocab-tap { color: var(--muted); font-weight: 700; font-size: .9rem; }
.vocab-def { font-size: 1.15rem; line-height: 1.5; max-width: 34rem; margin: 0 auto; }
.vocab-rate { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-top: .9rem; }
.vocab-rate button { font: inherit; font-weight: 900; font-size: 1rem; border: 0; border-radius: 14px; padding: .9rem; cursor: pointer; }
.vocab-again { background: #f4e6cf; color: #8a5a1a; }
.vocab-got { background: #dcefe9; color: #1f6b52; }
.vocab-rate button:active { transform: scale(.97); }
.vocab-done h3 { color: var(--navy); font-size: 1.4rem; margin-bottom: .3rem; }

/* ---------- brain breaks ---------- */
#breakFab { position: fixed; right: 16px; bottom: 92px; width: 64px; border-radius: 16px; border: 3px solid #fff; background: var(--accent); cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.3); z-index: 90; padding: 4px 4px 2px; display: flex; flex-direction: column; align-items: center; color: #fff; font-weight: 900; font-size: .68rem; font-family: inherit; letter-spacing: .5px; }
#breakFab svg { width: 34px; height: 34px; }
#breakFab:hover { transform: scale(1.06); }
#breakModal { position: fixed; inset: 0; background: rgba(18,35,61,.6); z-index: 96; display: flex; align-items: center; justify-content: center; padding: 1rem; }
#breakModal[hidden] { display: none; }
.break-card { background: #fff; border-radius: 18px; max-width: 430px; width: 100%; padding: 1.4rem 1.5rem; box-shadow: 0 16px 50px rgba(0,0,0,.4); max-height: 85vh; overflow-y: auto; }
.break-card h2 { color: var(--navy); margin-bottom: .3rem; }
.break-star { color: var(--accent); font-weight: 800; margin-bottom: .5rem; }
.break-clock { font-family: "Courier New", monospace; font-size: 3rem; font-weight: 900; color: var(--navy); text-align: center; margin: .4rem 0; }
.break-card ol { padding-left: 1.3rem; margin: .5rem 0 .8rem; }
.break-card li { margin-bottom: .4rem; font-weight: 600; }
.break-note { color: var(--muted); font-size: .92rem; margin-bottom: .8rem; }
.break-lengths { display: flex; gap: .6rem; margin-bottom: .8rem; }
.break-lengths button { flex: 1; font: inherit; font-weight: 900; font-size: 1.05rem; background: var(--pitch); color: #fff; border: 0; border-radius: 12px; padding: .8rem 0; cursor: pointer; }
.break-lengths button:hover { background: var(--pitch-dark); }
.break-skip { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }

footer { background: var(--navy); color: #c7d2e2; text-align: center; padding: .8rem; font-size: .85rem; }

@media (max-width: 560px) {
  .logo-btn span { font-size: .95rem; }
  #app { padding: .8rem .7rem 2.5rem; }
  .lesson-panel { padding: 1rem .9rem; }
}
