/* ─── Reset & Variables ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Same design system as landing/landing.css :root — same product, one look. */
:root {
  --bg: #0a0a0f;
  --surface: #13131a;
  --surface2: #1c1c26;
  --border: #1c1c26;
  --text: #ffffff;
  --text-muted: #7a7a8c;

  --accent: #ffd60a;

  --keep: #16a34a;     /* Sporting */
  --reject: #dc2626;   /* Benfica */
  --favorite: #52525b; /* Restantes */
  --skip: #1d4ed8;     /* Porto */

  --radius: 0px;
  --card-w: min(360px, 90vw);
  --card-h: min(480px, 65vh);
  --transition: 0.2s ease;
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
}

body.theme-light {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface2: #ececf1;
  --border: #dcdce3;
  --text: #0a0a0f;
  --text-muted: #6b6b7a;
  color-scheme: light;
}

body {
  font-family: 'Inter Tight', system-ui, sans-serif;
  background: var(--bg);
  background-image: radial-gradient(ellipse 80% 40% at 50% 0%, rgba(255,255,255,0.05), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  color-scheme: dark;
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  position: fixed;
  width: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Accessibility ──────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 8px;
  z-index: 100;
  background: var(--accent);
  color: #0a0a0f;
  padding: 10px 16px;
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { top: 8px; }

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

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 600px;
  margin: 0 auto;
}

/* ─── Header ────────────────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  flex-wrap: wrap;
}

header h1 {
  font-size: 1.1rem;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-right: auto;
  color: var(--text);
}

.title-accent { color: var(--accent); }


/* Breaks out of #app's 600px column and re-centers on the full viewport
   (same center point as #comecar-pill), so the button row isn't squeezed
   into that narrow column on wide screens. Standard full-bleed trick:
   margin-left resolves "% of container" then subtracts "% of viewport",
   which nets out to viewport-span regardless of the parent's own width. */
.header-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
  width: 100vw;
  margin-left: calc(50% - 50vw);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background var(--transition), transform 0.1s ease, border-color var(--transition);
  white-space: nowrap;
}
.btn-secondary:hover { border-color: var(--accent); }
.btn-secondary:active { transform: scale(0.96); }

.header-actions .btn-icon { display: none; color: var(--text); }

/* Matches landing's .l-cta/.l-cta-small exactly (same tokens, same rules). */
.btn-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--bg);
  font-weight: 800;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  white-space: nowrap;
  transition: transform 0.15s ease;
}
.btn-cta:hover { transform: scale(1.04); }
.btn-cta-small { padding: 5px 12px; font-size: 0.7rem; gap: 5px; }

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 11px 24px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  transition: transform 0.12s ease, box-shadow var(--transition);
}
.btn-primary:hover { transform: scale(1.04); }
.btn-primary:active { transform: scale(0.97); }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--bg);
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 4px;
}

/* ─── Date Header ───────────────────────────────────────────────────────── */
#date-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px;
  flex-shrink: 0;
}

.date-progress-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

#date-label {
  font-size: 0.9rem;
  font-weight: 700;
  font-style: italic;
  text-transform: uppercase;
  color: var(--text);
}

#date-progress {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 4px;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

/* ─── Card Area ─────────────────────────────────────────────────────────── */
#card-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  touch-action: none;
}

#card-stack {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: center;
  height: min(300px, 52vh);
  padding: 0 12px;
  width: 100%;
  transition: opacity 0.2s;
}

#card-stack.dimmed { opacity: 0.25; pointer-events: none; }

/* ─── Swipe direction hints ─────────────────────────────────────────────── */
#swipe-hints {
  position: absolute;
  inset: 0;
  z-index: 11;
  pointer-events: none;
}

.dir-hint {
  position: absolute;
  font-size: 2rem;
  line-height: 1;
  transition: opacity 0.15s;
}

