/*
 * trophy-cabinet.css — the unified PlayStation-style Trophy Cabinet.
 *
 * IDENTITY: this is NOT a new visual language. It extends the platform's existing
 * badge idiom (dark-indigo ground, indigo-bordered cards, points-derived rarity
 * rings, grayscale-when-locked art, uppercase letter-spaced eyebrows — see the
 * .obs-pbadge rules in houses/observatory/index.html) and adds PlayStation's four
 * TIERS on top. The tier accents are the only new tokens:
 *   bronze  #c98a4b   silver #cbd5e1   gold #fbbf24 (= existing legendary gold)
 *   platinum #67e8f9  (cyan-white — the crown jewel, reads as "rarest")
 * Everything else (grounds, panels, muted text) is the existing palette.
 *
 * Scope note: every selector is under .tc so this file cannot bleed into the rest
 * of a host page. Motion respects prefers-reduced-motion.
 */

.tc {
    --tc-ground: #0a0e1f;
    --tc-panel: rgba(129,140,248,0.045);
    --tc-panel-border: rgba(129,140,248,0.22);
    --tc-text: #e6e9ff;
    --tc-muted: #8891c9;
    --tc-bronze: #c98a4b;
    --tc-silver: #cbd5e1;
    --tc-gold: #fbbf24;
    --tc-platinum: #67e8f9;
    color: var(--tc-text);
    max-width: 1280px;
    margin: 0 auto;
    padding: 4px 0 40px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* ── Profile banner ──────────────────────────────────────────────────────── */
.tc-profile {
    display: flex;
    align-items: center;
    gap: 26px;
    padding: 24px 28px;
    border: 1px solid var(--tc-panel-border);
    border-radius: 18px;
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(103,232,249,0.10), transparent 55%),
        linear-gradient(150deg, rgba(129,140,248,0.10), rgba(13,18,38,0.4));
    margin-bottom: 26px;
}
/* The big "Trophy Level" chip — the single number that aggregates every trophy. */
.tc-level {
    flex: 0 0 auto;
    width: 116px; height: 116px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 38%, rgba(103,232,249,0.22), rgba(13,18,38,0.9) 72%);
    border: 2px solid rgba(103,232,249,0.5);
    box-shadow: 0 0 30px rgba(103,232,249,0.18), inset 0 0 20px rgba(103,232,249,0.10);
}
.tc-level__num { font-size: 2.7rem; font-weight: 800; line-height: 1; color: #eafcff; font-variant-numeric: tabular-nums; }
.tc-level__label { margin-top: 5px; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: #7fd7e6; }

.tc-profile__main { flex: 1 1 auto; min-width: 0; }
.tc-profile__title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; }
.tc-profile__sub { margin-top: 3px; font-size: 0.86rem; color: var(--tc-muted); }
.tc-profile__sub b { color: var(--tc-text); font-weight: 700; }

/* Tier-count row: one pill per tier with its earned count. */
.tc-tiercounts { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 12px; }
.tc-tiercount { display: inline-flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--tc-muted); }
.tc-medal {
    width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto;
    display: inline-block; border: 1.5px solid rgba(255,255,255,0.25);
}
.tc-medal--bronze   { background: radial-gradient(circle at 35% 30%, #e6b380, var(--tc-bronze)); border-color: rgba(201,138,75,0.7); }
.tc-medal--silver   { background: radial-gradient(circle at 35% 30%, #f1f5fb, var(--tc-silver)); border-color: rgba(203,213,225,0.7); }
.tc-medal--gold     { background: radial-gradient(circle at 35% 30%, #ffe9a8, var(--tc-gold)); border-color: rgba(251,191,36,0.75); }
.tc-medal--platinum { background: radial-gradient(circle at 35% 30%, #d4fbff, var(--tc-platinum)); border-color: rgba(103,232,249,0.8); box-shadow: 0 0 10px rgba(103,232,249,0.5); }
.tc-tiercount b { color: var(--tc-text); font-weight: 700; font-variant-numeric: tabular-nums; }

/* Overall completion bar. */
.tc-progress { height: 8px; border-radius: 999px; background: rgba(129,140,248,0.14); overflow: hidden; }
.tc-progress > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #34d399, #67e8f9); }

/* Banner spotlight (right side): rarest trophy + closest Platinum. */
.tc-spot { flex: 0 0 auto; display: flex; flex-direction: column; gap: 10px; min-width: 210px; max-width: 260px; }
.tc-spot__card { border: 1px solid var(--tc-panel-border); border-radius: 12px; padding: 10px 12px; background: rgba(13,18,38,0.35); }
.tc-spot__label { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #7fd7e6; margin-bottom: 5px; }
.tc-spot__row { display: flex; align-items: center; gap: 10px; }
.tc-spot__art { width: 40px; height: 40px; object-fit: contain; border-radius: 50%; flex: 0 0 auto; }
.tc-spot__name { font-size: 0.84rem; font-weight: 700; color: var(--tc-text); line-height: 1.2; }
.tc-spot__sub { font-size: 0.68rem; color: var(--tc-muted); font-variant-numeric: tabular-nums; }

/* ── Summary strip (index of sets) ───────────────────────────────────────── */
.tc-index { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 12px; margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
.tc-chip {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
    border: 1px solid var(--tc-panel-border); border-radius: 999px; padding: 7px 14px;
    background: var(--tc-panel); color: var(--tc-text); font: inherit; font-size: 0.78rem; white-space: nowrap;
}
.tc-chip:hover { border-color: rgba(103,232,249,0.5); background: rgba(103,232,249,0.06); }
.tc-chip__count { color: var(--tc-muted); font-variant-numeric: tabular-nums; }
.tc-chip__plat { display: inline-block; width: 9px; height: 9px; flex: 0 0 auto; transform: rotate(45deg); border-radius: 2px;
    background: radial-gradient(circle at 50% 50%, #d4fbff, var(--tc-platinum)); box-shadow: 0 0 8px rgba(103,232,249,0.6); }

/* ── Set section (collapsible) ───────────────────────────────────────────── */
.tc-set { margin-bottom: 10px; border: 1px solid var(--tc-panel-border); border-radius: 14px; overflow: hidden; background: rgba(129,140,248,0.02); }
.tc-set__head {
    display: flex; align-items: center; gap: 14px; width: 100%; cursor: pointer;
    padding: 14px 18px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left;
}
.tc-set__head:hover { background: rgba(129,140,248,0.05); }
.tc-set__chevron { flex: 0 0 auto; width: 9px; height: 9px; border-right: 2px solid var(--tc-muted); border-bottom: 2px solid var(--tc-muted);
    transform: rotate(-45deg); transition: transform 0.18s ease; }
.tc-set.is-open .tc-set__chevron { transform: rotate(45deg); }
.tc-set__name { font-size: 1.0rem; font-weight: 700; color: var(--tc-text); flex: 0 0 auto; }
.tc-set__meta { font-size: 0.78rem; color: var(--tc-muted); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.tc-set__soon { color: #6b76b0; }
.tc-set__minibar { flex: 1 1 auto; height: 5px; border-radius: 999px; background: rgba(129,140,248,0.12); overflow: hidden; min-width: 40px; }
.tc-set__minibar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, rgba(129,140,248,0.6), #67e8f9); }
/* Body collapses unless the set is open. */
.tc-set__body { display: none; padding: 4px 18px 20px; }
.tc-set.is-open .tc-set__body { display: block; }

/* The Platinum capstone medallion — a rotated-square diamond drawn in CSS (no
   glyph/emoji). Dim until the set is 100% complete, then it lights up. */
.tc-plat {
    display: block; width: 26px; height: 26px; flex: 0 0 auto; transform: rotate(45deg);
    border-radius: 6px; border: 2px solid rgba(129,140,248,0.3);
    background: rgba(129,140,248,0.06);
}
.tc-plat--earned {
    border-color: rgba(103,232,249,0.9);
    background: radial-gradient(circle at 50% 50%, #d4fbff, var(--tc-platinum) 70%);
    box-shadow: 0 0 16px rgba(103,232,249,0.6);
    animation: tcPlatPulse 2.8s ease-in-out infinite;
}
@keyframes tcPlatPulse { 0%,100% { box-shadow: 0 0 12px rgba(103,232,249,0.45); } 50% { box-shadow: 0 0 22px rgba(103,232,249,0.8); } }

/* ── Badge grid + tiles ──────────────────────────────────────────────────── */
.tc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 14px; }
.tc-badge {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
    padding: 16px 10px 14px; border-radius: 14px;
    border: 1px solid var(--tc-panel-border); background: var(--tc-panel);
    position: relative;
}
.tc-badge__art { position: relative; width: 88px; height: 88px; }
.tc-badge__art img { width: 88px; height: 88px; object-fit: contain; border-radius: 50%; display: block; }
/* Tier ring lives on the art wrapper so it can glow independent of the image. */
.tc-badge.is-earned.tc-badge--bronze   .tc-badge__art { box-shadow: 0 0 0 2px var(--tc-bronze), 0 0 14px rgba(201,138,75,0.35); border-radius: 50%; }
.tc-badge.is-earned.tc-badge--silver   .tc-badge__art { box-shadow: 0 0 0 2px var(--tc-silver), 0 0 14px rgba(203,213,225,0.35); border-radius: 50%; }
.tc-badge.is-earned.tc-badge--gold     .tc-badge__art { box-shadow: 0 0 0 2px var(--tc-gold), 0 0 16px rgba(251,191,36,0.45); border-radius: 50%; }
.tc-badge__name { font-size: 0.8rem; font-weight: 700; color: var(--tc-text); line-height: 1.2; }
/* Meta line: tier word + value. The tier word is tinted by tier when earned and
   muted when locked, so the whole shelf reads at a glance without a sticker on the art. */
.tc-badge__meta { font-size: 0.68rem; color: var(--tc-muted); font-variant-numeric: tabular-nums; }
.tc-badge__tier { font-weight: 800; letter-spacing: 0.05em; }
.tc-badge--bronze .tc-badge__tier { color: var(--tc-bronze); }
.tc-badge--silver .tc-badge__tier { color: var(--tc-silver); }
.tc-badge--gold   .tc-badge__tier { color: var(--tc-gold); }

/* Locked: grayscale, dim art, mute the tier word (still visible — aspiration). */
.tc-badge.is-locked { border-style: dashed; border-color: rgba(129,140,248,0.18); background: rgba(129,140,248,0.02); }
.tc-badge.is-locked .tc-badge__art img { filter: grayscale(1) brightness(0.4); }
.tc-badge.is-locked .tc-badge__name { color: #5a648f; }
.tc-badge.is-locked .tc-badge__tier { color: #6b76b0; }

/* Secret + unearned: a mystery tile, no art/name reveal. */
.tc-badge.is-secret .tc-badge__art img { filter: grayscale(1) brightness(0.25) blur(2px); }
.tc-badge.is-secret .tc-badge__name { color: #5a648f; letter-spacing: 0.16em; }

/* Legendary/gold-top badges get the platform's prismatic shimmer when earned. */
.tc-badge.is-earned.tc-badge--legendary .tc-badge__art { animation: tcPrismatic 3s linear infinite; border-radius: 50%; }
@keyframes tcPrismatic {
    0%   { box-shadow: 0 0 16px rgba(251,191,36,0.8), 0 0 0 2px rgba(251,191,36,0.7); }
    33%  { box-shadow: 0 0 16px rgba(236,72,153,0.8), 0 0 0 2px rgba(236,72,153,0.7); }
    66%  { box-shadow: 0 0 16px rgba(34,211,238,0.8), 0 0 0 2px rgba(34,211,238,0.7); }
    100% { box-shadow: 0 0 16px rgba(251,191,36,0.8), 0 0 0 2px rgba(251,191,36,0.7); }
}

@media (max-width: 720px) {
    .tc-profile { flex-direction: column; text-align: center; gap: 18px; }
    .tc-tiercounts { justify-content: center; }
    .tc-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
    .tc-plat--earned, .tc-badge.is-earned.tc-badge--legendary .tc-badge__art { animation: none; }
}
