/* Emma-O-Rama — Modern Responsive Glassmorphism design system (BLD-1093)
 * Detective Case File UI per the "Design System & Look and Feel" doc.
 * Dark glass canvas, polaroid hero showcase, segmented game rack + breed
 * search. Functional hooks from BLD-1076..1081 are all preserved so the
 * existing picker / i18n / submissions / reveal pipelines keep working.
 */
:root {
  --bg-dark: #0D0C10;
  --bg-surface: #17141A;
  --panel-glass: rgba(28, 24, 33, 0.75);
  --panel-border: rgba(255, 255, 255, 0.08);

  --amber-gold: #F59E0B;
  --amber-glow: rgba(245, 158, 11, 0.25);
  --red-accent: #EF4444;
  --pink-pop: #EC4899;
  --cyan-sky: #38BDF8;
  --violet-rank: #8B5CF6;
  --emerald-bright: #10B981;

  --text-main: #F8FAFC;
  --text-muted: #94A3B8;

  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-accent: 'Special Elite', monospace;
  --font-hand: 'Caveat', cursive;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  background-color: var(--bg-dark);
  background-image:
    radial-gradient(circle at 15% 12%, rgba(245, 158, 11, 0.10) 0%, transparent 42%),
    radial-gradient(circle at 88% 88%, rgba(239, 68, 68, 0.10) 0%, transparent 42%);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  /* BLD-1081: no rubber-band pull, no overscroll chaining, tap-once buttons */
  overscroll-behavior-y: contain;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

/* ---- Sticky Modern Navbar ---- */
.navbar {
  width: 100%;
  padding: 1rem 1.5rem;
  padding-top: max(1rem, env(safe-area-inset-top, 0px));
  padding-bottom: 1rem;
  background: rgba(13, 12, 16, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--panel-border);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.nav-brand-icon { font-size: 1.3rem; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.case-badge {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--red-accent);
  font-family: var(--font-accent);
  font-size: 0.68rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* Language switcher */
.lang-switch {
  display: flex;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 0.2rem;
}
.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 32px;
}
.lang-btn.active {
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
}

/* ---- Main Responsive Grid ---- */
.app-container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem 1rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  flex-grow: 1;
}

@media (min-width: 640px) {
  .app-container { padding: 2rem 1.5rem 3.5rem 1.5rem; }
}

/* Desktop: asymmetric 2-column spread (hero 1.1fr | rack 1.2fr) */
@media (min-width: 980px) {
  .app-container { grid-template-columns: 1.1fr 1.2fr; gap: 2.5rem; padding-top: 2.5rem; }
}

/* ---- Left Column: Hero Showcase & Character ---- */
.hero-card {
  background: var(--panel-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
.hero-card::before {
  content: '';
  position: absolute;
  top: -60px;
  left: -60px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, var(--amber-glow) 0%, transparent 70%);
  pointer-events: none;
}

/* Polaroid frame with red pushpin */
.polaroid-container {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  background: #FAF8F5;
  padding: 14px 14px 18px 14px;
  border-radius: 8px;
  transform: rotate(-1deg);
  box-shadow: 0 16px 36px rgba(0,0,0,0.6);
  transition: transform 0.3s ease;
}
.polaroid-container:hover { transform: rotate(0deg) scale(1.01); }

.polaroid-pin {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 22px;
  background: var(--red-accent);
  border-radius: 50%;
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.4), 0 4px 12px rgba(0,0,0,0.6);
  z-index: 10;
}

.polaroid-photo {
  width: 100%;
  height: 340px;
  border-radius: 4px;
  overflow: hidden;
  background: #111;
}
.polaroid-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.polaroid-caption {
  margin-top: 12px;
  text-align: center;
  font-family: var(--font-hand);
  font-size: 1.7rem;
  color: #1E1B18;
  line-height: 1;
}

.hero-info h1 {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}
.hero-info p { color: var(--text-muted); font-size: 1rem; line-height: 1.6; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
  margin-top: 0.25rem;
}
.stat-box {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--panel-border);
  padding: 0.85rem 0.5rem;
  border-radius: 12px;
  text-align: center;
}
.stat-val { font-family: var(--font-accent); font-size: 1.15rem; color: var(--amber-gold); }
.stat-lbl { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; margin-top: 0.2rem; font-weight: 600; letter-spacing: 0.02em; }

