/* The player portal: the profile page, the header's login button and the build planner's "owned only" bar.
   Colors come from codex.css's variables, so it follows the dark and light themes. The profile is drawn with the
   build planner's own pieces (codex.css `.pl-*`, `.card`, `.thumb`); what is here is only what the planner has not. */

/* ----- header login / avatar ----- */
#portal-slot { display: inline-flex; align-items: center; }
.portal-login, .portal-user {
  display: inline-flex; align-items: center; gap: 0.5rem; height: 40px; padding: 0 0.9rem;
  border-radius: var(--radius-md); border: 1px solid var(--badge-border); background: var(--badge-bg);
  color: var(--text-main); font-size: 0.875rem; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}
.portal-login { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.portal-login:hover { background: var(--accent-hover); }
.portal-user { padding-left: 0.35rem; }
.portal-user:hover { border-color: var(--accent-border); color: var(--accent-text); }
.portal-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.portal-name { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
/* Phones: the avatar alone (the name stays for someone with no avatar, or the button would be empty) */
@media (max-width: 640px) { .portal-avatar + .portal-name { display: none; } .portal-user { padding-right: 0.35rem; } .portal-name:only-child { max-width: 4.5rem; padding: 0 0.3rem; } }
/* Small phones: the header has to hold the logo, Log in and two buttons without sticking out sideways */
@media (max-width: 480px) {
  .header-container:has(.portal-login) .brand-subtitle { display: none; }
  .header-container:has(#portal-slot) .header-actions { gap: 0.35rem; }
  .portal-login { padding: 0 0.6rem; font-size: 0.8rem; }
}
@media (max-width: 340px) {
  .header-container:has(.portal-login) .brand { gap: 0.4rem; }
  .header-container:has(.portal-login) .brand-logo { width: 32px; height: 32px; }
  .header-container:has(.portal-login) .brand-title { font-size: 1.05rem; }
  .portal-login { padding: 0 0.45rem; }
}

/* ----- profile page ----- */
.pf-page { --hdr: 61px; } /* the header's height: the character sheet stays under it while the page scrolls */
.pf-nav { display: flex; gap: 1.25rem; margin-left: 1.5rem; }
.pf-nav a { color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.pf-nav a:hover { color: var(--accent-text); }
@media (max-width: 880px) { .pf-nav { display: none; } }
.pf-main { width: 100%; max-width: 1200px; margin: 0 auto; padding: 1rem 1rem 4rem; }
.pf-fine { font-size: 0.78rem; line-height: 1.45; color: var(--text-faint); margin-top: 0.7rem; }
.pf-fine .emo { width: 14px; height: 14px; }
.pf-code { font-family: var(--font-mono); font-size: 0.92em; color: var(--text-muted); }
.pf-link { padding: 0; border: 0; background: none; color: var(--accent-text); font-weight: 700; text-decoration: underline; cursor: pointer; }
.pf-problem, .pf-error { color: var(--danger); font-weight: 600; }
.pf-error { margin-top: 1rem; }

/* Logged out, or no hero yet: the game's art with a few words over it. Always dark with light words, like the
   Codex's banners. */
.pf-gate {
  position: relative; isolation: isolate; overflow: hidden; display: grid; align-items: end;
  min-height: min(36rem, calc(100vh - 9rem)); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: var(--radius-lg);
  background: #1a1613; color: #fff; box-shadow: var(--shadow-lg);
}
.pf-gate-art { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; transform: scaleX(-1); }
.pf-gate::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(90deg, rgba(10, 8, 12, 0.94) 0%, rgba(10, 8, 12, 0.7) 45%, rgba(10, 8, 12, 0.15) 100%),
    linear-gradient(180deg, rgba(10, 8, 12, 0) 30%, rgba(10, 8, 12, 0.8) 100%);
}
.pf-gate-in { max-width: 41rem; padding: clamp(1.25rem, 5vw, 3rem); }
.pf-kicker { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.5rem; }
.pf-title {
  font-family: var(--font-epic); font-size: clamp(1.9rem, 6.5vw, 3.2rem); font-weight: 900; line-height: 1.05; letter-spacing: 0.02em;
  background: linear-gradient(180deg, #fff6df 0%, #ffcb78 55%, #f8941a 100%); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; filter: drop-shadow(0 3px 12px rgba(0, 0, 0, 0.65));
}
.pf-lead { color: rgba(255, 255, 255, 0.88); line-height: 1.55; margin: 0.9rem 0 1.3rem; max-width: 34rem; }
.pf-gate .pf-problem { color: #fca5a5; margin-bottom: 0.9rem; }
.pf-gate .pf-fine { color: rgba(255, 255, 255, 0.7); max-width: 34rem; }
.pf-gate-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.pf-discord, .pf-cta {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 1.6rem; border-radius: var(--radius-md);
  font-weight: 700; text-decoration: none; transition: filter var(--transition-fast), transform var(--transition-fast);
}
.pf-discord { background: #5865f2; color: #fff; box-shadow: 0 8px 24px rgba(88, 101, 242, 0.4); }
.pf-cta { background: var(--accent); color: var(--on-accent); box-shadow: 0 8px 24px rgba(248, 148, 26, 0.35); }
.pf-discord:hover, .pf-cta:hover { filter: brightness(1.1); transform: translateY(-1px); }
/* A quiet button over the art (Log out) */
.pf-ghost {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 0.95rem; border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.28); background: rgba(10, 8, 12, 0.55); color: #fff; font-size: 0.85rem; font-weight: 600;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); cursor: pointer; white-space: nowrap;
  transition: border-color var(--transition-fast);
}
.pf-ghost:hover { border-color: var(--accent); }
.pf-gate-actions .pf-ghost { min-height: 48px; }
.pf-perks { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; margin-top: 1.5rem; }
.pf-perks li {
  display: flex; flex-direction: column; gap: 0.15rem; padding: 0.65rem 0.8rem; border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.14); border-left: 3px solid var(--accent); background: rgba(10, 8, 12, 0.55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.pf-perks strong { font-family: var(--font-display); font-size: 0.95rem; }
.pf-perks span { font-size: 0.82rem; line-height: 1.4; color: rgba(255, 255, 255, 0.78); }
@media (min-width: 560px) { .pf-perks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* The banner (codex.css `.page-head.has-art`): the player over their hero's art */
.pf-banner.sk { min-height: 9rem; margin-bottom: 0.9rem; border-radius: var(--radius-lg); }
.pf-banner.has-art { align-items: flex-start; }
.pf-banner > .page-art { object-position: 50% 16%; }
.pf-id {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "avatar text" "wallet wallet";
  align-items: center; gap: 0.6rem 0.9rem; align-self: center; flex: 1;
}
.pf-avatar { grid-area: avatar; }
.pf-id-text { grid-area: text; min-width: 0; }
.pf-wallet { grid-area: wallet; }
.pf-avatar {
  width: 64px; height: 64px; flex-shrink: 0; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 3px rgba(248, 148, 26, 0.6), 0 6px 18px rgba(0, 0, 0, 0.6);
}
.pf-avatar-none {
  display: grid; place-items: center; background: linear-gradient(180deg, #ffd58a, #f8941a 60%, #d9730b);
  font-family: var(--font-epic); font-size: 1.7rem; font-weight: 900; color: var(--on-accent);
}
.has-art .page-title.pf-name { font-size: clamp(1.5rem, 6vw, 2.4rem); letter-spacing: 0.02em; text-transform: none; overflow-wrap: anywhere; }
.pf-sub {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.8rem; margin-top: 0.3rem; font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.86); text-shadow: 0 1px 8px rgba(0, 0, 0, 0.75);
}
.pf-guild { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 0.35rem; }
.pf-guild .emo { width: 18px; height: 18px; }
.pf-guild strong { color: #fff; }
.pf-wallet { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pf-coin {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.65rem 0.2rem 0.45rem; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(10, 8, 12, 0.6); font-size: 0.82rem;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.pf-coin .emo { width: 16px; height: 16px; }
.pf-coin b { font-family: var(--font-display); font-weight: 800; }
.pf-coin small { font-size: 0.7rem; color: rgba(255, 255, 255, 0.72); }
/* Phones: Log out sits in the corner, and what they hold gets the banner's whole width */
@media (max-width: 559px) {
  .pf-avatar { width: 52px; height: 52px; }
  .has-art .page-title.pf-name { padding-right: 4.2rem; font-size: clamp(1.1rem, 5.6vw, 1.5rem); }
  .pf-coin small { display: none; }
  .pf-logout { position: absolute; top: 0.6rem; right: 0.6rem; min-height: 36px; padding: 0 0.6rem; font-size: 0.78rem; }
}
@media (min-width: 560px) {
  .pf-id { grid-template-areas: "avatar text" "avatar wallet"; }
}

/* Overview / Inventory / Dex / Leaderboards / Notifications: the planner's tab strip. Five don't fit side by side on a
   phone, so there the strip scrolls sideways. */
.pf-page .pf-tabs { grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: 54rem; margin: 0 0 0.9rem; }
@media (max-width: 760px) {
  .pf-page .pf-tabs { display: flex; overflow-x: auto; scrollbar-width: none; }
  .pf-tabs::-webkit-scrollbar { display: none; }
  .pf-tabs .pl-tab { flex: 0 0 auto; padding: 0 0.9rem; }
}

/* A small label beside a name ("You" on a leaderboard row) */
.pf-tag {
  flex-shrink: 0; padding: 0.1rem 0.45rem; border: 1px solid currentColor; border-radius: 999px; color: var(--accent-text);
  font-size: 0.64rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
}

/* Overview. Phones: the sheet, what is ready, then stats, gear and moves. Wide screens: three columns, like the
   planner (the sheet, the build, what is ready). */
.pf-over { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; align-items: start; }
.pf-over > *, .pf-build > *, .pf-now > *, .pf-stack > * { min-width: 0; }
.pf-now, .pf-build, .pf-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; align-items: start; }
.pf-page .pl-card + .pl-card { margin-top: 0; }
.pf-page .pl-card-head { margin-bottom: 0.6rem; }
.pf-over .sk-block { min-height: 24rem; }
@media (min-width: 700px) {
  .pf-over { grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); grid-template-areas: "sheet now" "build build"; }
  .pf-sheet { grid-area: sheet; }
  .pf-now { grid-area: now; }
  /* Stats and moves on the left, the gear (the tall one) down the right */
  .pf-build { grid-area: build; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pf-build > :nth-child(2) { grid-row: span 2; }
}
@media (min-width: 1024px) {
  .pf-over { grid-template-columns: clamp(280px, 27vw, 330px) minmax(0, 1fr) clamp(280px, 27vw, 340px); grid-template-areas: "sheet build now"; gap: 1.1rem; }
  .pf-build { grid-template-columns: minmax(0, 1fr); }
  .pf-build > :nth-child(2) { grid-row: auto; }
}

/* The sheet: the planner's paper doll, but nothing here is changed, so a worn piece opens its Codex page and an
   empty slot does nothing */
.pf-sheet span.pl-doll-slot { cursor: default; }
.pf-sheet span.pl-doll-slot:hover { transform: none; border-color: rgba(255, 255, 255, 0.28); }
/* A worn piece's details, beside it while the mouse is on it (profile.js showTip puts it there) */
.pf-tip {
  position: fixed; z-index: 200; display: grid; gap: 0.35rem; width: min(17rem, calc(100vw - 1.25rem)); padding: 0.7rem 0.8rem;
  border: 1px solid var(--rc, var(--border-subtle)); border-radius: 12px; background: var(--bg-surface); box-shadow: var(--shadow-lg);
  color: var(--text-main); font-size: 0.85rem; pointer-events: none;
}
.pf-tip-name { font-family: var(--font-display); font-size: 1rem; font-weight: 700; line-height: 1.25; color: var(--rc, var(--text-main)); }
.pf-tip-label { display: flex; align-items: center; gap: 0.25rem; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.pf-tip-label .emo { width: 14px; height: 14px; }
.pf-tip .pl-chips { margin-top: 0; }
.pf-tip-desc { font-size: 0.8rem; line-height: 1.45; color: var(--text-muted); }
.pf-tip-hint { font-size: 0.72rem; color: var(--text-faint); }
.pf-sheet .pl-actions { grid-template-columns: minmax(0, 1fr); }
.pf-xp { display: grid; gap: 0.3rem; }
.pf-xp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.pf-xp-head strong { font-family: var(--font-display); font-size: 1.05rem; font-weight: 800; color: var(--accent-text); }
.pf-xp .pl-points-bar { margin-top: 0; }
.pf-page a.action-btn { text-decoration: none; text-align: center; }
.pf-page .action-btn .emo { width: 18px; height: 18px; }
.pf-page a.pl-mini-move, .pf-page a.pf-timer { color: var(--text-main); text-decoration: none; }
.pf-page button.pl-slot:hover { border-color: var(--rc, var(--accent-border)); }
.pf-page div.pl-slot, .pf-page div.pl-mini-move { cursor: default; }
.pf-page div.pl-mini-move:hover { border-color: var(--border-subtle); }
.pf-page .pf-slots { grid-template-columns: minmax(0, 1fr); } /* one piece a row at every width: its name and what it gives stay on a line */
.pf-slots .card-name, .pf-moves .card-name, .pf-moves .card-label { white-space: normal; overflow-wrap: anywhere; }
.pf-page .card-label.warn { white-space: normal; }

/* What is ready and what is counting down. A row copies its command. */
.pf-timers, .pf-active, .pf-notifs, .pf-worn-by { list-style: none; margin: 0; padding: 0; }
.pf-timers, .pf-active { display: grid; gap: 0.4rem; }
.pf-timer, .pf-boost {
  display: flex; align-items: center; gap: 0.65rem; width: 100%; min-width: 0; min-height: 58px; padding: 0.45rem 0.65rem;
  border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg-surface); text-align: left;
}
.pf-timer { cursor: pointer; transition: border-color var(--transition-fast); }
.pf-timer:hover { border-color: var(--accent-border); }
.pf-timer .thumb, .pf-boost .thumb { width: 40px; height: 40px; }
.pf-timer .thumb-icon .emo, .pf-boost .thumb-icon .emo { width: 26px; height: 26px; }
.pf-timer .card-name, .pf-boost .card-name { font-size: 0.95rem; white-space: normal; }
.pf-timer .card-label, .pf-boost .card-label { white-space: normal; }
.pf-cmd { font-family: var(--font-mono); font-size: 0.74rem; color: var(--text-faint); }
.pf-cmd.copied { color: var(--success); font-weight: 700; }
.pf-timer-when { flex-shrink: 0; font-family: var(--font-display); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.pf-timer.is-ready { border-color: rgba(74, 222, 128, 0.45); }
.pf-timer.is-ready .pf-timer-when {
  padding: 0.12rem 0.6rem; border: 1px solid currentColor; border-radius: 999px; color: var(--success);
  font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase;
}
@supports (color: color-mix(in srgb, red 10%, transparent)) {
  .pf-timer.is-ready { border-color: color-mix(in srgb, var(--success) 45%, var(--border-subtle)); background: linear-gradient(90deg, color-mix(in srgb, var(--success) 11%, transparent), transparent 70%), var(--bg-surface); }
}
.pf-pool + .pf-pool { margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid var(--border-subtle); }
.pf-pool-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 0.4rem; font-size: 0.92rem; }
.pf-pool-n { font-family: var(--font-display); font-size: 1.2rem; font-weight: 800; line-height: 1; }
.pf-pool-n small { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.pf-pips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.4rem; }
.pf-pips .emo { width: 26px; height: 26px; }
.pf-pool .pl-points-bar { margin: 0 0 0.4rem; }
.pf-pool .pl-vital-hint { display: block; }
.pf-until {
  flex-shrink: 0; padding: 0.15rem 0.55rem; border: 1px solid var(--accent-border); border-radius: 999px; background: var(--accent-soft);
  color: var(--accent-text); font-size: 0.78rem; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* Inventory */
.pf-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.pf-tile { display: flex; flex-direction: column; min-width: 0; padding: 0.6rem 0.75rem; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg-surface-elevated); }
.pf-tile b { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; line-height: 1.15; color: var(--accent-text); }
.pf-tile span { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.pf-rarity { margin-top: 0.8rem; }
.pf-rbar { display: flex; gap: 3px; height: 12px; }
.pf-rseg { min-width: 6px; border-radius: 4px; background: var(--rc); transition: opacity var(--transition-fast); }
.pf-rkey { display: flex; flex-wrap: wrap; gap: 0.15rem 0.9rem; margin-top: 0.5rem; }
.pf-rname { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.78rem; font-weight: 600; color: var(--rc); transition: opacity var(--transition-fast); }
.pf-rname .emo { width: 14px; height: 14px; }
.pf-rname b { color: var(--text-main); }
.pf-rseg.dim, .pf-rname.dim { opacity: 0.3; }
.pf-invbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; margin: 0.9rem 0 0.6rem; }
.pf-search {
  grid-column: 1 / -1; min-width: 0; height: 46px; padding: 0 0.9rem; border: 1px solid var(--input-border); border-radius: 12px;
  background: var(--input-bg); color: var(--text-main); font: inherit; font-size: 16px;
}
.pf-search::placeholder { color: var(--text-faint); }
.pf-search:focus { outline: none; border-color: var(--accent-border); box-shadow: 0 0 0 3px var(--accent-soft); }
.pf-select { font-size: 0.9rem; }
.pf-count { margin: 0.5rem 0 0; }
.pf-items { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.45rem; align-items: start; margin-top: 0.6rem; }
.pf-item { min-width: 0; }
.pf-item.is-open { grid-column: 1 / -1; }
.pf-item .card { min-height: 58px; padding: 0.5rem 0.65rem; }
.pf-item .thumb { width: 40px; height: 40px; }
.pf-item .thumb-icon .emo { width: 29px; height: 29px; }
.pf-item.is-open .card { border-bottom-right-radius: 0; border-bottom-left-radius: 0; }
.pf-item-detail {
  display: grid; gap: 0.5rem; padding: 0.75rem 0.9rem 0.85rem; border: 1px solid var(--border-subtle); border-top: 0;
  border-radius: 0 0 12px 12px; background: var(--bg-surface); font-size: 0.88rem;
}
.pf-item-detail .pl-chips { margin-top: 0; }
.pf-item-desc { max-width: 60rem; line-height: 1.5; color: var(--text-muted); }
.pf-worn-by li { display: flex; align-items: center; gap: 0.4rem; padding: 0.1rem 0; }
.pf-worn-by .emo, .pf-equipped .emo { width: 18px; height: 18px; }
.pf-equipped { flex-shrink: 0; display: inline-flex; }
.pf-fav .emo { width: 14px; height: 14px; margin-right: 0.3rem; }
.pf-codex-link { justify-self: start; color: var(--accent-text); font-weight: 700; text-decoration: none; }
.pf-codex-link:hover { text-decoration: underline; }
.pf-none { padding: 1.5rem 0; text-align: center; }
@media (min-width: 640px) {
  .pf-invbar { grid-template-columns: minmax(0, 1fr) auto auto; }
  .pf-search { grid-column: auto; }
  .pf-select { width: auto; }
  .pf-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) { .pf-items { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Bonuses: one that is off (a perk the bot has not seen on the player) is greyed, with a plain label */
.pf-boost.is-off .thumb { opacity: 0.55; filter: grayscale(1); }
.pf-until.off { border-color: var(--badge-border); background: transparent; color: var(--text-faint); }
.pf-sheet .pl-field .pl-select { font-size: 0.95rem; }

/* Inventory: lent and borrowed */
.pf-loans { margin-bottom: 0.75rem; }
.pf-loan-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 0.5rem 1rem; }
.pf-loans .sub-title { margin-top: 0; }

/* Inventory: select items, then copy them as a list the bot's trade takes. The bar follows the reader down the list. */
.pf-pick { grid-column: 1 / -1; width: 100%; min-height: 46px; margin-top: 0; padding: 0 1rem; font-size: 0.9rem; white-space: nowrap; }
.pf-pick .emo { width: 18px; height: 18px; }
.pf-item .card:disabled { opacity: 0.45; cursor: not-allowed; }
.pf-item.is-picked .card:not(:last-child) { border-bottom-right-radius: 0; border-bottom-left-radius: 0; }
.pf-pick-qty { gap: 0.3rem; padding: 0.4rem 0.5rem; border: 1px solid var(--border-subtle); border-top: 0; border-radius: 0 0 12px 12px; background: var(--bg-surface); }
.pf-pick-qty .step { flex: 1; }
.pf-pick-qty .step:disabled { opacity: 0.4; cursor: default; }
.pf-tradebar {
  position: sticky; bottom: 0.75rem; z-index: 50; display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem;
  margin-top: 0.75rem; padding: 0.7rem 0.85rem; border: 1px solid var(--accent-border); border-radius: 14px;
  background: var(--bg-surface); box-shadow: var(--shadow-lg);
}
.pf-trade-text { flex: 1 1 16rem; display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; font-size: 0.85rem; }
.pf-trade-text span { color: var(--text-muted); line-height: 1.4; }
.pf-trade-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pf-trade-actions .action-btn { width: auto; min-height: 42px; margin-top: 0; padding: 0 1rem; font-size: 0.9rem; }
@media (min-width: 900px) {
  .pf-inv .pf-invbar { grid-template-columns: minmax(0, 1fr) auto auto auto; }
  .pf-pick { grid-column: auto; width: auto; }
}

/* Dex: the two dexes as cards with how far along each is, then its monsters; the ones still to kill are greyed */
.pf-dexes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.6rem; margin-bottom: 0.75rem; }
.pf-dexcard {
  display: flex; align-items: center; gap: 0.75rem; min-width: 0; padding: 0.7rem 0.85rem; border: 1px solid var(--border-subtle);
  border-radius: 16px; background: var(--bg-card); text-align: left; cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.pf-dexcard:hover { border-color: var(--accent-border); }
.pf-dexcard.active { border-color: var(--accent); background: linear-gradient(90deg, var(--accent-soft), transparent 85%), var(--bg-card); box-shadow: inset 0 0 0 1px var(--accent); }
.pf-dexcard .thumb { width: 52px; height: 52px; border-radius: 14px; }
.pf-dexcard .card-name { font-size: 1.1rem; }
.pf-dexcard .card-label { white-space: normal; }
.pf-dexcard .pl-points-bar { margin-top: 0.35rem; }
.pf-dex-reward { display: flex; align-items: center; gap: 0.3rem; margin-top: 0.3rem; font-size: 0.76rem; color: var(--text-faint); }
.pf-dex-reward .emo { width: 14px; height: 14px; }
.pf-dex-pct { flex-shrink: 0; font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; color: var(--accent-text); }
.pf-page .pf-seg { display: flex; margin: 0; }
.pf-seg .seg-btn { flex: 1; height: 36px; padding: 0 0.6rem; }
.pf-mons .card { min-height: 58px; padding: 0.5rem 0.65rem; text-decoration: none; }
.pf-mons .thumb { width: 44px; height: 44px; border-radius: 12px; }
.pf-mons .thumb > img { object-fit: cover; object-position: 50% 20%; }
.pf-mons .thumb-icon .emo { width: 28px; height: 28px; }
.pf-mons .card-name, .pf-mons .card-label { white-space: normal; overflow-wrap: anywhere; }
.pf-mons .is-missing .thumb > img { filter: grayscale(1) brightness(0.7); }
.pf-mons .is-missing .card-name { color: var(--text-muted); }
.pf-dex-done { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.4rem; }
.pf-dex-done .emo { width: 20px; height: 20px; }
#pf-dex-more .action-btn { margin-top: 0.75rem; }
#pf-dex-where { max-width: 100%; }
@media (min-width: 700px) {
  .pf-dexes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pf-page .pf-seg { display: inline-flex; }
  .pf-seg .seg-btn { flex: 0 0 auto; padding: 0 1rem; }
  #pf-dex-where { max-width: 17rem; }
}

/* Leaderboards: every board with the player's place on it, and the picked board's top 10 with their own row under it.
   Phones pick the board from a menu; wide screens from the list on the left. */
.pf-lb { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; align-items: start; }
.pf-lb-pick { margin-bottom: 0.75rem; }
.pf-lb-region { max-width: 20rem; margin-top: 0.6rem; }
.pf-lb-list .sub-title:first-of-type { margin-top: 0; }
.pf-lb-rows { display: grid; gap: 0.3rem; }
.pf-lb-row {
  display: flex; align-items: center; gap: 0.55rem; width: 100%; min-height: 42px; padding: 0.35rem 0.6rem;
  border: 1px solid var(--border-subtle); border-radius: 10px; background: var(--bg-surface); text-align: left;
  font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: border-color var(--transition-fast);
}
.pf-lb-row .emo { width: 18px; height: 18px; }
.pf-lb-row:hover { border-color: var(--accent-border); }
.pf-lb-row.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.pf-lb-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.pf-lb-name small { font-size: 0.7rem; font-weight: 500; color: var(--text-faint); }
.pf-lb-place { flex-shrink: 0; font-family: var(--font-display); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text-main); }
.pf-lb-place.top { color: var(--accent-text); }
.pf-lb-place.none, .pf-lb-place.wait { font-family: inherit; font-size: 0.75rem; font-weight: 600; color: var(--text-faint); }
.pf-ranks { list-style: none; display: grid; gap: 0.35rem; margin: 0.75rem 0 0; padding: 0; }
.pf-rank {
  display: flex; align-items: center; gap: 0.7rem; min-width: 0; min-height: 52px; padding: 0.45rem 0.7rem;
  border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg-surface);
}
.pf-rank.sk { border-color: transparent; }
.pf-place {
  flex-shrink: 0; display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 0.4rem; border: 1px solid var(--badge-border);
  border-radius: 10px; background: var(--bg-surface-elevated); font-family: var(--font-display); font-size: 0.95rem; font-weight: 800; color: var(--text-muted);
}
.pf-rank .card-name { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.4rem; white-space: normal; overflow-wrap: anywhere; }
.pf-rank .card-label { white-space: normal; }
.pf-rank-val { flex-shrink: 0; display: inline-flex; align-items: center; gap: 0.3rem; font-family: var(--font-display); font-weight: 800; font-variant-numeric: tabular-nums; }
.pf-rank-val .emo { width: 16px; height: 16px; }
.pf-rank.is-you { border-color: var(--accent); background: linear-gradient(90deg, var(--accent-soft), transparent 80%), var(--bg-surface); box-shadow: inset 0 0 0 1px var(--accent); }
.pf-rank.is-you .pf-place { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
/* The first three: gold, silver, bronze */
.pf-rank.top1 .pf-place { border-color: #e8b923; background: linear-gradient(180deg, #ffe08a, #e8b923); color: #3a2a00; }
.pf-rank.top2 .pf-place { border-color: #aab0b7; background: linear-gradient(180deg, #eef0f3, #aab0b7); color: #23262b; }
.pf-rank.top3 .pf-place { border-color: #b9722d; background: linear-gradient(180deg, #f0b98a, #b9722d); color: #3a1d05; }
.pf-rank-gap { padding: 0.1rem 0; text-align: center; line-height: 1; color: var(--text-faint); }
.pf-rank-none { padding: 0.6rem 0.2rem 0; font-size: 0.9rem; color: var(--text-muted); }
.pf-lb-retry { max-width: 14rem; }
@media (min-width: 900px) {
  .pf-lb { grid-template-columns: 20rem minmax(0, 1fr); grid-template-areas: "list board"; gap: 1.1rem; }
  .pf-lb-list { grid-area: list; }
  .pf-lb-board { grid-area: board; }
  .pf-lb-pick { display: none; }
}

/* Notifications */
.pf-notif-card { max-width: 46rem; }
.pf-notifs { margin-top: 0.5rem; }
.pf-notifs li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.8rem 0; border-bottom: 1px solid var(--border-subtle); }
.pf-notifs .card-name { white-space: normal; }
.pf-notif-desc { font-size: 0.82rem; line-height: 1.4; color: var(--text-muted); }
.pf-switch {
  position: relative; width: 46px; height: 26px; flex-shrink: 0; border-radius: 999px; border: 1px solid var(--badge-border);
  background: var(--bg-surface-elevated); cursor: pointer; transition: background var(--transition-fast);
}
.pf-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--text-muted); transition: transform var(--transition-fast), background var(--transition-fast); }
.pf-switch.on { background: var(--accent-soft); border-color: var(--accent); }
.pf-switch.on::after { transform: translateX(20px); background: var(--accent); }
.pf-switch:disabled { opacity: 0.6; cursor: progress; }
.pf-actions { max-width: 24rem; margin-top: 1rem; }

/* ----- header: the season pass (owner, Nov 28: "a place from main page of the site to show you the pass") ----- */
/* Always the brand's orange, whatever the theme, with a light passing over it now and then. It sits just before the
   header's buttons (the free room goes to its left). The headers have little room to spare (checked at 360 to 1600px
   wide on every page, Nov 28): under 1100px it is a bar of its own under the header, and the gift alone where the
   row is tight (below) */
.pass-pill {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  flex-shrink: 0; margin-left: auto; height: 40px; padding: 0 0.95rem; border-radius: 999px;
  color: #2a1300; font-size: 0.86rem; font-weight: 800;
  text-decoration: none; white-space: nowrap; background: linear-gradient(135deg, #ffc46b, #f8941a 55%, #e2700f);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 6px 20px -6px rgba(248, 148, 26, 0.9);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.pass-pill::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%);
  animation: pass-pill-shine 4.5s ease-in-out 1.5s infinite;
}
.pass-pill:hover { transform: translateY(-1px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45), 0 8px 26px -6px rgba(248, 148, 26, 1); }
.pass-pill:focus-visible { outline: 2px solid #f8941a; outline-offset: 3px; }
@keyframes pass-pill-shine { 0%, 70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
/* Phones and tablets: the header's row is already full, so the pass is a strip along the header's bottom edge, out of
   the row (which stays exactly as it was): the header grows by the strip's height, and the pages that measure it follow */
@media (max-width: 1099px) {
  .header-container:has(> .pass-pill) { position: relative; padding-bottom: calc(0.6rem + 34px); }
  .pass-pill { position: absolute; left: 0; right: 0; bottom: 0; height: 34px; margin: 0; border-radius: 0; font-size: 0.82rem; }
  .pass-pill:hover { transform: none; }
}
/* Small laptops, and the Codex (its section tabs fill the row) on most laptops: the gift alone */
@media (min-width: 1100px) and (max-width: 1279px) {
  .pass-pill { width: 40px; padding: 0; }
  .pass-pill-text { display: none; }
}
@media (min-width: 1280px) and (max-width: 1599px) {
  .header-container:has(> .top-nav) > .pass-pill { width: 40px; padding: 0; }
  .header-container:has(> .top-nav) .pass-pill-text { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pass-pill::after { animation: none; }
}

/* ----- build planner: owned-only bar ----- */
.pl-owned { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; padding: 0.7rem 0.9rem; margin-bottom: 0.85rem; background: var(--bg-surface-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
.pl-owned-toggle { display: inline-flex; align-items: center; gap: 0.6rem; min-height: 44px; touch-action: manipulation; -webkit-tap-highlight-color: transparent; font-weight: 600; font-size: 0.9rem; cursor: pointer; background: none; border: 0; color: var(--text-main); padding: 0; font-family: inherit; }
.pl-owned-char { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-muted); }
.pl-owned-note { flex-basis: 100%; margin: 0; font-size: 0.8rem; color: var(--text-faint); }
.pl-owned-login { color: var(--accent-text); font-weight: 600; text-decoration: none; }

/* ----- build planner: load one of my characters (spans the sheet's two-column setup) ----- */
.pl-field-char { grid-column: 1 / -1; }