.dir-hint.left   { left: calc(50% - var(--card-w)/2 - 2.5rem - 8px); top: 50%; transform: translateY(-50%); }
.dir-hint.right  { left: calc(50% + var(--card-w)/2 + 8px);          top: 50%; transform: translateY(-50%); }
.dir-hint.up     { top: calc(50% - var(--card-h)/2 - 2.5rem - 8px);  left: 50%; transform: translateX(-50%); }
.dir-hint.down   { top: calc(50% + var(--card-h)/2 + 8px);           left: 50%; transform: translateX(-50%); }

.dir-hint::after {
  position: absolute;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8), 0 0 6px rgba(0,0,0,0.6);
  line-height: 1;
}
.dir-hint.left::after  { content: '←'; right: calc(100% + 6px); top: 50%; transform: translateY(-50%); }
.dir-hint.right::after { content: '→'; left: calc(100% + 6px);  top: 50%; transform: translateY(-50%); }
.dir-hint.up::after    { content: '↑'; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); }
.dir-hint.down::after  { content: '↓'; top: calc(100% + 6px);   left: 50%; transform: translateX(-50%); }

/* Flat edge indicators at card-area edges during drag — was a blurred
   radial-glow oval, which was the odd one out against landing's flat,
   zero-blur, zero-gradient system everywhere else. Solid color bar
   instead, same club-color mapping. */
.edge-oval {
  position: absolute;
  pointer-events: none;
}

.edge-oval.oval-left  { left: 0;   top: 45px; bottom: 45px; width: 5px;  background: var(--reject); }
.edge-oval.oval-right { right: 0;  top: 45px; bottom: 45px; width: 5px;  background: var(--keep); }
.edge-oval.oval-up    { top: 0;    left: 45px; right: 45px; height: 5px; background: var(--favorite); }
.edge-oval.oval-down  { bottom: 0; left: 45px; right: 45px; height: 5px; background: var(--skip); }

@media (max-width: 480px) {
  .dir-hint {
    font-size: 1.5rem;
    background: rgba(0, 0, 0, 1);
    border-radius: 50%;
    width: 2.6rem;
    height: 2.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .dir-hint::after { font-size: 0.75rem; }
  .dir-hint.left  { left: calc(50% - var(--card-w)/2 + 1rem); }
  .dir-hint.right { left: calc(50% + var(--card-w)/2 - 3.8rem); }
  .dir-hint.up    { top: calc(50% - var(--card-h)/2 - 1rem); font-weight: 700; }
  .dir-hint.down  { top: calc(50% + var(--card-h)/2 - 1.8rem); }

  /* Voltar is the least useful header action on mobile — shrink it to
     just the arrow so it stops eating a whole row's worth of width. */
  .voltar-text { display: none; }
  #btn-voltar {
    padding: 5px 10px;
    font-size: 0.85rem;
  }

  /* Icon-only header buttons on mobile — text labels for Instruções /
     Definições / Conta / Rank take too much width to fit one row. */
  .header-actions .btn-secondary {
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    justify-content: center;
  }
  .header-actions .btn-secondary .btn-label { display: none; }
  .header-actions .btn-secondary .btn-icon { display: inline-flex; }
}

/* ─── Começar Pill ───────────────────────────────────────────────────────── */
#comecar-pill {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  border: none;
  font-family: inherit;
  cursor: pointer;
  padding: 14px 40px;
  font-size: 1rem;
}
#comecar-pill:hover  { transform: translate(-50%, -50%) scale(1.04); }
#comecar-pill:active { transform: translate(-50%, -50%) scale(0.97); }

/* ─── Active card overlay ────────────────────────────────────────────────── */
#active-card-area {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#active-card-area .card {
  width: var(--card-w);
  height: var(--card-h);
  max-height: 100%;
  flex-shrink: 0;
  aspect-ratio: unset;
  /* animation applied via JS inline style to avoid specificity overriding fly-* */
}

