/* La tiendita. The shop is the loud part; the libreta is lined paper and blue ink. */

:root {
  --navy: #172235;
  --navy-2: #1F2D46;
  --paper: #FBFCF8;
  --paper-2: #F1F4EC;
  --rule: #D5E4F4;
  --margin: #EE7B7B;
  --ink: #1C2433;
  --ink-soft: #55607A;
  --blue-ink: #1E3F95;
  --rosa: #E0287D;
  --rosa-dark: #B71E64;
  --cartulina: #FFF04D;
  --cartulina-green: #A8F05A;
  --cartulina-pink: #FF68B4;
  --good: #16804A;
  --bad: #C1121F;
  --alert: #C25E05;
  --highlight: rgba(255, 240, 77, 0.55);
  --shadow: 0 10px 30px rgba(10, 16, 32, 0.35);
  --radius: 10px;
  --ui: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Kalam", "Segoe Print", "Comic Sans MS", cursive;
  --marker: "Permanent Marker", "Kalam", cursive;
  --hud-h: 50px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131A27;
    --paper-2: #1A2232;
    --rule: #233150;
    --margin: #8B3B47;
    --ink: #E8EDF6;
    --ink-soft: #A9B3C8;
    --blue-ink: #A9C4FF;
    --good: #5BD08F;
    --bad: #FF7A7A;
    --alert: #FFB15C;
    --highlight: rgba(255, 240, 77, 0.22);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #131A27;
  --paper-2: #1A2232;
  --rule: #233150;
  --margin: #8B3B47;
  --ink: #E8EDF6;
  --ink-soft: #A9B3C8;
  --blue-ink: #A9C4FF;
  --good: #5BD08F;
  --bad: #FF7A7A;
  --alert: #FFB15C;
  --highlight: rgba(255, 240, 77, 0.22);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--navy);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--cartulina); outline-offset: 2px; }

#app { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }

/* ---------------------------------------------------------------- HUD */

