/* ==========================================================================
   SPRINKLERDUDE UI KIT — STEP 7: SHOPS AND PLACES
   Paste after the step 6 block. It reuses .sd-note, .sd-msg, .sd-action
   (step 5), .sd-menu (step 4) and the Program pieces from step 6.
   Covers: supply house, gas station with scratch-off, job board, van panel,
   payday, side-quest quiz and the schedule quest.
   ========================================================================== */

/* 10.0 Tokens -------------------------------------------------------------- */
:root {
  --sd-talk-portrait: 56px;
  --sd-job-num: 36px;
  --sd-badge-size: 150px;
  --sd-badge-size-sm: 104px;
  --sd-ticket-w: 150px;
  --sd-ticket-h: 78px;
  --sd-quiz-pic-w: 180px;
  --sd-quiz-pic-w-sm: 132px;
  --sd-hero-max: 200px;               /* "On to the next one" art on payday */
  --sd-hero-max-sm: 150px;
  --sd-hero-max-xs: 96px;             /* phone landscape */
}

/* 10.1 A character talking inside a panel ----------------------------------- */
/* <div class="sd-talk"><canvas class="sd-talk__portrait"></canvas><p class="sd-talk__text"><strong>Rosa:</strong> …</p></div> */
.sd-talk {
  display: flex;
  align-items: center;
  gap: var(--sd-sp-3);
  padding: var(--sd-sp-2);
  border-radius: var(--sd-r-md);
  background: var(--sd-paper-2);
}
.sd-talk__portrait {
  flex: none;
  width: var(--sd-talk-portrait);
  height: var(--sd-talk-portrait);
  border: var(--sd-bw) solid var(--sd-ink);
  border-radius: var(--sd-r-md);
  background: var(--sd-paper);
}
.sd-talk__text { margin: 0; line-height: 1.4; }

/* A panel body laid out as a simple stack */
.sd-stack {
  display: grid;
  gap: var(--sd-sp-3);
  min-width: 0;
}

/* 10.2 Shop items ----------------------------------------------------------- */
.sd-items {
  display: grid;
  gap: var(--sd-sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.sd-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--sd-sp-1) var(--sd-sp-3);
  align-items: center;
  padding: var(--sd-sp-2) var(--sd-sp-3);
  border: var(--sd-bw) solid var(--sd-line);
  border-radius: var(--sd-r-md);
  background: var(--sd-paper);
}
.sd-item__main { min-width: 0; }
.sd-item__name { font-weight: 800; line-height: 1.3; }
.sd-price {
  color: var(--sd-amber-text);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sd-item__desc {
  display: block;
  font-size: var(--sd-fs-sm);
  line-height: 1.35;
}
.sd-item__tip {
  display: block;
  color: var(--sd-ink-soft);
  font-size: var(--sd-fs-sm);
  line-height: 1.35;
}
.sd-item__reason {                    /* why Buy is disabled */
  display: block;
  color: var(--sd-red-text);
  font-size: var(--sd-fs-sm);
  font-weight: 700;
}
.sd-item__action { padding-bottom: 3px; }
/* Owned: lime tint, and the price slot reads "✔ Owned" */
.sd-item.is-owned {
  border-color: var(--sd-lime-dark);
  background: var(--sd-lime-tint);
}
.sd-item.is-owned .sd-price { color: var(--sd-green-text); }
/* On order: arrives with a later appointment */
.sd-item.is-soon {
  border-style: dashed;
  border-color: var(--sd-ink-soft);
  background: var(--sd-paper-2);
}
.sd-item.is-soon .sd-item__name,
.sd-item.is-soon .sd-item__desc { color: var(--sd-ink-soft); }
.sd-item.is-soon .sd-price { color: var(--sd-ink-soft); }

/* 10.3 Scratch-off ----------------------------------------------------------- */
.sd-scratch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sd-sp-3) var(--sd-sp-4);
}
.sd-scratch__side {
  flex: 1 1 220px;
  display: grid;
  gap: var(--sd-sp-2);
  min-width: 0;
}
/* The ticket. Plain = not scratched yet. */
.sd-ticket {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--sd-ticket-w);
  height: var(--sd-ticket-h);
  padding: var(--sd-sp-1);
  border: var(--sd-bw) dashed var(--sd-ink);
  border-radius: var(--sd-r-md);
  background-color: var(--sd-amber-tint);
  background-image: repeating-linear-gradient(135deg,
    transparent 0, transparent 7px,
    var(--sd-ink-a20) 7px, var(--sd-ink-a20) 9px);
  color: var(--sd-ink);
  font-family: var(--sd-font-display);
  font-stretch: condensed;
  font-size: var(--sd-fs-lg);
  font-weight: 800;
  line-height: var(--sd-lh-tight);
  text-align: center;
  text-transform: uppercase;
}
.sd-ticket--lose {
  border-color: var(--sd-ink-soft);
  background: var(--sd-paper-2);
  color: var(--sd-ink-soft);
}
.sd-ticket--win {
  border-style: solid;
  background: var(--sd-lime);
  box-shadow: var(--sd-shadow-card);
}

