/* Emma-O-Rama — Bright Sunburst Pop visual system (BLD-1076)
 * Tokens from the Design System & Look and Feel doc (Parker / Perspekiv).
 */
:root {
  --bg-sky: #E0F2FE;
  --card-white: #FFFFFF;
  --purple-hero: #7C3AED;
  --purple-light: #F3E8FF;
  --yellow-sun: #F59E0B;
  --pink-pop: #EC4899;
  --cyan-sky: #06B6D4;
  --emerald-bright: #10B981;
  --emerald-light: #D1FAE5;
  --text-main: #0F172A;
  --text-sub: #475569;
  --font-title: 'Fredoka', cursive, sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

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

html, body { height: 100%; }

body {
  background: linear-gradient(180deg, #BAE6FD 0%, #E0F2FE 40%, #F0F9FF 100%);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  /* BLD-1081: no rubber-band pull, no overscroll chaining, tap-once buttons */
  overscroll-behavior-y: contain;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

.mobile-app-shell {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  min-height: 100dvh;
  background: #FAF5FF;
  box-shadow: 0 25px 60px rgba(124, 58, 237, 0.18);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* BLD-1081: respect notch / home-indicator safe areas */
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Top Sticky Header */
.top-bar {
  padding: 0.9rem 1.25rem;
  background: #FFFFFF;
  border-bottom: 3px solid #F3E8FF;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.05);
}

.top-logo {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: var(--purple-hero);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Language switcher */
.lang-switch {
  display: flex;
  gap: 0.3rem;
  background: var(--purple-light);
  border-radius: 999px;
  padding: 0.2rem;
}
.lang-btn {
  border: none;
  background: transparent;
  color: var(--purple-hero);
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.8rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.lang-btn.active {
  background: var(--purple-hero);
  color: #FFF;
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.35);
}

/* Hero */
.character-showcase-container { padding: 1rem 1.25rem 0.5rem 1.25rem; }
.giant-character-card {
  background: #FFFFFF;
  border-radius: 28px;
  padding: 1rem;
  box-shadow: 0 12px 32px rgba(124, 58, 237, 0.12);
  border: 3px solid var(--purple-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.giant-portrait-wrapper {
  width: 100%;
  height: 300px;
  border-radius: 22px;
  overflow: hidden;
  position: relative;
  background: #38BDF8;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  border: 4px solid #FFFFFF;
}
.giant-portrait-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.character-floating-pill {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  color: var(--purple-hero);
  font-family: var(--font-title);
  font-size: 0.9rem;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.character-title-area { width: 100%; text-align: center; margin-top: 0.85rem; }
.character-title-area h1 {
  font-family: var(--font-title);
  font-size: 1.8rem;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 0.3rem;
}
.character-title-area p { color: var(--text-sub); font-size: 0.92rem; font-weight: 600; line-height: 1.35; }

/* Tabs */
.tabs-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  padding: 1rem 1.25rem 0.5rem 1.25rem;
}
.tab-btn {
  background: #FFFFFF;
  border: 2.5px solid #E2E8F0;
  color: var(--text-sub);
  padding: 0.7rem 0.3rem;
  border-radius: 18px;
  font-family: var(--font-title);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}
.tab-btn .tab-emoji { font-size: 1.2rem; }
.tab-btn.active {
  background: var(--purple-hero);
  border-color: var(--purple-hero);
  color: #FFFFFF;
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.35);
}
.badge-pill {
  background: var(--yellow-sun);
  color: #0F172A;
  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: #FFFFFF; color: var(--purple-hero); }

/* Panes */
.main-body { padding: 0.75rem 1.25rem 2.5rem 1.25rem; flex-grow: 1; }
.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-title);
  font-size: 1.25rem;
  color: var(--text-main);
  margin-bottom: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ===== Flow restructure: linear step wizard ===== */
.step { display: none; }
.step.active { display: block; animation: paneIn 0.25s ease; }

/* Consistent horizontal padding so every panel and button aligns to the same
   column. The step owns the padding; children (slots, breed list, buttons)
   are width:100% and inherit the same left/right inset. */
.step { padding: 0.75rem 1.25rem 2.5rem 1.25rem; }

.step-actions { margin-top: 1.25rem; display: flex; flex-direction: column; gap: 0.7rem; }
.primary-action-btn {
  width: 100%; background: linear-gradient(135deg, var(--purple-hero) 0%, #6D28D9 100%);
  color: #FFFFFF; font-family: var(--font-title); font-size: 1.25rem;
  padding: 1.05rem; border: none; border-radius: 18px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  transition: all 0.2s ease; min-height: 56px;
}
.primary-action-btn:disabled { opacity: 0.4; box-shadow: none; cursor: not-allowed; }
.primary-action-btn:not(:disabled):active { transform: scale(0.97); }
.secondary-action-btn {
  width: 100%; background: #FFFFFF; border: 2.5px solid var(--purple-hero);
  color: var(--purple-hero); font-family: var(--font-body); font-weight: 800; font-size: 1rem;
  padding: 0.9rem; border-radius: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  transition: all 0.2s ease; min-height: 52px;
}
.secondary-action-btn:active { transform: scale(0.97); background: var(--purple-light); }

/* Step 2: breed picker sits below the slots on the same step. It is hidden
   until the user taps a slot (slot-target mode), then shown; it hides again
   when they leave target mode. */
.breed-picker-block { margin-top: 1.25rem; display: none; }
body.slot-picking .breed-picker-block { display: block; }

/* Placeholder scaffold cards */
.scaffold-card {
  background: #FFFFFF;
  border: 2.5px dashed #CBD5E1;
  border-radius: 18px;
  padding: 1.2rem 1rem;
  text-align: center;
  color: var(--text-sub);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.4;
}
.scaffold-card .scaffold-emoji { font-size: 2rem; display: block; margin-bottom: 0.5rem; }

/* Footer */
footer {
  padding: 1.5rem 1.25rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-sub);
  font-weight: 600;
}

/* ===== BLD-1077: Top-5 ranked picker ===== */
.slots-status { font-size: 0.8rem; color: var(--text-sub); font-family: var(--font-body); font-weight: 700; }
.slots-status.flash { color: var(--pink-pop); }

.slots-stack { display: flex; flex-direction: column; gap: 0.7rem; margin-bottom: 1.25rem; }

.rank-slot-card {
  background: #FFFFFF;
  border: 2.5px dashed #CBD5E1;
  border-radius: 18px;
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  transition: all 0.2s ease;
}
.rank-slot-card.filled { border-style: solid; box-shadow: 0 6px 18px rgba(0,0,0,0.06); }
.rank-slot-card[draggable="true"] { cursor: grab; }
.rank-slot-card[draggable="true"]:active { cursor: grabbing; }
.rank-slot-card.r-1 { border-color: #F59E0B; background: #FFFBEB; }
.rank-slot-card.r-2 { border-color: #EC4899; background: #FCE7F3; }
.rank-slot-card.r-3 { border-color: #06B6D4; background: #ECFEFF; }
.rank-slot-card.r-4 { border-color: #8B5CF6; background: #F3E8FF; }
.rank-slot-card.r-5 { border-color: #10B981; background: #D1FAE5; }

.slot-meta-group { display: flex; align-items: center; gap: 0.85rem; min-width: 0; }
.rank-badge-circle {
  width: 40px; height: 40px; border-radius: 50%;
  background: #E2E8F0; color: var(--text-main);
  font-family: var(--font-title); font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.r-1 .rank-badge-circle { background: #F59E0B; color: #FFF; }
.r-2 .rank-badge-circle { background: #EC4899; color: #FFF; }
.r-3 .rank-badge-circle { background: #06B6D4; color: #FFF; }
.r-4 .rank-badge-circle { background: #8B5CF6; color: #FFF; }
.r-5 .rank-badge-circle { background: #10B981; color: #FFF; }

.slot-rank-label { font-size: 0.72rem; font-weight: 800; color: var(--text-sub); text-transform: uppercase; letter-spacing: 0.05em; }
.slot-breed-name { font-weight: 700; font-size: 1.02rem; color: var(--text-main); overflow-wrap: anywhere; }

.slot-controls { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.slot-ctrl-btn {
  background: #FFFFFF; border: 2px solid #E2E8F0; color: var(--purple-hero);
  width: 34px; height: 34px; 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(--purple-light); }
.slot-remove-btn {
  background: #F1F5F9; border: none; color: #94A3B8;
  width: 34px; height: 34px; 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: #FEE2E2; color: #EF4444; }

/* Submit */
.submit-block { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.85rem; }
.player-name-field {
  width: 100%; background: #FFFFFF; border: 2.5px solid #E2E8F0; border-radius: 16px;
  padding: 0.9rem 1rem; color: var(--text-main); font-weight: 700; font-size: 1rem; outline: none;
}
.player-name-field:focus { border-color: var(--pink-pop); }
.lockin-action-btn {
  width: 100%; background: linear-gradient(135deg, var(--purple-hero) 0%, #6D28D9 100%);
  color: #FFFFFF; font-family: var(--font-title); font-size: 1.25rem;
  padding: 1.05rem; border: none; border-radius: 18px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  transition: all 0.2s ease;
}
.lockin-action-btn:disabled { opacity: 0.4; box-shadow: none; cursor: not-allowed; }

.victory-modal {
  display: none; background: var(--emerald-light); border: 2.5px solid var(--emerald-bright);
  border-radius: 22px; padding: 1.35rem; text-align: center; margin-top: 1rem;
}
.victory-modal h3 { font-family: var(--font-title); color: var(--emerald-bright); font-size: 1.45rem; margin-bottom: 0.35rem; }
.victory-modal p { color: #065F46; font-size: 0.92rem; font-weight: 600; line-height: 1.4; }

/* Breed list picker */
.breed-count { font-size: 0.8rem; color: var(--text-sub); font-weight: 700; }
.search-input-wrapper { position: relative; margin-bottom: 0.85rem; }
.search-input-wrapper input {
  width: 100%; background: #FFFFFF; border: 2.5px solid #E2E8F0; border-radius: 16px;
  padding: 0.85rem 1rem 0.85rem 2.6rem; color: var(--text-main); font-size: 0.95rem;
  font-weight: 700; outline: none; box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.search-input-wrapper input:focus { border-color: var(--purple-hero); }
.search-icon-symbol { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); font-size: 1rem; }

.breed-items-list { display: flex; flex-direction: column; gap: 0.6rem; max-height: 460px; overflow-y: auto; }
.breed-item-row {
  background: #FFFFFF; border: 2px solid #F1F5F9; border-radius: 16px;
  padding: 0.85rem 1rem; display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; transition: all 0.15s ease; box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}
.breed-item-row:active { transform: scale(0.98); background: var(--purple-light); }
.breed-item-row.selected { opacity: 0.4; pointer-events: none; background: #F8FAFC; }
.breed-title-text { font-weight: 700; font-size: 1rem; color: var(--text-main); display: flex; align-items: center; gap: 0.5rem; }
.plus-icon-badge {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--purple-light); color: var(--purple-hero);
  font-weight: 800; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.breed-empty { text-align: center; color: var(--text-sub); font-weight: 600; padding: 1.5rem 0; }

/* ===== BLD-1087: slot-targeted picking ===== */
/* Slots are tappable to jump straight to the breed list. */
.rank-slot-card.select-target { cursor: pointer; }
.rank-slot-card.select-target:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0,0,0,0.08); }
.rank-slot-card.select-target:focus-visible { outline: 3px solid var(--purple-hero); outline-offset: 2px; }

/* While picking into a slot, keep already-picked breeds tappable so the user
   can swap/reorder by tapping (classic mode dims + disables them). */
.slot-picking .breed-item-row.selected { opacity: 1; pointer-events: auto; background: #FFFFFF; }

/* Back bar shown at the top of the breed list while filling a specific slot. */
.slot-pick-back {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  background: var(--purple-light); border: 2px solid var(--purple-hero);
  border-radius: 14px; padding: 0.55rem 0.8rem; margin-bottom: 0.85rem;
}
.slot-pick-back-btn {
  background: var(--purple-hero); color: #FFFFFF; border: none; border-radius: 10px;
  font-weight: 800; font-size: 0.85rem; padding: 0.45rem 0.7rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.35rem; transition: all 0.15s ease;
}
.slot-pick-back-btn:active { transform: scale(0.95); }
.slot-pick-target-hint { font-size: 0.8rem; font-weight: 800; color: var(--purple-hero); }

/* ===== BLD-1078: guest finishing flow ===== */
.pane-title-right { display: inline-flex; align-items: center; gap: 0.5rem; }

/* Avatar picker */
.avatar-picker { display: flex; flex-direction: column; gap: 0.5rem; }
.avatar-label { font-size: 0.8rem; font-weight: 800; color: var(--text-sub); text-transform: uppercase; letter-spacing: 0.04em; }
.avatar-options { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.avatar-option {
  width: 44px; height: 44px; border-radius: 14px;
  background: #FFFFFF; border: 2.5px solid #E2E8F0;
  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(--purple-hero);
  background: var(--purple-light);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}

/* Edit-mode banner */
.edit-banner {
  background: var(--purple-light); border: 2.5px solid var(--purple-hero);
  border-radius: 18px; padding: 0.9rem 1rem; margin-top: 1rem; text-align: center;
}
.edit-banner h3 { font-family: var(--font-title); color: var(--purple-hero); font-size: 1.1rem; margin-bottom: 0.2rem; }
.edit-banner p { color: var(--text-sub); font-size: 0.85rem; font-weight: 600; }

/* Already-guessed state */
.already-card {
  background: #FFFBEB; border: 2.5px solid var(--yellow-sun);
  border-radius: 22px; padding: 1.35rem; text-align: center; margin-top: 1rem;
}
.already-card h3 { font-family: var(--font-title); color: #B45309; font-size: 1.35rem; margin-bottom: 0.35rem; }
.already-card p { color: #78350F; font-size: 0.92rem; font-weight: 600; line-height: 1.4; margin-bottom: 0.9rem; }
.already-view-btn {
  background: linear-gradient(135deg, var(--yellow-sun) 0%, #D97706 100%);
  color: #FFFFFF; font-family: var(--font-title); font-size: 1.05rem;
  padding: 0.8rem 1.2rem; border: none; border-radius: 16px; cursor: pointer;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.4);
  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 state (after reveal) */
.locked-card {
  background: #F1F5F9; border: 2.5px solid #CBD5E1;
  border-radius: 22px; padding: 1.35rem; text-align: center; margin-top: 1rem;
}
.locked-card h3 { font-family: var(--font-title); color: var(--text-main); font-size: 1.3rem; margin-bottom: 0.35rem; }
.locked-card p { color: var(--text-sub); font-size: 0.92rem; font-weight: 600; line-height: 1.4; }

/* Victory confirmation */
.victory-in { font-family: var(--font-title); color: var(--emerald-bright); font-size: 1.1rem; margin-bottom: 0.3rem; }
.victory-edit-btn {
  margin-top: 0.9rem; background: #FFFFFF; border: 2.5px solid var(--emerald-bright);
  color: var(--emerald-bright); font-family: var(--font-body); 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: var(--emerald-light); }

/* ===== BLD-1080: reveal + leaderboard payoff ===== */
.reveal-heading { font-family: var(--font-title); font-size: 1.4rem; color: var(--purple-hero); margin-bottom: 0.6rem; }
.reveal-subheading { font-family: var(--font-title); font-size: 1.1rem; color: var(--text-main); margin: 1rem 0 0.4rem; }

.reveal-pre-note { background: var(--purple-light); border: 2.5px dashed var(--purple-hero); border-radius: 18px; padding: 0.9rem 1rem; color: var(--purple-hero); font-weight: 700; font-size: 0.95rem; line-height: 1.4; }

.reveal-countdown {
  background: linear-gradient(135deg, var(--purple-hero) 0%, #6D28D9 100%);
  border-radius: 22px; padding: 1.1rem; text-align: center; margin: 0.9rem 0 1rem;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.35);
}
.reveal-countdown-label { color: #E9D5FF; font-weight: 800; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.3rem; }
.reveal-countdown-value { font-family: var(--font-title); color: #FFF; font-size: 1.6rem; letter-spacing: 0.05em; font-variant-numeric: tabular-nums; }

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

.reveal-pick, .reveal-answer-row {
  background: #FFFFFF; border: 2px solid #F1F5F9; 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; background: #FFFBEB; }
.reveal-pick.r-2 { border-color: #EC4899; background: #FCE7F3; }
.reveal-pick.r-3 { border-color: #06B6D4; background: #ECFEFF; }
.reveal-pick.r-4 { border-color: #8B5CF6; background: #F3E8FF; }
.reveal-pick.r-5 { border-color: #10B981; background: #D1FAE5; }
.reveal-pick-name { font-weight: 700; font-size: 0.98rem; }

.reveal-post-intro { color: var(--text-sub); 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; background: #FFFBEB; box-shadow: 0 4px 12px rgba(245,158,11,0.25); }
.reveal-answer-row.r-2 { border-color: #CBD5E1; background: #F8FAFC; }
.reveal-answer-row.r-3 { border-color: #F59E0B; background: #FFF7ED; }

.reveal-my-score {
  background: var(--emerald-light); border: 2.5px solid var(--emerald-bright);
  border-radius: 18px; padding: 0.9rem 1rem; text-align: center; margin-top: 1rem;
  font-weight: 800; color: #065F46;
}
.reveal-my-score.crowned { background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%); border-color: var(--yellow-sun); color: #92400E; }

/* Leaderboard */
.reveal-doormat { color: var(--text-sub); font-size: 0.92rem; font-weight: 600; line-height: 1.4; }
.leaderboard-empty { text-align: center; color: var(--text-sub); 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: #FFFFFF; border: 2px solid #F1F5F9; border-radius: 14px;
  padding: 0.65rem 0.8rem; margin-bottom: 0.5rem; box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.leaderboard-row.leader { border-color: var(--yellow-sun); background: #FFFBEB; box-shadow: 0 4px 14px rgba(245,158,11,0.3); }
.leaderboard-row.is-me { border-color: var(--purple-hero); background: var(--purple-light); }
.leaderboard-rank { font-family: var(--font-title); font-size: 1.05rem; text-align: center; }
.leaderboard-name { font-weight: 700; font-size: 0.95rem; min-width: 0; overflow-wrap: anywhere; }
.leaderboard-exact { color: var(--cyan-sky); font-weight: 800; font-size: 0.8rem; }
.leaderboard-points { background: var(--purple-light); color: var(--purple-hero); font-weight: 800; font-size: 0.85rem; padding: 0.25rem 0.6rem; border-radius: 999px; text-align: right; }
.leaderboard-row.leader .leaderboard-points { background: var(--yellow-sun); color: #0F172A; }

/* ===== BLD-1088: pre-reveal guessboard (top guesses so far) ===== */
.guessboard-block { margin-top: 0.75rem; }
.guessboard-block h4 { font-family: var(--font-title); font-size: 1.05rem; color: var(--text-main); margin: 0.5rem 0 0.2rem; }
.guessboard-subtitle { color: var(--text-sub); font-size: 0.9rem; font-weight: 600; line-height: 1.4; margin: 0 0 0.6rem; }
.guessboard-list { display: flex; flex-direction: column; gap: 0.4rem; }
.guessboard-row {
  display: grid; grid-template-columns: 2.2rem 1fr auto; align-items: center; gap: 0.55rem;
  background: #FFFFFF; border: 2px solid #F1F5F9; border-radius: 14px;
  padding: 0.6rem 0.8rem; box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.guessboard-row.leader { border-color: var(--yellow-sun); background: #FFFBEB; box-shadow: 0 4px 14px rgba(245,158,11,0.3); }
.guessboard-rank { font-family: var(--font-title); font-size: 1.05rem; text-align: center; }
.guessboard-name { font-weight: 700; font-size: 0.95rem; min-width: 0; overflow-wrap: anywhere; }
.guessboard-count { color: var(--purple-hero); font-weight: 800; font-size: 0.8rem; background: var(--purple-light); padding: 0.25rem 0.6rem; border-radius: 999px; white-space: nowrap; }
.guessboard-empty, .guessboard-loading, .guessboard-error { text-align: center; color: var(--text-sub); font-weight: 600; padding: 0.8rem 0; }
.guessboard-row { animation: riseIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* ===== BLD-1081: mobile-first polish + fun polish pass =====
 * Game-feel micro-interactions (sound-free), thumb-friendly tap targets,
 * no horizontal overflow on a phone in portrait, safe-area aware, and a
 * graceful tablet/desktop breakpoint so the shell scales up cleanly.
 */

/* --- Thumb-friendly tap targets (>= 44px recommended) --- */
.tab-btn { min-height: 58px; }
.tab-btn .tab-emoji { transform: translateY(1px); }
.slot-ctrl-btn, .slot-remove-btn { width: 42px; height: 42px; }
.avatar-option { width: 48px; height: 48px; font-size: 1.5rem; }
.breed-item-row { min-height: 54px; }
.lockin-action-btn { min-height: 56px; }
.lang-btn { min-height: 36px; }
.plus-icon-badge { width: 34px; height: 34px; }

/* --- Playful micro-interactions --- */
/* Slot pop-in when a slot becomes filled */
@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); }

/* Gently nudge the rank badge on fill for extra delight */
@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; }

/* Drag-over target highlight while reordering */
.rank-slot-card.drag-over {
  outline: 3px solid var(--purple-hero);
  outline-offset: 2px;
  transform: scale(1.02);
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.28);
}
.rank-slot-card.drag-origin {
  opacity: 0.5;
  transform: scale(0.97);
}

/* Realigned slot after a reorder move — flutter into position */
@keyframes slotRealign {
  0%   { transform: translateY(-6px); }
  100% { transform: translateY(0); }
}
.rank-slot-card.realign { animation: slotRealign 0.28s ease; }

/* Breed row selection "take it" pop on the plus badge */
@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; }

/* Reveal/leaderboard rows walk in with a satisfying stagger */
@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) { animation-delay: 0.05s; }
.reveal-answer-row:nth-child(3) { animation-delay: 0.10s; }
.reveal-answer-row:nth-child(4) { animation-delay: 0.15s; }
.reveal-answer-row:nth-child(5) { animation-delay: 0.20s; }
.reveal-pick:nth-child(2) { animation-delay: 0.05s; }
.reveal-pick:nth-child(3) { animation-delay: 0.10s; }
.reveal-pick:nth-child(4) { animation-delay: 0.15s; }
.reveal-pick:nth-child(5) { animation-delay: 0.20s; }

/* Countdown ticking heartbeat */
@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; }

/* Section energy: hero portrait subtle float, tab press squash */
@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}
.giant-portrait-wrapper 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; }
}

/* --- Tablet / desktop responsive (shell scales up gracefully) --- */
@media (min-width: 640px) {
  body { align-items: flex-start; }
  .mobile-app-shell {
    max-width: 720px;
    border-radius: 32px;
    margin: 2rem auto;
    min-height: calc(100vh - 4rem);
    min-height: calc(100dvh - 4rem);
    box-shadow: 0 30px 70px rgba(124, 58, 237, 0.22);
  }
  .giant-portrait-wrapper { height: 340px; }
}

/* Desktop (≥980px): genuinely wide layout — hero showcase left, interactive
 * content right — instead of a phone-width column. BLD-1086. */
@media (min-width: 980px) {
  .mobile-app-shell {
    max-width: 1200px;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr);
    grid-template-areas:
      "topbar topbar"
      "hero   main"
      "footer footer";
    gap: 0 2.5rem;
    align-items: start;
  }
  .top-bar { grid-area: topbar; }
  .character-showcase-container { grid-area: hero; padding: 1.5rem 0 0.5rem 1.5rem; }
  .step { grid-area: main; padding: 0.75rem 1.5rem 2.5rem 1.5rem; }
  footer { grid-area: footer; }

  /* Content column keeps a comfortable reading width; hero fills its column */
  .step { max-width: 640px; }
  .character-showcase-container { max-width: none; }
  .giant-portrait-wrapper { height: 420px; }

  /* Two-up grids for slots and breed list on wide screens */
  .slots-stack { grid-template-columns: 1fr 1fr; gap: 0.7rem; display: grid; }
  .breed-items-list { grid-template-columns: 1fr 1fr; gap: 0.6rem; display: grid; max-height: none; }
}
