/* ══════════════════════════════════════════════════════════════════════════════
   YEARBOOK (anuario de temporada) — the most "special" view: generated once per
   season and kept forever, so it leans into elaborate, celebratory styling.
   ══════════════════════════════════════════════════════════════════════════════ */
.yearbook-inner { max-width: 880px; margin: 0 auto; padding: 28px 22px 100px; }
.yearbook-topbar { margin-bottom: 18px; }
.yb-loading { text-align: center; padding: 80px 20px; color: var(--text-3); }
.yb-loading-book { font-size: 3rem; margin-bottom: 12px; animation: ybBook 1.6s ease-in-out infinite; }
@keyframes ybBook { 0%,100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }

/* Entrance: sections fade + rise, staggered via inline animation-delay set in JS. */
@keyframes ybIn { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
.yb-cover, .yb-section, .yb-closing { opacity: 0; }
.yb-in { animation: ybIn .55s cubic-bezier(.22,1,.36,1) both; }
@media (prefers-reduced-motion: reduce) { .yb-cover, .yb-section, .yb-closing { opacity: 1; } .yb-in { animation: none; } .yb-loading-book { animation: none; } }

/* ── Portada ── */
.yb-cover {
  position: relative; overflow: hidden; text-align: center;
  border: 1px solid color-mix(in srgb, var(--c) 35%, var(--border));
  border-radius: 22px; padding: 40px 26px 30px; margin-bottom: 30px;
  background:
    radial-gradient(120% 80% at 50% -10%, color-mix(in srgb, var(--c) 26%, transparent), transparent 70%),
    var(--surface-1);
  box-shadow: var(--shadow-lg);
}
.yb-cover::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 40% at 50% 0%, color-mix(in srgb, var(--c) 18%, transparent), transparent 65%);
}
.yb-cover-kicker {
  position: relative; font-size: .72rem; font-weight: 800; letter-spacing: .22em;
  text-transform: uppercase; color: color-mix(in srgb, var(--c) 65%, var(--text-3));
}
.yb-cover-title {
  position: relative; font-family: 'Playfair Display', serif; font-weight: 800;
  font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1.05; margin: 6px 0 18px; color: var(--text-1);
}
.yb-champion { position: relative; margin-bottom: 24px; }
.yb-champion-crown { font-size: 1.7rem; margin-bottom: -6px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); animation: ybFloat 3s ease-in-out infinite; }
@keyframes ybFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.yb-champion-shield {
  width: 108px; height: 108px; margin: 0 auto 10px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 3.4rem;
  background: radial-gradient(circle at 38% 30%, color-mix(in srgb, var(--c) 30%, var(--surface-2)), var(--surface-2));
  border: 3px solid var(--c); box-shadow: 0 0 34px -4px var(--c), inset 0 0 18px rgba(0,0,0,.25);
}
.yb-champion-name { font-family: 'Bebas Neue', sans-serif; font-size: 1.9rem; letter-spacing: .04em; }
.yb-champion-sub { font-size: .8rem; color: var(--text-3); font-style: italic; margin-top: 2px; }

.yb-scorebar { position: relative; display: flex; flex-direction: column; gap: 9px; max-width: 520px; margin: 0 auto; }
.yb-scorebar-row { display: grid; grid-template-columns: 116px 1fr auto; align-items: center; gap: 10px; }
.yb-scorebar-house { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; color: var(--text-2); justify-self: start; }
.yb-scorebar-icon { font-size: 1rem; }
.yb-scorebar-track { height: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.yb-scorebar-fill { display: block; height: 100%; border-radius: 999px; transition: width .8s cubic-bezier(.22,1,.36,1); }
.yb-scorebar-pts { font-size: .82rem; font-weight: 800; color: var(--text-1); min-width: 54px; text-align: right; }

/* ── Sections shell ── */
.yb-section { margin-bottom: 30px; padding: 22px 22px 24px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-card); }
.yb-section-title { font-family: 'Bebas Neue', sans-serif; font-size: 1.5rem; letter-spacing: .03em; color: var(--text-1); margin: 0 0 4px; }
.yb-section-sub { font-size: .82rem; color: var(--text-3); margin: 0 0 16px; }
.yb-empty { color: var(--text-3); font-style: italic; padding: 20px; text-align: center; }

