* {
  box-sizing: border-box;
}
html {
  scrollbar-gutter: stable;
}
:root {
  color-scheme: light dark;

  /* Neutral palette in oklch (perceptually uniform). Each token pairs
     symmetric lightness steps: light L + dark L ≈ 1.17 (mid of our usable
     range). Same conceptual "step away from bg" in both modes — mismatched
     pairs are a smell. */
  --bg: light-dark(oklch(1 0 0), oklch(0.17 0 0));
  --surface: light-dark(oklch(0.97 0 0), oklch(0.2 0 0));
  --border: light-dark(oklch(0.93 0 0), oklch(0.24 0 0));
  --border-obj: light-dark(oklch(0.8 0 0), oklch(0.37 0 0));
  --muted: light-dark(oklch(0.47 0 0), oklch(0.7 0 0));
  --text: light-dark(oklch(0.2 0 0), oklch(0.97 0 0));

  /* Semantic state — --success and --error are perceptual peers
     (same L and C, hue-only difference). --success-bg is the tinted
     surface counterpart for owned tiles. */
  --link: light-dark(oklch(0.46 0.16 245), oklch(0.67 0.13 245));
  --success: light-dark(oklch(0.6 0.18 142), oklch(0.7 0.13 142));
  --success-bg: light-dark(oklch(0.93 0.06 142), oklch(0.24 0.05 142));
  --error: light-dark(oklch(0.6 0.18 27), oklch(0.7 0.13 27));
}
body {
  font-family: system-ui, -apple-system, sans-serif;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.5rem 1rem;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  touch-action: manipulation;
  font-variant-numeric: tabular-nums;
}
/* inline-block shrinks the wrapper to the text width so the .countdown
   child matches the "Reserva expira en MM:SS" line, not the full row. */
.expires {
  display: inline-block;
  margin: 0.5rem 0;
}
hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}
.countdown {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.2rem;
}
.countdown::after {
  content: "";
  display: block;
  height: 100%;
  width: var(--remaining-pct, 100%);
  background: var(--muted);
  animation: cd-shrink var(--duration, 30s) linear forwards;
}
@keyframes cd-shrink {
  to {
    width: 0;
  }
}
table {
  border-collapse: collapse;
  width: 100%;
}
th,
td {
  border-bottom: 1px solid var(--border);
  padding: 0.4rem;
  text-align: left;
  font-size: 0.9rem;
  vertical-align: top;
}
td.chk {
  width: 1.2em;
  text-align: center;
}
td.chk.off {
  color: transparent;
}
tr[data-id] {
  cursor: pointer;
}
tr[data-id]:hover {
  background: var(--surface);
}
tr.agotado td {
  opacity: 0.45;
}
td details {
  position: relative;
}
td details[open] > ul {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border-obj);
  border-radius: 4px;
  padding: 0.4rem 1rem;
  min-width: 14em;
  z-index: 5;
  box-shadow: 0 4px 12px light-dark(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.4));
}
nav {
  display: flex;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 20;
}
a {
  text-decoration: none;
  color: var(--link);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 4px;
}
.tile {
  aspect-ratio: 3 / 4;
  background: var(--surface);
  border: 2px solid var(--border-obj);
  display: grid;
  place-items: center;
  font-size: 12px;
  padding: 2px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  border-radius: 3px;
}
.tile.owned {
  background: var(--success-bg);
  border-color: var(--success);
}
input,
button,
textarea,
select {
  font: inherit;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border-obj);
  border-radius: 4px;
  background: var(--surface);
  color: inherit;
}
/* Replace the browser's system-blue focus ring (which looks out-of-place
   in dark mode and sits a few px off the border) with one in our theme
   color, flush against the border. */
input:focus-visible,
button:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 0;
}
button {
  cursor: pointer;
  background: var(--surface);
}
button:hover {
  background: var(--border);
}
button.copy {
  position: relative;
  padding: 0;
  border: 0;
  background: transparent;
  font-weight: bold;
  color: inherit;
}
button.copy:hover {
  text-decoration: underline;
}
button.copy.done {
  color: transparent;
  text-decoration: none;
  cursor: default;
}
button.copy.done::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--success);
}
.bigInput {
  font-size: 1.4rem;
  width: 100%;
  max-width: 36rem;
}
.sticky {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  z-index: 10;
  margin-bottom: 0.5rem;
  display: grid;
  gap: 0.4rem;
}
.row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
/* Inline error slot. min-height + margin (not padding) reserves the row
   without the box-sizing trap that folds padding into min-height. */
.err {
  color: var(--error);
  font-size: 0.85rem;
  margin: 0.2rem 0;
  min-height: 1.4em;
}
/* /sync figPaste error self-fades after ~5s. Scoped to this id so the
   server-rendered <p class="err"> on /sync/import doesn't decay out
   from under the reader. JS clears textContent at the start of each
   click — :not(:empty) drops, animation resets, next set re-triggers. */
#figPasteErr:not(:empty) {
  animation: err-fade 5s ease-out forwards;
}
@keyframes err-fade {
  0%,
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
/* /album bad-input flash: outline pulses red for ~1.5s then fades. Same
   primitive as :focus-visible, just a different color while [data-err]
   is set. Re-trigger on back-to-back failures: JS removes + re-adds the
   attr around a forced reflow (see app.js). */
input[data-err] {
  animation: err-flash 2.5s ease-out;
}
@keyframes err-flash {
  0%,
  60% {
    outline: 2px solid var(--error);
    outline-offset: 0;
  }
}
.muted {
  color: var(--muted);
  font-size: 0.8rem;
}
h1,
h2,
h3 {
  margin: 0.5rem 0;
}
form {
  margin: 0;
}
td > form {
  display: inline;
}
input[data-filter] {
  width: 100%;
  margin-bottom: 0.5rem;
}
@media (max-width: 640px) {
  .hide-mobile {
    display: none;
  }
}