@keyframes card-enter {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card {
  position: relative;
  height: 100%;
  aspect-ratio: 2/3;
  flex-shrink: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 14px 48px rgba(0,0,0,.55), 0 2px 8px rgba(0,0,0,.4);
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.card:active { cursor: grabbing; }

#card-stack.presentation-mode .card {
  cursor: pointer;
}
#card-stack.presentation-mode .card:hover {
  box-shadow: 0 18px 48px rgba(0,0,0,.5), 0 2px 8px rgba(0,0,0,.4);
  border-color: var(--accent);
  transform: translateY(-3px);
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  display: block;
  background: #000;
}

.card-label-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 28px 16px 14px;
  background: linear-gradient(transparent, rgba(0,0,0,.75));
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.7);
}

/* ─── Full-app swipe feedback ────────────────────────────────────────────── */
#swipe-bg {
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.05s, background-color 0.05s;
}

/* ─── Swipe Overlays ─────────────────────────────────────────────────────── */
.swipe-overlay {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity 0.05s;
  pointer-events: none;
  border: 5px solid transparent;
}

.swipe-overlay.keep     { background: rgba(22,163,74,.25);  border-color: var(--keep); }
.swipe-overlay.reject   { background: rgba(220,38,38,.25);  border-color: var(--reject); }
.swipe-overlay.favorite { background: rgba(82,82,91,.25);   border-color: var(--favorite); }
.swipe-overlay.skip     { background: rgba(29,78,216,.25);  border-color: var(--skip); }

/* ─── Swipe Pill (fixed, centered on viewport) ───────────────────────────── */
#swipe-pill {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255,255,255,0.94);
  border-radius: 100px;
  padding: 18px 28px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.35);
  opacity: 0;
  transition: opacity 0.08s;
}

#pill-icon {
  font-size: 3rem;
  line-height: 1;
  color: var(--bg);
}

#pill-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

#swipe-pill[data-dir="right"] #pill-label { color: var(--keep); }
#swipe-pill[data-dir="left"]  #pill-label { color: var(--reject); }
#swipe-pill[data-dir="up"]    #pill-label { color: var(--favorite); }
#swipe-pill[data-dir="down"]  #pill-label { color: var(--skip); }

/* ─── Fly-off Animations ─────────────────────────────────────────────────── */
@keyframes fly-left {
  to { transform: translateX(-150vw) rotate(-25deg); opacity: 0; }
}
@keyframes fly-right {
  to { transform: translateX(150vw) rotate(25deg); opacity: 0; }
}
@keyframes fly-up {
  to { transform: translateY(-150vh) rotate(-5deg); opacity: 0; }
}
@keyframes fly-down {
  to { transform: translateY(150vh) rotate(5deg); opacity: 0; }
}
@keyframes snap-back {
  to { transform: none; }
}

.card.fly-left     { animation: fly-left  0.35s ease-in forwards; }
.card.fly-right    { animation: fly-right 0.35s ease-in forwards; }
.card.fly-up       { animation: fly-up    0.35s ease-in forwards; }
.card.fly-down     { animation: fly-down  0.35s ease-in forwards; }
.card.snap-back    { animation: snap-back 0.3s cubic-bezier(.34,1.56,.64,1) forwards; }

/* ─── Empty State ───────────────────────────────────────────────────────── */
#empty-state {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-icon {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: 4px;
}

#empty-state p {
  color: var(--text-muted);
  font-size: 1rem;
}

#card-stack:not(:empty) ~ #empty-state {
  display: none;
}


/* ─── Calendar ───────────────────────────────────────────────────────────── */
#calendar-section {
  padding: 0 16px 14px;
  flex-shrink: 0;
}

#calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

#cal-month-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  text-transform: capitalize;
}

.cal-nav-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 26px;
  height: 26px;
  border-radius: 4px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-nav-btn:hover { border-color: var(--accent); }

#calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day-header {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-align: center;
  padding: 2px 0 4px;
  text-transform: uppercase;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  border-radius: 0;
  color: var(--text-muted);
  position: relative;
  transition: background var(--transition), transform 0.15s ease, color var(--transition);
}

.cal-day.has-data {
  cursor: pointer;
}
.cal-day.has-data:hover {
  background: var(--surface2);
  transform: scale(1.08);
}