/* ── Cup timeline (multi-line chart) ── */
.yb-timeline-svg { width: 100%; height: auto; display: block; overflow: visible; }
.yb-grid { stroke: var(--border); stroke-width: 1; }
.yb-axis-y, .yb-axis-x { font-size: 11px; font-weight: 600; fill: var(--text-3); }
.yb-line { fill: none; stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.yb-line-dot { stroke: var(--surface-1); stroke-width: 1.6; }
.yb-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; margin-top: 14px; }
.yb-legend-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--text-2); }
.yb-legend-dot { width: 12px; height: 4px; border-radius: 2px; }

/* ── Records / superlatives ── */
.yb-records { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.yb-rec {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.yb-rec:hover { transform: translateY(-2px); border-color: var(--border-hi); box-shadow: var(--shadow-card); }
.yb-rec-icon { font-size: 1.9rem; line-height: 1; flex-shrink: 0; filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); }
.yb-rec-body { min-width: 0; }
.yb-rec-title { font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.yb-rec-value { font-size: 1.02rem; font-weight: 800; color: var(--text-1); margin: 3px 0; line-height: 1.2; }
.yb-rec-sub { font-size: .76rem; color: var(--text-2); }
.yb-rec-house { font-weight: 700; }
.yb-rarity { font-size: .68rem; font-weight: 800; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); margin-left: 2px; }
.yb-rarity.rarity-uncommon  { color: var(--rar-uncommon); border-color: var(--rar-uncommon); }
.yb-rarity.rarity-rare      { color: var(--rar-rare); border-color: var(--rar-rare); }
.yb-rarity.rarity-mythic    { color: var(--rar-mythic); border-color: var(--rar-mythic); }
.yb-rarity.rarity-legendary { color: var(--rar-legendary); border-color: var(--rar-legendary); }

/* ── Achievements aggregate ── */
.yb-ach-total { font-size: 1.05rem; color: var(--text-2); margin-bottom: 14px; }
.yb-ach-total strong { font-family: 'Bebas Neue', sans-serif; font-size: 1.9rem; color: var(--gold); letter-spacing: .02em; margin-right: 4px; }
.yb-ach-rarest-label { font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.yb-ach-rarest { display: flex; flex-direction: column; gap: 7px; }
.yb-ach-chip { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.yb-ach-chip-icon { font-size: 1.3rem; flex-shrink: 0; }
.yb-ach-chip-label { font-weight: 700; color: var(--text-1); font-size: .86rem; flex: 1; min-width: 0; }
.yb-ach-chip-count { font-size: .74rem; font-weight: 700; color: var(--text-3); white-space: nowrap; }

/* ── Closing ── */
.yb-closing {
  text-align: center; padding: 30px 24px; border-radius: 18px;
  background: radial-gradient(120% 90% at 50% 0%, rgba(212,160,23,.1), transparent 70%), var(--surface-1);
  border: 1px solid var(--border);
}
.yb-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 560px) { .yb-tiles { grid-template-columns: repeat(2, 1fr); } }
.yb-tile { padding: 14px 8px; }
.yb-tile-val { font-family: 'Bebas Neue', sans-serif; font-size: 2.1rem; line-height: 1; color: var(--gold); letter-spacing: .02em; }
.yb-tile-label { font-size: .72rem; color: var(--text-3); margin-top: 4px; letter-spacing: .03em; }
.yb-closing-bye { font-family: 'Playfair Display', serif; font-style: italic; font-size: 1.15rem; color: var(--text-1); margin: 0; }

/* ══════════════════════════════════════════════════════════════════════════════
   GLOBAL MOTION LAYER (modernization base pass)
   ══════════════════════════════════════════════════════════════════════════════ */
/* View transitions: a CSS animation on each view container replays every time
   switchView flips it from display:none to visible — no JS hook needed. The
   transform resolves back to identity when the animation ends, so the fixed
   lootbox-opener overlay inside #lootboxView is unaffected afterwards. */
@keyframes viewIn {
  from { opacity: 0; transform: translateY(14px) scale(.995); }
  to   { opacity: 1; transform: none; }
}
#boardView, #teacherView, #shopView, #friendsView,
#profileView, #lootboxView, #yearbookView, #hallOfFameView {
  animation: viewIn .4s var(--ease-out);
}

/* ── HALL OF FAME (egresados) + frozen-profile (egresado) ─────────────────── */
.frozen-banner {
  text-align: center; padding: 9px 16px;
  font-size: .82rem; line-height: 1.4; color: var(--text-1);
  background: linear-gradient(90deg, rgba(167,139,250,.20), rgba(124,92,214,.22));
  border-bottom: 1px solid rgba(124,92,214,.42);
}
.frozen-banner strong { color: #7c5cd6; }
[data-theme="light"] .frozen-banner strong { color: #6d4bd1; }

/* When the current user is a graduated (frozen) student, hide every action that
   earns/spends points, unlocks achievements, or deletes — only customization stays.
   The server enforces this regardless; this is the matching UX. */
.frozen-profile #pollBanner,
.frozen-profile #missionsSection,
.frozen-profile .shop-btn-buy,
.frozen-profile .lootbox-card-open,
.frozen-profile .lootbox-again,
.frozen-profile .bp-slot-claim,
.frozen-profile .bp-premium-buy,
.frozen-profile .profile-danger-block,
.frozen-profile .item-add-btn,
.frozen-profile .attr-row-ctrls,
.frozen-profile .attr-confirm,
.frozen-profile .attr-reset-btn,
.frozen-profile .friend-btn { display: none !important; }

/* House-modal entry button into the Hall of Fame. */
.hof-open-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px; border-radius: 12px; cursor: pointer;
  font-family: 'Bebas Neue', sans-serif; font-size: 1.05rem; letter-spacing: .04em;
  color: #fff; background: linear-gradient(100deg, #7c5cd6, #a78bfa);
  border: none; box-shadow: var(--shadow-card); transition: transform .15s var(--ease-out), filter .15s;
}
.hof-open-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.hof-open-arrow { transition: transform .15s var(--ease-out); }
.hof-open-btn:hover .hof-open-arrow { transform: translateX(3px); }

/* Dedicated Hall of Fame view. */
.hof-inner { max-width: 760px; margin: 0 auto; padding: 24px 22px 100px; }
.hof-topbar { margin-bottom: 14px; }
.hof-header { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.hof-icon { font-size: 2.4rem; line-height: 1; filter: drop-shadow(0 2px 6px rgba(124,92,214,.4)); }
.hof-kicker {
  font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: #a78bfa; font-weight: 800;
}
.hof-title { font-family: 'Bebas Neue', sans-serif; font-size: 1.9rem; letter-spacing: .02em; margin: 2px 0 0; }
.hof-search {
  width: 100%; margin-bottom: 18px;
}
.hof-count { font-size: .78rem; color: var(--text-3); margin: 0 0 10px; font-weight: 600; }

/* Yearbook: nuevos egresados por casa. */
.yb-grad-intro { font-size: .82rem; color: var(--text-3); margin: 0 0 16px; }
.yb-grad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.yb-grad-house {
  border: 1px solid var(--border); border-left: 3px solid var(--c, #888);
  border-radius: 12px; padding: 12px 14px; background: var(--surface-2);
}
.yb-grad-house-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.yb-grad-house-icon { font-size: 1.1rem; }
.yb-grad-house-name { font-weight: 800; font-size: .92rem; }
.yb-grad-house-count {
  margin-left: auto; font-size: .72rem; font-weight: 800; color: var(--text-2);
  background: rgba(124,92,214,.16); border-radius: 20px; padding: 1px 9px;
}
.yb-grad-names { display: flex; flex-wrap: wrap; gap: 6px; }
.yb-grad-name {
  font-size: .8rem; padding: 3px 9px; border-radius: 8px;
  background: var(--surface-1); border: 1px solid var(--border); color: var(--text-1);
}

/* Master accessibility kill-switch: honor reduced motion everywhere at once. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  html { scroll-behavior: auto; }
}
