/* activity/styles/leaderboard.css */
/* Leaderboard overlay styles */

/* ── Quest header tiles (Home tab) ─────────────────────────────────────────── */
.qt-header-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 20px 0 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.qt-header-row::-webkit-scrollbar { display: none; }

.qt-tile {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 76px;
  padding: 10px 6px 8px;
  border-radius: 14px;
  background: var(--qt-bg);
  border: 1px solid var(--qt-border);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.qt-tile:active { transform: scale(.94); }

.qt-tile-emoji { font-size: 1.35rem; line-height: 1; }
.qt-tile-label {
  font-size: .55rem;
  font-family: 'Press Start 2P', monospace;
  color: var(--qt-color);
  letter-spacing: .5px;
  text-align: center;
}
.qt-tile-count {
  font-size: .9rem;
  font-weight: 800;
  color: #eee;
  font-family: 'Orbitron', 'Press Start 2P', monospace;
  line-height: 1;
}
.qt-tile-bar {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,.1);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}
.qt-tile-bar-fill {
  height: 100%;
  background: var(--qt-color);
  border-radius: 3px;
  transition: width .4s ease;
  opacity: .8;
}

/* ── Quest tier modal ───────────────────────────────────────────────────────── */
.qt-modal-overlay {}  /* inherits .lb-overlay */

.qt-modal-container {
  max-width: 480px;
  max-height: calc(100vh - var(--sait, 0px) - 48px - var(--saib, 0px) - 38px - 24px);
  overflow-y: auto;
}

.qt-modal-reset-hint {
  font-size: .5rem;
  color: rgba(255,255,255,.3);
  font-family: 'Press Start 2P', monospace;
  text-align: center;
  letter-spacing: .5px;
  line-height: 1.8;
  margin-bottom: 16px;
}

.qt-modal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qt-modal-empty {
  text-align: center;
  color: rgba(255,255,255,.3);
  font-family: 'Press Start 2P', monospace;
  font-size: .55rem;
  padding: 32px 0;
}

/* Quest row */
.qt-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  transition: background .15s;
}
.qt-row-active {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.12);
}
.qt-row-done { opacity: .55; }

.qt-row-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }

.qt-row-body { flex: 1; min-width: 0; }

.qt-row-name {
  font-size: .6rem;
  font-family: 'Press Start 2P', monospace;
  color: #ddd;
  margin-bottom: 4px;
  letter-spacing: .5px;
}
.qt-row-desc {
  font-size: .5rem;
  color: rgba(255,255,255,.4);
  font-family: 'Press Start 2P', monospace;
  line-height: 1.6;
  letter-spacing: .3px;
  margin-bottom: 6px;
}

.qt-row-progress-bar {
  height: 4px;
  background: rgba(255,255,255,.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}
.qt-row-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .4s ease;
  opacity: .85;
}
.qt-row-progress-text {
  font-size: .48rem;
  color: rgba(255,255,255,.35);
  font-family: 'Press Start 2P', monospace;
  letter-spacing: .3px;
}
.qt-row-not-started { color: rgba(255,255,255,.2); }

.qt-row-done-label {
  font-size: .48rem;
  color: #4ade80;
  font-family: 'Press Start 2P', monospace;
  letter-spacing: .3px;
}