.cal-day.pending {
  color: var(--text);
}
.cal-day.pending::after {
  content: '';
  position: absolute;
  bottom: 15%;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.cal-day.active {
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
}

.cal-day.completed {
  background: var(--surface2);
  color: var(--text);
  font-weight: 600;
}

.cal-day.completed::after {
  content: '✓';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--keep);
  font-size: 0.45rem;
  font-weight: 900;
  color: #fff;
  line-height: 11px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

/* ─── Progress Bar ───────────────────────────────────────────────────────── */
/* ─── Tap-to-vote bar ────────────────────────────────────────────────────── */
/* Shown/hidden via JS based on the "Votar por botões" setting — on for both
   desktop and mobile, not tied to viewport width. */
#vote-bar {
  display: flex;
  gap: 8px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
}
.vote-bar-btn {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--vote-color);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  padding: 12px 0;
  cursor: pointer;
}
.vote-bar-btn:hover  { background: var(--surface2); border-color: var(--vote-color); }
.vote-bar-btn:active { background: var(--surface2); transform: scale(0.96); }

/* ─── Definições ─────────────────────────────────────────────────────────── */
.definicoes-list { display: flex; flex-direction: column; overflow-y: auto; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}
.switch-row:last-child { border-bottom: none; }

.switch {
  appearance: none;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.switch::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--transition), background var(--transition);
}
.switch:checked { background: rgba(255, 214, 10, 0.25); border-color: var(--accent); }
.switch:checked::before { transform: translateX(18px); background: var(--accent); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.definicoes-warning {
  font-size: 0.78rem;
  color: var(--reject);
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.3);
  padding: 10px 12px;
  flex-shrink: 0;
}

#progress-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 12px;
  flex-shrink: 0;
}

#progress-bar-container.hidden { display: none; }

#progress-bar {
  flex: 1;
  height: 6px;
  background: var(--surface2);
  overflow: hidden;
}

#progress-bar::after {
  content: '';
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  background: var(--text-muted);
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

#progress-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ─── Modal ──────────────────────────────────────────────────────────────── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 50;
}

/* Shared by every bottom-sheet modal (leaderboard, instruções, account, …) —
   was a hand-maintained per-ID list that had gone stale (still listed a
   #catalogue-modal id nothing uses, and silently missed #account-modal
   entirely — it rendered as a normal in-flow block instead of a fixed
   overlay, which is also why it read as not fully opaque: no overlay
   positioning meant nothing was really covering the page behind it). Every
   modal already carries class="modal", so key off that instead. */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

/* #app is capped at 600px too — past that width this was rendering
   4-column grids of ~450px thumbnails edge to edge. */
@media (min-width: 640px) {
  .modal-content { max-width: 600px; }
}

.modal:not(.hidden) { pointer-events: all; }

.modal:not(.hidden) .modal-content {
  animation: slide-up 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes slide-down {
  from { transform: translateY(0); }
  to   { transform: translateY(100%); }
}

.modal-content {
  background: var(--surface);
  border-radius: 0;
  width: 100%;
  max-height: 82dvh;
  display: flex;
  flex-direction: column;
  padding: 26px 20px 20px;
  gap: 14px;
  overflow: hidden;
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
  position: relative;
}

.modal-content::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 38px;
  height: 4px;
  background: var(--border);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h2 {
  font-family: 'Inter Tight', system-ui, sans-serif;
  font-size: 1.2rem;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.btn-icon {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform 0.1s ease;
}
.btn-icon:hover { border-color: var(--accent); }
.btn-icon:active { transform: scale(0.92); }

.modal-filters {
  display: flex;
  flex-shrink: 0;
  border: 1px solid var(--border);
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}

.filter-btn {
  background: transparent;
  color: var(--text);
  border: none;
  border-left: 1px solid var(--border);
  padding: 7px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.filter-btn:first-child { border-left: none; }
.filter-btn:hover { color: var(--accent); }
.filter-btn.active {
  background: var(--accent);
  color: var(--bg);
}

#catalogue-grid {
  display: block;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

#catalogue-grid.grid-view {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  align-items: start;
}

/* ─── Catalogue Nav (back button + breadcrumb) ───────────────────────────── */
#catalogue-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-back {
  background: none;
  border: none;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: color var(--transition), transform 0.1s ease;
}
.btn-back:hover { color: var(--text); }
.btn-back:active { transform: translateX(-2px); }

#catalogue-nav-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ─── Month bundle grid ──────────────────────────────────────────────────── */
.cat-month-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cat-month-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color var(--transition), transform 0.15s ease;
}
.cat-month-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.cat-month-item .bundle-stack {
  width: 72px;
  height: 96px;
}

