/* ============================================================
   ROCKET ROOKIE · Toronto transit sticker-book
   Chunky flat cartoon · ink outlines · hard offset shadows
   ============================================================ */

/* self-hosted variable fonts; the game makes zero network requests */
@font-face{
  font-family:"Fredoka";font-style:normal;font-weight:400 700;font-display:swap;
  src:url("../fonts/fredoka.woff2") format("woff2");
}
@font-face{
  font-family:"Nunito";font-style:normal;font-weight:600 900;font-display:swap;
  src:url("../fonts/nunito.woff2") format("woff2");
}
@font-face{
  font-family:"Oswald";font-style:normal;font-weight:500 600;font-display:swap;
  src:url("../fonts/oswald.woff2") format("woff2");
}

:root{
  --red:#D8262C;
  --red-dark:#8f191d;
  --ink:#22252B;
  --cream:#F6EFE3;
  --paper:#FBF7EE;
  --tile:#EADFCB;
  --amber:#FFB000;
  --brass:#E8B33C;
  --sky:#BFE3F0;
  --skyline:#31507a;
  --green:#159A54;
  --yellow:#F4C63D;
  --orange:#E8842C;
  --blue:#27418F;
  --good:#1FA35C;
  --bad:#E4572E;
  --shadow: 4px 5px 0 rgba(34,37,43,.9);
  --shadow-sm: 3px 3px 0 rgba(34,37,43,.9);
  --f-display:"Fredoka",sans-serif;
  --f-body:"Nunito",sans-serif;
  --f-sign:"Oswald",sans-serif;
}

*{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{
  font-family:var(--f-body);
  color:var(--ink);
  background:var(--tile);
  overflow:hidden;
  user-select:none;-webkit-user-select:none;
  display:flex;align-items:center;justify-content:center;
}

/* subway-tile backdrop behind the app column */
body::before{
  content:"";position:fixed;inset:0;z-index:0;
  background:
    repeating-linear-gradient(0deg, transparent 0 34px, rgba(34,37,43,.07) 34px 36px),
    repeating-linear-gradient(90deg, transparent 0 62px, rgba(34,37,43,.07) 62px 64px),
    var(--tile);
}

#app{
  position:relative;z-index:1;
  width:100%;max-width:560px;
  height:100vh; /* fallback for browsers without dvh */
  height:100dvh;
  max-height:1000px; /* big monitors get a centred card, not a tower */
  background:var(--cream);
  box-shadow:0 0 0 3px var(--ink), 12px 0 0 rgba(34,37,43,.12), -12px 0 0 rgba(34,37,43,.12);
  display:flex;flex-direction:column;overflow:hidden;
}
@media (min-height:1061px){
  #app{border-radius:26px;box-shadow:0 0 0 3px var(--ink), 10px 14px 0 rgba(34,37,43,.16)}
}

.screen{display:none;flex-direction:column;height:100%;overflow:hidden;position:relative}
.screen.active{display:flex}
.screen:focus{outline:none} /* screens receive programmatic focus on switch */

/* ============ shared bits ============ */