/* ---- Right Column: Dynamic Rack & Picker ---- */
.app-panel {
  background: var(--panel-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

/* Segmented Navigation Bar */
.segmented-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  background: rgba(0,0,0,0.3);
  padding: 0.35rem;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
}
@media (min-width: 640px) {
  .segmented-tabs { grid-template-columns: repeat(4, 1fr); }
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.7rem 0.4rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  transition: all 0.2s ease;
  min-height: 54px;
}
.tab-btn .tab-emoji { font-size: 1.15rem; }
.tab-btn.active {
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
}

.badge-pill {
  background: var(--amber-gold);
  color: #000;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}
.tab-btn.active .badge-pill { background: #fff; }

/* Panes */
.panel-body { display: flex; flex-direction: column; gap: 1.1rem; }
.pane-content { display: none; }
.pane-content.active { display: block; animation: paneIn 0.25s ease; }
@keyframes paneIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.pane-title {
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.7rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
.pane-title-right { display: inline-flex; align-items: center; gap: 0.5rem; }

.slots-status { font-size: 0.75rem; color: var(--text-muted); font-weight: 700; }
.slots-status.flash { color: var(--pink-pop); }

/* ===== Slot Rack (5 color-coded rank slots) ===== */
.slots-stack { display: flex; flex-direction: column; gap: 0.7rem; margin-bottom: 0.5rem; }

.rank-slot-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1.5px dashed rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  transition: all 0.2s ease;
}
.rank-slot-card.filled { border-style: solid; background: rgba(255, 255, 255, 0.05); box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
.rank-slot-card[draggable="true"] { cursor: grab; }
.rank-slot-card[draggable="true"]:active { cursor: grabbing; }

.rank-slot-card.r-1 { border-color: #F59E0B; }
.rank-slot-card.r-2 { border-color: #EC4899; }
.rank-slot-card.r-3 { border-color: #38BDF8; }
.rank-slot-card.r-4 { border-color: #8B5CF6; }
.rank-slot-card.r-5 { border-color: #10B981; }

.slot-meta-group { display: flex; align-items: center; gap: 0.85rem; min-width: 0; }
.rank-badge-circle {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.1); color: #FFF;
  font-family: var(--font-accent); font-size: 1.05rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.r-1 .rank-badge-circle { background: #F59E0B; color: #000; }
.r-2 .rank-badge-circle { background: #EC4899; color: #FFF; }
.r-3 .rank-badge-circle { background: #38BDF8; color: #000; }
.r-4 .rank-badge-circle { background: #8B5CF6; color: #FFF; }
.r-5 .rank-badge-circle { background: #10B981; color: #000; }

.slot-rank-label { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.slot-breed-name { font-weight: 700; font-size: 1rem; color: var(--text-main); overflow-wrap: anywhere; }

.slot-controls { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.slot-ctrl-btn {
  background: rgba(255,255,255,0.06); border: 1px solid var(--panel-border); color: var(--text-main);
  width: 38px; height: 38px; border-radius: 10px;
  font-size: 1rem; font-weight: 800; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.slot-ctrl-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.slot-ctrl-btn:not(:disabled):active { transform: scale(0.92); background: var(--bg-surface); }
.slot-remove-btn {
  background: rgba(255,255,255,0.06); border: none; color: var(--text-muted);
  width: 38px; height: 38px; border-radius: 50%;
  font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.slot-remove-btn:active { transform: scale(0.92); background: rgba(239,68,68,0.2); color: var(--red-accent); }

/* ===== Submit / Lock-in ===== */
.submit-block { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.85rem; }

.avatar-picker { display: flex; flex-direction: column; gap: 0.5rem; }
.avatar-label { font-size: 0.72rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.avatar-options { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.avatar-option {
  width: 46px; height: 46px; border-radius: 14px;
  background: rgba(255,255,255,0.04); border: 1.5px solid var(--panel-border);
  font-size: 1.4rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.avatar-option:active { transform: scale(0.92); }
.avatar-option.selected { border-color: var(--amber-gold); background: rgba(245,158,11,0.12); box-shadow: 0 4px 12px var(--amber-glow); }

.player-name-field {
  width: 100%; background: rgba(0,0,0,0.3); border: 1px solid var(--panel-border); border-radius: 14px;
  padding: 0.9rem 1rem; color: var(--text-main); font-weight: 600; font-size: 1rem; outline: none;
}
.player-name-field:focus { border-color: var(--amber-gold); }

.lockin-action-btn {
  width: 100%; background: linear-gradient(135deg, var(--amber-gold) 0%, #D97706 100%);
  color: #000; font-family: var(--font-body); font-weight: 800; font-size: 1.1rem;
  padding: 1rem; border: none; border-radius: 14px; cursor: pointer;
  box-shadow: 0 8px 25px var(--amber-glow);
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  transition: all 0.2s ease; min-height: 54px;
}
.lockin-action-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(245, 158, 11, 0.4); }
.lockin-action-btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

/* ===== Breed Search ===== */
.breed-count { font-size: 0.78rem; color: var(--text-muted); font-weight: 700; }
.search-box { position: relative; margin-bottom: 0.85rem; }
.search-box .search-icon { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-box input {
  width: 100%; background: rgba(0,0,0,0.3); border: 1px solid var(--panel-border); border-radius: 14px;
  padding: 0.9rem 1rem 0.9rem 2.75rem; color: var(--text-main); font-size: 0.95rem;
  font-weight: 600; outline: none; transition: border-color 0.2s;
}
.search-box input:focus { border-color: var(--amber-gold); }

.breed-items-list { display: flex; flex-direction: column; gap: 0.6rem; max-height: 460px; overflow-y: auto; padding-right: 0.25rem; }
.breed-item-row {
  background: rgba(255,255,255,0.03); border: 1px solid var(--panel-border); border-radius: 12px;
  padding: 0.85rem 1.1rem; display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; transition: all 0.15s ease; min-height: 50px;
}
.breed-item-row:active { transform: scale(0.98); background: rgba(245,158,11,0.1); }
.breed-item-row.selected { opacity: 0.35; pointer-events: none; }
.breed-title-text { font-weight: 700; font-size: 0.95rem; color: var(--text-main); display: flex; align-items: center; gap: 0.5rem; }
.plus-icon-badge {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.1); color: var(--text-main);
  font-weight: 800; font-size: 1rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.breed-empty { text-align: center; color: var(--text-muted); font-weight: 600; padding: 1.5rem 0; }

/* Placeholder scaffold cards */
.scaffold-card {
  background: rgba(255,255,255,0.03); border: 1.5px dashed var(--panel-border);
  border-radius: 18px; padding: 1.2rem 1rem; text-align: center;
  color: var(--text-muted); font-weight: 600; font-size: 0.95rem; line-height: 1.4;
}
.scaffold-card .scaffold-emoji { font-size: 2rem; display: block; margin-bottom: 0.5rem; }

/* ===== BLD-1078 guest finishing-flow cards ===== */
.edit-banner {
  background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.4);
  border-radius: 18px; padding: 0.9rem 1rem; margin-top: 1rem; text-align: center;
}
.edit-banner h3 { font-weight: 800; color: var(--amber-gold); font-size: 1.05rem; margin-bottom: 0.2rem; }
.edit-banner p { color: var(--text-muted); font-size: 0.85rem; font-weight: 600; }

.already-card {
  background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.5);
  border-radius: 20px; padding: 1.3rem; text-align: center; margin-top: 1rem;
}
.already-card h3 { font-weight: 800; color: var(--amber-gold); font-size: 1.3rem; margin-bottom: 0.35rem; }
.already-card p { color: var(--text-muted); font-size: 0.92rem; font-weight: 600; line-height: 1.4; margin-bottom: 0.9rem; }
.already-view-btn {
  background: linear-gradient(135deg, var(--amber-gold) 0%, #D97706 100%);
  color: #000; font-weight: 800; font-size: 1rem;
  padding: 0.8rem 1.2rem; border: none; border-radius: 14px; cursor: pointer;
  box-shadow: 0 6px 18px var(--amber-glow);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  transition: all 0.2s ease;
}
.already-view-btn:active { transform: scale(0.97); }

.locked-card {
  background: rgba(255,255,255,0.03); border: 1px solid var(--panel-border);
  border-radius: 20px; padding: 1.3rem; text-align: center; margin-top: 1rem;
}
.locked-card h3 { font-weight: 800; color: var(--text-main); font-size: 1.3rem; margin-bottom: 0.35rem; }
.locked-card p { color: var(--text-muted); font-size: 0.92rem; font-weight: 600; line-height: 1.4; }

.victory-modal {
  display: none; background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.4);
  border-radius: 20px; padding: 1.4rem 1.3rem; text-align: center; margin-top: 1rem;
}
.victory-modal h3 { font-weight: 800; color: var(--emerald-bright); font-size: 1.35rem; margin-bottom: 0.35rem; }
.victory-modal p { color: var(--text-muted); font-size: 0.92rem; font-weight: 600; line-height: 1.4; }
.victory-in { color: var(--emerald-bright); font-size: 1.05rem; margin-bottom: 0.3rem; }
.victory-edit-btn {
  margin-top: 0.9rem; background: rgba(16,185,129,0.1); border: 1.5px solid var(--emerald-bright);
  color: var(--emerald-bright); font-weight: 800; font-size: 0.95rem;
  padding: 0.7rem 1.1rem; border-radius: 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  transition: all 0.2s ease;
}
.victory-edit-btn:active { transform: scale(0.97); background: rgba(16,185,129,0.18); }

/* ===== BLD-1080 reveal + leaderboard payoff ===== */
.reveal-heading { font-family: var(--font-accent); font-size: 1.3rem; color: var(--amber-gold); margin-bottom: 0.6rem; }
.reveal-subheading { font-weight: 800; font-size: 1.05rem; color: var(--text-main); margin: 1rem 0 0.4rem; }

.reveal-pre-note {
  background: rgba(245,158,11,0.08); border: 1.5px dashed rgba(245,158,11,0.4);
  border-radius: 18px; padding: 0.9rem 1rem; color: var(--amber-gold); font-weight: 700; font-size: 0.95rem; line-height: 1.4;
}

.reveal-countdown {
  background: linear-gradient(135deg, var(--amber-gold) 0%, #D97706 100%);
  border-radius: 20px; padding: 1.1rem; text-align: center; margin: 0.9rem 0 1rem;
  box-shadow: 0 8px 24px var(--amber-glow);
}
.reveal-countdown-label { color: rgba(0,0,0,0.6); font-weight: 800; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.3rem; }
.reveal-countdown-value { font-family: var(--font-accent); color: #000; font-size: 1.5rem; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }

.reveal-hint { color: var(--text-muted); font-size: 0.82rem; font-weight: 600; margin-bottom: 0.6rem; }
.reveal-myempty { color: var(--text-muted); font-size: 0.9rem; font-weight: 600; padding: 1rem; text-align: center; }

.reveal-pick, .reveal-answer-row {
  background: rgba(255,255,255,0.03); border: 1px solid var(--panel-border); border-radius: 14px;
  padding: 0.6rem 0.8rem; display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.5rem;
}
.reveal-pick.r-1 { border-color: #F59E0B; }
.reveal-pick.r-2 { border-color: #EC4899; }
.reveal-pick.r-3 { border-color: #38BDF8; }
.reveal-pick.r-4 { border-color: #8B5CF6; }
.reveal-pick.r-5 { border-color: #10B981; }
.reveal-pick-name { font-weight: 700; font-size: 0.98rem; }

.reveal-post-intro { color: var(--text-muted); font-size: 0.92rem; font-weight: 600; margin-bottom: 0.6rem; }
.reveal-answer-rank { font-size: 1.3rem; width: 2rem; text-align: center; flex-shrink: 0; }
.reveal-answer-name { font-weight: 800; font-size: 1.02rem; }
.reveal-answer-row.r-1 { border-color: #F59E0B; box-shadow: 0 4px 12px rgba(245,158,11,0.25); }

.reveal-my-score {
  background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.4);
  border-radius: 18px; padding: 0.9rem 1rem; text-align: center; margin-top: 1rem;
  font-weight: 800; color: var(--emerald-bright);
}
.reveal-my-score.crowned { background: rgba(245,158,11,0.12); border-color: var(--amber-gold); color: var(--amber-gold); }

.reveal-doormat { color: var(--text-muted); font-size: 0.92rem; font-weight: 600; line-height: 1.4; }
.leaderboard-empty { text-align: center; color: var(--text-muted); font-weight: 600; padding: 1.2rem 0; }
.leaderboard-row {
  display: grid; grid-template-columns: 2.2rem 1fr auto auto; align-items: center; gap: 0.55rem;
  background: rgba(255,255,255,0.03); border: 1px solid var(--panel-border); border-radius: 14px;
  padding: 0.65rem 0.8rem; margin-bottom: 0.5rem; box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.leaderboard-row.leader { border-color: var(--amber-gold); box-shadow: 0 4px 14px var(--amber-glow); }
.leaderboard-row.is-me { border-color: var(--violet-rank); }
.leaderboard-rank { font-family: var(--font-accent); font-size: 1rem; text-align: center; color: var(--amber-gold); }
.leaderboard-name { font-weight: 700; font-size: 0.95rem; color: var(--text-main); min-width: 0; overflow-wrap: anywhere; }
.leaderboard-exact { color: var(--cyan-sky); font-weight: 800; font-size: 0.8rem; }
.leaderboard-points { background: rgba(139,92,246,0.2); color: #D8CCFF; font-weight: 800; font-size: 0.85rem; padding: 0.25rem 0.6rem; border-radius: 999px; text-align: right; }
.leaderboard-row.leader .leaderboard-points { background: rgba(245,158,11,0.25); color: var(--amber-gold); }

/* ===== Footer ===== */
footer {
  width: 100%;
  padding: 1.5rem 1rem;
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px));
  text-align: center;
  border-top: 1px solid var(--panel-border);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ===== BLD-1081: mobile-first polish + fun micro-interactions =====
 * Preserved from the earlier polish pass: pop-in, realign flutter,
 * drag highlight, rise-in stagger, countdown heartbeat, hero float,
 * tap-squash. All visuals adapted to the glassmorphism system.
 */

/* Playful micro-interactions */
@keyframes slotFillPop {
  0%   { transform: scale(0.92); }
  55%  { transform: scale(1.045); }
  100% { transform: scale(1); }
}
.rank-slot-card.pop-in { animation: slotFillPop 0.3s cubic-bezier(0.22, 1, 0.36, 1); }

@keyframes badgePulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18) rotate(-6deg); }
  70%  { transform: scale(0.96) rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}
.rank-slot-card.pop-in .rank-badge-circle { animation: badgePulse 0.42s ease 0.08s; }

.rank-slot-card.drag-over {
  outline: 3px solid var(--amber-gold);
  outline-offset: 2px;
  transform: scale(1.02);
  box-shadow: 0 8px 22px var(--amber-glow);
}
.rank-slot-card.drag-origin { opacity: 0.5; transform: scale(0.97); }

@keyframes slotRealign {
  0%   { transform: translateY(-6px); }
  100% { transform: translateY(0); }
}
.rank-slot-card.realign { animation: slotRealign 0.28s ease; }

@keyframes plusPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.breed-item-row.taken .plus-icon-badge { animation: plusPop 0.28s ease; }

@keyframes riseIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.reveal-answer-row, .reveal-pick, .leaderboard-row { animation: riseIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) both; }
.reveal-answer-row:nth-child(2), .reveal-pick:nth-child(2) { animation-delay: 0.05s; }
.reveal-answer-row:nth-child(3), .reveal-pick:nth-child(3) { animation-delay: 0.10s; }
.reveal-answer-row:nth-child(4), .reveal-pick:nth-child(4) { animation-delay: 0.15s; }
.reveal-answer-row:nth-child(5), .reveal-pick:nth-child(5) { animation-delay: 0.20s; }

@keyframes countdownBeat {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}
.reveal-countdown-value { display: inline-block; animation: countdownBeat 2s ease-in-out infinite; }

@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}
.polaroid-photo img { animation: heroFloat 5s ease-in-out infinite; }

@keyframes tabSquash {
  0% { transform: scale(1); }
  50% { transform: scale(0.94); }
  100% { transform: scale(1); }
}
.tab-btn:active, .avatar-option:active { animation: tabSquash 0.2s ease; }

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ===== Responsive breakpoints (BLD-1081 keeps these; 992px adds the grid) ===== */
@media (min-width: 640px) {
  .navbar { padding-left: 2rem; padding-right: 2rem; }
  .hero-card { padding: 1.75rem; }
  .app-panel { padding: 1.5rem; }
}

@media (min-width: 980px) {
  .polaroid-photo { height: 400px; }
  .hero-card { gap: 1.5rem; }
  /* 2-col slot and breed stacks on wide panels breathe better */
  .slots-stack { gap: 0.7rem; }
}