.hud {
  height: var(--hud-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  padding-top: env(safe-area-inset-top);
  background: var(--navy);
  color: #F4F6FB;
  font-variant-numeric: tabular-nums;
}
.hud-when { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.hud-day { font-size: 13px; color: #B9C4DA; white-space: nowrap; }
.hud-time { font-size: 20px; letter-spacing: 0.01em; }
.hud-weather { display: inline-grid; place-items: center; width: 22px; height: 22px; align-self: center; }
.hud-weather svg { width: 20px; height: 20px; }
.hud-money { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.05; }
.hud-money strong { font-size: 17px; }
.hud-label { font-size: 10.5px; color: #9FAAC2; }
.hud-rep { display: flex; flex-direction: column; gap: 3px; width: 48px; }
.rep-bar { display: block; height: 7px; border-radius: 4px; background: #2C3A57; overflow: hidden; }
.rep-bar > span { display: block; height: 100%; width: 60%; background: linear-gradient(90deg, #FF68B4, #FFE14A); border-radius: 4px; transition: width 0.6s; }
.hud-speed { display: flex; background: #22304B; border-radius: 9px; padding: 2px; }
.hud-speed button {
  border: 0; background: transparent; color: #C9D3E8; min-width: 31px; height: 34px; border-radius: 7px; font-size: 12.5px; font-weight: 700; display: grid; place-items: center; padding: 0 2px;
}
.hud-speed button svg { width: 13px; height: 13px; fill: currentColor; }
.hud-speed button[aria-pressed="true"] { background: var(--cartulina); color: #16161D; }
.hud { position: relative; }
.hud-shift { font-size: 11.5px; color: #B9C4DA; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.hud-shift:empty { display: none; }
@media (max-width: 520px) { .hud-shift { display: none; } }
.shift-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--rosa); transform-origin: left; transform: scaleX(0); transition: transform 0.4s linear; }
.hud-live { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #C9D3E8; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-live .dot { width: 8px; height: 8px; border-radius: 50%; background: #6B7A99; flex: none; }
.hud-live.on .dot { background: #FF4D6D; box-shadow: 0 0 0 3px rgba(255, 77, 109, 0.25); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: 0.45; } }
.rotulo-small { position: absolute; left: 10px; top: 10px; background: var(--rosa); color: #FFFFFF; font-family: var(--marker); font-size: 18px; padding: 4px 10px 6px; border-radius: 4px; text-shadow: 2px 2px 0 #F2C200; transform: rotate(-2deg); }

/* ---------------------------------------------------------------- Layout */

.layout { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.stage { position: relative; flex: none; display: flex; justify-content: center; background: #0F1828; touch-action: manipulation; }
#scene { display: block; }
.overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.overlay > * { pointer-events: auto; }

.libreta {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-radius: 14px 14px 0 0;
  margin-top: -10px;
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

@media (min-width: 900px) {
  .layout { flex-direction: row; justify-content: center; align-items: stretch; gap: 0; padding: 16px; }
  .stage { flex: none; align-self: flex-start; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
  .libreta { width: 420px; flex: none; margin: 0 0 0 16px; border-radius: 14px; }
}

/* ---------------------------------------------------------------- Tabs */

.action-bar { flex: none; padding: 10px 14px 8px; border-bottom: 1px solid var(--rule); background: var(--paper); }
.action-bar .status { font-size: 14px; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.action-bar .status.small { font-size: 12.5px; color: var(--ink-soft); margin: 6px 0 0; }
.action-bar .big-btn { margin-top: 0; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #FF4D6D; box-shadow: 0 0 0 3px rgba(255, 77, 109, 0.25); animation: blink 1.4s infinite; flex: none; }
.nick { display: grid; gap: 3px; margin-top: 10px; font-size: 12.5px; color: var(--ink-soft); }
.nick input { font: inherit; font-size: 15px; color: var(--ink); background: var(--paper-2); border: 1.5px solid var(--rule); border-radius: 9px; padding: 9px 10px; }
.nick small { font-size: 11.5px; }
.nick-line { margin-top: 8px; font-size: 13px; color: var(--ink-soft); }
.link-btn { border: 0; background: none; color: var(--blue-ink); text-decoration: underline; font-size: 13px; padding: 0 2px; }
.lead { margin: 2px 0 8px; font-size: 13.5px; color: var(--ink-soft); }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 3px 0; font-size: 14px; }
.hand { font-family: var(--hand); color: var(--blue-ink); font-size: 16px; line-height: 1.3; margin: 4px 0; }
.counters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 6px 0 10px; }
.counter { background: var(--paper-2); border-radius: 10px; padding: 8px 6px; text-align: center; }
.counter strong { display: block; font-size: 20px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.counter span { font-size: 10.5px; color: var(--ink-soft); line-height: 1.15; display: block; }
.payoff-card { background: var(--highlight); border-radius: 12px; padding: 10px 12px; margin: 4px 0 10px; }
.payoff-card h3 { margin: 0 0 2px; font-size: 16px; }
.payoff-card .meta { font-size: 12.5px; color: var(--ink-soft); }
.payoff-card li { font-family: var(--hand); color: var(--blue-ink); font-size: 16px; line-height: 1.3; }
.shifts .shift-row { display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: start; padding: 6px 0; border-bottom: 1px dashed var(--rule); }
.shift-row .n { font-family: var(--marker); font-size: 18px; color: var(--rosa); text-align: center; }
.shift-row .meta { font-size: 12.5px; color: var(--ink-soft); }
.day-card { padding: 8px 0; border-bottom: 1px dashed var(--rule); }
.day-card .meta { font-size: 12.5px; color: var(--ink-soft); }
.day-card .comment { font-size: 14.5px; line-height: 22px; margin: 2px 0 0; }
.day-card .warn { color: var(--bad); font-weight: 700; }
.solo-card { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; margin: 14px 0 6px; padding: 10px 12px; border: 1.5px dashed var(--rule); border-radius: 12px; }
.solo-card .meta { grid-column: 1; font-size: 12.5px; color: var(--ink-soft); }
.solo-card .small-btn { grid-column: 2; grid-row: 1 / span 2; }
.decisions li { font-size: 13.5px; padding: 4px 0; border-bottom: 1px dashed var(--rule); }
.decisions .meta { font-size: 11.5px; color: var(--ink-soft); }
.prev-card { background: var(--paper-2); border-radius: 12px; padding: 10px 12px; margin: 6px 0 10px; font-size: 14px; }
.prev-card .meta { font-size: 12.5px; color: var(--ink-soft); }
.recado { display: grid; gap: 4px; margin: 10px 0 12px; font-size: 13.5px; }
.recado input { font: inherit; font-family: var(--hand); font-size: 17px; color: var(--blue-ink); background: var(--paper-2); border: 1.5px solid var(--rule); border-radius: 9px; padding: 9px 10px; }
.recado small { font-size: 11.5px; color: var(--ink-soft); }
.seg.wide { display: flex; flex-wrap: wrap; margin-bottom: 8px; }
.seg.wide button { flex: 1 1 auto; }
.count-meta { font-weight: 400; font-size: 11.5px; margin-left: 6px; }
.ledger { margin-top: 6px; padding: 6px 8px; background: var(--paper-2); border-radius: 8px; }
.ledger .mono { font-variant-numeric: tabular-nums; font-size: 12px; }
.count-btn { float: right; margin-top: -6px; padding: 4px 9px; min-height: 30px; font-size: 12px; }
.limit-ctl { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 13px; }
.limit-ctl output { min-width: 70px; }
.business h2 { margin: 4px 0 6px; font-size: 20px; }
.business p { font-size: 14.5px; line-height: 1.45; }
.checks li { padding: 4px 0 4px 24px; position: relative; font-size: 14px; }
.checks li::before { content: ""; position: absolute; left: 4px; top: 9px; width: 10px; height: 6px; border-left: 2.5px solid var(--good); border-bottom: 2.5px solid var(--good); transform: rotate(-45deg); }
.business .big-btn { text-align: center; text-decoration: none; box-sizing: border-box; }
.act.link { border: 0; padding: 0; color: var(--blue-ink); background: none; font-weight: 700; }
.modal-card .rotulo { font-size: 44px; margin-bottom: 6px; }
.modal-card .tagline { font-size: 17px; margin: 14px 0 8px; }
.tabs { display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; flex: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  position: relative; flex: 1 0 auto; border: 0; background: transparent; padding: 8px 9px 9px; border-radius: 8px 8px 0 0; font-size: 13.5px; color: var(--ink-soft); white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--blue-ink); font-weight: 700; box-shadow: inset 0 -3px 0 var(--blue-ink); }
.tabs button .dot { position: absolute; top: 5px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--rosa); }

.pages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.page {
  min-height: 100%;
  padding: 10px 14px 24px 26px;
  background-image: linear-gradient(90deg, transparent 17px, var(--margin) 17px, var(--margin) 18.5px, transparent 18.5px), repeating-linear-gradient(180deg, transparent 0 25px, var(--rule) 25px 26px);
  background-attachment: local;
}

.section-title { font-size: 13px; color: var(--ink-soft); margin: 14px 0 6px; font-weight: 700; }
.section-title:first-child { margin-top: 2px; }

/* ---------------------------------------------------------------- Feed */

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 40px 1fr; gap: 6px; padding: 5px 0; font-size: 14px; line-height: 1.38; animation: rise 0.35s ease-out; }
.feed time { font-size: 11.5px; color: var(--ink-soft); padding-top: 2px; font-variant-numeric: tabular-nums; }
.feed .msg { position: relative; }
.feed li.tip .msg { background: var(--highlight); border-radius: 3px; padding: 1px 4px; margin-left: -4px; }
.feed li.note .msg { font-family: var(--hand); color: var(--blue-ink); font-size: 15.5px; line-height: 1.3; }
.feed li.good .msg { color: var(--good); }
.feed li.bad .msg { color: var(--bad); }
.feed li.alert .msg { color: var(--alert); }
.feed li.rule .msg { color: var(--bad); }
.feed li.rule .msg::before { content: "Regla"; font-size: 10.5px; font-weight: 700; border: 1.5px solid currentColor; border-radius: 4px; padding: 0 4px; margin-right: 6px; transform: rotate(-4deg); display: inline-block; }
html[lang="en"] .feed li.rule .msg::before { content: "Rule"; }
.feed li.money .msg { color: var(--ink); }
.feed .act { display: inline-block; margin-left: 6px; border: 1.5px solid var(--blue-ink); color: var(--blue-ink); background: transparent; border-radius: 6px; padding: 1px 8px; font-size: 13px; font-weight: 700; }
.feed-empty { color: var(--ink-soft); font-size: 14px; padding: 6px 0; }

.notes { list-style: none; margin: 0; padding: 0; }
.notes li { font-family: var(--hand); color: var(--blue-ink); font-size: 16px; line-height: 26px; }
.notes li .who { font-family: var(--ui); font-size: 11px; color: var(--ink-soft); margin-left: 6px; }
.notes li.duena { color: var(--ink); }

/* ---------------------------------------------------------------- Lists: stock, prices, credit */

.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--rule); }
.row img { width: 28px; height: 28px; }
.row .name { font-size: 14px; line-height: 1.2; }
.row .meta { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.row .meta b { color: var(--ink); font-weight: 700; }
.row .meta .warn { color: var(--alert); font-weight: 700; }
.row .meta .cold { color: #2F7BD6; }
.bar { height: 5px; border-radius: 3px; background: var(--paper-2); overflow: hidden; margin-top: 4px; max-width: 160px; }
.bar > span { display: block; height: 100%; background: var(--blue-ink); }
.bar.low > span { background: var(--alert); }
.small-btn { border: 1.5px solid var(--blue-ink); background: transparent; color: var(--blue-ink); border-radius: 8px; padding: 5px 10px; font-size: 13px; font-weight: 700; min-height: 34px; }
.small-btn:disabled { opacity: 0.35; cursor: default; }
.small-btn.done { border-color: transparent; color: var(--good); }

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid var(--rule); background: var(--paper); font-size: 18px; font-weight: 700; line-height: 1; color: var(--ink); }
.stepper output { min-width: 54px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; }

.price-star {
  display: inline-grid; place-items: center; min-width: 58px; height: 34px; padding: 0 8px;
  background: var(--cartulina); color: #16161D; font-family: var(--marker); font-size: 16px;
  clip-path: polygon(50% 0%, 61% 14%, 79% 6%, 80% 25%, 98% 28%, 88% 45%, 100% 62%, 81% 68%, 82% 88%, 63% 82%, 50% 100%, 37% 82%, 18% 88%, 19% 68%, 0% 62%, 12% 45%, 2% 28%, 20% 25%, 21% 6%, 39% 14%);
}
.price-row { grid-template-columns: 30px 1fr auto; }
.price-controls { display: flex; align-items: center; gap: 4px; }
.price-controls .stepper button { width: 32px; height: 32px; }

.tab-card { border: 1.5px solid var(--rule); border-radius: var(--radius); padding: 10px 12px; margin: 8px 0; background: color-mix(in srgb, var(--paper) 85%, transparent); }
.tab-card h3 { margin: 0 0 2px; font-size: 15px; }
.tab-card .meta { font-size: 12.5px; color: var(--ink-soft); }
.tab-card .rule-badge { display: inline-block; font-size: 11px; font-weight: 700; color: var(--bad); border: 1.5px solid var(--bad); border-radius: 4px; padding: 0 5px; margin-top: 4px; transform: rotate(-2deg); }
.debt { font-variant-numeric: tabular-nums; font-weight: 700; }

.seg { display: inline-flex; border: 1.5px solid var(--rule); border-radius: 9px; overflow: hidden; margin-top: 6px; }
.seg button { border: 0; background: transparent; padding: 7px 11px; font-size: 13px; min-height: 36px; }
.seg button[aria-pressed="true"] { background: var(--blue-ink); color: var(--paper); font-weight: 700; }

.rule-item { display: grid; grid-template-columns: 26px 1fr; gap: 8px; padding: 6px 0; }
.rule-item .stamp { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--bad); color: var(--bad); display: grid; place-items: center; font-size: 10px; font-weight: 700; transform: rotate(-10deg); }
.rule-item b { display: block; font-size: 14px; }
.rule-item span { font-size: 12.5px; color: var(--ink-soft); }
.rule-item .count { color: var(--bad); font-weight: 700; }

/* ---------------------------------------------------------------- Bubbles over the scene */

.bubble {
  position: absolute; transform: translate(-50%, -100%); width: max-content; max-width: min(230px, 80vw); min-width: 120px;
  background: #FFFFFF; color: #1C2433; border: 0; border-radius: 14px; padding: 8px 10px 8px 12px;
  font-family: var(--ui); font-size: 13.5px; line-height: 1.3; text-align: left;
  box-shadow: 0 6px 16px rgba(10, 16, 32, 0.28); animation: pop 0.28s cubic-bezier(.2, 1.4, .4, 1);
}
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%); border: 8px solid transparent; border-top-color: #FFFFFF; border-bottom: 0; }
.bubble .who { display: block; font-size: 11.5px; color: #55607A; margin-bottom: 2px; }
.bubble .pencil { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; font-size: 11.5px; font-weight: 700; color: var(--rosa-dark); }
.bubble .life { position: absolute; left: 12px; right: 12px; bottom: 3px; height: 2px; border-radius: 2px; background: #E7EBF3; overflow: hidden; }
.bubble .life > i { display: block; height: 100%; background: var(--rosa); transform-origin: left; }
.bubble.captured { background: #EAF1FF; color: #1E3F95; font-family: var(--hand); font-size: 15px; animation: fly 0.9s ease-in forwards; pointer-events: none; }
.bubble.captured::after { border-top-color: #EAF1FF; }
.bubble.fading { opacity: 0; transition: opacity 0.5s; }

.whisper {
  position: absolute; transform: translate(-50%, -100%); background: #EAF1FF; color: #1E3F95; border-radius: 10px; padding: 5px 9px;
  font-size: 12px; line-height: 1.25; box-shadow: 0 4px 12px rgba(10, 16, 32, 0.22); pointer-events: none; white-space: nowrap; width: max-content; animation: pop 0.25s ease-out;
}
.whisper b { font-family: var(--hand); font-size: 14px; font-weight: 700; }
.whisper .warn { color: #C1121F; font-weight: 700; }
.whisper img { width: 16px; height: 16px; vertical-align: -3px; }
.whisper.fading { opacity: 0; transition: opacity 0.6s; }

.serve-btn {
  position: absolute; right: 12px; bottom: 30%; border: 0; border-radius: 999px; padding: 12px 20px; font-weight: 700; font-size: 16px;
  background: var(--cartulina); color: #16161D; box-shadow: var(--shadow);
}
.paused-flag { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: rgba(23, 34, 53, 0.86); color: #FFFFFF; padding: 4px 12px; border-radius: 999px; font-size: 13px; }

/* ---------------------------------------------------------------- Decision sheet */

.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 100%; overflow-y: auto;
  background: var(--paper); border-radius: 16px 16px 0 0; box-shadow: 0 -10px 30px rgba(10, 16, 32, 0.35);
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); z-index: 5; animation: slideup 0.28s ease-out;
}
.sheet .countdown { height: 4px; border-radius: 2px; background: var(--paper-2); overflow: hidden; margin: -4px 0 10px; }
.sheet .countdown > i { display: block; height: 100%; background: var(--blue-ink); transform-origin: left; }
.sheet .count-label { font-size: 11.5px; color: var(--ink-soft); margin: -6px 0 8px; }
.sheet h2 { margin: 0 0 4px; font-size: 18px; line-height: 1.2; }
.sheet p { margin: 0 0 10px; font-size: 14.5px; }
.sheet .who-line { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.sheet .who-line canvas { width: 40px; height: 48px; flex: none; }
.sheet .lines { list-style: none; margin: 0 0 8px; padding: 0; }
.sheet .lines li { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px dashed var(--rule); }
.sheet .lines img { width: 26px; height: 26px; }
.sheet .lines .why { font-size: 11.5px; color: var(--ink-soft); }
.sheet .lines .why b { color: var(--rosa-dark); font-weight: 700; }
.sheet .total { display: flex; justify-content: space-between; font-weight: 700; margin: 6px 0 12px; font-variant-numeric: tabular-nums; }
.sheet .total .over { color: var(--bad); }
.options { display: flex; flex-wrap: wrap; gap: 8px; }
.options .opt { flex: 1 1 130px; position: relative; border: 1.5px solid var(--rule); background: var(--paper); border-radius: 12px; padding: 12px 10px; font-weight: 700; font-size: 15px; min-height: 48px; }
.options .opt.rec { border-color: var(--blue-ink); background: var(--blue-ink); color: var(--paper); }
.options .opt.rec::before { content: attr(data-rec); position: absolute; top: -9px; left: 10px; font-size: 10.5px; font-weight: 700; background: var(--cartulina); color: #16161D; padding: 1px 6px; border-radius: 5px; }

/* ---------------------------------------------------------------- Modals */

.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(10, 16, 32, 0.55); backdrop-filter: blur(2px); overflow-y: auto; }
.modal-card {
  width: min(440px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--paper); color: var(--ink); border-radius: 16px; box-shadow: var(--shadow);
  padding: 18px 18px 20px 30px; animation: pop 0.3s ease-out;
  background-image: linear-gradient(90deg, transparent 18px, var(--margin) 18px, var(--margin) 19.5px, transparent 19.5px), repeating-linear-gradient(180deg, transparent 0 25px, var(--rule) 25px 26px);
  background-attachment: local;
}
.modal-card h2 { margin: 0 0 2px; font-size: 22px; line-height: 1.15; }
.modal-card .sub { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 12px; }
.modal-card ul.brief { list-style: none; margin: 0 0 14px; padding: 0; }
.modal-card ul.brief li { padding: 3px 0 3px 18px; position: relative; font-size: 14.5px; line-height: 1.4; }
.modal-card ul.brief li::before { content: ""; position: absolute; left: 2px; top: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--blue-ink); }
.modal-card ul.brief li.hot::before { background: var(--rosa); }
.big-btn { display: block; width: 100%; border: 0; border-radius: 12px; background: var(--rosa); color: #FFFFFF; font-weight: 700; font-size: 17px; padding: 14px; margin-top: 8px; min-height: 52px; }
.big-btn.secondary { background: transparent; color: var(--ink); border: 1.5px solid var(--rule); }
.letter { font-family: var(--hand); color: var(--blue-ink); font-size: 18px; line-height: 26px; margin: 4px 0 6px; }
.letter .sign { display: block; text-align: right; font-size: 20px; margin-top: 2px; }

.receipt { position: relative; background: #FFFFFF; color: #1C2433; border-radius: 4px 4px 0 0; padding: 14px 14px 16px; margin: 4px 0 22px -12px; font-variant-numeric: tabular-nums; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12); }
.receipt::after { content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 8px; background: linear-gradient(135deg, #FFFFFF 50%, transparent 50%) 0 0 / 12px 8px repeat-x, linear-gradient(225deg, #FFFFFF 50%, transparent 50%) 0 0 / 12px 8px repeat-x; }
.receipt h3 { margin: 0 0 8px; text-align: center; font-family: var(--marker); font-weight: 400; font-size: 18px; color: #E0287D; }
.receipt .r { display: flex; justify-content: space-between; font-size: 14px; padding: 2px 0; }
.receipt .r.neg span:last-child { color: #8A1C1C; }
.receipt .r.total { border-top: 1.5px dashed #9AA3B5; margin-top: 6px; padding-top: 6px; font-weight: 700; font-size: 16px; }
.receipt .r.total.loss span:last-child { color: #C1121F; }
.receipt .r.total.win span:last-child { color: #16804A; }
.receipt .dash { border-top: 1.5px dashed #9AA3B5; margin: 8px 0; }
.receipt .small { font-size: 12.5px; color: #55607A; }
.comment { font-family: var(--hand); color: var(--blue-ink); font-size: 16.5px; line-height: 26px; margin: 0 0 6px; }
.week-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; align-items: end; height: 70px; margin: 6px 0 4px; }
.week-bars span { display: block; border-radius: 3px 3px 0 0; background: var(--blue-ink); min-height: 2px; position: relative; }
.week-bars span.neg { background: var(--bad); }
.week-bars span.today { background: var(--rosa); }
.week-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; font-size: 10.5px; color: var(--ink-soft); text-align: center; margin-bottom: 8px; }

.stars { font-size: 30px; letter-spacing: 3px; color: #F2B705; margin: 6px 0 2px; }
.stars .off { color: color-mix(in srgb, var(--ink-soft) 35%, transparent); }
.poster-img { display: block; width: 100%; border-radius: 10px; margin: 10px 0 4px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); }
.poster-hint { font-size: 12.5px; color: var(--ink-soft); text-align: center; }

/* ---------------------------------------------------------------- Welcome */

.rotulo {
  display: inline-block; background: var(--rosa); color: #FFFFFF; font-family: var(--marker); font-size: clamp(36px, 11vw, 52px); line-height: 1; padding: 10px 16px 12px; border-radius: 6px;
  text-shadow: 3px 3px 0 #F2C200; transform: rotate(-2.5deg); box-shadow: 0 10px 0 -4px rgba(0, 0, 0, 0.25);
}
.lang-pick { display: flex; gap: 8px; }
.lang-pick .big-btn { margin: 8px 0 0; }

/* ---------------------------------------------------------------- Motion */

@keyframes pop { from { transform: translate(-50%, -100%) scale(0.85); opacity: 0; } to { transform: translate(-50%, -100%) scale(1); opacity: 1; } }
.modal-card { animation-name: card-in; }
@keyframes card-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
@keyframes rise { from { transform: translateY(-4px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fly { 0% { transform: translate(-50%, -100%) scale(1); opacity: 1; } 100% { transform: translate(var(--fly-x, 0), var(--fly-y, 300px)) scale(0.2); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------------------------------------------------------- Lobby on phones scrolls as a page */

@media (max-width: 899px) {
  #app[data-screen="lobby"] { height: auto; min-height: 100dvh; overflow: visible; }
  #app[data-screen="lobby"] .hud { position: sticky; top: 0; z-index: 6; }
  #app[data-screen="lobby"] .layout { display: block; }
  #app[data-screen="lobby"] .libreta { display: block; min-height: 70dvh; }
  #app[data-screen="lobby"] .pages { overflow: visible; }
  #app[data-screen="lobby"] .action-bar { position: sticky; top: var(--hud-h); z-index: 5; box-shadow: 0 6px 12px -8px rgba(10, 16, 32, 0.35); }
}
body:has(#app[data-screen="lobby"]) { overscroll-behavior: auto; }
