:root {
  --yellow: #FFC529;
  --yellow-deep: #F2A900;
  --navy: #1B2659;
  --navy-soft: #4A5585;
  --red: #E5432D;
  --green: #1F9D55;
  --sky: #E7F2FF;
  --white: #FFFFFF;
  --line: #C9D8EE;
  --display: 'Fredoka', 'Trebuchet MS', 'Arial Rounded MT Bold', sans-serif;
  --body: 'Atkinson Hyperlegible', 'Segoe UI', Verdana, sans-serif;
  --nav-h: 68px;
  --radius-sm: 10px;
  --radius-lg: 22px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--navy);
  background: var(--sky);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 16px);
}
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0 0 .5rem; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 .75rem; }
a { color: var(--navy); }
.muted { color: var(--navy-soft); }
:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---------- status banner ---------- */
.status-banner {
  font-family: var(--display); font-weight: 600; font-size: 1.05rem;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  text-align: center; color: var(--white);
}
.status-banner.green { background: var(--green); }
.status-banner.yellow { background: #EA6A12; } /* "heads up" shows as orange so it stands out from the yellow header */
.status-banner.red { background: var(--red); }
.status-banner.blue { background: #2563C9; }
.status-banner.purple { background: #6D3FC0; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--yellow);
  border-bottom: 4px solid var(--navy);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 1.15rem; flex: 1; min-width: 0; }
.brand span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-bus { font-size: 1.6rem; }
.bucks-pill {
  font-family: var(--display); font-weight: 700; text-decoration: none;
  background: var(--white); border: 2px solid var(--navy); border-radius: 999px; padding: 4px 12px; white-space: nowrap;
}
.icon-btn {
  min-width: 44px; min-height: 44px; border: 2px solid var(--navy); border-radius: 12px;
  background: var(--white); font-size: 1.2rem; cursor: pointer; color: var(--navy);
}

/* ---------- layout ---------- */
main { max-width: 720px; margin: 0 auto; padding: 16px 14px 24px; outline: none; }
.section { margin: 22px 0; }
.panel { background: var(--white); border-radius: var(--radius-lg); padding: 18px; border: 2px solid var(--line); }
.back { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; text-decoration: none; margin-bottom: 10px; min-height: 44px; }

/* ---------- bottom nav: bus stops ---------- */
.stops {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--navy); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.stops a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--nav-h); color: #CCD4F2; text-decoration: none; font-size: .8rem; font-weight: 700;
}
.stops a span { font-size: 1.4rem; line-height: 1; }
.stops a[aria-current="page"] { color: var(--navy); background: var(--yellow); border-radius: 0 0 16px 16px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 10px 20px; border-radius: 14px; border: 3px solid var(--navy);
  background: var(--white); color: var(--navy); font: 600 1.1rem var(--display);
  cursor: pointer; text-decoration: none; box-shadow: 0 4px 0 var(--navy);
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--navy); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-go { background: var(--green); color: var(--white); }
.btn-yellow { background: var(--yellow); }
.btn-red { background: var(--red); color: var(--white); }
.btn-block { width: 100%; }
.btn-small { min-height: 44px; padding: 6px 14px; font-size: 1rem; box-shadow: 0 3px 0 var(--navy); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Bus Bucks ticket ---------- */
.ticket {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1fr var(--stub);
  background: var(--yellow); color: var(--navy);
  border-radius: 18px;
  /* notches at the top and bottom of the perforation */
  --stub: 138px;
  -webkit-mask: radial-gradient(circle 13px at calc(100% - var(--stub)) 0, transparent 98%, #000) top / 100% 51% no-repeat,
                radial-gradient(circle 13px at calc(100% - var(--stub)) 100%, transparent 98%, #000) bottom / 100% 51% no-repeat;
          mask: radial-gradient(circle 13px at calc(100% - var(--stub)) 0, transparent 98%, #000) top / 100% 51% no-repeat,
                radial-gradient(circle 13px at calc(100% - var(--stub)) 100%, transparent 98%, #000) bottom / 100% 51% no-repeat;
}
.ticket::after { /* shimmer: proves the screen is live, not a screenshot */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.55) 50%, transparent 65%);
  transform: translateX(-100%); animation: shimmer 3.2s ease-in-out infinite;
}
@keyframes shimmer { 60%, 100% { transform: translateX(100%); } }
.ticket-main { padding: 18px 18px 16px 22px; }
.ticket-label { font-family: var(--display); font-weight: 600; font-size: 1.05rem; }
.ticket-points { font-family: var(--display); font-weight: 700; font-size: 4.2rem; line-height: 1; letter-spacing: -1px; }
.ticket-points small { font-size: 1.1rem; font-weight: 600; letter-spacing: 0; margin-left: 4px; }
.ticket-week { font-size: .95rem; margin-top: 4px; }
.ticket-stub {
  border-left: 3px dashed var(--navy); padding: 16px 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.stamp {
  width: 116px; height: 116px; border-radius: 50%; border: 3px solid var(--red); color: var(--red);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  font-family: var(--display); font-weight: 700; line-height: 1.05; transform: rotate(-12deg);
  background: rgba(255,255,255,.35);
}
.stamp b { font-size: 1.05rem; }
.stamp span { font-size: .78rem; }
.stamp .countdown { display: flex; flex-direction: column; margin-top: 2px; }
.stamp .cd-days { font-size: .9rem; }
.stamp .cd-time { font-size: .95rem; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badge { background: var(--white); border: 2px solid var(--navy); border-radius: 999px; padding: 2px 10px; font-size: .9rem; font-weight: 700; }
.ticket-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }
.link-btn { background: none; border: 0; color: var(--navy-soft); text-decoration: underline; font: inherit; font-size: .95rem; cursor: pointer; min-height: 44px; padding: 0 4px; }

/* ---------- home ---------- */
.ride-cta { text-decoration: none; display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--white); border: 3px solid var(--navy); border-radius: var(--radius-lg); padding: 14px 16px; cursor: pointer; font: inherit; color: inherit; box-shadow: 0 5px 0 var(--navy); }
.ride-cta:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--navy); }
.ride-cta .big { font-size: 2.4rem; }
.ride-cta strong { font-family: var(--display); font-size: 1.35rem; display: block; }
.verse-teaser blockquote { margin: 0 0 12px; font-size: 1.2rem; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile {
  display: flex; flex-direction: column; gap: 6px; padding: 16px; min-height: 110px;
  background: var(--white); border: 2px solid var(--line); border-radius: var(--radius-sm);
  text-decoration: none; font-family: var(--display); font-weight: 600; font-size: 1.1rem;
}
.tile .t-icon { font-size: 2rem; }
.tile small { font-family: var(--body); font-weight: 400; font-size: .9rem; color: var(--navy-soft); }
.tile.done { border-color: var(--green); }

/* ---------- the verse can't be selected or copied ---------- */
.verse-card, .fill-text, .letters, .tray, .pool, .result-words {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.trivia-about { background: var(--navy); color: var(--white); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 12px; }
.trivia-about strong { display: block; font-family: var(--display); font-size: 1.25rem; color: var(--yellow); }

/* ---------- about ---------- */
.about-welcome { font-size: 1.15rem; }
.about-card { margin-bottom: 14px; }
.about-card h2 { font-size: 1.25rem; }
.about-card p { margin-bottom: 6px; }
.about-name { font-family: var(--display); font-weight: 600; font-size: 1.4rem; }
#ride { scroll-margin-top: 80px; }

/* ---------- this sunday ---------- */
.sunday-card { background: var(--white); border-radius: var(--radius-lg); border-left: 10px solid var(--red); padding: 14px 16px; }
.sunday-card h2 { font-size: 1.6rem; margin-bottom: 6px; }
.sunday-card p { margin: 2px 0; }
.sunday-when { font-weight: 700; color: var(--red); }
.no-bus { color: var(--red); font-weight: 700; }

/* ---------- verse ---------- */
.verse-card { background: var(--navy); color: var(--white); border-radius: var(--radius-lg); padding: 22px 20px; }
.verse-card blockquote { margin: 0 0 6px; font-family: var(--display); font-weight: 500; font-size: 1.45rem; line-height: 1.35; }
.verse-card cite { font-style: normal; font-weight: 700; color: var(--yellow); }
.verse-card.covered blockquote { filter: blur(9px); user-select: none; }
.verse-card .row .btn { margin-top: 14px; }
.verse-card .ghost { background: transparent; color: var(--white); border-color: var(--white); box-shadow: 0 4px 0 rgba(255,255,255,.35); }
.verse-card .btn { margin-top: 14px; }
.game-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0 12px; }
.game-tabs button {
  min-height: 56px; border-radius: 14px; border: 2px solid var(--navy); background: var(--white); color: var(--navy);
  font: 600 .98rem var(--display); cursor: pointer; padding: 4px;
}
.game-tabs button[aria-selected="true"] { background: var(--yellow); border-width: 3px; }

/* chips (scramble, word bank) */
.tray { min-height: 72px; border: 3px dashed var(--line); border-radius: var(--radius-sm); padding: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; background: var(--white); }
.pool { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  min-height: 46px; padding: 6px 14px; border-radius: 12px; border: 2px solid var(--navy);
  background: var(--yellow); color: var(--navy); font: 600 1.05rem var(--display); cursor: pointer;
}
.chip.placed { background: var(--white); }
.chip.ok { background: var(--green); color: var(--white); border-color: var(--green); }
.chip.used { visibility: hidden; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.fill-text { font-size: 1.25rem; line-height: 2.4; background: var(--white); border-radius: var(--radius-sm); padding: 12px 14px; }
.blank {
  display: inline-block; min-width: 72px; min-height: 40px; padding: 0 10px; vertical-align: middle; line-height: 36px;
  border: 0; border-bottom: 3px solid var(--navy); background: var(--sky); border-radius: 8px 8px 0 0;
  font: 600 1.1rem var(--display); color: var(--navy); cursor: pointer;
}
.blank.selected { background: #FFE9A6; }
.blank.ok { background: #D4F2E0; border-color: var(--green); cursor: default; }
.blank.wrong { background: #FBD8D2; border-color: var(--red); }

.letters { font-family: var(--display); font-size: 1.35rem; line-height: 2.1; background: var(--white); border-radius: var(--radius-sm); padding: 12px 14px; }
.letters button { font: inherit; background: none; border: 0; border-bottom: 2px dotted var(--navy-soft); color: var(--navy); cursor: pointer; padding: 0 3px; min-height: 40px; }
.letters button.peek { background: #FFE9A6; border-radius: 6px; }
textarea.recall { width: 100%; min-height: 120px; font: 1.1rem var(--body); padding: 12px; border-radius: var(--radius-sm); border: 2px solid var(--navy); margin-top: 12px; }
.result-words span { padding: 1px 3px; border-radius: 4px; }
.result-words .hit { background: #D4F2E0; }
.result-words .miss { background: #FBD8D2; text-decoration: underline; }

.levels { display: flex; gap: 8px; margin-bottom: 12px; }
.levels button { flex: 1; min-height: 46px; border-radius: 12px; border: 2px solid var(--navy); background: var(--white); font: 600 1rem var(--display); color: var(--navy); cursor: pointer; }
.levels button[aria-pressed="true"] { background: var(--navy); color: var(--white); }

/* ---------- arcade / sequence / quiz ---------- */
.seq-done { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.seq-done li { display: flex; gap: 10px; align-items: center; background: #D4F2E0; border-radius: 10px; padding: 8px 12px; font-weight: 700; }
.seq-done li b { font-family: var(--display); min-width: 1.6em; }
.seq-pool { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.seq-pool .chip { text-align: left; background: var(--white); line-height: 1.25; padding: 10px 12px; }
.seq-pool .chip .ic { font-size: 1.5rem; display: block; }
.progress { height: 12px; background: var(--white); border: 2px solid var(--navy); border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.progress div { height: 100%; background: var(--green); transition: width .3s; }
.q-prompt { font-family: var(--display); font-weight: 600; font-size: 1.35rem; margin-bottom: 14px; }
.q-prompt .q-icon { font-size: 3.5rem; display: block; }
.choices { display: grid; gap: 10px; }
.choice {
  min-height: 56px; text-align: left; padding: 10px 16px; border-radius: 14px; border: 2px solid var(--navy);
  background: var(--white); color: var(--navy); font: 600 1.08rem var(--body); cursor: pointer;
}
.choice.right { background: var(--green); color: var(--white); border-color: var(--green); }
.choice.wrong { background: var(--red); color: var(--white); border-color: var(--red); }
.choices.two { grid-template-columns: 1fr 1fr; }
.choices.two .choice { text-align: center; min-height: 72px; font-family: var(--display); }
.explain { margin-top: 12px; padding: 12px 14px; background: var(--sky); border-radius: var(--radius-sm); }
.explain cite { font-style: normal; font-weight: 700; }
.finish { text-align: center; padding: 8px 0; }
.big-emoji { font-size: 3.5rem; text-align: center; }

/* ---------- crossword ---------- */
.xw-clue-bar { position: sticky; top: 70px; z-index: 5; background: var(--navy); color: var(--white); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 10px; min-height: 64px; }
.xw-clue-bar cite { font-style: normal; color: var(--yellow); font-weight: 700; }
.xw-wrap { overflow-x: auto; padding-bottom: 6px; }
.xw-grid { display: grid; gap: 2px; margin: 0 auto; }
.xw-cell { position: relative; aspect-ratio: 1; }
.xw-cell input {
  display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; margin: 0; border: 2px solid var(--navy); border-radius: 4px; padding: 0; text-align: center;
  font: 700 clamp(.9rem, 4.5vw, 1.35rem) var(--display); text-transform: uppercase; color: var(--navy); background: var(--white);
  caret-color: transparent;
}
.xw-cell input:focus { outline: none; background: var(--yellow); }
.xw-cell.hl input { background: #FFF1C2; }
.xw-cell input:focus { background: var(--yellow); }
.xw-cell.bad input { background: #FBD8D2; }
.xw-cell.good input { background: #D4F2E0; }
.xw-num { position: absolute; top: 1px; left: 3px; font-size: .6rem; font-weight: 700; pointer-events: none; }
.xw-clues { display: grid; gap: 14px; margin-top: 16px; }
@media (min-width: 560px) { .xw-clues { grid-template-columns: 1fr 1fr; } }
.xw-clues ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.xw-clues button { width: 100%; text-align: left; background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; color: inherit; cursor: pointer; }
.xw-clues button.active { border: 2px solid var(--navy); background: #FFF1C2; }
.xw-clues button.solved { color: var(--green); }

/* ---------- events ---------- */
.event { display: grid; grid-template-columns: 74px 1fr; gap: 14px; background: var(--white); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 14px; border: 2px solid var(--line); }
.event-date { background: var(--red); color: var(--white); border-radius: 14px; text-align: center; padding: 8px 4px; font-family: var(--display); align-self: start; }
.event-date b { display: block; font-size: 1.9rem; line-height: 1; }
.event-date span { font-size: .85rem; font-weight: 600; }
.event h3 { font-size: 1.3rem; }
.event .meta { color: var(--navy-soft); font-size: .95rem; margin-bottom: 6px; }
.going { font-weight: 700; color: var(--green); margin-left: 4px; }

/* ---------- forms & dialog ---------- */
label { display: block; font-weight: 700; margin-bottom: 12px; }
input, textarea, select {
  display: block; width: 100%; margin-top: 4px; min-height: 48px; padding: 10px 12px;
  font: 1.05rem var(--body); color: var(--navy); border: 2px solid var(--navy-soft); border-radius: 10px; background: var(--white);
}
input:focus, textarea:focus, select:focus { outline: 3px solid var(--yellow-deep); border-color: var(--navy); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-error { color: var(--red); font-weight: 700; }
.sheet { border: 0; padding: 0; width: min(560px, 100%); max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; margin: auto auto 0; color: var(--navy); }
@media (min-width: 640px) { .sheet { margin: auto; border-radius: var(--radius-lg); } }
.sheet::backdrop { background: rgba(27, 38, 89, .55); }
.sheet form, .ride-done { padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px)); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ride-done { text-align: center; }

/* ---------- toast & confetti ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 14px); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--navy); color: var(--white); padding: 12px 18px; border-radius: 14px; font-weight: 700;
  max-width: calc(100% - 28px); text-align: center; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

.empty { text-align: center; padding: 30px 16px; background: var(--white); border-radius: var(--radius-lg); }
.loading { text-align: center; padding: 40px; color: var(--navy-soft); }

@media (prefers-reduced-motion: reduce) {
  .ticket::after { animation: none; display: none; }
  .shake { animation: none; }
  * { transition: none !important; }
}

/* ---------- closed on Sundays ---------- */
.closed-card { text-align: center; background: var(--white); border: 3px dashed var(--navy-soft); border-radius: var(--radius-lg); padding: 26px 18px; margin-top: 18px; }
.closed-card h2 { margin-bottom: 6px; }
.tile.locked { opacity: .75; border-style: dashed; }

/* ---------- what things are worth ---------- */
.worth { display: inline-block; align-self: flex-start; font: 700 .85rem var(--body); color: #8A5A00; background: #FFF1C2; border-radius: 999px; padding: 2px 9px; margin-top: 4px; white-space: nowrap; }
.worth.got { color: #12693A; background: #D4F2E0; }
.listen-worth { margin-top: 10px; }
.verse-card .worth { margin: 0; }
.game-tabs .worth { margin-top: 2px; font-size: .75rem; padding: 1px 7px; }
.levels .worth { font-size: .75rem; padding: 0 6px; margin: 0; }
.levels button[aria-pressed="true"] .worth { color: var(--navy); }
.earn-link { margin-top: 12px; }

/* ---------- what can I earn ---------- */
.earn-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.earn-summary div { background: var(--yellow); border-radius: var(--radius-sm); padding: 12px 8px; text-align: center; display: flex; flex-direction: column; }
.earn-summary b { font: 700 2rem var(--display); line-height: 1.1; }
.earn-summary span { font-size: .85rem; font-weight: 700; }
.earn-section { margin-bottom: 14px; }
.earn-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 10px 2px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; min-height: 48px; }
.earn-row:first-of-type { border-top: 0; }
.earn-row .check-mark { font-weight: 700; font-size: 1.1rem; color: var(--navy-soft); text-align: center; }
.earn-row.got .check-mark { color: var(--green); }
.earn-row.got .earn-label { color: var(--navy-soft); }
.earn-label small { display: block; color: var(--navy-soft); font-size: .85rem; }
.earn-pts { font: 700 1rem var(--display); color: #8A5A00; }
.earn-row.got .earn-pts { color: var(--green); }