.btn{
  font-family:var(--f-display);font-weight:600;
  border:3px solid var(--ink);border-radius:16px;
  background:#fff;color:var(--ink);
  box-shadow:var(--shadow);cursor:pointer;
  transition:transform .08s, box-shadow .08s;
  touch-action:manipulation;
}
.btn:active{transform:translate(3px,4px);box-shadow:1px 1px 0 rgba(34,37,43,.9)}
.btn-big{font-size:1.5rem;padding:.7em 1.4em;letter-spacing:.03em}
.btn-red{background:var(--red);color:#fff}
.btn-small{font-size:.95rem;padding:.5em 1em}
.btn-ghost{background:transparent;box-shadow:none;border-color:transparent;color:rgba(34,37,43,.55);text-decoration:underline}
.btn-ghost:active{transform:none}
.btn .arrow{font-size:.75em;vertical-align:.1em}

.icon-btn{
  font-size:1.15rem;background:#2c2f36;border:2px solid #4a4e57;border-radius:10px;
  width:2.2rem;height:2.2rem;cursor:pointer;line-height:1;
}
.icon-btn.muted{filter:grayscale(1);opacity:.5}

/* destination sign header */
.destsign{
  flex:0 0 auto;
  background:#1B1D22;color:var(--amber);
  display:flex;align-items:center;justify-content:space-between;gap:.5rem;
  padding:.55rem .8rem;
  border-bottom:3px solid var(--ink);
  background-image:radial-gradient(rgba(255,176,0,.06) 1px, transparent 1.6px);
  background-size:7px 7px;
}
.sign-left{display:flex;align-items:center;gap:.6rem;min-width:0}
.sign-right{display:flex;align-items:center;gap:.45rem}
.sign-text{
  font-family:var(--f-sign);font-weight:600;font-size:1.15rem;letter-spacing:.14em;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  text-shadow:0 0 8px rgba(255,176,0,.55);
}
.bullet{
  font-family:var(--f-display);font-weight:700;
  min-width:2.1rem;height:2.1rem;padding:0 .3rem;
  border-radius:999px;display:inline-flex;align-items:center;justify-content:center;
  font-size:1.02rem;border:2.5px solid #fff;flex:0 0 auto;
  background:var(--red);color:#fff;
}
.bullet-green{background:var(--green)}
.bullet-yellow{background:var(--yellow);color:var(--ink)}
.bullet-orange{background:var(--orange)}
.bullet-blue{background:var(--blue)}
.bullet-purple{background:#8E5AA8}
.bullet-grey{background:#7d8590}
.bullet-upx{background:#4B6B2F}
.bullet-go{background:#1E8A4C}
.bullet-porter{background:#1F3A5F}
.bullet-ac{background:#1B1D22}
.bullet-westjet{background:#00A3AD}
.bullet-transat{background:#2B6CB0}
.bullet-sky{background:#27418F}
.bullet-harbour{background:#0E6F8C}
.bullet-ccg{background:#D8262C}
.bullet-navy{background:#2F3E55}
.bullet-space{background:#4B2E83}
.bullet-csa{background:#1B1D22}

.xp-chip{
  display:inline-flex;align-items:center;gap:.32rem;
  background:#2c2f36;border:2px solid #4a4e57;border-radius:999px;
  padding:.22rem .7rem .22rem .35rem;color:var(--brass);
  font-family:var(--f-display);font-weight:600;font-size:1rem;
}
.xp-chip svg{width:1.35rem;height:1.35rem}
.chip-label{font-size:.62rem;font-weight:700;letter-spacing:.1em;color:var(--brass);opacity:.8}

.panel{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:1.2rem;padding:1.2rem;overflow-y:auto;
}

.ruby-row{display:flex;align-items:flex-start;gap:.9rem;max-width:30rem}
.ruby-face{width:5.2rem;height:5.2rem;flex:0 0 auto;filter:drop-shadow(3px 3px 0 rgba(34,37,43,.25))}
.bubble{
  background:#fff;border:3px solid var(--ink);border-radius:18px;border-top-left-radius:4px;
  box-shadow:var(--shadow-sm);padding:.9rem 1.1rem;
  font-size:1.06rem;font-weight:700;line-height:1.45;
}
.bubble p + p{margin-top:.5rem}

/* ============ TITLE ============ */

#screen-title{background:linear-gradient(#8FCDE8 0%, #BFE3F0 55%, #DFF1F8 100%)}
.sky{position:relative;flex:0 0 46%;min-height:230px;overflow:hidden}
.skyline{position:absolute;bottom:16px;left:0;width:100%;height:75%;opacity:.92}
.clouds .cloud{
  position:absolute;background:#fff;border-radius:999px;opacity:.85;
  animation:drift 38s linear infinite;
}
.cloud.c1{width:110px;height:34px;top:14%;animation-duration:44s}
.cloud.c2{width:70px;height:24px;top:34%;animation-delay:-18s}
.cloud.c3{width:140px;height:38px;top:6%;animation-delay:-30s;animation-duration:56s}
@keyframes drift{from{left:-30%}to{left:110%}}

/* streetcar track: two rails set into the pavement, not a railway bed */
.title-track{
  position:absolute;bottom:0;left:0;right:0;height:20px;
  background-color:#8a919c;border-top:3px solid var(--ink);
  background-image:
    linear-gradient(#2e333b, #2e333b),
    linear-gradient(#2e333b, #2e333b);
  background-size:100% 2.5px, 100% 2.5px;
  background-position:0 5px, 0 12px;
  background-repeat:no-repeat, no-repeat;
}
.title-wire{
  position:absolute;left:0;right:0;bottom:57px;height:2.5px;
  background:rgba(34,37,43,.45);
}
.title-car{
  position:absolute;bottom:-4px;width:190px;height:70px;
  animation:roll 11s linear infinite;
}
@keyframes roll{from{left:-40%}to{left:108%}}

.title-body{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:.9rem;padding:1.4rem;background:var(--cream);
  border-top:3px solid var(--ink);
}
.title-crest{width:6.5rem;height:2.4rem;margin:0 auto .1rem;display:block;animation:pop-in .5s .15s backwards}
.title-sub .leaf{width:1.45em;height:1.45em;vertical-align:-.32em}
.title-kicker{
  font-family:var(--f-sign);font-weight:600;letter-spacing:.4em;font-size:.95rem;
  color:var(--red);animation:pop-in .5s .1s backwards;
}
.game-title{
  font-family:var(--f-display);font-weight:700;line-height:.92;text-align:center;
  font-size:clamp(3.2rem, 15vw, 4.6rem);letter-spacing:.01em;
  display:flex;flex-direction:column;
}
.game-title span{
  color:var(--red);
  text-shadow:3px 3px 0 var(--ink);
  -webkit-text-stroke:2px var(--ink);
  animation:pop-in .5s .2s backwards;
}
.game-title .t2{color:var(--amber);animation-delay:.32s}
@keyframes pop-in{
  from{transform:scale(.4) rotate(-4deg);opacity:0}
  60%{transform:scale(1.12)}
  to{transform:scale(1);opacity:1}
}
.title-sub{font-weight:800;font-size:1.1rem;color:rgba(34,37,43,.7);animation:pop-in .5s .45s backwards}
#btn-start{animation:pop-in .5s .6s backwards;margin-top:.4rem}
.title-fine{font-size:.82rem;font-weight:700;letter-spacing:.12em;color:rgba(34,37,43,.45);text-transform:uppercase;text-align:center;line-height:1.7}

/* ============ NAME ============ */

.badge-card{
  width:min(21rem, 88%);
  background:#fff;border:3px solid var(--ink);border-radius:18px;box-shadow:var(--shadow);
  overflow:hidden;text-align:center;
}
.badge-top{
  background:var(--red);color:#fff;
  font-family:var(--f-sign);font-size:.78rem;letter-spacing:.18em;padding:.5rem;
  border-bottom:3px solid var(--ink);
}
#name-input{
  width:100%;border:none;outline:none;text-align:center;
  font-family:var(--f-display);font-weight:700;font-size:2rem;
  padding:.7rem .5rem .4rem;color:var(--ink);background:#fff;
  text-transform:uppercase;
}
#name-input::placeholder{color:rgba(34,37,43,.25)}
.badge-no{
  font-family:var(--f-sign);font-size:.8rem;letter-spacing:.22em;color:rgba(34,37,43,.45);
  padding-bottom:.7rem;
}

/* ============ MAP ============ */

.map-scroll{flex:1;overflow-y:auto;padding:1.1rem 1.2rem 2rem;overscroll-behavior:contain}
.map-hello{
  font-family:var(--f-display);font-weight:600;font-size:1.25rem;text-align:center;
  margin-bottom:1.1rem;
}
.career-line{position:relative;margin:0 auto;max-width:26rem;padding-left:3.4rem}
.career-line::before{
  content:"";position:absolute;left:1.05rem;top:1.4rem;bottom:1.4rem;width:.9rem;
  background:var(--line-color, var(--red));border:3px solid var(--ink);border-radius:999px;
}
.station{
  position:relative;display:flex;align-items:center;gap:.9rem;
  margin-bottom:1rem;width:100%;
  text-align:left;
  background:#fff;border:3px solid var(--ink);border-radius:16px;box-shadow:var(--shadow-sm);
  padding:.75rem .9rem;cursor:pointer;
  font-family:var(--f-body);
  transition:transform .08s;
}
.station:active{transform:translate(2px,2px)}
.station::before{
  /* centred on the route line at 27px into the career-line. Absolute
     offsets measure from the card's PADDING box, which starts 3px
     inside its border, hence the extra 0.1875rem. Verified by paint
     measurement: bar centre 27.00, dot centre 27.00. */
  content:"";position:absolute;left:-2.7275rem;top:50%;transform:translateY(-50%);
  width:1.15rem;height:1.15rem;border-radius:50%;
  background:#fff;border:4px solid var(--ink);
}
.station.done::before{background:var(--good)}
.station.current::before{background:var(--amber);animation:pulse-dot 1.4s ease-in-out infinite}
@keyframes pulse-dot{0%,100%{box-shadow:0 0 0 0 rgba(255,176,0,.55)}50%{box-shadow:0 0 0 9px rgba(255,176,0,0)}}
.station.locked{opacity:.45;cursor:default;background:var(--paper)}
.station .st-bullet{flex:0 0 auto}
.station .st-info{flex:1;min-width:0}
.station .st-name{font-family:var(--f-display);font-weight:600;font-size:1.08rem;line-height:1.15}
.station .st-sub{font-size:.85rem;font-weight:700;color:rgba(34,37,43,.55)}
.station .st-stars{font-size:1.05rem;color:var(--amber);text-shadow:1px 1px 0 var(--ink);letter-spacing:.05em}
.station .st-stars .off{color:#d8d2c4;text-shadow:1px 1px 0 rgba(34,37,43,.25)}
.station .st-lock{font-size:1.3rem}
.station.current .st-go{
  font-family:var(--f-display);font-weight:700;color:#fff;background:var(--red);
  border:2.5px solid var(--ink);border-radius:999px;padding:.25rem .8rem;font-size:.9rem;
  animation:wiggle 2.2s ease-in-out infinite;
}
@keyframes wiggle{0%,88%,100%{transform:rotate(0)}91%{transform:rotate(-4deg)}95%{transform:rotate(4deg)}}
.map-footer{text-align:center;margin-top:1.6rem}
.shift-row{display:flex;justify-content:center;align-items:center;gap:1rem;margin:-.3rem 0 .7rem;flex-wrap:wrap}
.week-board i{
  display:inline-flex;width:1.35rem;height:1.35rem;margin:0 .1rem;align-items:center;justify-content:center;
  font-style:normal;font-family:var(--f-display);font-weight:600;font-size:.7rem;
  border:2px solid rgba(34,37,43,.35);border-radius:50%;color:rgba(34,37,43,.45);
}
.week-board i.on{background:var(--good);border-color:var(--ink);color:#fff}
.week-board i.today{box-shadow:0 0 0 2.5px var(--amber)}
.day-ticket{font-weight:800;font-size:.85rem;color:rgba(34,37,43,.65)}
.report-habit,.report-due{font-weight:700;font-size:.92rem;margin:.3rem 0;color:rgba(34,37,43,.75)}
.report-how{font-size:.92rem;line-height:1.5;color:rgba(34,37,43,.85)}
.report-certs{display:flex;flex-direction:column;gap:.45rem;align-items:flex-start;margin:.6rem 0}
.report-how{border-top:3px solid rgba(34,37,43,.15);padding-top:.8rem;margin-top:1.2rem}
.report-how h3{font-family:var(--f-display);font-weight:600;font-size:1.05rem;margin:0 0 .3rem}
.report-how p{margin:.45rem 0}
.report-how h4{font-size:.95rem;margin:.7rem 0 .1rem;color:var(--ink)}
.report-how ul{margin:.3rem 0 .3rem 1.2rem;padding:0}
.report-how li{margin:.25rem 0}
.report-how a{color:var(--blue);font-weight:800}
.sprint-list{display:flex;flex-direction:column;gap:.7rem;margin-top:.8rem}
.sprint-fact{font-family:var(--f-display);font-weight:700;font-size:2.3rem;display:block;text-align:center;letter-spacing:.04em}

/* line switcher */
.line-tabs{display:flex;gap:.5rem;padding:.7rem .9rem 0;justify-content:center;flex:0 0 auto;flex-wrap:nowrap}
.tab-mark{margin-left:.15rem}
/* five lines never fit one row with every name shown, so inactive tabs
   collapse to their roundel at every width; the active tab keeps its name */
.line-tab:not(.active) .tab-name{display:none}
.line-tab:not(.active){padding:.22rem .4rem}
@media (max-height:780px){
  .sky{flex:0 0 34%;min-height:150px}
  .title-body{gap:.5rem;padding:.9rem}
  .game-title{font-size:clamp(2.3rem, 8.5vh, 3.6rem)}
  .title-kicker{font-size:.8rem}
  .title-sub{font-size:.95rem}
  .btn-big{font-size:1.25rem;padding:.55em 1.2em}
  .title-fine{font-size:.68rem;line-height:1.5}
  .routebar{height:3.7rem}
  .routebar-vehicle{width:3.4rem;height:1.9rem}
  .key{font-size:1.2rem;padding:.3em 0}
  .display{font-size:1.45rem;min-height:2.3rem}
  .stamp{font-size:2rem}
  .ruby-face{width:4rem;height:4rem}
  .panel{gap:.8rem;padding:.9rem}
}

@media (max-width:520px){
  .line-tabs{gap:.3rem;padding:.55rem .4rem 0}
  .line-tab{padding:.22rem .55rem;font-size:.72rem;letter-spacing:.02em}
  .line-tab .bullet{min-width:1.35rem;height:1.35rem;font-size:.7rem}
  .line-tab:not(.active){padding:.22rem .3rem}
}
.line-tabs:empty{display:none}
.line-tab{
  display:inline-flex;align-items:center;gap:.4rem;
  font-family:var(--f-display);font-weight:600;font-size:.85rem;letter-spacing:.06em;
  background:#fff;color:var(--ink);border:3px solid var(--ink);border-radius:999px;
  padding:.22rem .75rem .22rem .28rem;box-shadow:var(--shadow-sm);cursor:pointer;
}
.line-tab .bullet{min-width:1.6rem;height:1.6rem;font-size:.85rem;border-width:2px;padding:0 .2rem}
.line-tab.active{background:var(--ink);color:#fff}
.line-tab.locked{opacity:.45;cursor:default;box-shadow:none}
.depot-line{
  grid-column:1 / -1;display:flex;align-items:center;gap:.5rem;
  font-family:var(--f-sign);font-weight:600;letter-spacing:.16em;font-size:.95rem;
  margin:.5rem 0 -.2rem;color:rgba(34,37,43,.75);
}

/* bonus stations */
.bullet-bonus{background:var(--brass);color:#fff}
.station.bonus{background:#FFF9EA;border-style:dashed}
.station.bonus.locked{background:var(--paper)}
.station.bonus.current::before{background:var(--brass)}
.station.bonus .st-go{background:var(--brass);animation-duration:1.6s}

/* gold line tab: every run on the line at three stars */
.line-tab.gold{background:var(--yellow);border-color:#9a6b00;color:#4a3300}
.line-tab.gold.active{background:#4a3300;color:var(--yellow);border-color:#4a3300}

/* Lost & Found station */
.station.lost{background:#FFF9EA;border-style:dashed}
.station.lost::before{background:var(--brass)}
.station.lost .st-go{background:var(--brass);animation-duration:1.6s}
/* map footer rows */
.footer-row{display:flex;justify-content:center;flex-wrap:wrap;gap:.2rem .6rem}

/* ============ DEPOT ============ */

.depot-sub{
  text-align:center;font-weight:800;color:rgba(34,37,43,.6);margin-bottom:1rem;
}
.depot-grid{display:grid;grid-template-columns:1fr 1fr;gap:.9rem;max-width:30rem;margin:0 auto}
.depot-card{
  background:#fff;border:3px solid var(--ink);border-radius:16px;box-shadow:var(--shadow-sm);
  padding:.7rem;text-align:center;
}
.depot-card svg{width:100%;height:4.2rem}
.depot-card .dc-name{font-family:var(--f-display);font-weight:600;font-size:.98rem;margin:.3rem 0 .15rem}
.depot-card .dc-fact{font-size:.78rem;font-weight:700;color:rgba(34,37,43,.6);line-height:1.35}
.depot-card.locked-card{background:var(--paper);color:rgba(34,37,43,.4)}
.depot-card.locked-card .dc-q{
  font-family:var(--f-display);font-size:2.6rem;font-weight:700;line-height:4.2rem;color:#d8d2c4;
}

/* ============ RIDERS ============ */

.rider-list{display:flex;flex-direction:column;gap:.8rem;max-width:24rem;margin:0 auto}
.rider{
  display:flex;justify-content:space-between;align-items:center;gap:.8rem;width:100%;
  background:#fff;border:3px solid var(--ink);border-radius:16px;box-shadow:var(--shadow-sm);
  padding:.8rem 1rem;cursor:pointer;font-family:var(--f-body);text-align:left;
}
.rider:active{transform:translate(2px,2px)}
.rider.active{background:#FFF3D6}
.rider-name{font-family:var(--f-display);font-weight:600;font-size:1.25rem;letter-spacing:.04em}
.rider-meta{font-size:.8rem;font-weight:800;color:rgba(34,37,43,.55);white-space:nowrap}

/* ============ MANAGER'S OFFICE ============ */

.report-summary{text-align:center;font-weight:800;font-size:.92rem;color:rgba(34,37,43,.7);margin:0 0 1rem}
.report-list{display:flex;flex-direction:column;gap:.7rem;max-width:26rem;margin:0 auto}
.rep-row{background:#fff;border:3px solid var(--ink);border-radius:14px;padding:.6rem .85rem;box-shadow:var(--shadow-sm)}
.rep-head{display:flex;justify-content:space-between;align-items:baseline}
.rep-label{font-family:var(--f-display);font-weight:600;font-size:1rem}
.rep-num{font-family:var(--f-sign);font-size:1rem;font-variant-numeric:tabular-nums}
.rep-bar{height:.7rem;background:var(--paper);border:2px solid var(--ink);border-radius:999px;overflow:hidden;margin:.35rem 0}
.rep-bar i{display:block;height:100%;background:var(--good)}
.rep-bar i.mid{background:var(--amber)}
.rep-bar i.low{background:var(--bad)}
.rep-sub{font-size:.78rem;font-weight:800;color:rgba(34,37,43,.55)}
.report-lost{text-align:center;font-weight:800;font-size:.88rem;color:rgba(34,37,43,.6);margin:1.2rem 0 0}

/* ============ BRIEFING ============ */

#screen-brief .panel{justify-content:center}
.brief-vehicle{width:min(19rem,80%);animation:bob 3s ease-in-out infinite}
.brief-vehicle svg{width:100%;height:auto}
@keyframes bob{0%,100%{transform:translateY(0)}50%{transform:translateY(-7px)}}
#brief-bubble{min-height:5.4rem;display:flex;flex-direction:column;justify-content:center;animation:pop-in .3s}

/* Rush Hour toggle */
.rush-toggle{
  display:flex;align-items:center;gap:.5rem;font-weight:800;font-size:.88rem;color:rgba(34,37,43,.65);
  cursor:pointer;margin-top:.2rem;
}
.rush-toggle input{width:1.15rem;height:1.15rem;accent-color:var(--red);cursor:pointer}

/* subway briefings show the departure station's tiled wall */
.tile-wall{
  position:relative;border:3px solid var(--ink);border-radius:12px;margin:.2rem 0 .6rem;
  padding:1.4rem 1rem .9rem;overflow:hidden;
  background:linear-gradient(90deg, rgba(34,37,43,.10) 2px, transparent 2px) 0 0 / 2.4rem 100%, #F7F4EC;
  box-shadow:var(--shadow-sm);
}
.tile-wall::before{content:"";position:absolute;top:0;left:0;right:0;height:.7rem;background:var(--band,#2E4A3F);border-bottom:2px solid var(--ink)}
.tw-name{font-family:var(--f-display);font-weight:600;font-size:1.55rem;letter-spacing:.35em;margin-right:-.35em;text-align:center;color:#2B3138;text-transform:uppercase}
.tw-sub{font-family:var(--f-sign);font-weight:500;font-size:.78rem;letter-spacing:.35em;margin:.15rem -.35em 0 0;text-align:center;color:rgba(34,37,43,.55);text-transform:uppercase}

/* ============ RUN ============ */

#screen-run{background:var(--cream)}

.routebar{
  flex:0 0 auto;position:relative;height:4.6rem;margin:0 1rem;
}
.routebar-line{
  position:absolute;left:1.4rem;right:1.4rem;top:2.9rem;height:.55rem;
  background:var(--red);border:2.5px solid var(--ink);border-radius:999px;
}
.routebar-line .rdot{
  position:absolute;top:50%;transform:translate(-50%,-50%);
  width:.95rem;height:.95rem;border-radius:50%;
  background:#fff;border:3px solid var(--ink);
  transition:background .3s;
}
.routebar-line .rdot.past{background:var(--good)}
.routebar-line .rdot.terminus{width:1.25rem;height:1.25rem;background:var(--amber)}
.routebar-vehicle{
  position:absolute;top:.35rem;width:4.2rem;height:2.3rem;
  transform:translateX(-50%);
  transition:left .9s cubic-bezier(.45,1.4,.55,1);
  filter:drop-shadow(2px 3px 0 rgba(34,37,43,.3));
}
.routebar-vehicle svg{width:100%;height:100%}
.routebar-vehicle.arriving{animation:vbounce .9s}
@keyframes vbounce{0%,100%{transform:translateX(-50%) translateY(0)}30%{transform:translateX(-50%) translateY(-5px)}60%{transform:translateX(-50%) translateY(-2px)}}

.next-stop{
  flex:0 0 auto;text-align:center;
  font-family:var(--f-sign);font-weight:500;letter-spacing:.16em;font-size:.85rem;
  text-transform:uppercase;color:rgba(34,37,43,.6);
  padding:.15rem 0 .35rem;
}

/* ============ TTC STRIP MAP (subway runs) ============
   The in-car lit route map: black band, the line in its colour, an LED
   per real station; passed stations go dark. Plus the platform-edge
   tactile strip and the internally lit next-station sign. */
.routebar.strip .routebar-line{
  background:#14161B;border-radius:10px;height:1.9rem;top:1.7rem;
  border:3px solid var(--ink);
}
.routebar.strip .routebar-line::before{
  content:"";position:absolute;left:.5rem;right:.5rem;top:50%;height:.32rem;transform:translateY(-50%);
  background:var(--line-color,#159A54);border-radius:999px;opacity:.85;
}
.routebar.strip .rdot{width:.55rem;height:.55rem;border:2px solid #0B0D10;background:var(--line-color,#159A54);box-shadow:0 0 7px var(--line-color,#159A54)}
.routebar.strip .rdot.check{width:.85rem;height:.85rem;background:#F6EFE3}
.routebar.strip .rdot.past{background:#39404A;box-shadow:none}
.routebar.strip .rdot.check.past{background:#707A86}
.routebar.strip .rdot.terminus{width:1rem;height:1rem;background:var(--amber);box-shadow:0 0 8px var(--amber)}
.routebar.strip::after{
  content:"";position:absolute;left:.4rem;right:.4rem;bottom:-.1rem;height:.5rem;border-radius:4px;
  background:radial-gradient(circle at .22rem 50%, rgba(34,37,43,.4) .1rem, transparent .17rem) 0 0 / .5rem 100%, var(--yellow);
  border:2px solid var(--ink);
}
/* the bronze maple-leaf door marker rides under the train on subway runs */
.door-disc{display:none}
.routebar.strip .door-disc{
  display:block;position:absolute;left:50%;bottom:-2.1rem;width:.85rem;height:.85rem;
  transform:translateX(-50%);
}

.next-stop.lit{
  background:#14161B;color:#F3EFE4;width:fit-content;
  margin:.2rem auto .4rem;padding:.28rem 1.1rem;border-radius:8px;border:2.5px solid var(--ink);
  letter-spacing:.22em;text-shadow:0 0 9px rgba(246,239,227,.55);
}
.next-stop.lit::before{content:"◀  "}
.next-stop.lit::after{content:"  ▶"}


.run-body{
  flex:1;display:flex;flex-direction:column;gap:.8rem;
  padding:.2rem 1rem 1rem;overflow-y:auto;
}

.qcard{
  background:#fff;border:3px solid var(--ink);border-radius:18px;box-shadow:var(--shadow);
  padding:1rem 1.1rem;
  animation:card-in .35s;
  margin-block:auto;
}
@keyframes card-in{from{transform:translateY(14px) scale(.97);opacity:0}to{transform:none;opacity:1}}
.qcard.shake{animation:shake .4s}
@keyframes shake{0%,100%{transform:translateX(0)}20%{transform:translateX(-7px)}40%{transform:translateX(7px)}60%{transform:translateX(-5px)}80%{transform:translateX(5px)}}
.qtext{font-size:1.13rem;font-weight:800;line-height:1.5}
.qtext b{color:var(--red)}
.qvisual{display:flex;flex-direction:column;align-items:center;justify-content:center;margin-top:.5rem}
.qvisual:empty{display:none}
.qvisual svg{max-width:12rem;height:auto}
/* departure board & clock pairs */
.board{
  background:#1B1D22;border:3px solid var(--ink);border-radius:12px;padding:.5rem .9rem;
  font-family:var(--f-sign);color:var(--amber);letter-spacing:.12em;min-width:13rem;
  box-shadow:var(--shadow-sm);text-shadow:0 0 8px rgba(255,176,0,.45);
}
.board .bh{font-size:.7rem;opacity:.75;border-bottom:2px dashed rgba(255,176,0,.35);padding-bottom:.25rem;margin-bottom:.3rem}
.board .br{display:flex;justify-content:space-between;gap:1.4rem;font-size:1.05rem;padding:.1rem 0}
.board .br.gone{opacity:.35;text-decoration:line-through}
.clocks{display:flex;align-items:center;gap:.5rem}
.clocks figure{display:flex;flex-direction:column;align-items:center;gap:.15rem}
.clocks figcaption{font-size:.7rem;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:rgba(34,37,43,.6)}
.clocks .arrow-c{font-size:1.6rem;font-weight:800;color:rgba(34,37,43,.6)}
.hint{
  margin-top:.55rem;font-size:.95rem;font-weight:800;color:#8a5f14;
  background:#FFF3D6;border:2.5px dashed var(--brass);border-radius:12px;padding:.5rem .7rem;
  display:none;animation:pop-in .3s;
}
.hint.show{display:block}
.hint::before{content:"💡 "}

.answer-area{margin-top:auto}

.display{
  background:#1B1D22;border:3px solid var(--ink);border-radius:13px;
  color:var(--amber);font-family:var(--f-display);font-weight:600;
  font-size:1.8rem;min-height:3rem;
  width:fit-content;min-width:12rem;max-width:100%;
  padding:0 1.4rem;
  display:flex;align-items:center;justify-content:center;gap:.1em;
  margin:0 auto .6rem;letter-spacing:.06em;
  text-shadow:0 0 10px rgba(255,176,0,.5);
}
.display .cursor{
  width:.55em;height:.12em;background:var(--amber);border-radius:2px;
  animation:blink 1s steps(1) infinite;align-self:flex-end;margin-bottom:.55em;
}
@keyframes blink{50%{opacity:0}}

.numpad{display:grid;grid-template-columns:repeat(3,1fr);gap:.5rem}
.key{
  font-family:var(--f-display);font-weight:600;font-size:1.5rem;
  padding:.5em 0;border:3px solid var(--ink);border-radius:14px;
  background:#fff;box-shadow:var(--shadow-sm);cursor:pointer;
  transition:transform .06s, box-shadow .06s;
  touch-action:manipulation;
}
.key:active{transform:translate(2px,3px);box-shadow:0 0 0 rgba(0,0,0,0)}
.key-del{background:var(--paper);font-size:1.3rem}
.key-go{background:var(--good);color:#fff}
/* Harbour Line and up: questions with decimal or negative answers add ± and . keys
   and the pad widens to four columns (1 2 3 ± / 4 5 6 . / 7 8 9 ⌫ / 0 0 GO GO) */
.key-ext{display:none;background:var(--paper)}
.key-ext[disabled]{opacity:.35;cursor:default}
.numpad.ext{grid-template-columns:repeat(4,1fr)}
.numpad.ext .key-ext{display:block}
.numpad.ext .key[data-k="1"]{order:1}.numpad.ext .key[data-k="2"]{order:2}.numpad.ext .key[data-k="3"]{order:3}.numpad.ext .key[data-k="neg"]{order:4}
.numpad.ext .key[data-k="4"]{order:5}.numpad.ext .key[data-k="5"]{order:6}.numpad.ext .key[data-k="6"]{order:7}.numpad.ext .key[data-k="."]{order:8}
.numpad.ext .key[data-k="7"]{order:9}.numpad.ext .key[data-k="8"]{order:10}.numpad.ext .key[data-k="9"]{order:11}.numpad.ext .key-del{order:12}
.numpad.ext .key[data-k="0"]{order:13;grid-column:span 2}.numpad.ext .key-go{order:14;grid-column:span 2}

.choices{display:grid;grid-template-columns:1fr 1fr;gap:.6rem}
.choices:empty{display:none}
.choice{
  font-family:var(--f-display);font-weight:600;font-size:1.4rem;
  padding:.6em .4em;border:3px solid var(--ink);border-radius:16px;
  background:#fff;box-shadow:var(--shadow-sm);cursor:pointer;
  display:flex;align-items:center;justify-content:center;gap:.5rem;
  transition:transform .06s;
  touch-action:manipulation;
}
.choice:active{transform:translate(2px,3px)}
.choice svg{width:3rem;height:3rem}
.hide{display:none !important}

/* stamp feedback */
.stamp{
  position:absolute;top:38%;left:50%;transform:translate(-50%,-50%) scale(0) rotate(-10deg);
  font-family:var(--f-display);font-weight:700;font-size:2.6rem;
  color:#fff;background:var(--good);border:4px solid var(--ink);border-radius:20px;
  padding:.35em .8em;box-shadow:var(--shadow);
  pointer-events:none;opacity:0;z-index:30;white-space:nowrap;
}
.stamp.bad{background:var(--bad);font-size:2rem}
.stamp.show{animation:stamp-in .95s}
@keyframes stamp-in{
  0%{transform:translate(-50%,-50%) scale(0) rotate(-14deg);opacity:0}
  22%{transform:translate(-50%,-50%) scale(1.15) rotate(3deg);opacity:1}
  32%{transform:translate(-50%,-50%) scale(1) rotate(-2deg)}
  80%{opacity:1}
  100%{transform:translate(-50%,-50%) scale(1) rotate(-2deg);opacity:0}
}

/* question badges: Express (double XP) and practice retries */
.q-badge{
  display:inline-block;font-family:var(--f-sign);font-size:.72rem;letter-spacing:.16em;
  padding:.2rem .6rem;border-radius:999px;margin-bottom:.5rem;border:2px solid var(--ink);
  animation:pop-in .3s;
}
.q-badge.express{background:var(--amber);color:var(--ink)}
.q-badge.practice{background:#E6EEF9;color:var(--blue);border-color:var(--blue)}
.q-badge.transfer{background:#D7EEE9;color:#0E6F8C;border-color:#0E6F8C}
.q-badge.teach{background:#FBEED2;color:#8a5a00;border-color:#C98F1B}
.skip-flow{display:block;margin:.3rem auto 0}
.btn-hint{display:block;margin:.5rem auto 0;background:#FBEED2}
.btn-hint.glow{animation:hint-glow 1.3s ease-in-out infinite}
@keyframes hint-glow{0%,100%{box-shadow:var(--shadow-sm)}50%{box-shadow:0 0 0 6px rgba(255,176,0,.45)}}
.station.dispatch .st-bullet{box-shadow:0 0 0 3px var(--amber)}

/* choose-an-answer keyboard numbers */
.choice{position:relative}
.choice-key{
  position:absolute;top:.3rem;left:.4rem;font-family:var(--f-sign);font-size:.7rem;
  width:1.2rem;height:1.2rem;border-radius:50%;border:2px solid var(--ink);
  display:inline-flex;align-items:center;justify-content:center;background:#fff;opacity:.6;
}

/* array picture for small multiplications */
.array{
  display:grid;grid-template-columns:repeat(var(--cols,1),1rem);gap:.22rem;justify-content:center;
  margin:.2rem auto 0;
}
.array i{display:block;width:1rem;height:1rem;border-radius:50%;background:var(--red);border:2px solid var(--ink)}
.array-cap{text-align:center;font-size:.78rem;font-weight:800;color:rgba(34,37,43,.55);letter-spacing:.08em;margin-top:.3rem}

/* Rush Hour clock */
.rush-bar{height:.55rem;margin:0 1.2rem .35rem;background:#fff;border:2px solid var(--ink);border-radius:999px;overflow:hidden}
.rush-bar i{display:block;height:100%;background:var(--amber);transform-origin:left center;transform:scaleX(1)}

/* ============ RESULTS ============ */

.results-panel{gap:.9rem;text-align:center}
.results-kicker{
  font-family:var(--f-sign);font-weight:600;letter-spacing:.34em;font-size:1rem;color:var(--red);
}
.stars{font-size:3.4rem;line-height:1;display:flex;gap:.4rem}
.stars span{
  color:#d8d2c4;-webkit-text-stroke:2px var(--ink);
  transition:color .2s;transform:scale(1);
}
.stars span.lit{color:var(--amber);animation:star-pop .5s}
@keyframes star-pop{0%{transform:scale(0) rotate(-30deg)}70%{transform:scale(1.4)}100%{transform:scale(1)}}
.results-line{font-weight:800;font-size:1.1rem;max-width:24rem}

.reward-card{width:min(17rem,80%);perspective:900px;cursor:pointer}
.reward-inner{
  position:relative;width:100%;transform-style:preserve-3d;transition:transform .8s cubic-bezier(.4,1.4,.6,1);
}
.reward-card.flipped .reward-inner{transform:rotateY(180deg)}
.reward-front,.reward-back{
  backface-visibility:hidden;-webkit-backface-visibility:hidden;
  border:3px solid var(--ink);border-radius:18px;box-shadow:var(--shadow);
  background:#fff;padding:1rem;
}
.reward-front{
  position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  background:repeating-linear-gradient(45deg, var(--red) 0 16px, var(--red-dark) 16px 32px);
}
.reward-front span{
  font-family:var(--f-display);font-weight:700;font-size:4rem;color:#fff;
  text-shadow:3px 3px 0 var(--ink);
  animation:wiggle 1.6s ease-in-out infinite;
}
.reward-back{transform:rotateY(180deg);position:relative}
.reward-name{font-family:var(--f-display);font-weight:700;font-size:1.15rem;margin-bottom:.3rem}
.reward-back svg{width:100%;height:5rem}
.reward-fact{font-size:.85rem;font-weight:700;color:rgba(34,37,43,.65);line-height:1.4;margin-top:.4rem}
.reward-tap{font-size:.8rem;font-weight:800;color:rgba(34,37,43,.5);letter-spacing:.1em}
.results-xp{
  font-family:var(--f-display);font-weight:600;font-size:1.2rem;color:#8a5f14;
}

.confetti{position:absolute;inset:0;pointer-events:none;overflow:hidden;z-index:5}
.confetti i{
  position:absolute;top:-5%;width:.65rem;height:.4rem;border-radius:2px;
  animation:fall linear forwards;
}
@keyframes fall{
  to{transform:translateY(110vh) rotate(720deg)}
}

/* ============ PASSWORDS ============ */

.pass-form{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:.5rem;margin:.6rem 0}
.pass-form input{
  font-family:var(--f-display);font-weight:600;font-size:1.15rem;letter-spacing:.08em;text-transform:uppercase;
  width:11rem;padding:.45rem .7rem;border:3px solid var(--ink);border-radius:12px;background:#fff;color:var(--ink);
  box-shadow:var(--shadow-sm);outline:none;text-align:center;
}
.pass-form input:focus{border-color:var(--red)}
.pass-msg{width:100%;text-align:center;font-weight:800;font-size:.95rem;min-height:1.2em;color:rgba(34,37,43,.7)}
.pass-msg.ok{color:var(--good)}
.pass-msg.bad{color:var(--bad)}

/* ============ PROMOTION CELEBRATION ============ */

#screen-promo{background:linear-gradient(#0F1530 0%, #1A2238 55%, #2B3A66 100%);color:#F6EFE3}
.promo-sky{position:absolute;inset:0;pointer-events:none;overflow:hidden;z-index:0}
.promo-body{
  position:relative;z-index:1;flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:.9rem;padding:1.2rem 1.2rem .4rem;
}
.promo-kicker{
  font-family:var(--f-sign);font-weight:600;letter-spacing:.4em;font-size:1.05rem;color:var(--amber);
  text-shadow:0 0 12px rgba(255,176,0,.6);animation:pop-in .5s .1s backwards;
}
.promo-badge{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.15rem;
  width:11.5rem;height:11.5rem;border-radius:50%;
  background:radial-gradient(circle at 50% 38%, #FFD166 0%, #E8B33C 55%, #B9831E 100%);
  border:5px solid var(--ink);box-shadow:0 0 0 6px rgba(255,209,102,.35), var(--shadow);
  text-align:center;animation:pop-in .6s .3s backwards;
}
.promo-badge::before{
  content:"";position:absolute;width:9.4rem;height:9.4rem;border-radius:50%;
  border:3px dashed rgba(34,37,43,.5);
}
.promo-badge{position:relative}
.pb-rank{font-family:var(--f-display);font-weight:700;font-size:1.5rem;color:var(--ink);line-height:1.05;letter-spacing:.04em;padding:0 .8rem;text-transform:uppercase}
.pb-line{font-family:var(--f-sign);font-size:.7rem;letter-spacing:.18em;color:rgba(34,37,43,.75)}
.promo-ruby{animation:pop-in .5s .6s backwards;max-width:28rem}
.promo-ruby .bubble{background:#F6EFE3;color:var(--ink);font-size:1rem}

.parade{position:relative;z-index:1;flex:0 0 auto;height:5.6rem;overflow:hidden}
.parade-road{
  position:absolute;left:0;right:0;bottom:0;height:1.4rem;background:#3c424d;border-top:3px solid var(--ink);
  background-image:repeating-linear-gradient(90deg, transparent 0 22px, rgba(255,255,255,.25) 22px 26px);
}
.parade-row{
  position:absolute;left:0;bottom:1.15rem;display:flex;align-items:flex-end;gap:1.6rem;white-space:nowrap;
  animation:parade var(--parade-dur,24s) linear infinite;will-change:transform;
}
.parade-row svg{height:3.4rem;width:auto;filter:drop-shadow(2px 3px 0 rgba(0,0,0,.35))}
.parade-row svg.small{height:2.4rem;margin-bottom:.3rem}
/* vehicles face right, so the parade drives left to right */
@keyframes parade{from{transform:translateX(-100%)}to{transform:translateX(var(--start,100vw))}}

.promo-actions{
  position:relative;z-index:1;flex:0 0 auto;display:flex;flex-direction:column;align-items:center;gap:.6rem;
  padding:.8rem 1.2rem 1.2rem;background:rgba(0,0,0,.18);
}
.promo-actions .btn-small{background:#F6EFE3}

/* fireworks */
.fw{position:absolute;width:0;height:0}
.fw i{
  position:absolute;left:0;top:0;width:.42rem;height:.42rem;border-radius:50%;background:var(--c);
  box-shadow:0 0 8px var(--c);
  animation:fw-burst 1.3s cubic-bezier(.15,.7,.3,1) forwards;
}
@keyframes fw-burst{
  0%{transform:translate(0,0) scale(1);opacity:1}
  70%{opacity:1}
  100%{transform:translate(var(--dx),var(--dy)) scale(.2);opacity:0}
}

/* ============ CERTIFICATE (print only) ============ */

#certificate{display:none}
@media print{
  @page{size:landscape;margin:1.2cm}
  body{background:#fff !important;overflow:visible;height:auto}
  body::before{display:none}
  #app{display:none !important}
  #certificate{display:block;font-family:var(--f-body);color:#22252B}
  /* sized to fit one page on both letter and A4 landscape: fixed frame
     height, tighter type, Ruby kept clear of the border and the foot */
  .cert-frame{
    position:relative;border:6px double #D8262C;outline:3px solid #22252B;outline-offset:6px;
    padding:1.1cm 2.2cm 1cm;text-align:center;height:15.6cm;
    page-break-inside:avoid;box-sizing:border-box;overflow:hidden;
  }
  .cert-top{font-family:var(--f-sign);letter-spacing:.35em;font-size:11pt;color:#D8262C;margin:0 0 .45cm}
  .cert-title{font-family:var(--f-display);font-weight:700;font-size:30pt;margin:0 0 .35cm;letter-spacing:.02em}
  .cert-lead{font-size:13pt;margin:0 0 .25cm;color:#555}
  .cert-name{font-family:var(--f-display);font-weight:700;font-size:36pt;margin:0 0 .3cm;color:#D8262C;border-bottom:3px solid #22252B;display:inline-block;padding:0 1cm .1cm}
  .cert-body{font-size:13pt;max-width:16cm;margin:.15cm auto .25cm;line-height:1.45}
  .cert-rank{font-family:var(--f-display);font-weight:700;font-size:26pt;letter-spacing:.08em;margin:0 0 .25cm}
  .cert-stars{font-size:14pt;color:#B9831E;font-weight:800;margin:0 0 .3cm}
  .cert-pass{font-family:var(--f-sign);font-size:12pt;letter-spacing:.12em;color:#27418F;margin:0 0 .6cm}
  .cert-foot{
    position:absolute;left:2.2cm;right:2.2cm;bottom:1cm;
    display:flex;justify-content:space-between;font-size:11pt;font-weight:800;
    border-top:2px solid #22252B;padding-top:.35cm;padding-right:3.4cm;
  }
  .cert-ruby{position:absolute;right:1.1cm;bottom:.9cm;width:2.5cm;height:2.5cm}
  .cert-crest{display:block;width:4cm;height:1.5cm;margin:0 auto .2cm}
}

/* ============ NIGHT THEME (missions flagged night: true) ============ */

body.night #app{background:#1A2238}
body.night .screen{background:#1A2238}
body.night .next-stop{color:rgba(246,239,227,.7)}
body.night .routebar-line{background:var(--blue)}
body.night .qcard,
body.night .bubble{background:#F3EDDF}
body.night .map-hello,
body.night .results-kicker{color:#F6EFE3}
body.night .results-line,
body.night .results-xp{color:#F6EFE3}
body.night .key{background:#E9E2D2}
body.night .key-del{background:#d9d2c2}
body.night .key-go{background:var(--good)}
/* starry sky */
body.night #screen-run,
body.night #screen-brief,
body.night #screen-results{
  background-image:
    radial-gradient(rgba(255,233,168,.8) 1.2px, transparent 2px),
    radial-gradient(rgba(255,233,168,.4) 1px, transparent 1.6px);
  background-size:140px 90px, 90px 70px;
  background-position:20px 10px, 60px 40px;
  background-color:#1A2238;
}

body.night .rush-bar{background:#2B3A66}
body.night .rush-toggle{color:rgba(246,239,227,.75)}

/* small phones */

@media (max-height:640px){
  .qtext{font-size:1rem}
  .key{font-size:1.25rem;padding:.4em 0}
  .display{font-size:1.5rem;min-height:2.6rem}
  .ruby-face{width:4rem;height:4rem}
}
@media (min-width:600px){
  #app{height:min(92dvh, 60rem);margin-top:max(2vh, 1rem);border-radius:26px}
  .screen{border-radius:24px}
}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.001s !important;transition-duration:.001s !important}
}