/* 10.4 Job board ------------------------------------------------------------- */
.sd-jobs {
  display: grid;
  gap: var(--sd-sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.sd-job {
  display: grid;
  grid-template-columns: var(--sd-job-num) minmax(0, 1fr);
  gap: var(--sd-sp-1) var(--sd-sp-3);
  align-items: center;
  padding: var(--sd-sp-2) var(--sd-sp-3);
  border: var(--sd-bw) solid var(--sd-line);
  border-radius: var(--sd-r-md);
  background: var(--sd-paper);
}
.sd-job__num {
  align-self: start;
  display: grid;
  place-items: center;
  width: var(--sd-job-num);
  height: var(--sd-job-num);
  border-radius: 50%;
  background: var(--sd-ink);
  color: var(--sd-paper);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.sd-job__main { min-width: 0; }
.sd-job__title { font-weight: 800; line-height: 1.3; }
.sd-job__place { color: var(--sd-ink-soft); font-weight: 400; }
.sd-job__teaser { display: block; font-size: var(--sd-fs-sm); line-height: 1.35; }
.sd-job__meta { display: block; color: var(--sd-ink-soft); font-size: var(--sd-fs-sm); line-height: 1.35; }
.sd-job__state {
  grid-column: 2;
  font-size: var(--sd-fs-sm);
  font-weight: 800;
  padding-bottom: 3px;
}
.sd-job.is-done {
  border-color: var(--sd-lime-dark);
  background: var(--sd-lime-tint);
}
.sd-job.is-done .sd-job__num { background: var(--sd-green-text); }
.sd-job.is-done .sd-job__state { color: var(--sd-green-text); }
/* The one you can take: outlined in ink and lifted */
.sd-job.is-current {
  border-color: var(--sd-ink);
  box-shadow: var(--sd-shadow-card);
  margin: 0 4px 4px 0;
}
.sd-job.is-current .sd-job__num { background: var(--sd-lime); color: var(--sd-ink); box-shadow: 0 0 0 var(--sd-bw) var(--sd-ink); }
.sd-job.is-locked {
  border-style: dashed;
  border-color: var(--sd-ink-soft);
  background: var(--sd-paper-2);
}
.sd-job.is-locked .sd-job__num { background: var(--sd-ink-soft); }
.sd-job.is-locked .sd-job__title,
.sd-job.is-locked .sd-job__teaser,
.sd-job.is-locked .sd-job__state { color: var(--sd-ink-soft); }

/* 10.5 Van panel -------------------------------------------------------------- */
.sd-van-art {
  display: grid;
  place-items: center;
  padding: var(--sd-sp-3);
  border-radius: var(--sd-r-md);
  background: var(--sd-ink-raised);
  box-shadow: inset 0 -4px 0 var(--sd-blue), inset 0 -8px 0 var(--sd-lime);
  padding-bottom: calc(var(--sd-sp-3) + 8px);
}
.sd-van-art > * { max-width: 100%; max-height: 60px; object-fit: contain; }

/* 10.6 Payday ---------------------------------------------------------------- */
.sd-payday {
  display: grid;
  gap: var(--sd-sp-3);
  min-width: 0;
}
.sd-payday__hero {
  display: block;
  width: 100%;
  max-width: var(--sd-hero-max-sm);
  height: auto;
  margin: 0 auto;
}
.sd-payday__slip {                    /* badge beside the pay slip */
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sd-sp-3);
  align-items: center;
  justify-items: center;
}
.sd-payday__slip > :not(.sd-badge) { width: 100%; min-width: 0; }
.sd-badge {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 2px;
  flex: none;
  width: var(--sd-badge-size-sm);
  height: var(--sd-badge-size-sm);
  border: 5px solid var(--sd-lime);
  border-radius: 50%;
  outline: var(--sd-bw-heavy) solid var(--sd-ink);
  background: var(--sd-ink);
  color: var(--sd-paper);
  text-align: center;
}
.sd-badge__logo { width: 72%; height: auto; }
.sd-badge__title {
  color: var(--sd-lime);
  font-size: var(--sd-fs-2xs);
  font-weight: 800;
  line-height: 1.1;
}
.sd-badge__sub { font-size: var(--sd-fs-2xs); font-weight: 700; line-height: 1.1; padding: 0 var(--sd-sp-2); }
.sd-zone-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--sd-sp-3);
}
.sd-zone-cards .sd-table th,
.sd-zone-cards .sd-table td { padding-left: var(--sd-sp-3); padding-right: var(--sd-sp-3); }

