/* Player profile (profile.js). Uses the pixel skin's tokens and frames from skin.css; .db-h and .db-input come from decks.css. */

/* ---------- title screen entry ---------- */
.pf-chip { all: unset; cursor: pointer; position: absolute; z-index: 2; top: 10px; left: max(12px, env(safe-area-inset-left, 0px));
  display: flex; align-items: center; gap: 8px; max-width: calc(100% - 140px); padding: 4px 10px 4px 4px;
  border: 6px solid transparent; border-image: var(--btn-dark) 2 fill / 6px / 0 stretch; }
.pf-chip:active { border-image-source: var(--btn-dark-down); }
.pf-chip:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.pf-chip .pf-ava { width: 34px; height: 34px; }
.pf-chip-t { display: grid; min-width: 0; line-height: 1.25; }
.pf-chip-t b { font-weight: 400; font-size: 14px; color: var(--cream); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-chip-t small { font-size: 12px; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.record { all: unset; cursor: pointer; display: block; text-align: center; padding: 4px 0; }
button.record:active { color: var(--cream); }

/* ---------- screen ---------- */
#profile { padding-inline: max(12px, calc((100% - 720px) / 2)); padding-bottom: max(16px, env(safe-area-inset-bottom, 0px)); }
.pf-ava { flex: none; display: block; padding: 0; border: 0; border-radius: 0; background: var(--ink) center 30% / cover; box-shadow: var(--frame); }
.pf-head { display: grid; grid-template-columns: 88px 1fr; gap: 14px; align-items: center; padding: 6px;
  border: 9px solid transparent; border-image: var(--win-dark) 3 fill / 9px / 0 stretch; }
.pf-ava.big { position: relative; width: 88px; height: 88px; cursor: pointer; }
.pf-ava.big i { position: absolute; right: -4px; bottom: -4px; font-style: normal; font-size: 14px; background: var(--gold); color: var(--ink); padding: 0 4px; box-shadow: var(--frame); }
.pf-id { display: grid; gap: 4px; min-width: 0; justify-items: start; }
.pf-name, .pf-title { all: unset; cursor: pointer; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-name { font-size: 22px; color: var(--cream); text-shadow: 3px 3px 0 var(--ink); }
.pf-name i, .pf-title i { font-style: normal; font-size: 14px; color: var(--dim); }
.pf-title { font-size: var(--fs-s, 14px); color: var(--ink); background: var(--gold); padding: 1px 8px; box-shadow: var(--frame); }
.pf-acct { font-size: 12px; color: var(--dim); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-acct.on { color: var(--teal); }
.pf-name:focus-visible, .pf-title:focus-visible, .pf-row:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.pf-stats { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pf-stats.three { grid-template-columns: repeat(3, 1fr); }
.pf-stats div { padding: 8px 4px; text-align: center; line-height: 1.3; min-width: 0; }
.pf-stats b { font-size: 22px; }

.pf-heroes { display: grid; gap: 8px; }
.pf-hero { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; padding: 4px;
  border: 9px solid transparent; border-image: var(--win-dark) 3 fill / 9px / 0 stretch; }
.pf-hero .pic { position: relative; width: 56px; height: 56px; background: center 25% / cover; box-shadow: var(--frame); }
.pf-hero .pic em { position: absolute; left: -6px; bottom: -6px; min-width: 22px; text-align: center; font-style: normal; font-size: 14px;
  background: var(--gold); color: var(--ink); box-shadow: var(--frame); }
.pf-hero > div { display: grid; gap: 4px; min-width: 0; }
.pf-hero b { font-weight: 400; font-size: 18px; color: var(--gold); }
.pf-hero small { font-size: 12px; color: var(--dim); }
.pf-bar { display: block; height: 8px; background: var(--ink); box-shadow: 0 0 0 2px var(--rimlo); }
.pf-bar i { display: block; height: 100%; background: var(--teal); box-shadow: inset 0 2px 0 #b4f5dc; }

.pf-hist { display: grid; gap: 4px; }
.pf-match { display: grid; grid-template-columns: 30px 32px auto 32px 1fr; gap: 6px; align-items: center; padding: 4px 8px 4px 4px;
  background: var(--panel); box-shadow: inset 0 0 0 2px var(--rimlo); }
.pf-match em { font-style: normal; text-align: center; font-size: 16px; color: var(--ink); background: var(--teal); padding: 4px 0; }
.pf-match.l em { background: var(--red); color: var(--cream); }
.pf-match.d em { background: var(--dim); }
.pf-match .pic { width: 32px; height: 32px; background: center 25% / cover; box-shadow: 0 0 0 2px var(--ink); }
.pf-match i { font-style: normal; font-size: 12px; color: var(--dim); }
.pf-match .txt { display: grid; min-width: 0; line-height: 1.3; }
.pf-match .txt b { font-weight: 400; font-size: 14px; color: var(--cream); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-match .txt small { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-none { margin: 0; color: var(--dim); font-size: var(--fs-s, 14px); }

.pf-rows { display: grid; gap: 4px; }
.pf-row { all: unset; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px;
  background: var(--panel); box-shadow: inset 0 0 0 2px var(--rimlo); font-size: var(--fs-m, 16px); color: var(--cream); }
.pf-row b { font-weight: 400; color: var(--gold); font-size: var(--fs-s, 14px); }
.pf-row:active { filter: brightness(1.3); }
/* guests: the permanent "link Google" row under the profile header, and the Google button in the link prompt (link.js) */
.pf-link { margin: 4px 0 10px; box-shadow: inset 0 0 0 2px var(--gold); }
.pf-link span { font-size: var(--fs-s, 14px); }
/* color-scheme light, like the account box's .gis (cloud.js): the page is dark, Google's button frame is light, and a
   frame whose scheme differs from its container's gets an opaque white backdrop (the white box QA saw). */
.lk-g { display: flex; justify-content: center; min-height: 44px; color-scheme: light; background: transparent; }
/* Google's button is the one action; "Not now" is a quiet text button under it */
.lk-later { all: unset; cursor: pointer; justify-self: center; padding: 8px 16px; font-size: var(--fs-s, 14px); color: var(--dim); text-decoration: underline; text-underline-offset: 3px; }
.lk-later:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
/* Language: a two-way switch, each side labelled in its own language (as Hearthstone and Snap list them). */
.pf-lang { cursor: default; }
.pf-lang:active { filter: none; }
.pf-seg { display: flex; gap: 4px; }
.pf-seg button { min-width: 76px; min-height: 36px; padding: 0 10px; font-size: var(--fs-s, 14px); color: var(--cream); cursor: pointer;
  border-radius: 0; border: 6px solid transparent; border-image: var(--btn-dark) 2 fill / 6px / 0 stretch; background: none; }
.pf-seg button[aria-pressed="true"] { border-image-source: var(--btn-paper); color: var(--ink); }
.pf-seg button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.pf-box { display: grid; gap: 8px; padding: 6px; border: 9px solid transparent; border-image: var(--win-dark) 3 fill / 9px / 0 stretch; }
.pf-box p { margin: 0; font-size: var(--fs-s, 14px); color: var(--dim); line-height: 1.5; }
#profile .record { margin-top: 4px; }
/* 重置账号: the page's last action, a red danger button under Settings (ray 2026-10-30): red outline and text, not a
 * filled block, so it reads as dangerous without outshouting the page; the confirm modal has the filled red one. */
.pf-reset { all: unset; cursor: pointer; display: block; width: fit-content; margin: 16px auto 0; padding: 0 20px; min-height: 44px; line-height: 44px;
  font-size: var(--fs-s, 14px); color: var(--red); box-shadow: inset 0 0 0 2px var(--red); }
.pf-reset:active { background: var(--redlo); color: var(--cream); }
.pf-reset:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- modals ---------- */
.pf-tabs { margin-bottom: 2px; }
.pf-avas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-height: 50vh; overflow-y: auto; padding: 6px; }
.pf-avas .pf-ava { width: 100%; aspect-ratio: 1; cursor: pointer; }
.pf-avas .pf-ava.sel { box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--gold); }
.pf-titles { display: grid; gap: 6px; text-align: left; max-height: 55vh; overflow-y: auto; padding: 3px; }
.pf-ach { all: unset; cursor: pointer; display: grid; gap: 2px; padding: 8px 10px; background: var(--panel); box-shadow: inset 0 0 0 2px var(--rimlo); }
.pf-ach b { font-weight: 400; font-size: 16px; color: var(--gold); }
.pf-ach small { font-size: 12px; color: var(--dim); }
.pf-ach.locked { opacity: .5; }
.pf-ach.locked b { color: var(--dim); }
.pf-ach.sel { box-shadow: inset 0 0 0 3px var(--teal); }
.pf-grp { margin: 6px 0 0; font-weight: 400; font-size: 13px; color: var(--dim); }
.pf-grp:first-child { margin-top: 0; }
.pf-frames { display: flex; flex-wrap: wrap; gap: 14px; padding: 8px 6px 4px; }
.pf-frame { all: unset; cursor: pointer; display: grid; justify-items: center; gap: 8px; padding: 6px 4px 2px; min-width: 56px; }
.pf-frame .pf-ava { width: 44px; height: 44px; }
.pf-frame small { font-size: 12px; color: var(--cream); white-space: nowrap; }
.pf-frame.sel small { color: var(--ink); background: var(--teal); padding: 0 6px; }
.pf-frame:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- card backs (profile.js backsModal; pictures from backs.js, 512x683) ---------- */
/* The default back is the duel's plain blue tile; a back with a picture fills it. */
.pf-back { flex: none; display: inline-block; vertical-align: middle; width: 15px; height: 20px; margin-right: 8px; background: var(--blue) center / cover no-repeat;
  box-shadow: 0 0 0 2px var(--ink); }
.pf-back.big { width: 100%; height: auto; aspect-ratio: 3 / 4; margin: 0; }
.pf-backs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-height: 58vh; overflow-y: auto; padding: 6px; }
@media (min-width: 700px) { .pf-backs { grid-template-columns: repeat(5, 1fr); } }
.pf-backpick { all: unset; cursor: pointer; display: grid; align-content: start; gap: 6px; text-align: center; padding: 4px; }
.pf-backpick b { font-weight: 400; font-size: 12px; line-height: 1.2; color: var(--cream); }
.pf-backpick small { font-size: 11px; line-height: 1.2; color: var(--dim); }
.pf-backpick.locked .pf-back { filter: grayscale(1) brightness(.45); }
.pf-backpick.locked b { color: var(--dim); }
.pf-backpick.sel .pf-back { box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--gold); }
.pf-backpick.sel b { color: var(--gold); }
.pf-backpick:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.pf-backrow span { display: inline-flex; align-items: center; }

/* ---------- season avatar frames (ladder.js frameClass; ray + PM 2026-10-27) ----------
   A pixel bevel round the avatar: a 3px ring lit top-left and shaded bottom-right, the frame colour inside it, an ink
   outline with stepped corners. Gold glints in two frames (steps), still under prefers-reduced-motion. */
@property --fr-h { syntax: '<color>'; inherits: false; initial-value: #f4f7fd; }
@property --fr-m { syntax: '<color>'; inherits: false; initial-value: #c7d0e4; }
@property --fr-l { syntax: '<color>'; inherits: false; initial-value: #7d86a8; }
.fr-silver { --fr-h: #f4f7fd; --fr-m: #c7d0e4; --fr-l: #7d86a8; }
.fr-gold { --fr-h: #ffe08a; --fr-m: #f2c14e; --fr-l: #a8761e; animation: fr-glint 2.4s steps(2, jump-none) infinite; }
@keyframes fr-glint { from { --fr-h: #ffe08a; --fr-m: #f2c14e; --fr-l: #a8761e; } to { --fr-h: #fffbe8; --fr-m: #ffd877; --fr-l: #d29a2c; } }
.fr-silver, .fr-gold {
  --fr-ring: 0 -3px 0 var(--fr-h), -3px 0 0 var(--fr-h), 0 3px 0 var(--fr-l), 3px 0 0 var(--fr-l),
    -3px -3px 0 var(--ink), 3px -3px 0 var(--ink), -3px 3px 0 var(--ink), 3px 3px 0 var(--ink),
    0 -6px 0 var(--ink), 0 6px 0 var(--ink), -6px 0 0 var(--ink), 6px 0 0 var(--ink);
  box-shadow: inset 0 0 0 3px var(--fr-m), var(--fr-ring);
}
/* the duel portrait has its own 3px border: the frame colour goes there */
.portrait.fr-silver, .portrait.fr-gold { border-color: var(--fr-m); box-shadow: var(--fr-ring); }
.portrait.tgt.fr-silver, .portrait.tgt.fr-gold { border-color: var(--red); }
@media (prefers-reduced-motion: reduce) { .fr-gold { animation: none; } }

@media (min-width: 640px) {
  .pf-avas { grid-template-columns: repeat(5, 1fr); }
}
/* short landscape: style.css moves the lang/sound corner to the bottom-left, so the chip sits right after it */
@media (orientation: landscape) and (max-height: 560px) {
  .pf-chip { top: auto; bottom: 8px; left: calc(max(12px, env(safe-area-inset-left, 0px)) + 118px); max-width: 30%; padding: 2px 8px 2px 2px; }
  .pf-chip .pf-ava { width: 22px; height: 22px; }
  .pf-chip-t small { display: none; }
}