.cat-month-item .bundle-count-badge {
  font-size: 0.7rem;
  padding: 2px 7px;
  top: -8px;
  right: -8px;
}

.cat-month-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  text-align: center;
  text-transform: uppercase;
  line-height: 1.3;
}

/* ─── Catalogue Bundle View ──────────────────────────────────────────────── */
.cat-bundle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px 0 8px;
  cursor: pointer;
  user-select: none;
}

.cat-bundle:hover .bundle-stack {
  transform: translateY(-4px);
}

.bundle-stack {
  position: relative;
  width: 130px;
  height: 174px;
  transition: transform 0.2s ease;
}

.bundle-card {
  position: absolute;
  inset: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--surface2);
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
}

.bundle-card.bc-0 { transform: none; z-index: 3; }
.bundle-card.bc-1 { transform: rotate(4deg) translate(7px, 3px); z-index: 2; }
.bundle-card.bc-2 { transform: rotate(-5deg) translate(-7px, 5px); z-index: 1; }

.bundle-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1);
}

.bundle-count-badge {
  position: absolute;
  top: -10px;
  right: -12px;
  z-index: 10;
  background: var(--accent);
  color: var(--bg);
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 3px 9px;
  min-width: 26px;
  text-align: center;
}

.bundle-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  text-align: center;
  text-transform: uppercase;
}

.bundle-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-align: center;
  text-transform: uppercase;
  margin-top: -12px;
}

.catalogue-item {
  border-radius: 0;
  background: var(--surface2);
  position: relative;
}

/* Reliable portrait aspect ratio via padding-bottom — works in all browsers */
.catalogue-item::before {
  content: '';
  display: block;
  padding-bottom: 133.33%; /* height = width × 4/3  →  3:4 portrait */
}

.catalogue-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(1);
}

.catalogue-item-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
}