/* 10.7 Quiz ------------------------------------------------------------------- */
.sd-quiz {
  display: grid;
  gap: var(--sd-sp-3);
  min-width: 0;
}
.sd-quiz__q {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sd-sp-3);
}
.sd-quiz__pic {
  flex: none;
  width: var(--sd-quiz-pic-w-sm);
  height: auto;
  aspect-ratio: 2;
  border: var(--sd-bw) solid var(--sd-ink);
  border-radius: var(--sd-r-md);
  background: var(--sd-paper-2);
}
.sd-quiz__prompt {
  flex: 1 1 180px;
  margin: 0;
  font-size: var(--sd-fs-lg);
  font-weight: 800;
  line-height: 1.3;
}
.sd-choices {
  display: grid;
  gap: var(--sd-sp-2);
  padding-bottom: 3px;
}
/* An answer: a wide button with left-aligned sentence text */
.sd-choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sd-sp-2);
  width: 100%;
  min-height: var(--sd-tap);
  padding: var(--sd-sp-2) var(--sd-sp-4);
  border: var(--sd-bw) solid var(--sd-ink);
  border-radius: var(--sd-r-md);
  background: var(--sd-paper);
  color: var(--sd-ink);
  font-family: var(--sd-font-body);
  font-size: var(--sd-fs-md);
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
  box-shadow: var(--sd-shadow-btn-sm);
  cursor: pointer;
  transition: transform var(--sd-dur) ease-out, box-shadow var(--sd-dur) ease-out;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) {
  .sd-choice:not(:disabled):hover { background: var(--sd-lime-tint); }
}
.sd-choice:active { transform: translateY(2px); box-shadow: var(--sd-shadow-pressed); }
.sd-choice:disabled {
  border-style: dashed;
  border-color: var(--sd-ink-soft);
  background: var(--sd-paper-2);
  color: var(--sd-ink-soft);
  box-shadow: none;
  transform: none;
  cursor: default;
}
/* After answering: the right answer and, if different, the one you picked */
.sd-choice.is-right,
.sd-choice.is-wrong {
  border-style: solid;
  color: var(--sd-ink);
}
.sd-choice.is-right { border-color: var(--sd-green-text); background: var(--sd-lime-tint); }
.sd-choice.is-wrong { border-color: var(--sd-red-text); background: var(--sd-red-tint); }
.sd-choice.is-right::after,
.sd-choice.is-wrong::after {
  content: "✔";
  display: grid;
  place-items: center;
  flex: none;
  width: var(--sd-mark);
  height: var(--sd-mark);
  margin-left: auto;
  border-radius: var(--sd-r-sm);
  background: var(--sd-green-text);
  color: var(--sd-paper);
  font-size: var(--sd-fs-xs);
  font-weight: 900;
  line-height: 1;
}
.sd-choice.is-wrong::after { content: "✖"; background: var(--sd-red-text); }

/* 10.8 Roomier from 600px wide ------------------------------------------------ */
@container sd-viewport (min-width: 600px) {
  .sd-job { grid-template-columns: var(--sd-job-num) minmax(0, 1fr) auto; }
  .sd-job__state { grid-column: 3; padding-bottom: 0; text-align: right; }
  .sd-payday__slip { grid-template-columns: auto minmax(0, 1fr); }
  .sd-quiz__pic { width: var(--sd-quiz-pic-w); }
}
@container sd-viewport (min-width: 600px) and (min-height: 521px) {
  .sd-payday__hero { max-width: var(--sd-hero-max); }
  .sd-badge { width: var(--sd-badge-size); height: var(--sd-badge-size); border-width: 6px; gap: var(--sd-sp-1); }
  .sd-badge__title { font-size: var(--sd-fs-sm); }
  .sd-badge__sub { font-size: var(--sd-fs-xs); }
}

@container sd-viewport (max-height: 520px) {
  .sd-payday__hero { max-width: var(--sd-hero-max-xs); }
}

/* 10.9 Reduced motion --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .sd-choice { transition: none; }
  .sd-choice:active { transform: none; }
}
