/*
 * Overrides for "El dinero" (dinero/). The shared look, the hud/stage/pad
 * grid and the background live in shared/shell.css - only the shop (item +
 * price tag), the tray and the purse are defined here.
 *
 * Same calm family as reloj/ and puzles/: cream surfaces in a deep purple
 * frame. Coins and notes are drawn by coins.js.
 */

:root {
  --dn-frame: #6f4a86;
  --dn-ink: #553669;
  --dn-cream: #fbf2e2;
  --dn-tray: #fff1d9;
  --dn-good: #3cb54a;
  --dn-bad: #d8433e;
}

/* the site-wide feedback bubble (fixed bottom-left) would sit on the purse */
body:has(#screen-game:not([hidden])) .am-fb-fab { display: none; }

/* ---- start screen ---- */
.start-hint {
  margin: -6px 0 0;
  max-width: 34ch;
  font-size: clamp(15px, 3.6vw, 19px);
  line-height: 1.25;
  color: var(--purple-dark);
  opacity: .9;
}
.dn-start-coins { display: flex; align-items: center; justify-content: center; gap: 10px; }
.dn-start-piece { display: block; }
.dn-start-piece .dn-art { width: 100%; height: 100%; display: block; }
.dn-cur {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 14px;
  background: rgba(255, 255, 255, .7);
  border: 2px solid #fff;
  border-radius: 999px;
  color: var(--purple-dark);
  font-size: 17px;
}
.dn-cur select {
  font: 15px var(--am-readable-font);
  font-weight: 600;
  color: var(--dn-ink);
  padding: 6px 8px;
  border: 2px solid var(--dn-frame);
  border-radius: 999px;
  background: #fff;
  max-width: 62vw;
}

/* ---- coins and notes (purse buttons and paid pieces) ---- */
.dn-art { display: block; width: 100%; height: 100%; overflow: visible; }
.dn-art-main, .dn-art-unit { font-family: var(--am-readable-font); font-weight: 800; }
.dn-coin, .dn-paid {
  width: var(--w);
  height: var(--h);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  filter: drop-shadow(0 3px 0 rgba(80, 50, 100, .25));
  transition: transform .1s;
}
.dn-coin:active { transform: translateY(2px) scale(.96); }
.dn-coin:focus-visible, .dn-paid:focus-visible { outline: 3px solid #fff; outline-offset: 3px; border-radius: 12px; }
.dn-ghost {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.08);
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .25));
}