.catalogue-item-badge.keep     { background: var(--keep);     color: #fff; }
.catalogue-item-badge.reject   { background: var(--reject);   color: #fff; }
.catalogue-item-badge.favorite { background: var(--favorite); color: #fff; }
.catalogue-item-badge.skip     { background: var(--skip);     color: #fff; }

.catalogue-item-star {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  background: rgba(0,0,0,.5);
  color: rgba(255,255,255,.7);
  font-size: 1.1rem;
  line-height: 26px;
  text-align: center;
  cursor: pointer;
}
.catalogue-item-star.active { color: var(--accent); }

.catalogue-item-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 3px 4px;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.catalogue-item-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  font-weight: 700;
  color: rgba(255,255,255,.95);
  text-align: center;
  line-height: 1.2;
}

.catalogue-item-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  color: rgba(255,255,255,.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  width: 100%;
  line-height: 1.2;
  text-transform: uppercase;
}

.catalogue-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 20px 0;
}

/* ─── Direction guide (used by the Instruções modal) ────────────────────── */
.landing-dirs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.landing-dir {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.15s ease, border-color var(--transition);
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
.landing-dir:hover {
  transform: translateY(-2px);
}

.ldir-arrow {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 700;
  width: 14px;
  flex-shrink: 0;
}

.ldir-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.ldir-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
}

/* ─── Utilities ──────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* Fullscreen cover viewer — matches landing/landing.css's .l-cover-modal
   exactly (same rules, app's own tokens). Sits above the bottom-sheet
   modals (z-index 200 vs .modal's 60) since it can open from within one. */
.cover-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  cursor: zoom-out;
}
.cover-modal img {
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.cover-modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

/* ─── Instruções modal ───────────────────────────────────────────────────── */
.instrucoes-content {
  overflow-y: auto;
}

.instrucoes-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.instrucoes-body p { margin: 0; }
.instrucoes-body strong { color: var(--text); }

.instrucoes-highlight {
  background: var(--surface2);
  border-radius: 0;
  padding: 12px 14px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.55;
}

.instrucoes-label {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px !important;
}

.instrucoes-body ul {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.instrucoes-tip {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--surface2);
  border-radius: 0;
  padding: 12px;
  margin-top: 10px;
}

.instrucoes-tip-icon { font-size: 1.1rem; flex-shrink: 0; }
.instrucoes-tip p { margin: 0; }

.kbd-arrows {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  grid-template-areas: ". up ." "left down right";
  gap: 8px;
  justify-content: center;
  margin: 4px 0 14px;
}
.kbd-key { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.kbd-icon { width: 40px; height: 40px; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.kbd-key span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-align: center;
}

.kbd-list { display: flex; flex-direction: column; gap: 10px; }
.kbd-row { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--text); }
.kbd-row .kbd-icon { width: 34px; height: 34px; flex-shrink: 0; }
.kbd-row .kbd-icon-space { width: 48px; height: 24px; }

/* ─── Account modal ──────────────────────────────────────────────────────── */
.acc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; flex-shrink: 0; }
.acc-stat { background: var(--surface); border: 1px solid var(--border); padding: 14px; text-align: center; }
.acc-stat-value { font-family: 'JetBrains Mono', monospace; font-size: 1.6rem; font-weight: 900; color: var(--accent); }
.acc-stat-label { font-family: 'JetBrains Mono', monospace; font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }
.acc-breakdown { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.acc-bar-row { display: grid; grid-template-columns: 70px 1fr 40px; align-items: center; gap: 10px; font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.acc-bar-track { height: 8px; background: var(--surface2); overflow: hidden; }
.acc-bar-fill { height: 100%; }
.acc-section-title { font-family: 'Inter Tight', system-ui, sans-serif; font-size: 1.05rem; font-weight: 900; font-style: italic; text-transform: uppercase; margin-bottom: 4px; flex-shrink: 0; }

/* ─── Leaderboard ────────────────────────────────────────────────────────── */
.leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Pinned above the scrollable list — always visible regardless of scroll
   position or rank, so finding yourself never needs scrolling. */
#leaderboard-me:empty { display: none; }
#leaderboard-me { flex-shrink: 0; margin-bottom: 4px; }
.lb-pinned-row { border-bottom: 2px solid var(--accent); }

.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid transparent;
  border-radius: 0;
  font-size: 0.95rem;
  transition: transform 0.12s ease, border-color var(--transition);
}

.lb-row.lb-rank-1 { background: rgba(245, 158, 11, 0.1);  border-color: rgba(245, 158, 11, 0.35); }
.lb-row.lb-rank-2 { background: rgba(203, 213, 225, 0.08); border-color: rgba(203, 213, 225, 0.25); }
.lb-row.lb-rank-3 { background: rgba(217, 119, 6, 0.1);   border-color: rgba(217, 119, 6, 0.3); }

.lb-rank {
  width: 28px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}
.lb-rank .lb-medal { vertical-align: middle; }

.lb-row.lb-rank-1 .lb-rank,
.lb-row.lb-rank-2 .lb-rank,
.lb-row.lb-rank-3 .lb-rank {
  font-size: 1.3rem;
}

.lb-name {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.lb-me {
  border: 1px solid var(--accent);
  background: rgba(255, 214, 10, 0.08);
}

.lb-you {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  font-weight: 700;
  background: var(--accent);
  color: var(--bg);
  border-radius: 4px;
  padding: 2px 6px;
  vertical-align: middle;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lb-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
  list-style: none;
}

.lb-loading {
  text-align: center;
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  list-style: none;
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
