/* Daily missions: a clipboard of three jobs from Sparky. */

.missions-btn { position: relative; }
.badge {
  position: absolute; top: -8px; right: -8px; min-width: 30px; height: 30px; padding: 0 8px;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--red); color: #fff; font-family: var(--display); font-size: 1.05rem;
  box-shadow: 0 2px 4px rgba(20, 30, 50, .3);
}
.badge.all-done { background: var(--go); }
.badge .i { width: 18px; height: 18px; }

.missions-body {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
  padding: 4px 4px 16px; scrollbar-width: thin; scrollbar-color: rgba(28, 35, 51, .35) transparent; max-width: 760px; width: 100%; margin: 0 auto;
}
.missions-body > .mech { position: static; align-self: flex-start; }

.jobs {
  list-style: none; margin: 0; padding: 18px; display: flex; flex-direction: column; gap: 12px;
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  position: relative;
}
/* The clipboard clip */
.jobs::before {
  content: ""; position: absolute; top: -12px; left: 50%; translate: -50% 0;
  width: 110px; height: 24px; border-radius: 10px 10px 6px 6px;
  background: linear-gradient(#b9c1cc, #8b95a3); box-shadow: 0 2px 3px rgba(20, 30, 50, .3);
}

.job {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-areas: "icon text pay" "icon gauge pay";
  align-items: center; gap: 6px 14px; padding: 10px 14px; border-radius: 16px; background: #fff;
  border: 2px solid #ece4d2; position: relative;
}
.job-icon { grid-area: icon; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: #fff0c4; color: #6b4500; }
.job-icon .i { width: 28px; height: 28px; }
.job-text {
  grid-area: text; text-align: left; border: 0; background: none; padding: 0; color: var(--ink);
  font-family: var(--read); font-weight: 700; font-size: clamp(1.15rem, 2.6vw, 1.45rem); line-height: 1.25;
}
.job-text::after { content: ""; position: absolute; inset: 0; }
.job-text::before {
  content: ""; display: inline-block; width: 22px; height: 22px; margin-right: 8px; vertical-align: -4px; background: var(--ink);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9h4l5-4v14l-5-4H3z'/%3E%3Cpath d='M15 9a4 4 0 0 1 0 6M17.5 6.5a8 8 0 0 1 0 11' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9h4l5-4v14l-5-4H3z'/%3E%3Cpath d='M15 9a4 4 0 0 1 0 6M17.5 6.5a8 8 0 0 1 0 11' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.gauge {
  grid-area: gauge; position: relative; height: 24px; border-radius: 999px; overflow: hidden;
  background: #e9e2d2; box-shadow: inset 0 2px 3px rgba(20, 30, 50, .15);
}
.gauge i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#ffd75a, var(--gold)); border-radius: 999px; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.gauge b { position: relative; display: block; text-align: center; font-family: var(--display); font-weight: 400; font-size: .95rem; line-height: 24px; color: var(--ink); font-variant-numeric: tabular-nums; }
.job-pay { grid-area: pay; display: inline-flex; align-items: center; gap: 4px; font-family: var(--display); font-size: 1.3rem; }
.job-pay .i { width: 1.4em; height: 1.4em; }

.job.done { background: #eaf7ee; border-color: #b9e2c5; }
.job.done .job-icon { background: var(--go); color: #fff; }
.job.done .gauge i { background: linear-gradient(var(--go), var(--go-dark)); }
.job.done .gauge b { color: #fff; }
.job-pay .tick { color: var(--go-dark); width: 40px; height: 40px; }

.job-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.job-foot p { margin: 0; display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-size: 1.15rem; }
.job-foot .i { width: 1.4em; height: 1.4em; }
.all-three.got { color: var(--go-dark); }
.days { background: var(--paper); border-radius: 999px; padding: 6px 16px; box-shadow: var(--shadow); }
.days b { color: var(--red); font-weight: 400; font-size: 1.4rem; }
.job-foot .btn { margin-left: auto; }

/* Mission notes on the results and story screens */
.mission-toast { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.mission-toast p { margin: 0; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 1.05rem; animation: pop .5s cubic-bezier(.2, .9, .3, 1.4) both; }
.mission-toast p:nth-child(2) { animation-delay: .15s; }
.mission-toast p:nth-child(3) { animation-delay: .3s; }
.mission-toast .i { width: 1.3em; height: 1.3em; color: var(--go); }
.mission-toast b { font-family: var(--display); font-weight: 400; color: var(--gold-dark); }
.mission-toast .bonus-line { font-family: var(--display); font-weight: 400; color: var(--go-dark); }

@media (max-width: 700px), (max-height: 420px) {
  .missions-body { gap: 18px; }
  .missions-body > .mech { display: none; }
  .jobs { padding: 14px 12px; gap: 8px; }
  .job { padding: 8px 10px; gap: 4px 10px; grid-template-columns: 40px minmax(0, 1fr) auto; }
  .job-icon { width: 40px; height: 40px; }
}

/* Short landscape phones: one line per job so "Go racing" stays on screen. */
@media (max-height: 420px) {
  .missions-body { gap: 14px; padding-top: 10px; }
  .jobs { padding: 12px 10px; gap: 6px; }
  .jobs::before { height: 16px; top: -8px; width: 80px; }
  .job { grid-template-columns: 36px minmax(0, 1fr) minmax(90px, 26%) auto; grid-template-areas: "icon text gauge pay"; padding: 6px 10px; }
  .job-icon { width: 36px; height: 36px; }
  .job-icon .i { width: 22px; height: 22px; }
  .job-text { font-size: 1.1rem; }
  .job-foot .btn { min-height: 52px; padding: 10px 20px; }
}

/* Three buttons under Race! now: let them share the row and wrap on narrow screens. */
.home-row { flex-wrap: wrap; justify-content: center; }
.home-row .btn { flex: 1 1 150px; padding-inline: 18px; }

@media (max-width: 420px) {
  .topbar-right { gap: 6px; }
  .topbar-right .icon-btn { width: 46px; height: 46px; }
  .topbar-right .coins { padding: 4px 10px 4px 6px; font-size: 1.1rem; }
  .logo { font-size: 1.45rem; }
}

/* New car on sale, shown in the region celebration */
.prize { display: flex; align-items: center; gap: 12px; justify-content: center; }
.prize svg { width: min(180px, 40vw); height: auto; }
.prize p { margin: 0; max-width: 18ch; text-align: left; }

/* Garage tabs: a sideways strip with arrows at each end when there's more to see. */
.tabs-wrap { position: relative; display: flex; align-items: center; gap: 6px; flex: none; min-width: 0; }
.tabs-wrap .shop-tabs { flex: 1; min-width: 0; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: rgba(28, 35, 51, .35) transparent; }
.tabs-wrap .shop-tabs::-webkit-scrollbar { display: block; height: 6px; }
.tabs-wrap .shop-tabs::-webkit-scrollbar-thumb { background: rgba(28, 35, 51, .35); border-radius: 3px; }
.shop-tabs .tab { scroll-snap-align: start; }
.tabs-arrow { width: 48px; height: 48px; visibility: hidden; }
.tabs-arrow .i { width: 22px; height: 22px; }
.tabs-arrow.next .i { transform: scaleX(-1); }
.tabs-wrap.can-left .tabs-arrow:not(.next), .tabs-wrap.can-right .tabs-arrow.next { visibility: visible; }

/* Track name, shown at the start of each race then fading out */
.track-tag {
  position: absolute; left: 50%; top: 10px; translate: -50% 0; z-index: 4; pointer-events: none;
  background: rgba(28, 35, 51, .72); color: #fff; font-family: var(--display); font-size: 1.25rem;
  padding: 6px 18px; border-radius: 999px; animation: tagFade 5s ease-out forwards;
}
@keyframes tagFade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

/* Sticker book screen and the "you got stickers" note */
.book-body { flex: 1; min-height: 0; margin-top: 8px; }
.badges-btn { margin-left: auto; min-height: 48px; padding: 8px 16px; font-size: 1.05rem; }
.book-toast {
  display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center;
  border: 3px dashed var(--gold); background: #fff8e1; border-radius: 16px; padding: 6px 12px; min-height: 48px;
  font-family: var(--display); font-size: 1.05rem; color: var(--ink); animation: pop .5s cubic-bezier(.2, .9, .3, 1.4) both .4s;
}
.book-toast img { width: 32px; height: 32px; }

/* Game picker on the road trip screen */
.game-pick { display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px; scrollbar-width: none; flex: none; }
.game-pick::-webkit-scrollbar { display: none; }
.game-chip {
  flex: none; border: 0; border-radius: 999px; padding: 8px 16px; min-height: 48px; white-space: nowrap;
  font-family: var(--display); font-size: 1rem; background: rgba(255, 255, 255, .6); color: var(--ink);
}
.game-chip[aria-checked="true"] { background: var(--go); color: #fff; box-shadow: var(--shadow); }
.tabs-arrow span { font-family: var(--display); font-size: 2rem; line-height: 1; color: var(--ink); margin-top: -4px; }

/* Garage groups: five big choices above the part tabs */
.shop-groups { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: none; padding: 2px; }
.shop-groups::-webkit-scrollbar { display: none; }
.shop-group {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 52px; padding: 8px 14px; border: 0; border-radius: 16px;
  background: var(--paper); color: var(--ink); font-family: var(--display); font-size: 1.05rem; box-shadow: var(--shadow);
}
.shop-group span { font-size: 1.4rem; line-height: 1; }
.shop-group[aria-pressed="true"] { background: var(--go); color: #fff; }
@media (max-height: 430px) { .shop-group { min-height: 44px; padding: 6px 10px; font-size: .95rem; } .shop-group span { font-size: 1.15rem; } }
@media (max-height: 430px) {
  .shop-side { gap: 6px; }
  .shop-groups .shop-group { min-height: 40px; padding: 4px 10px; }
  .tabs-wrap .tab { min-height: 40px; padding: 6px 12px; }
  .tabs-wrap .tabs-arrow { width: 40px; height: 40px; }
  .shop-tabs { padding: 4px; }
}

/* Picture on each game and length chip */
.chip-pic { width: 1.6em; height: 1.6em; margin-right: 6px; vertical-align: middle; flex: none; pointer-events: none; }
.game-chip, .length { display: inline-flex; align-items: center; }

/* Garage tabs wrap onto a second row instead of hiding behind arrows, and stay
   48px tall on short screens, so every part type is visible and easy to tap. */
.shop-groups { flex-wrap: wrap; overflow: visible; }
.tabs-wrap .shop-tabs { flex-wrap: wrap; overflow: visible; justify-content: flex-start; }
.tabs-wrap .tabs-arrow { display: none; }
@media (max-height: 430px) {
  .shop-groups .shop-group, .tabs-wrap .tab { min-height: 48px; }
  .tabs-wrap .tab { padding: 6px 14px; }
}
/* Phones held sideways have no height to spare: one sideways row with arrows again. */
@media (max-height: 430px) {
  .shop-groups { flex-wrap: nowrap; overflow-x: auto; }
  .tabs-wrap .shop-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .tabs-wrap .tabs-arrow { display: grid; }
}

/* Tablet and PC: two columns so the whole page fits without scrolling.
   Left: Sparky and today's jobs. Right: the reading streak and the Weekly Cup. */
@media (min-width: 760px) {
  .missions-body { display: grid; max-width: 1100px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 18px; row-gap: 10px; align-content: start;
    grid-template-areas: "mech streak" "jobs streak" "jobs cup" "foot cup"; grid-template-rows: auto auto 1fr auto; }
  .missions-body > .mech { grid-area: mech; }
  .missions-body > .jobs { grid-area: jobs; }
  .missions-body > .job-foot { grid-area: foot; }
  .missions-body > .streak-cal { grid-area: streak; margin-top: 0; align-self: start; }
  .missions-body > .cup { grid-area: cup; margin-top: 0; align-self: start; }
}
@media (min-width: 760px) and (max-height: 640px) {
  .missions-body .job { padding-block: 6px; }
  .missions-body > .mech { transform: scale(.9); transform-origin: left top; }
}
@media (min-width: 760px) and (max-height: 640px) {
  .missions-body { row-gap: 6px; padding-bottom: 4px; }
  .missions-body > .streak-cal, .missions-body > .cup { padding: 8px 12px; }
  .missions-body > .job-foot { margin: 0; }
}
@media (min-width: 760px) and (max-height: 640px) { .missions-body .jobs { gap: 6px; } .missions-body .job { padding-block: 4px; } .missions-body > .mech { margin-bottom: -6px; } }
@media (min-width: 760px) and (max-height: 640px) { .missions-body > .cup li { min-height: 0; padding-block: 2px; } .missions-body > .cup .note { margin-block: 2px; } }
