/* The Arcade's level trail (js/core/level-trail.js, GameShell.renderLevelTrail):
   numbered level dots with stars, on the start card and the finish card. White discs
   with dark numbers read on the light cards and on the dark immersive frame alike. */

.level-trail { width: max-content; max-width: 100%; margin: 4px 0 2px; }
.game-room[data-trail="true"] #intro .intro-return { display: none; }
.level-trail-row { list-style: none; margin: 0; padding: 0 0 16px; display: grid; grid-template-columns: repeat(6, auto); justify-content: start; gap: 16px 8px; align-items: center; }
.level-trail-row li { position: relative; display: flex; align-items: center; justify-content: center; }
/* a little path between the dots of a row (six to a row) */
.level-trail-row li:not(:nth-child(6n + 1))::before {
  content: ""; position: absolute; left: -9px; top: 50%; width: 10px; height: 4px; border-radius: 2px;
  background: #ffffffb3; box-shadow: 0 0 0 1px #30345f22; transform: translateY(-50%);
}
.level-dot {
  --dot: 46px; position: relative; width: var(--dot); height: var(--dot); border-radius: 50%;
  border: 3px solid #fff; background: #ffffffe6; color: #30345f; font: 700 18px/1 Fredoka, system-ui, sans-serif;
  display: grid; place-items: center; padding: 0; cursor: pointer;
  box-shadow: 0 4px 0 #30345f2e; transition: transform .15s;
}
.level-dot:active:not(:disabled) { transform: translateY(2px) scale(.96); }
.level-dot.done { background: #ffcf4a; border-color: #fff4c9; color: #5b3d00; }
.level-dot.bonus .level-num::after { content: "✦"; position: absolute; top: -9px; right: -6px; font-size: 16px; color: #8d7cdb; }
.level-dot.current, .level-dot.fresh {
  --dot: 56px; background: #2f8f5b; border-color: #d7f3e1; color: #fff; font-size: 22px;
  animation: level-glow 1.4s ease-in-out infinite;
}
.level-dot.locked { background: #ffffff66; border-color: #ffffff99; color: transparent; cursor: default; box-shadow: none; }
.level-dot.locked::before {
  content: ""; width: 16px; height: 13px; border-radius: 3px; background: #30345f55; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -20%);
}
.level-dot.locked::after {
  content: ""; width: 10px; height: 10px; border: 3px solid #30345f55; border-bottom: 0; border-radius: 8px 8px 0 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -95%);
}
.level-dot.just { animation: level-pop .6s cubic-bezier(.3, 1.6, .5, 1); }
.level-num { position: relative; }
.level-stars { position: absolute; bottom: -15px; left: 50%; transform: translateX(-50%); display: flex; gap: 1px; }
.level-stars i { width: 11px; height: 11px; background: #ffffff8c; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.level-stars i.on { background: #f5b82e; }
.level-dot:not(.done) .level-stars { display: none; }
.level-trail-name { margin: 2px 0 0; font: 500 16px/1.3 Fredoka, system-ui, sans-serif; color: inherit; opacity: .85; }
@keyframes level-glow { 0%, 100% { box-shadow: 0 4px 0 #1d6440, 0 0 0 0 #2f8f5b88; } 50% { box-shadow: 0 4px 0 #1d6440, 0 0 0 10px #2f8f5b00; } }
@keyframes level-pop { 0% { transform: scale(.6); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }

/* the finish card centres its trail */
.finish-card .level-trail { margin: 10px auto 2px; }
.finish-card .level-trail-row { justify-content: center; }
/* the start card: the trail sits under the game's goal */
.game-room[data-trail="true"] #intro .level-options { opacity: .75; }

@media (max-width: 700px) {
  .level-trail { margin-inline: auto; max-width: 100%; }
  .level-trail-row { justify-content: center; gap: 16px 7px; }
  .level-dot { --dot: 40px; font-size: 16px; }
  .level-dot.current, .level-dot.fresh { --dot: 48px; font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { .level-dot { animation: none !important; } }
html.quiet .level-dot { animation: none !important; }

/* Arcade tiles: the level this child is on, and the stars they have */
.room-tile .tile-trail {
  position: absolute; top: 10px; left: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px; background: #ffffffe8; color: #30345f; box-shadow: 0 3px 0 #30345f26;
  font: 600 14px/1 Fredoka, system-ui, sans-serif;
}
.room-tile .tile-trail[data-fresh="true"] { background: #2f8f5b; color: #fff; }
.room-tile .tile-stars { color: #b07a00; }
.room-tile .tile-stars:empty { display: none; }
@media (max-width: 700px) { .room-tile .tile-trail { top: 8px; left: 8px; font-size: 12px; padding: 4px 8px; } }
