/* The game's components, built on the design system in tokens.css (DESIGN.md).
   Layout and device safe areas live in style.css. */
:root {
  /* the names older rules use */
  --cream: #fff9ed;
  --ro-blue: var(--brand);
  --ro-red: var(--primary);
  --ro-yellow: var(--fun-yellow);
  --invite-green: var(--fun-green);
  --invite-green-hover: var(--fun-green-hover);
  --display-font: var(--font-body);
}
button { transition: background .18s, box-shadow .18s, transform .18s; }
button:focus-visible { outline: 3px solid var(--fun-yellow); outline-offset: 3px; }
.overlay { background: #0c1f4680; }
.panel { background: var(--surface); border: 1px solid #ffffffb3; border-radius: 24px; box-shadow: var(--shadow); }
.panel::before { height: 4px; opacity: 1; }
h1, h2, h3 { color: var(--brand); text-shadow: none; }
h1, h2 { font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; }
h1 { font-size: var(--fs-display); line-height: 1; }
h2 { font-size: var(--fs-title); line-height: 1.12; }
h3 { font: 800 var(--fs-heading)/1.25 var(--font-body); letter-spacing: -.01em; }
.label { font: 800 var(--fs-label)/1.2 var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.subtitle, .muted, .small-text, .shop-fine { color: var(--muted); }
.subtitle { font-weight: 600; line-height: 1.4; }
/* Buttons: primary, secondary, tertiary. Sharing is the only other colour. */
.btn { font-family: var(--font-body); font-weight: 800; color: #fff; background: var(--primary); border: 1px solid transparent; border-radius: var(--radius); box-shadow: 0 2px 0 var(--primary-edge); letter-spacing: 0; }
.btn:hover:not(:disabled) { background: var(--primary-hover); }
.btn.secondary { background: var(--surface); color: var(--brand); border: 1.5px solid var(--line-strong); box-shadow: none; }
.btn.secondary:hover:not(:disabled) { background: var(--card); }
.btn.ghost, .btn.tertiary, .btn[data-back] { background: transparent; color: var(--brand); border: 1px solid transparent; box-shadow: none; }
.btn.ghost:hover:not(:disabled), .btn.tertiary:hover:not(:disabled), .btn[data-back]:hover:not(:disabled) { background: var(--card); }
.btn.share-btn, .btn.invite, .btn.fb, .btn.wa { background: var(--fun-green); color: #fff; box-shadow: 0 2px 0 #1d4a2c; }
.btn.share-btn:hover:not(:disabled), .btn.invite:hover:not(:disabled), .btn.fb:hover:not(:disabled), .btn.wa:hover:not(:disabled) { background: var(--fun-green-hover); }
.btn:active, .hud-buttons button:active { transform: translateY(1px); box-shadow: none; }
.segmented { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.segmented button { color: var(--muted); font-weight: 800; border-radius: 9px; }
.segmented button[aria-pressed="true"] { color: var(--brand); background: var(--surface); box-shadow: 0 1px 4px #10244d26; }
input, select { color: var(--ink); border-color: var(--line); border-radius: 10px; }
.ach, .gear, .boost-card, .shop-item, .offer, .end-offer, .reset-choice { background: var(--card); border-color: var(--line); box-shadow: none; border-radius: 14px; }
.ach .icon, .rank-step { background: var(--card); }
.ach.locked .icon { background: #e4e7ee; }
.gear.equipped, .gear.selected { background: var(--card); border-color: #5979b6; box-shadow: inset 0 0 0 1px #5979b6; }
.profile-chip, .icon-btn, .hud-buttons button, .hud-box { border: 1px solid #ffffff91; background: #fffdf5ed; box-shadow: 0 4px 16px #10244d18; }
.icon-btn, .hud-buttons button { border-radius: 12px; }
.hud-buttons button:hover { background: var(--surface); }
.hud-buttons button:focus-visible { outline-color: var(--ro-blue); }
.profile-chip { border-radius: 14px; color: var(--ink); }
#score { font-size: 26px; letter-spacing: -.04em; }
#levelName { color: var(--muted); }
.hud-box { padding: 9px 14px 7px; }
#hint { background: #002b7feb; border: 1px solid #ffffff25; box-shadow: 0 4px 16px #10244d22; font-size: 13px; font-weight: 600; }
#hint b { color: var(--ro-yellow); }
.coach .say { background: #fffdf5ef; border-color: var(--line); box-shadow: 0 4px 18px #10244d20; }
.toast { background: var(--surface); color: var(--ink); box-shadow: 0 4px 20px #10244d30; border-color: var(--line); }
/* The backdrop recedes in saturation and contrast. Active pieces retain their full colours. */
#backdrop { filter: saturate(.78) contrast(.92); }
.overlay.lobby, .overlay.onboarding { background: radial-gradient(ellipse at 15% 0%, #244b98 0, #0d3377 42%, #081d48 100%); }
html:has(> body > .overlay:is(.lobby, .onboarding):not(.hidden)),
body:has(> .overlay:is(.lobby, .onboarding):not(.hidden)) { background: #081d48 !important; }
.lobby-brand { color: #f7f4e6; font-family: 'Baloo 2', 'Nunito', sans-serif; text-shadow: none; font-size: 29px; letter-spacing: -.03em; }
.lobby .total-stars { background: #ffffff10; color: var(--ro-yellow); border: 1px solid #ffffff14; border-radius: 10px; }
.lobby .total-points { color: #e4eafb; }
.lobby-top { padding-bottom: 6px; border-bottom: 1px solid #ffffff18; }
.lobby .profile-chip { background: #ffffff0c; color: #f8f5e9; border-color: #ffffff24; box-shadow: none; }
.lobby .profile-chip .rk { color: #e4eafb; }
.lobby-actions .icon-btn { background: #ffffff0e; color: #e4eafb; border: 1px solid #ffffff2b; box-shadow: none; }
.lobby-actions .icon-btn:hover { background: #ffffff20; }
.lobby-actions .setup-btn { background: #f2cf66; color: var(--ro-blue); border-color: #ddba52; box-shadow: 0 2px 8px #0002; }
.lobby-actions .setup-btn:hover { background: #e9bf43; }
.map-wrap { background: #e9eee7; border-radius: 22px; border: 1px solid #ffffff4d; padding: 12px; overflow: hidden; box-shadow: inset 0 1px 0 #fff8; }
/* The lobby's chapters, every one by name, down the left of the map (game.js buildChapterTabs). The open one is the
   light card with the blue edge; locked ones say what opens them. */
.chapter-rail { width: 220px; flex: none; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.chapter-rail button {
  flex: 1; min-height: 0; max-height: 84px; display: flex; align-items: center; gap: 8px; padding: 2px 10px; overflow: hidden;
  border: 2px solid transparent; border-radius: var(--radius); background: var(--card); color: var(--ink); text-align: left; font: inherit; cursor: pointer;
}
.chapter-rail button[aria-pressed="true"] { background: var(--surface); border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 2px var(--surface); }
.chapter-rail button:disabled { color: var(--muted); cursor: default; }
.chapter-rail .ic { flex: none; width: 22px; text-align: center; font-size: 18px; line-height: 1; }
.chapter-rail button:disabled .ic { filter: grayscale(1); opacity: .6; }
.chapter-rail .tx { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.chapter-rail b { font-weight: 800; font-size: 14px; line-height: 1.15; }
.chapter-rail small { font-weight: 600; font-size: var(--fs-label); line-height: 1.2; color: var(--muted); }
.map-sea { fill: #447b8d; opacity: .8; font-size: 11px; }
#map .map-region { fill: #66785f; opacity: .5; font-size: 8px; letter-spacing: 1.8px; }
.map-leg { fill: none; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.map-road-bed { stroke: #fffdf2; stroke-width: 5.5px; opacity: .95; }
.map-route { stroke: #8a968c; stroke-width: 2px; stroke-dasharray: 3 5; }
.map-leg.done .map-route { stroke: var(--ro-blue); stroke-dasharray: none; stroke-width: 2.6px; }
.map-leg.active .map-route { stroke: var(--ro-red); stroke-dasharray: 5 4; stroke-width: 2.8px; }
.map-leg.bonus .map-road-bed { stroke-width: 3px; }
.map-leg.bonus .map-route { stroke-width: 1.3px; stroke-dasharray: 1 4; }
#map .stop .label { fill: var(--ro-blue); stroke: #f6f5e9; stroke-width: 3.5px; font-size: 13px; }
#map .stop.locked .label { fill: var(--muted); opacity: .9; }
.stop .dot { stroke: #bac9e4; }
.stop.done .dot { fill: #002b7f; stroke: #001f5d; }
.stop.current .dot { fill: var(--ro-red); stroke: #8c302b; }
.stop.selected .dot { stroke: var(--ro-yellow); stroke-width: 4; }
.stop .pulse { animation-duration: 3s; stroke-width: 2; }
.stop.locked .dot { fill: #f6f6ec; stroke: #a1ada2; stroke-width: 1.5px; }
#map .stop.locked .num { fill: #677967; font-size: 15px; }
#map .stop .dot { r: 13px; }
#map .stop .num { font-size: 15px; }
#map .stop .hit { r: 21px; }
/* Keep the atlas large in a narrow desktop pane; the stop details become a footer. */
@container (max-width: 900px) and (min-height: 501px) {
  .lobby-main { flex-direction: column; }
  /* the chapters go over the map, three to a row */
  .chapter-rail { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chapter-rail button { min-height: 52px; }
  .stop-card { flex: 0 0 auto; width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 3px 18px; padding: 14px 20px; text-align: left; }
  .stop-card > * { grid-column: 1; margin: 0; }
  .stop-card #stopPlay { grid-column: 2; grid-row: 1 / 5; align-self: center; min-width: 160px; }
  .stop-card h3 { font-size: 22px; }
  .stop-card .stop-stars { font-size: 20px; }
  .lobby-top { gap: 6px; }
  .lobby-actions { gap: 4px; }
  .lobby-actions .icon-btn { width: 34px; height: 36px; }
  .lobby .total-stars { font-size: 14px; padding: 5px 7px; }
  .lobby .profile-chip { font-size: 12px; padding-right: 8px; }
}
.stop-card { background: var(--surface); border: 1px solid #ffffff96; border-radius: 22px; box-shadow: 0 8px 30px #10244d20; gap: 10px; }
.stop-card h3 { color: var(--ro-blue); font-size: 24px; letter-spacing: -.035em; }
.stop-num { color: var(--primary); font-size: 11px; letter-spacing: .14em; }
.stop-best { color: var(--muted); font-weight: 600; opacity: 1; }
.stop-stars, #endStars { color: #b38d00; }
.album-head, .coming-head { color: var(--ro-blue); }
.album-grid .photo { border-radius: 10px; box-shadow: 0 3px 9px #10244d1c; transform: none; border: 1px solid var(--line); }
.album-grid .photo.selected { outline: 2px solid var(--ro-yellow); transform: none; }
.album-grid .photo:hover:not(:disabled) { transform: translateY(-2px); }
.album-grid .year { color: var(--primary); }
.album-grid .photo.current::after { animation: none; background: var(--ro-red); }
.coming-page { background: transparent; color: var(--ro-blue); border: 0; box-shadow: none; }
.coming-mystery { background: linear-gradient(135deg,#244b98,#0d3377); border: 1px solid var(--line); box-shadow: 0 8px 24px #10244d20; transform: rotate(-2deg); }
.coming-mystery > span, .coming-mystery small { color: var(--ro-yellow); }
.coming-stamp { color: var(--primary); border-color: #b38d00; background: #fff2b875; font-family: 'Nunito', sans-serif; font-size: 16px; }
.brief-panel.album { background: var(--surface); }
.brief-where, .chapter-num { color: var(--primary); letter-spacing: .12em; }
.brief-task { background: var(--card); box-shadow: none; border: 1px solid var(--line); }
#brief h2, .chapter-panel h2 { color: var(--ro-blue); }
.brief-faces span { background: transparent; box-shadow: none; }
.brief-faces b { background: #002b7f; }
.brief-label { color: var(--primary); }
#end h2 { color: var(--ro-blue); }
#end .end-summary { border-color: var(--line); }
#end .grade-num { border-color: var(--ro-red); color: var(--ro-red); box-shadow: none; }
#end .grade-text { flex: 1; }
.grade-heading { display: flex; align-items: center; gap: 8px; }
.grade-heading > b { flex: 1; min-width: 0; }
.record-stamp { flex: none; border: 1.5px solid currentColor; border-radius: 4px; padding: 4px 6px; color: var(--ro-red); font-size: 10px; font-weight: 800; line-height: 1.1; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; transform: rotate(-4deg); }
.btn.share-btn, .btn.invite { background: var(--invite-green); color: #fff; }
.btn.share-btn:hover:not(:disabled), .btn.invite:hover:not(:disabled) { background: var(--invite-green-hover); }
#endShare > span, #endShare > small { display: block; }
#endShare > small { margin-top: 3px; font: 600 12px/1.3 var(--display-font); }
.share-panel .share-tip { font-size: 13px; line-height: 1.35; margin: 2px 0 0; }
.end-rival { border-radius: 12px; border-color: var(--line); }
.setup-panel .setup-top { background: #fff5d6; border-color: var(--line); }
#setupRank > b { color: var(--ro-blue); }
.gear-preview { background: linear-gradient(#e6edf7,#fff5d6); }
progress { accent-color: var(--ro-red); }
progress, progress::-webkit-progress-bar, .meter-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--ro-red); }
progress::-moz-progress-bar { background: var(--ro-red); }
.meter-bar i { background: var(--ro-red); }
.rank-step.earned { background: #dce6f7; color: var(--ro-blue); }
.rank-step.next { background: #fff2b8; color: var(--primary); border-color: #e5ca62; }
/* A bound notebook opens over the lobby, with ruled paper even before the first debt. */
#debts { background: #081d4866; }
.ledger-panel { max-width: 540px; padding: 28px 24px 0 50px; border: 1px solid #c3aa7e; border-left: 12px solid #31577a; border-radius: 8px 18px 18px 8px; background: #fff9e9; box-shadow: 5px 5px 0 #e7ddc8, 8px 8px 0 #ccb991, 0 18px 48px #081d4866; }
.ledger-panel::before { top: 24px; bottom: 22px; left: 8px; right: auto; width: 24px; height: auto; background: radial-gradient(ellipse 10px 4px at 12px 14px, #708296 55%, #d4dce0 60%, transparent 75%) 0 0 / 24px 28px repeat-y; }
.ledger-panel h2 { text-align: left; font-size: 28px; margin: 0 0 16px; }
.notebook-page { min-height: 224px; padding: 8px 12px 20px 20px; border-left: 2px solid #d9a4a0; background: repeating-linear-gradient(transparent 0 27px, #b9ccdc 27px 28px); text-align: left; }
.notebook-page #ledgerEmpty { margin: 0; max-width: 34ch; color: var(--muted); font: 600 15px/28px 'Nunito',sans-serif; }
.notebook-page .ledger { margin: 0; padding: 0; gap: 0; background: none; border: 0; border-radius: 0; }
.notebook-page .ledger li { min-height: 28px; line-height: 28px; align-items: flex-start; }
.notebook-page .ledger .av { padding-top: 2px; }
.ledger-panel .panel-foot { margin: 12px -24px 0 -50px; padding: 10px 24px 18px 50px; background: #fff9e9; justify-content: flex-end; }
.ledger-panel .panel-foot::before { background: linear-gradient(#fff9e900, #fff9e9); }
@container (max-height: 500px) {
  .ledger-panel { padding-top: 18px; }
  .ledger-panel h2 { font-size: 24px; margin-bottom: 10px; }
  .notebook-page { min-height: 140px; }
  .ledger-panel .panel-foot { margin-top: 6px; padding-top: 6px; padding-bottom: 12px; }
}
/* Rewards: a quiet, persistent badge; a scrollable list only on request. */
.notification-button { position: relative; flex-shrink: 0; }
.notification-count { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 1px 4px; border: 2px solid #f8f6ee; border-radius: 9px; background: var(--ro-red); color: #fff; font: 800 10px/12px 'Nunito',sans-serif; text-align: center; }
.notification-count:empty { display: none; }
.notifications-panel { display: flex; flex-direction: column; max-height: 100%; }
.notification-list { list-style: none; padding: 0; margin: 20px 0; overflow: auto; min-height: 0; text-align: left; }
.notification-item { display: flex; align-items: center; gap: 14px; padding: 13px; border-bottom: 1px solid var(--line); border-radius: 10px; }
.notification-item.unread { background: #fff5d6; }
.notification-icon { width: 40px; height: 40px; display: grid; place-items: center; flex-shrink: 0; font-size: 25px; }
.notification-icon svg { width: 40px; height: 40px; border-radius: 50%; }
.notification-item small { display: block; color: var(--muted); margin-bottom: 3px; font-size: 11px; }
.notification-item b { display: block; font-size: 14px; }
.notifications-panel > .row { flex-shrink: 0; }
/* A new item's card, compact at every size: the picture on the left; the badge, the name, the two steps and the way on
   beside it. */
#newShot .panel.newshot-panel { display: grid; grid-template-columns: 112px minmax(0, 1fr); column-gap: 16px; row-gap: 4px; align-items: center; justify-items: start; text-align: left; max-width: 440px; padding: 18px 20px 16px; }
#newShot .panel > * { grid-column: 2; margin: 0; }
.newshot-badge { padding: 3px 9px; border-radius: 999px; background: #fff2b8; color: var(--primary); font: 800 10px/1.2 var(--font-body); letter-spacing: .08em; text-transform: uppercase; }
#newShot .tutorial-art { grid-column: 1; grid-row: 1 / 6; position: relative; width: 112px; height: 100%; min-height: 104px; display: grid; place-items: center; background: linear-gradient(130deg,#e6edf7,#fff5d6); border-radius: 12px; overflow: hidden; }
#newShotIcon { position: relative; z-index: 1; display: block; width: 104px; height: 72px; }
.tutorial-path { position: absolute; width: 130%; height: 90px; left: -15%; top: 34px; border-top: 2px dashed #5979b6; border-radius: 50%; transform: rotate(-16deg); }
.tutorial-tap { position: absolute; right: 8%; top: 12%; color: #b38d00; font-size: 20px; }
#newShot h2 { font-size: 24px; line-height: 1.1; }
.tutorial-launch, .newshot-ability { font-size: 14px; line-height: 1.35; font-weight: 700; color: var(--ink); }
.newshot-ability b { color: var(--brand); }
#newShot #newShotOk { width: auto; margin-top: 6px; padding: 9px 16px; font-size: 15px; }
@container (max-height: 500px) {
  .lobby-top { padding-bottom: 4px; }
  .map-wrap { padding: 8px; border-radius: 16px; }
  .stop-card { gap: 5px; border-radius: 16px; }
  .lobby-brand { font-size: 22px; }
  .panel { border-radius: 18px; }
  .hud-buttons { gap: 6px; }
  .hud-buttons button { width: 38px; height: 38px; }
  .hud-box { padding: 5px 10px; }
  #score { font-size: 23px; }
  #levelName { max-width: 42vw; font-size: 11px; }
  .notifications-panel { max-width: 640px; padding: 20px; }
  .notification-list { margin: 10px 0; }
  #newShot .panel.newshot-panel { padding: 14px 16px 12px; }
  #newShot h2 { font-size: 21px; }
  .tutorial-launch, .newshot-ability { font-size: 13px; }
}
@container (max-height: 360px) {
  .notifications-panel h2 { font-size: 24px; }
  .notifications-panel .subtitle { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
  .stop .pulse, .album-grid .photo.current::after { animation: none; }
}
/* Equipment owns its scroll region, so its back button never covers the cards. */
.setup-panel { display: flex; flex-direction: column; gap: 8px; height: min(680px, 100%); overflow: hidden; }
.setup-panel > :not(.setup-items) { flex-shrink: 0; }
.setup-panel > h2, .setup-panel > .subtitle, .setup-panel > .row { margin: 0; }
.setup-panel .setup-items { min-height: 0; flex: 1 1 auto; overflow: auto; align-content: start; padding: 2px; }
.setup-panel .setup-items.grills { align-content: stretch; align-items: start; }
.setup-panel .setup-tabs { margin: 0 auto; }
.setup-panel .grill-card { border: 1px solid var(--line); }
.setup-panel .grill-card.on { border-color: #5979b6; box-shadow: inset 0 0 0 1px #5979b6; }
.setup-panel .shop-fine { margin: 0; }
.notifications-panel > .row { margin-top: 0; }
@container (max-height: 500px) {
  .setup-panel { padding: 16px 18px 12px; gap: 4px; }
  .setup-panel h2 { font-size: 23px; }
  .setup-panel .setup-top { padding: 5px 10px; min-height: 70px; }
  .setup-panel #setupPreview { max-height: 62px; }
  .setup-panel .rank-steps, .setup-panel .shop-fine { display: none; }
  .setup-panel .setup-tabs { margin: 0 auto; }
  .setup-panel .setup-items.grills { min-height: 86px; grid-auto-columns: minmax(130px, 1fr); }
  .setup-panel .grill-card { padding: 5px 7px; gap: 3px; }
  .setup-panel .grill-card .gear-desc { display: none; }
  .setup-panel .gear-preview { height: 42px; }
  .setup-panel .grill-card .gear-state { margin-top: 0; }
  .setup-panel .grill-card .gear-name { font-size: 12px; }
  .setup-panel > .row .btn { padding: 7px 18px; }
}
/* Matching surfaces for collection, profile and settings screens. */
.album-page { background: #dce6f7; border: 1px solid #bac9e4; box-shadow: none; }
.coach .say { color: var(--ink); }
.coach .say b { color: var(--ro-blue); }
.avatar-pick, .music-pick, .pack, .boost { border: 1px solid var(--line); box-shadow: none; background: #f4f6fc; }
.avatar-pick[aria-pressed="true"], .music-pick[aria-pressed="true"] { border-color: #5979b6; background: var(--card); }
.pack.pick { border-color: #e5ca62; box-shadow: none; }
.name-row input { border-color: var(--line); }
.switch { background: #e4e7ee; }
.switch[aria-checked="true"] { background: var(--ro-red); }
.setting { border-color: var(--line); }
.boost .use:disabled { background: #e4e7ee; color: var(--muted); opacity: 1; }
.boost .use.queued:disabled { background: #dbeaff; color: #153d76; }
.lobby .total-stars { white-space: nowrap; }
.panel-foot { background: var(--surface); }
.panel-foot::before { height: 14px; background: linear-gradient(#fffdf700, var(--surface)); }
.scroll-cue { left: auto; right: 12px; width: 25px; height: 25px; bottom: calc(100% + 3px); background: var(--card); color: var(--ro-blue); border: 1px solid #bac9e4; box-shadow: none; }
.scroll-cue svg { width: 16px; height: 16px; }
.panel.more-below .scroll-cue { animation: none; }
@container (max-height: 500px) {
  .panel h2 { font-size: 26px; }
  .stop-card h3 { font-size: 19px; }
  #settings .panel { padding-top: 18px; }
  #settings .settings-list { margin: 6px 0; row-gap: 0; }
  #settings .setting { padding: 4px 0; }
  #settings .diff-note { font-size: 12px; margin: 3px 0; }
  #settings .panel-foot { margin-top: 0; padding-top: 8px; padding-bottom: 12px; }
  #map .stop:not(.selected) .label { display: none; }
  #map .stop.selected .label { font-size: 23px; }
  #map .stop .num { font-size: 20px; }
  #map .stop .dot { r: 17px; }
  #map .map-region { font-size: 12px; }
}
/* a phone on its side: a narrower rail and stop card, so the map keeps its size */
@container (max-height: 500px) {
  .lobby-main { gap: 8px; }
  .chapter-rail { width: 164px; gap: 4px; }
  .chapter-rail button { gap: 6px; padding: 0 7px; }
  .chapter-rail .ic { width: 18px; font-size: 16px; }
  .chapter-rail b { font-size: 11.5px; line-height: 1.1; }
  .chapter-rail small { font-size: 9.5px; }
  .stop-card { width: 176px; }
}
/* the smallest phones: names only */
@container (max-height: 340px) {
  .chapter-rail { width: 148px; gap: 3px; }
  .chapter-rail small { display: none; }
  .coming-text ul { display: none; }
}
/* the rail leaves the folder and the coming page less room: the stamps shrink with their paper, and the coming
   page drops its mystery card */
.album-page.dosar .photo { container-type: inline-size; }
.album-page.dosar .mark { inset-inline: 3%; font-size: min(15px, 13cqi); letter-spacing: .04em; border-width: 2px; white-space: nowrap; }
.coming-page { container-type: inline-size; }
@container (max-width: 320px) { .coming-mystery { display: none; } }
@container (max-width: 820px) {
  .lobby-brand { display: none; }
  .lobby-top { justify-content: space-between; }
  .lobby-actions { gap: 6px; }
}
/* ---------- In-game HUD (index.html #hud) ----------
   Left: pause (highlighted) and restart, then one card with the round's numbers: the journey (dots for the chapter's
   stops, a tap goes to the map), the targets still standing (with their face) and the score. Under pause, a column
   as wide as the buttons: the helpers (a lifebuoy), then what's next in the slingshot. Right: settings, sound, full
   screen. Every button shares one size and corner (--hud-btn, --hud-corner). */
#hud { --hud-btn: 44px; --hud-corner: 12px; }
.hud-row { display: flex; align-items: stretch; gap: 8px; min-width: 0; max-width: 100%; }
.hud-controls { display: flex; gap: 6px; flex-shrink: 0; pointer-events: auto; }
.hud-controls button, .hud-buttons button {
  width: var(--hud-btn); height: var(--hud-btn); padding: 0; display: grid; place-items: center; cursor: pointer;
  color: var(--ink); background: #fffdf5ed; border: 1px solid #ffffff91; border-radius: var(--hud-corner); box-shadow: 0 4px 16px #10244d18;
}
.hud-controls button > *, .hud-box button > *, .boost-wrap button > * { pointer-events: none; }
.hud-controls button:hover, .hud-buttons button:hover { background: var(--surface); }
.hud-controls button:active { transform: translateY(1px); }
#btnPause.hud-pause { background: var(--brand); color: #fff; border-color: #ffffff40; box-shadow: 0 4px 16px #002b7f40; }
#btnPause.hud-pause:hover { background: #0b3a9e; }
.hud-box { display: flex; align-items: center; gap: 0; margin: 0; padding: 5px 4px 5px 6px; border-radius: var(--radius); min-width: 0; pointer-events: auto; }
.hud-stops {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; min-width: 0; max-width: 220px;
  padding: 3px 10px 3px 6px; border: 0; border-radius: 8px; background: none; cursor: pointer; text-align: left; font: inherit; color: inherit;
}
.hud-stops:hover { background: var(--card); }
/* a new player's first round: the stop's name is only a label (no map yet) */
.hud-stops:disabled { cursor: default; background: none; }
#levelName { max-width: 100%; color: var(--ink); font: 800 12px/1.2 var(--font-body); opacity: 1; }
#levelName .n { color: var(--primary); }
.hud-route { display: flex; align-items: center; gap: 3px; }
.hud-route i { width: 7px; height: 7px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.hud-route i.done { background: var(--brand); box-shadow: none; }
.hud-route i.now { width: 11px; height: 11px; background: var(--primary); box-shadow: 0 0 0 2px #b5443d33; }
.hud-route:empty { display: none; }
.hud-stat { display: flex; align-items: center; gap: 6px; padding: 0 12px; border-left: 1px solid var(--line); }
.hud-num { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; }
.hud-num b, #score { font: 800 24px/1 var(--font-display); letter-spacing: -.02em; color: var(--brand); }
.hud-num small { margin-top: 1px; font-size: 9px; letter-spacing: .08em; white-space: nowrap; }
.hud-ic { width: 30px; height: 30px; display: grid; place-items: center; flex-shrink: 0; }
.hud-ic img { width: 100%; height: 100%; object-fit: contain; }
.hud-targets.cleared b { color: var(--fun-green); }
.hud-score { gap: 8px; }
/* the left column: helpers, then the slingshot's queue */
.hud-side { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; pointer-events: none; }
.hud-side .boost-wrap { order: -1; }
.boost-wrap { position: relative; display: flex; align-items: center; gap: 8px; pointer-events: auto; }
.boost-btn {
  position: relative; display: grid; place-items: center; width: var(--hud-btn); height: var(--hud-btn); padding: 0; cursor: pointer;
  border: 1px solid #e5c24a; border-radius: var(--hud-corner); background: #fff2b8; color: var(--brand);
  box-shadow: 0 4px 14px #10244d26;
}
.boost-btn:hover { background: #ffeaa0; }
/* the gilded cross a little smaller on phones, so it keeps its margin in the smaller button */
.boost-btn .help-cross { width: 26px; height: 26px; }
.boost-btn[aria-expanded="true"] { box-shadow: 0 0 0 3px #fffdf5, 0 4px 14px #10244d26; }
.boost-btn i { position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; border: 2px solid #fffdf5; border-radius: 10px; background: var(--primary); color: #fff; font: 800 11px/15px var(--font-body); font-style: normal; text-align: center; }
.boost-btn i:empty { display: none; }
.boost-tray { display: flex; gap: 6px; padding: 5px; border-radius: 999px; background: #fffdf5f2; border: 1px solid #ffffff91; box-shadow: 0 6px 20px #10244d26; animation: tray-in .18s ease-out; }
@keyframes tray-in { from { opacity: 0; transform: translateX(-8px); } }
.boost-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 10px 0 6px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: 800 13px/1 var(--font-body);
}
.boost-chip:hover:not(:disabled) { background: var(--card); border-color: var(--line-strong); }
.boost-chip .ic { width: 24px; height: 24px; display: grid; place-items: center; font-size: 17px; }
.boost-chip .ic .shot-ic { width: 24px; height: 24px; margin: 0; }
.boost-chip small { color: var(--muted); font-weight: 800; }
/* a helper you can use right now stands out in the cross's gold; the others fade, their icons grey */
.boost-chip[data-helper]:not(:disabled) { background: #fff2b8; border-color: #e5c24a; box-shadow: 0 2px 8px #10244d1f; }
.boost-chip[data-helper]:not(:disabled):hover { background: #ffeaa0; border-color: #e5c24a; }
.boost-chip[data-helper]:not(:disabled) small { color: var(--ink); }
.boost-chip:disabled { opacity: .45; cursor: default; }
.boost-chip:disabled .ic { filter: grayscale(1); }
/* the fridge with only Plan B's mici in it: they're in the sling already, in Plan B's blue */
.boost-chip.queued:disabled { opacity: 1; background: #dbeaff; border-color: #9fb6e0; }
.boost-chip.queued:disabled .ic { filter: none; }
.boost-chip.queued small { color: #153d76; }
.boost-chip.more { padding: 0 12px; color: var(--brand); }
.side-shots { display: flex; flex-direction: column; align-items: center; gap: 2px; width: var(--hud-btn); padding: 7px 4px 5px; border-radius: 10px; background: #fffdf5e6; border: 1px solid #ffffff91; box-shadow: 0 4px 16px #10244d18; }
.side-shots .label { max-width: 100%; color: var(--muted); font-size: 7.5px; letter-spacing: 0; text-align: center; line-height: 1.1; white-space: nowrap; }
.side-shots .label b { display: block; margin-top: 1px; font: 800 19px/1 var(--font-display); color: var(--brand); }
.side-shots ol { list-style: none; margin: 3px 0 0; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.side-shots li { width: 28px; height: 28px; display: grid; place-items: center; }
.side-shots li img { width: 100%; height: 100%; object-fit: contain; }
.side-shots li.now { width: 34px; height: 34px; border-radius: 7px; background: #fff2b8; box-shadow: inset 0 0 0 1.5px var(--fun-yellow); }
.side-shots.empty { display: none; }
/* Plan B's extra shots: how many are still to come, under the count, and each one in Plan B's blue */
.side-plan { display: flex; flex-direction: column; align-items: center; width: 100%; margin-top: 2px; padding: 2px 0; border-radius: 6px; background: #dbeaff; color: #153d76; line-height: 1; }
.side-plan b { font: 800 13px/1 var(--font-display); }
.side-plan small { font-size: 7px; font-weight: 800; white-space: nowrap; }
.side-shots li.plan { border-radius: 7px; background: #dbeaff; }
/* The lăutar's one hint at Settings (musicHint in game.js): the lobby's hint bubble, under the gear on the right */
.music-hint { position: fixed; top: calc(max(12px, var(--safe-top)) + 56px); right: max(16px, var(--safe-right)); left: auto; max-width: 270px; transform: none; animation-name: mh-in; z-index: 21; }
.music-hint::before { left: auto; right: 16px; margin: 0; }
body:has(> .overlay:not(.hidden)) .music-hint, html.touring .music-hint { visibility: hidden; }
.music-hint.out { transform: translateY(-6px); }
.music-hint .gh-face { background: #e6dcf5; }
@keyframes mh-in { from { opacity: 0; transform: translateY(-10px) scale(.92); } }
@container (max-height: 500px) { .music-hint { top: calc(max(8px, var(--safe-top)) + 50px); } .music-hint::before { right: 14px; } }
@media (prefers-reduced-motion: reduce) { .music-hint { animation: none; } }
/* In the lobby, snackbars (the train's announcement…) come under its top bar, never over its buttons */
body:has(> #menu:not(.hidden):not([inert])) #toasts { top: calc(max(6px, var(--safe-top)) + 60px); }
/* Bunica's one hint at the helpers (helpHint in game.js): the lobby's hint bubble, beside the button instead of under it,
   its top level with the button's so it stays clear of the bar above */
.help-hint { top: 0; left: calc(100% + 12px); max-width: 260px; transform: none; animation-name: hh-in; z-index: 1; }
.help-hint::before { top: calc(var(--hud-btn, 48px) / 2 - 6px); left: -7px; margin: 0; border-width: 0 0 1px 1px; }
.help-hint.out { transform: translateX(-6px); }
.help-hint .gh-face { background: #f6e3cf; }
@keyframes hh-in { from { opacity: 0; transform: translateX(-10px) scale(.92); } }
@media (prefers-reduced-motion: reduce) { .help-hint { animation: none; } }
/* while a tap sets off the flying shot, taps up here go to the game too */
.hud-controls, .hud-box, .boost-wrap { transition: opacity .2s; }
#hud.tapping :is(.hud-controls, .hud-box, .boost-wrap) { pointer-events: none; opacity: .45; }
/* the hint card sits right of the left column, under the numbers */
#hint { left: calc(max(16px, var(--safe-left)) + 60px); top: calc(max(12px, var(--safe-top)) + 62px); }
body:where(:has(#rival:not(.hidden))) #hint { top: calc(max(12px, var(--safe-top)) + 100px); }
/* The question before a round in progress is thrown away */
.leave-panel p { color: var(--muted); margin: 8px 0 16px; }
.pause-panel .notification-button, #pause .notification-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
#pause .notification-count { position: static; border-color: transparent; }
@container (max-height: 500px) {
  #hud { --hud-btn: 40px; --hud-corner: 10px; }
  .hud-row { gap: 6px; }
  .hud-box { padding: 3px 2px 3px 4px; }
  .hud-stops { gap: 3px; padding: 2px 8px 2px 4px; max-width: 180px; }
  #levelName { font-size: 11px; max-width: 180px; }
  .hud-route i { width: 6px; height: 6px; }
  .hud-route i.now { width: 9px; height: 9px; }
  .hud-stat { padding: 0 9px; gap: 4px; }
  .hud-num b, #score { font-size: 19px; }
  .hud-ic { width: 24px; height: 24px; }
  .hud-side { gap: 6px; }
  .boost-btn .help-cross { width: 24px; height: 24px; }
  .side-shots li:nth-child(n+4) { display: none; }
  .boost-chip .nm { display: none; }
  .boost-chip { height: 30px; font-size: 12px; }
  .side-shots { padding: 6px 3px 4px; border-radius: 9px; }
  .side-shots .label { font-size: 7px; }
  .side-shots li { width: 24px; height: 24px; }
  .side-shots li.now { width: 30px; height: 30px; border-radius: 6px; }
  .side-shots .label b { font-size: 16px; }
  #hint { left: calc(max(16px, var(--safe-left)) + 52px); top: calc(max(8px, var(--safe-top)) + 50px); }
  body:where(:has(#rival:not(.hidden))) #hint { top: calc(max(8px, var(--safe-top)) + 84px); }
}
@container (max-height: 340px) {
  .side-shots li:nth-child(n+3) { display: none; }
}
/* a thin window: the numbers get the second row, as before */
@container (max-width: 560px) {
  .hud-row { flex-wrap: wrap; }
  .hud-stops { max-width: 150px; }
}
@media (prefers-reduced-motion: reduce) { .boost-tray { animation: none; } }

/* ---------- A phone held upright: which way to turn it (game.js syncTurnHint) ---------- */
/* Over everything, the way the phone is held: on the turned page (html.rotated) the card turns back a quarter, from the
   turned body's corner (it holds fixed elements), so it reads upright. */
.turn-hint {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: #001a4fd6; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
html.rotated .turn-hint {
  inset: auto; left: 0; top: 0; width: var(--rot-h); height: var(--rot-w);
  transform-origin: 0 0; transform: translateY(var(--rot-h)) rotate(-90deg);
}
.turn-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 100%; max-width: 320px; padding: 20px 22px 18px;
  background: var(--surface); color: var(--ink); border-radius: 20px; box-shadow: var(--shadow); text-align: center;
  animation: panel-in 0.35s ease-out backwards;
}
.turn-phone { width: 132px; height: 132px; margin-bottom: 2px; }
.turn-arrow { fill: none; stroke: var(--primary); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.turn-device { fill: var(--brand); transform-box: view-box; transform-origin: 70px 78px; animation: turn-phone 2.8s ease-in-out infinite; }
.turn-screen { fill: var(--card); }
@keyframes turn-phone {
  0% { transform: rotate(0deg); opacity: 0; }
  8%, 24% { transform: rotate(0deg); opacity: 1; }
  56%, 86% { transform: rotate(-90deg); opacity: 1; }
  100% { transform: rotate(-90deg); opacity: 0; }
}
#turnHintTitle { font: 800 22px/1.15 var(--font-display); color: var(--brand); }
.turn-card span { font: 600 var(--fs-body)/1.35 var(--font-body); color: var(--muted); }
.turn-card small { margin-top: 10px; font: 800 var(--fs-label)/1.2 var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--primary); }
@media (prefers-reduced-motion: reduce) {
  .turn-card { animation: none; }
  .turn-device { animation: none; transform: rotate(-90deg); }
}
