/* The Trophy Hall (account page Trophies tab), the Scientist Level and weekly challenges: account/trophy-hall.js.
   Site tokens only (tokens.css), so light and dark mode both work. Body text 16 px or more. */

.th-ring { display: block; flex: none; }
.th-ring-track { fill: none; stroke: var(--tlg-surface-2); stroke-width: 10; }
.th-ring-fill { fill: none; stroke: var(--tlg-primary); stroke-width: 10; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 60px 60px; }
.th-ring-small { font: 800 13px var(--tlg-font, system-ui); letter-spacing: .12em; fill: var(--tlg-text-muted); }
.th-ring-big { font: 900 40px var(--tlg-font, system-ui); fill: var(--tlg-text); }

.th-progress { display: flex; align-items: center; gap: 8px; min-width: 0; }
.th-bar { flex: 1; min-width: 60px; height: 10px; border-radius: 999px; background: var(--tlg-surface-2); border: 1px solid var(--tlg-border); overflow: hidden; }
.th-bar > span { display: block; height: 100%; background: var(--tlg-primary); }
.th-count { font-size: 1rem; font-weight: 700; color: var(--tlg-text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.th-tier { font-size: 1rem; font-weight: 700; color: var(--tlg-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.th-desc { font-size: 1rem; line-height: 1.4; }
.th-when { font-size: 1rem; color: var(--tlg-text-muted); }
.th-new { font-size: 1rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--tlg-primary); color: var(--tlg-on-solid, #fff); }

/* ---- hero: level ring, tier counts, showcase ---- */
.th-hero { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(220px, 300px); gap: 20px; align-items: center; background: var(--tlg-surface); border: 1px solid var(--tlg-border); border-radius: 14px; padding: 16px 20px; margin-bottom: 16px; }
.th-hero-main { display: grid; gap: 10px; min-width: 0; }
.th-hero-title { margin: 0; font-size: 1.1rem; }
.th-hero-title b { font-size: 1.6rem; }
.th-level-bar { display: grid; gap: 4px; }
.th-level-note { font-size: 1rem; color: var(--tlg-text-muted); margin: 0; }
.th-tallies { display: flex; gap: 8px; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
.th-tally { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border-radius: 999px; background: var(--tlg-surface-2); font-weight: 700; font-size: 1rem; }
.th-hero-show h3 { margin: 0 0 6px; font-size: 1.05rem; }
.th-hero-show .acct-hint { margin: 6px 0 0; }
.th-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; list-style: none; padding: 0; margin: 0; }
.th-slot { display: grid; justify-items: center; align-content: center; gap: 4px; min-height: 84px; padding: 6px; border-radius: 12px; border: 2px dashed var(--tlg-border); text-align: center; }
.th-slot.is-filled { border-style: solid; background: var(--tlg-surface-2); }
.th-slot-name { font-size: 1rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.th-slot-empty { color: var(--tlg-text-muted); font-size: 1rem; }

/* ---- This week ---- */
.th-week { background: var(--tlg-surface); border: 2px solid var(--tlg-primary); border-radius: 14px; padding: 14px 18px; margin-bottom: 16px; }
.th-week-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.th-week-head h2 { margin: 0; font-size: 1.3rem; }
.th-week-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.th-week-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(140px, 220px) auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--tlg-surface-2); }
.th-week-item.is-done { grid-template-columns: minmax(0, 1fr) auto; }
.th-week-text { display: grid; gap: 2px; min-width: 0; }
.th-week-text span { font-size: 1rem; }
.th-week-done { font-weight: 800; color: var(--tlg-status-done-fg, #166534); white-space: nowrap; }

/* ---- level-up + unboxing ---- */
.th-levelup { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 16px; border-radius: 14px; background: var(--tlg-status-done-bg, #dcfcf7); color: var(--tlg-status-done-fg, #166534); font-size: 1.1rem; }
.th-levelup-star { font-size: 2rem; animation: th-spin-pop 900ms cubic-bezier(.2, 1.6, .4, 1) both; }
.th-levelup.is-still .th-levelup-star { animation: none; }
@keyframes th-spin-pop { from { transform: scale(0) rotate(-120deg); } to { transform: scale(1) rotate(0); } }

.th-unbox { background: var(--tlg-surface); border: 1px solid var(--tlg-border); border-radius: 14px; padding: 14px 18px; margin-bottom: 16px; }
.th-unbox h2 { margin: 0 0 8px; font-size: 1.3rem; }
.th-crates { display: flex; gap: 14px; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
.th-crate { position: relative; display: grid; justify-items: center; gap: 6px; width: 132px; text-align: center; }
.th-crate-box { position: relative; width: 72px; height: 72px; display: block; }
.th-crate-front, .th-crate-lid { position: absolute; left: 6px; right: 6px; background: #a8743f; border: 3px solid #6b4520; box-shadow: inset 0 0 0 3px #c99258; image-rendering: pixelated; }
.th-crate-front { bottom: 0; height: 44px; }
.th-crate-lid { top: 12px; height: 14px; }
.th-crate-badge { position: absolute; top: 8px; left: 50%; translate: -50% 0; line-height: 0; }
.th-crate-name { display: grid; gap: 2px; font-size: 1rem; }
.th-pixel { position: absolute; left: 50%; top: 40%; width: 6px; height: 6px; background: var(--tlg-primary); opacity: 0; }
.th-pixel:nth-child(3n) { background: #ffd23f; } .th-pixel:nth-child(3n+1) { background: #ff6b6b; }
/* ≤ 1.2 s in all: the lid flies, the crate drops away, pixels burst, the badge pops up out of it. */
.th-crate:not(.is-still) .th-crate-lid { animation: th-lid 450ms ease-in var(--th-delay, 0ms) both; }
.th-crate:not(.is-still) .th-crate-front { animation: th-front 400ms ease-in calc(var(--th-delay, 0ms) + 380ms) both; }
.th-crate:not(.is-still) .th-pixel { animation: th-burst 600ms ease-out calc(var(--th-delay, 0ms) + 350ms) both; }
.th-crate:not(.is-still) .th-crate-badge { animation: th-badge 600ms cubic-bezier(.2, 1.6, .4, 1) calc(var(--th-delay, 0ms) + 320ms) both; }
.th-crate.is-still .th-crate-box { display: none; }
.th-crate.is-still .th-crate-badge { position: static; translate: none; }
@keyframes th-lid { 0% { transform: none; } 100% { transform: translate(18px, -40px) rotate(40deg); opacity: 0; } }
@keyframes th-front { 0% { transform: none; opacity: 1; } 100% { transform: translateY(20px) scaleY(.4); opacity: 0; } }
@keyframes th-burst { 0% { opacity: 1; transform: rotate(var(--a)) translateY(0); } 100% { opacity: 0; transform: rotate(var(--a)) translateY(-46px); } }
@keyframes th-badge { 0% { transform: translateY(30px) scale(.2); opacity: 0; } 100% { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .th-crate .th-crate-box { display: none; }
  .th-crate .th-crate-badge { position: static; translate: none; animation: none !important; }
  .th-levelup-star { animation: none; }
}

/* ---- Next up ---- */
.th-nextup h2 { margin: 0 0 8px; }
.th-next-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; list-style: none; padding: 0; margin: 0 0 18px; }
.th-next { display: grid; grid-template-columns: 56px minmax(0, 1fr); grid-template-rows: 1fr auto; gap: 8px 12px; padding: 12px; background: var(--tlg-surface); border: 2px solid var(--tlg-border); border-radius: 14px; }
.th-next-art { grid-row: 1 / 3; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 12px; background: var(--tlg-surface-2); color: var(--tlg-text-muted); }
.th-next-text { display: grid; gap: 4px; min-width: 0; }
.th-next-name { font-size: 1.05rem; }
.th-next > .acct-btn { justify-self: start; }

/* ---- wings ---- */
.th-wings-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.th-wings { display: flex; gap: 6px; flex-wrap: wrap; }
.th-wing { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--tlg-border); background: var(--tlg-surface); color: var(--tlg-text); font-weight: 700; font-size: 1rem; cursor: pointer; }
.th-wing[aria-selected="true"] { background: var(--tlg-primary); border-color: var(--tlg-primary); color: var(--tlg-on-solid, #fff); }
.th-wing:focus-visible { outline: var(--tlg-focus-width, 3px) solid var(--tlg-focus, #2563eb); outline-offset: 2px; }
.th-wing-count { font-size: 1rem; font-weight: 800; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, currentColor 14%, transparent); font-variant-numeric: tabular-nums; }
.th-wing-panel:focus-visible { outline: var(--tlg-focus-width, 3px) solid var(--tlg-focus, #2563eb); outline-offset: 4px; border-radius: 8px; }

/* ---- cards ---- */
.th-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; list-style: none; padding: 0; margin: 0 0 16px; align-items: start; }
.th-card { display: grid; gap: 10px; padding: 14px; background: var(--tlg-surface); border: 2px solid var(--tlg-border); border-radius: 14px; min-width: 0; }
.th-card.is-earned.tier-bronze { border-color: #c98a52; } .th-card.is-earned.tier-silver { border-color: #9ea7b2; }
.th-card.is-earned.tier-gold { border-color: #e3b11c; } .th-card.is-earned.tier-platinum { border-color: #4fb8b4; }
.th-card.is-earned.tier-diamond { border-color: #4aa8f5; } .th-card.is-earned.tier-legend { border-color: #8b5cf6; }
.th-card-head { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: start; }
.th-card-art { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 12px; background: var(--tlg-surface-2); color: var(--tlg-text-muted); }
.th-card-title, .th-detail { display: grid; gap: 4px; min-width: 0; }
.th-card-top, .th-detail-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.th-card-name { font-size: 1.1rem; }
.th-card.is-locked .th-card-name { color: var(--tlg-text-muted); }
.th-card.is-hidden { border-style: dashed; }
.th-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.th-req { font-size: 1rem; }
.th-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.th-ladder-detail { padding: 10px 12px; border-radius: 10px; background: var(--tlg-surface-2); }

.th-tiers { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 4px; list-style: none; padding: 0; margin: 0; }
.th-tierbtn { all: unset; box-sizing: border-box; display: grid; justify-items: center; gap: 2px; width: 100%; min-height: 44px; padding: 6px 4px; border-radius: 10px; border: 2px solid transparent; cursor: pointer; color: var(--tlg-text-muted); }
.th-tierbtn.is-earned { color: var(--tlg-text); }
.th-tierbtn.is-current { background: var(--tlg-surface-2); border-color: var(--tlg-border-strong, #9aa3ad); }
.th-tierbtn[aria-pressed="true"] { border-color: var(--tlg-primary); box-shadow: 0 0 0 1px var(--tlg-primary); }
.th-tierbtn:focus-visible { outline: var(--tlg-focus-width, 3px) solid var(--tlg-focus, #2563eb); outline-offset: 2px; }
.th-tierbtn-label { font-size: 1rem; font-weight: 800; }

.th-reward, .th-pin { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--tlg-border); background: var(--tlg-surface); color: var(--tlg-text); font-size: 1rem; cursor: pointer; }
.th-reward[aria-pressed="true"], .th-pin[aria-pressed="true"] { border-color: var(--tlg-primary); background: color-mix(in srgb, var(--tlg-primary) 12%, var(--tlg-surface)); }
.th-reward:focus-visible, .th-pin:focus-visible { outline: var(--tlg-focus-width, 3px) solid var(--tlg-focus, #2563eb); outline-offset: 2px; }

/* Streak Master sticker book */
.th-book { grid-column: 1 / -1; }
.th-stickers { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; list-style: none; padding: 0; margin: 0; }
.th-sticker { display: grid; justify-items: center; gap: 4px; padding: 8px 6px; border-radius: 10px; background: var(--tlg-surface-2); color: var(--tlg-text); text-decoration: none; text-align: center; min-height: 44px; }
.th-sticker.is-locked { color: var(--tlg-text-muted); }
.th-sticker:hover .th-sticker-name { text-decoration: underline; }
.th-sticker:focus-visible { outline: var(--tlg-focus-width, 3px) solid var(--tlg-focus, #2563eb); outline-offset: 2px; }
.th-sticker-name { font-size: 1rem; line-height: 1.2; overflow-wrap: anywhere; }

/* ---- Overview ---- */
.th-overview { background: var(--tlg-surface); border: 1px solid var(--tlg-border); border-radius: 14px; padding: 16px; margin-bottom: 20px; display: grid; gap: 12px; justify-items: start; }
.th-overview-head { display: flex; align-items: center; gap: 16px; width: 100%; }
.th-overview-head > div { display: grid; gap: 4px; flex: 1; min-width: 0; }
.th-overview-head h2 { margin: 0; }
.th-overview .th-nextup { width: 100%; }
.th-overview .th-next-row { margin-bottom: 0; }
.th-week--compact { margin-bottom: 20px; }

/* ---- the account header: level ring around the stage, Lv chip, showcased badges ---- */
.acct-level { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.acct-level-ring { position: absolute; inset: 0; border-radius: 14px; padding: 5px;
  background: conic-gradient(var(--tlg-primary) calc(var(--lv, 0) * 1%), color-mix(in srgb, var(--tlg-text) 22%, transparent) 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }
.acct-stage .acct-level-chip, .acct-stage .acct-level-chip:visited { pointer-events: auto; position: absolute; top: 8px; left: 8px; display: inline-flex; align-items: center; min-height: 32px; padding: 3px 10px; border-radius: 999px; background: var(--tlg-primary); color: var(--tlg-on-solid, #fff); font-weight: 900; font-size: 1rem; text-decoration: none; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.acct-level-chip:hover { text-decoration: underline; }
.acct-level-chip:focus-visible { outline: var(--tlg-focus-width, 3px) solid var(--tlg-focus, #2563eb); outline-offset: 2px; }
.acct-showcase { display: flex; gap: 6px; list-style: none; padding: 0; margin: 4px 0; }
.acct-showcase li { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--tlg-surface-2); }

@media (max-width: 900px) {
  .th-hero { grid-template-columns: auto minmax(0, 1fr); }
  .th-hero-show { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .th-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .th-hero-main { justify-items: center; width: 100%; } .th-tallies { justify-content: center; }
  .th-hero-show { width: 100%; }
  .th-week-item, .th-week-item.is-done { grid-template-columns: 1fr; }
  .th-grid { grid-template-columns: 1fr; }
  .th-wings-bar { align-items: stretch; }
  .th-overview-head { flex-direction: column; align-items: flex-start; }
}

/* Buttons and filter chips inside the Hall: 16 px (the site's small buttons and chips are 14 px elsewhere). */
.th-week .acct-btn--small, .th-nextup .acct-btn--small, .th-card .acct-btn--small, .th-overview .acct-btn--small, .th-wings-bar .acct-chip { font-size: 1rem; }