/* ---- the shop: item + price tag ---- */
.dn-shop {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.dn-item .dn-item-art { width: clamp(70px, 20vw, 105px); height: auto; display: block; }
.dn-tag {
  position: relative;
  padding: 10px 20px 10px 30px;
  background: #fff;
  border: 3px solid var(--dn-frame);
  border-radius: 10px 18px 18px 10px;
  color: var(--dn-ink);
  font-family: var(--am-readable-font);
  font-weight: 800;
  font-size: clamp(26px, 7vw, 38px);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 0 rgba(80, 50, 100, .25);
}
.dn-tag::before {   /* the tag's hole */
  content: "";
  position: absolute;
  left: 10px; top: 50%;
  width: 9px; height: 9px;
  margin-top: -4.5px;
  border-radius: 50%;
  border: 2.5px solid var(--dn-frame);
  background: var(--sky);
}

/* ---- the tray ---- */
.dn-tray {
  position: relative;
  /* hugs its coins (room for two rows), scrolls past that - not a big empty box */
  flex: 0 1 auto;
  width: min(100%, 460px);
  min-height: 132px;
  max-height: 220px;
  padding: 12px 12px 30px;
  background:
    radial-gradient(circle, #bd789228 1px, transparent 1.6px) center / 13px 13px,
    linear-gradient(145deg, #fff9ec, var(--dn-tray));
  border: 3px solid var(--dn-frame);
  border-radius: 26px;
  box-shadow: inset 0 0 0 5px #edc7cd, inset 0 7px 0 #d79eaf, 0 4px 0 #6f4a8640;
  overflow: auto;
}
.dn-tray.is-empty::after {
  content: "";
  position: absolute;
  inset: 14px 14px 32px;
  border: 2px dashed #aa76968c;
  border-radius: 16px;
}
.dn-paid-list { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.dn-paid { width: calc(var(--w) * .82); height: calc(var(--h) * .82); }
.dn-paid.is-new { animation: dnDrop .28s ease-out; }
.dn-total {
  position: absolute;
  left: 0; right: 0; bottom: 6px;
  text-align: center;
  font-family: var(--am-readable-font);
  font-weight: 700;
  font-size: 15px;
  color: var(--dn-ink);
}
.dn-tray.is-shake { animation: dnShake .4s ease-in-out; border-color: var(--dn-bad); }
.dn-tray.is-paid { border-color: var(--dn-good); }
.dn-tray.is-paid .dn-paid { animation: dnPaid .9s ease-in forwards; }
@keyframes dnDrop { 0% { transform: translateY(-18px) scale(.8); opacity: .3; } 100% { transform: none; opacity: 1; } }
@keyframes dnShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
@keyframes dnPaid { 0% { transform: none; } 30% { transform: translateY(4px); } 100% { transform: translateY(-40px) scale(.6); opacity: 0; } }

/* ---- the line: running hint, or why the payment didn't work ---- */
.dn-line {
  flex: none;
  margin: 0;
  min-height: 2.5em;
  max-width: 36ch;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(16px, 4.2vw, 21px);
  line-height: 1.2;
  color: var(--purple-dark);
  text-shadow: 1px 1px 0 #fff;
}
.dn-line.is-why { color: #a0451c; }
.dn-line.is-good { color: #2a7d35; }

/* ---- the purse + PAGAR ---- */
.dn-pad {
  width: min(100%, 520px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.dn-purse {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 10px;
  padding: 10px;
  background: rgba(255, 255, 255, .45);
  border: 2px solid #fff;
  border-radius: 20px;
}
.dn-purse.is-many .dn-coin.dn-coin { width: calc(var(--w) * .86); height: calc(var(--h) * .86); }
.dn-pay { min-width: 200px; }
.dn-pay:disabled { opacity: .6; }

/* short phones: tighter */
@media (max-height: 720px) {
  .stage-area { gap: 6px; }
  .dn-tray { min-height: 92px; padding-bottom: 26px; }
  .dn-line { min-height: 2.4em; font-size: 16px; }
  .dn-purse { padding: 6px; gap: 6px 8px; }
}

/* landscape: purse in the side column */
@media (min-width: 640px) and (orientation: landscape) {
  .dn-pad { align-self: center; }
  /* a long counting-up trail scrolls inside its row instead of widening the page */
  [data-dn-game] .game-screen { grid-template-columns: minmax(0, 1fr) var(--pad-width); }
}
.stage-area { min-width: 0; }
@media (orientation: landscape) and (max-height: 500px) {
  .dn-shop { gap: 10px; }
  .dn-item .dn-item-art { width: 54px; }
  .dn-tag { font-size: 22px; padding: 4px 14px 4px 24px; }
  .dn-tray { min-height: 70px; padding: 6px 8px 22px; }
  .dn-total { font-size: 13px; bottom: 3px; }
  .dn-line { min-height: 0; font-size: 14px; }
  .dn-purse .dn-coin { width: calc(var(--w) * .78); height: calc(var(--h) * .78); }
  .dn-pay { min-width: 160px; }
}

@media (prefers-reduced-motion: reduce) {
  .dn-paid.is-new, .dn-tray.is-shake, .dn-tray.is-paid .dn-paid { animation: none; }
}

/* ==== one page, three games (kit.js shows the blocks for ?game=) ==== */
[data-only][hidden], .tn-trail[hidden], .br-next[hidden] { display: none !important; }

/* ==== La tienda (?game=tienda) ==== */
.tn-shop {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
  max-width: 100%;
}
.tn-items { display: flex; align-items: center; gap: 8px; }
.tn-item { display: flex; align-items: center; gap: 6px; }
.tn-item .dn-item-art { width: clamp(58px, 16vw, 88px); height: auto; display: block; }
.tn-shop.is-two .tn-item .dn-item-art { width: clamp(47px, 12.5vw, 70px); }
.dn-tag.tn-tag { font-size: clamp(21px, 5.6vw, 30px); padding: 6px 14px 6px 24px; }
.dn-tag.tn-tag::before { left: 8px; width: 8px; height: 8px; margin-top: -4px; }
.tn-plus { font: 800 26px var(--am-readable-font); color: var(--dn-ink); }
.tn-pays {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-family: var(--am-readable-font);
  font-weight: 700;
  font-size: 14px;
  color: var(--dn-ink);
}
.tn-note { display: block; }
.tn-note .dn-art { width: 100%; height: 100%; }
/* the shopping list: a paper ticket + the money you have */
.tn-list {
  list-style: none;
  margin: 0;
  padding: 6px 14px;
  min-width: 170px;
  background: #fff;
  border: 3px solid var(--dn-frame);
  border-radius: 12px;
  box-shadow: 0 4px 0 rgba(80, 50, 100, .25);
  font-family: var(--am-readable-font);
  color: var(--dn-ink);
}
.tn-list li { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 2px 0; }
.tn-list li + li { border-top: 1.5px dashed rgba(111, 74, 134, .3); }
.tn-list .dn-item-art { width: 42px; height: 42px; }
.tn-list b { font-size: 21px; font-variant-numeric: tabular-nums; }
.tn-list .tn-sum { font-weight: 800; border-top: 2.5px solid var(--dn-frame) !important; }
.tn-list .tn-sum span { font-size: 16px; }
.tn-budget b {
  font-size: clamp(22px, 6vw, 30px);
  padding: 6px 14px;
  background: #e6f4e2;
  border: 3px solid var(--dn-good);
  border-radius: 12px;
  font-variant-numeric: tabular-nums;
}
/* counting up: 3,40 € → 3,50 € → 4 € → 5 € */
.tn-trail {
  flex: none;
  list-style: none;
  margin: 0;
  padding: 2px 4px;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  font-family: var(--am-readable-font);
}
.tn-step {
  flex: none;
  padding: 3px 9px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid rgba(111, 74, 134, .35);
  color: var(--dn-ink);
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.tn-step.is-from { background: var(--dn-cream); border-color: var(--dn-frame); }
.tn-step.is-goal { background: #e6f4e2; border-color: var(--dn-good); color: #2a7d35; }
.tn-step.is-over { background: #fbe4e2; border-color: var(--dn-bad); color: #a0301c; }
.tn-step.is-target { background: transparent; border-style: dashed; opacity: .75; }
.tn-arrow { flex: none; color: var(--dn-frame); font-weight: 800; font-size: 14px; }
.dn-tray.tn-tray { min-height: 110px; padding-bottom: 12px; }
.dn-tray.tn-tray.is-empty::after { inset: 14px; }
.tn-ask { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; width: min(100%, 520px); }
.tn-ask .big-button { min-width: 150px; }

/* ==== ¿Cuál sale más barato? (?game=barato) ==== */
[data-dn-game="barato"] .game-screen {
  grid-template-areas: "hud" "stage";
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(min-content, 1fr);
}
[data-dn-game="barato"] .pad-area { display: none; }
[data-dn-game="barato"] .stage-area { gap: 8px; }
.br-start { width: 64px; height: 64px; }
.br-start .dn-item-art { width: 100%; height: 100%; }
.br-ask {
  margin: 0;
  width: min(100%, 520px);
  padding: 8px 14px;
  background: #fff9ed;
  border: 1px solid #fff;
  border-radius: 16px;
  color: #40304b;
  font: 750 clamp(18px, 4.4vw, 24px)/1.4 var(--am-readable-font);
}
.br-line { min-height: 2.6em; }
.br-pad { width: min(100%, 520px); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.br-cards { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.br-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 76px;
  padding: 8px 14px;
  background: #fff;
  border: 3px solid var(--dn-frame);
  border-radius: 18px;
  box-shadow: 0 4px 0 rgba(80, 50, 100, .3);
  color: var(--dn-ink);
  text-align: left;
  font-family: var(--am-readable-font);
  cursor: pointer;
  transition: transform .1s, background .2s, border-color .2s;
}
.br-card:not(:disabled):active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(80, 50, 100, .3); }
.br-card:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.br-card:disabled { cursor: default; }
.br-card.is-best { background: #e6f4e2; border-color: var(--dn-good); }
.br-card.is-wrong { background: #fbe4e2; border-color: var(--dn-bad); }
.br-cards.is-done .br-card:not(.is-best):not(.is-wrong) { opacity: .75; }
.br-icon { flex: none; width: 70px; height: 70px; position: relative; }
.br-icon .dn-item-art, .br-pack .dn-item-art { width: 100%; height: 100%; display: block; }
.br-pack { display: block; width: 100%; height: 100%; position: relative; }
.br-count {
  position: absolute;
  right: -8px; bottom: -4px;
  padding: 1px 6px;
  background: var(--dn-frame);
  color: #fff;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
}
.br-text { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.br-main { font-weight: 700; font-size: 17px; }
.br-price { font-weight: 800; font-size: 24px; font-variant-numeric: tabular-nums; margin-left: auto; }
.br-badge {
  padding: 2px 9px;
  background: #e5453f;
  color: #fff;
  border-radius: 8px;
  font-weight: 800;
  font-size: 15px;
  transform: rotate(-3deg);
}
.br-per { flex-basis: 100%; font-weight: 700; font-size: 16px; color: #2a5d8a; }
.br-per small { font-weight: 600; font-size: 13px; opacity: .85; }
.br-card.is-best .br-per { color: #2a7d35; }
.br-card.is-wrong .br-per { color: #a0301c; }
.br-next { min-width: 200px; }

@media (max-height: 720px) {
  .tn-list .dn-item-art { width: 35px; height: 35px; }
  .tn-list b { font-size: 18px; }
  .dn-tray.tn-tray { min-height: 84px; }
  .br-card { min-height: 64px; padding: 6px 12px; }
  .br-icon { width: 56px; height: 56px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  [data-dn-game="tienda"] .stage-area { gap: 4px; }
  [data-dn-game="tienda"] .feedback { min-height: 34px; }
  [data-dn-game="tienda"] .feedback img { width: 28px; }
  [data-dn-game="tienda"] .feedback span { font-size: 20px; }
  .tn-shop { flex-wrap: nowrap; gap: 8px; }
  .tn-items { gap: 4px; }
  .tn-item { gap: 3px; }
  .tn-item .dn-item-art, .tn-shop.is-two .tn-item .dn-item-art { width: 37px; }
  .dn-tag.tn-tag { font-size: 17px; padding: 3px 8px 3px 18px; }
  .dn-tag.tn-tag::before { left: 6px; width: 6px; height: 6px; margin-top: -3px; }
  .tn-plus { font-size: 18px; }
  .tn-note { width: 64px !important; height: 34px !important; }
  .tn-pays { font-size: 11px; gap: 1px; }
  .tn-list { padding: 2px 10px; display: flex; gap: 10px; min-width: 0; }
  .tn-list li { padding: 0; gap: 3px; }
  .tn-list li + li { border-top: 0; border-left: 1.5px dashed rgba(111, 74, 134, .3); padding-left: 8px; }
  .tn-list .tn-sum { border-top: 0 !important; border-left: 2.5px solid var(--dn-frame) !important; }
  .tn-list .tn-sum span { font-size: 12px; }
  .tn-list .dn-item-art { display: none; }
  .tn-list b { font-size: 15px; }
  .tn-budget b { font-size: 18px; padding: 2px 10px; }
  .tn-step { font-size: 13px; padding: 1px 7px; }
  .dn-tray.tn-tray { min-height: 60px; padding: 6px 8px; }
  .tn-ask .big-button { min-width: 120px; }
  .br-ask { font-size: 17px; }
  .br-line { min-height: 0; }
  .br-cards { gap: 6px; }
  .br-card { min-height: 0; padding: 3px 10px; border-radius: 14px; gap: 8px; }
  .br-icon { width: 42px; height: 42px; }
  .br-count { font-size: 11px; padding: 0 4px; }
  .br-main { font-size: 14px; }
  .br-price { font-size: 18px; }
  .br-badge { font-size: 12px; }
  .br-per { font-size: 13px; }
  .br-next { min-width: 140px; }
}

/* short landscape: the end screen's buttons fit without scrolling */
@media (orientation: landscape) and (max-height: 500px) {
  #screen-end { gap: 10px; }
  #screen-end .mascot { width: 64px; }
  #screen-end .results p { margin: 4px 0; }
}