.qt-row-hp {
  flex-shrink: 0;
  font-family: 'Orbitron', 'Press Start 2P', monospace;
  font-size: .85rem;
  font-weight: 800;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.qt-row-hp-label {
  font-size: .42rem;
  color: rgba(255,255,255,.3);
  font-family: 'Press Start 2P', monospace;
  letter-spacing: 1px;
}
.qt-row-hp-done { color: #4ade80 !important; }

/* ── House Leaderboard ── */
.hl-container {
  max-width: 480px;
}

.hl-subtitle {
  font-size: .65rem;
  color: rgba(255,255,255,.4);
  font-family: 'Press Start 2P', monospace;
  letter-spacing: 1px;
  text-align: center;
  margin-bottom: 20px;
}

.hl-board {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
}

.hl-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  transition: background .15s;
}
.hl-row-mine {
  background: rgba(255,255,255,.08);
  border-color: var(--house-accent, rgba(255,204,2,.4));
  box-shadow: 0 0 12px rgba(0,0,0,.3);
}

.hl-rank-badge {
  font-size: 1.4rem;
  width: 40px;
  flex-shrink: 0;
  text-align: center;
}

.hl-house-info {
  flex: 1;
  min-width: 0;
}

.hl-house-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Press Start 2P', monospace;
  font-size: .6rem;
  color: #eee;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.hl-house-emoji { font-size: .9rem; }
.hl-house-emblem-wrap {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hl-house-emblem {
  width: 38px;
  height: 38px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 6px var(--house-accent, rgba(255,255,255,.3)));
}
.hl-my-house-tag {
  font-size: .42rem;
  color: var(--house-accent, #ffcc02);
  border: 1px solid var(--house-accent, #ffcc02);
  padding: 1px 4px;
  border-radius: 4px;
  letter-spacing: .5px;
  opacity: .85;
}

.hl-progress-bar {
  height: 4px;
  background: rgba(255,255,255,.08);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 5px;
}
.hl-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .5s ease;
  opacity: .85;
}

.hl-house-meta {
  font-size: .48rem;
  color: rgba(255,255,255,.3);
  font-family: 'Press Start 2P', monospace;
  letter-spacing: .5px;
}

.hl-hp-display {
  flex-shrink: 0;
  text-align: right;
}
.hl-hp-number {
  font-family: 'Orbitron', 'Press Start 2P', monospace;
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 10px currentColor;
}
.hl-hp-label {
  font-family: 'Press Start 2P', monospace;
  font-size: .45rem;
  color: rgba(255,255,255,.35);
  text-align: right;
  margin-top: 2px;
  letter-spacing: 1px;
}

.hl-footer {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.hl-footer-note {
  font-size: .45rem;
  color: rgba(255,255,255,.25);
  font-family: 'Press Start 2P', monospace;
  text-align: center;
  letter-spacing: .5px;
  line-height: 1.8;
}


/* ── NEW HIGH SCORE flash animation ── */
@keyframes lb-newBest {
  0%, 100% { opacity: 1; color: #ffcc02; text-shadow: 0 0 12px rgba(255,204,2,.7); }
  50% { opacity: .3; color: #ff6b35; text-shadow: 0 0 20px rgba(255,107,53,.8); }
}
.hs-flash {
  animation: lb-newBest .4s ease-in-out 5;
}

.lb-overlay {
  position: fixed;
  top: calc(var(--sait, 0px) + 48px); /* start below top nav bar */
  left: 0;
  right: 0;
  bottom: calc(var(--saib, 0px) + 38px); /* stop above bottom tab bar */
  background: rgba(0,0,0,.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4000; /* above app content; bounded by top/bottom so it never overlaps nav bars */
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.lb-overlay.lb-overlay-visible {
  opacity: 1;
  pointer-events: auto;
}

.lb-container {
  background: #1a1a2e;
  border: 1px solid rgba(124,58,237,.4);
  border-radius: 20px;
  padding: 24px 20px;
  max-width: 520px;
  width: 95vw;
  max-height: calc(100vh - var(--sait, 0px) - 48px - var(--saib, 0px) - 38px - 24px);
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 50px rgba(124,58,237,.18);
  transform: scale(.88);
  opacity: 0;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .25s ease;
}
.lb-overlay-visible .lb-container {
  transform: scale(1);
  opacity: 1;
}

.lb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.lb-title {
  font-family: 'Orbitron', 'Press Start 2P', monospace;
  font-weight: 900;
  font-size: 1.3rem;
  color: #ffcc02;
  text-shadow: 0 0 20px rgba(255,204,2,.5);
  letter-spacing: 2px;
}
.lb-close-btn {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.5);
  font-size: 1rem;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
}
.lb-close-btn:hover { background: rgba(255,255,255,.12); color: #fff; }

/* Tabs */
.lb-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.lb-tab {
  flex: 1;
  min-width: 0;
  padding: 8px 6px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.5);
  font-family: 'Press Start 2P', monospace;
  font-size: .55rem;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-tab:hover { background: rgba(255,255,255,.1); color: #fff; }
.lb-tab-active {
  background: rgba(255,204,2,.15);
  border-color: rgba(255,204,2,.4);
  color: #ffcc02;
}

/* Board */
.lb-board {
  min-height: 120px;
}
.lb-loading, .lb-empty {
  text-align: center;
  color: rgba(255,255,255,.35);
  font-family: 'Press Start 2P', monospace;
  font-size: .6rem;
  padding: 40px 0;
  letter-spacing: 1px;
}

.lb-col-headers {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin-bottom: 4px;
  font-family: 'Press Start 2P', monospace;
  font-size: .5rem;
  color: rgba(255,255,255,.3);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 3px;
  background: rgba(255,255,255,.03);
  transition: background .15s;
}
.lb-row:hover { background: rgba(255,255,255,.06); }
.lb-row-me {
  background: rgba(255,204,2,.1);
  border: 1px solid rgba(255,204,2,.25);
}

.lb-rank {
  width: 36px;
  flex-shrink: 0;
  text-align: center;
  font-family: 'Press Start 2P', monospace;
  font-size: .6rem;
  color: rgba(255,255,255,.6);
}
.lb-name {
  flex: 1;
  min-width: 0;
  font-family: 'Press Start 2P', monospace;
  font-size: .55rem;
  color: #ddd;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-row-me .lb-name { color: #ffcc02; }

.lb-score {
  width: 70px;
  flex-shrink: 0;
  text-align: right;
  font-family: 'Press Start 2P', monospace;
  font-size: .55rem;
  color: #7DF9FF;
  font-weight: 700;
}
.lb-stat {
  width: 80px;
  flex-shrink: 0;
  text-align: right;
  font-family: 'Press Start 2P', monospace;
  font-size: .48rem;
  color: rgba(255,255,255,.35);
}

/* ── House Lore Overlay ──────────────────────────────────────────────────────── */

.hl-lore-overlay {}  /* extends .lb-overlay */

.hl-lore-container {
  max-width: 520px;
  display: flex;
  flex-direction: column;
  padding: 20px 18px 0;
}

.hl-lore-intro {
  font-size: .52rem;
  color: rgba(255,255,255,.35);
  font-family: 'Press Start 2P', monospace;
  text-align: center;
  letter-spacing: .5px;
  line-height: 1.8;
  margin-bottom: 16px;
}

/* ── Tabs ── */
.hl-lore-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.hl-lore-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 4px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.hl-lore-tab:hover { background: rgba(255,255,255,.07); }
.hl-lore-tab-active {
  background: rgba(var(--tab-accent-rgb, 255,255,255), .08);
  border-color: var(--tab-accent, rgba(255,255,255,.3));
  box-shadow: 0 0 12px rgba(0,0,0,.3);
}

.hl-lore-tab-emblem {
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 4px rgba(255,255,255,.2));
}
.hl-lore-tab-active .hl-lore-tab-emblem {
  filter: drop-shadow(0 0 6px var(--tab-accent, rgba(255,255,255,.5)));
}

.hl-lore-tab-name {
  font-family: 'Press Start 2P', monospace;
  font-size: .38rem;
  color: rgba(255,255,255,.5);
  text-align: center;
  line-height: 1.4;
  letter-spacing: .3px;
}
.hl-lore-tab-active .hl-lore-tab-name { color: var(--tab-accent, #fff); }

/* ── Scrollable body ── */
.hl-lore-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
.hl-lore-body::-webkit-scrollbar { width: 4px; }
.hl-lore-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }

/* ── Hero banner ── */
.hl-lore-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--house-bg, #1a1a2e) 0%, rgba(0,0,0,.4) 100%);
  border: 1px solid var(--house-accent, rgba(255,255,255,.15));
  box-shadow: 0 0 24px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.06);
  margin-bottom: 14px;
}

.hl-lore-hero-emblem-wrap {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hl-lore-hero-emblem {
  width: 56px;
  height: 56px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 12px var(--house-accent, rgba(255,255,255,.4)));
}

.hl-lore-hero-text { flex: 1; min-width: 0; }

.hl-lore-house-name {
  font-family: 'Orbitron', 'Press Start 2P', monospace;
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: 2px;
  text-shadow: 0 0 16px currentColor;
  margin-bottom: 4px;
}

.hl-lore-motto {
  font-family: 'Press Start 2P', monospace;
  font-size: .48rem;
  color: rgba(255,255,255,.45);
  letter-spacing: .5px;
  line-height: 1.6;
  font-style: italic;
}

/* ── Sections ── */
.hl-lore-section {
  margin-bottom: 14px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
}
.hl-lore-section-love {
  border-color: rgba(255,255,255,.1);
}

.hl-lore-section-label {
  font-family: 'Press Start 2P', monospace;
  font-size: .48rem;
  color: rgba(255,255,255,.3);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.hl-lore-founder-name {
  font-family: 'Orbitron', monospace;
  font-size: .85rem;
  font-weight: 700;
  color: #ddd;
  margin-bottom: 6px;
}

.hl-lore-years {
  font-size: .65rem;
  color: rgba(255,255,255,.4);
  font-weight: 400;
  font-family: 'Press Start 2P', monospace;
}

.hl-lore-location-name {
  font-family: 'Press Start 2P', monospace;
  font-size: .55rem;
  color: #ccc;
  margin-bottom: 8px;
  letter-spacing: .5px;
}

.hl-lore-subsection-label {
  font-family: 'Press Start 2P', monospace;
  font-size: .42rem;
  color: rgba(255,255,255,.25);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 10px 0 5px;
}

.hl-lore-text {
  font-size: .72rem;
  color: rgba(255,255,255,.6);
  line-height: 1.65;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

/* ── Key events ── */
.hl-lore-events {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hl-lore-event {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.hl-lore-event-year {
  font-family: 'Orbitron', 'Press Start 2P', monospace;
  font-size: .65rem;
  font-weight: 800;
  flex-shrink: 0;
  min-width: 38px;
  padding-top: 1px;
  text-shadow: 0 0 8px currentColor;
}

.hl-lore-event-body { flex: 1; min-width: 0; }

.hl-lore-event-name {
  font-family: 'Press Start 2P', monospace;
  font-size: .5rem;
  color: #ddd;
  letter-spacing: .4px;
  margin-bottom: 3px;
  line-height: 1.5;
}

.hl-lore-event-desc {
  font-size: .68rem;
  color: rgba(255,255,255,.5);
  line-height: 1.55;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

/* ── Battersby quote ── */
.hl-lore-quote {
  font-family: 'Press Start 2P', monospace;
  font-size: .48rem;
  line-height: 1.8;
  letter-spacing: .3px;
  font-style: italic;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0,0,0,.2);
  border-left: 3px solid currentColor;
  opacity: .85;
}
