/* ---------- portrait picker (profile settings) ---------- */
.pp-picker { display: grid; gap: 12px; margin: 4px 0 18px; }
.pp-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.pp-tab {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--field); color: var(--ink-2);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.pp-tab .ico { width: 14px; height: 14px; }
.pp-tab:hover { color: var(--ink); border-color: var(--line-2); }
.pp-tab.is-on { background: var(--grad-gold); color: #1b1206; border-color: transparent; box-shadow: 0 4px 16px rgba(217, 183, 122, 0.3); }
.pp-tab.is-staff:not(.is-on) { color: var(--gold); border-color: var(--line-2); }
.pp-tab:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.pp-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--muted); }
.pp-note > .ico { width: 16px; height: 16px; color: var(--gold); }
.pp-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-pill);
  background: linear-gradient(180deg, rgba(217, 183, 122, 0.2), rgba(217, 183, 122, 0.06));
  box-shadow: 0 0 0 1px var(--gold) inset; color: var(--gold-2);
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
}
.pp-badge .ico { width: 12px; height: 12px; }

.pp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; min-height: 64px; }
.pp-grid.is-locked { opacity: 0.85; }
.pp-loading, .pp-empty { grid-column: 1 / -1; margin: 0; align-self: center; }
.pp-cell {
  position: relative; aspect-ratio: 1; width: 100%; padding: 0;
  border-radius: 50%; border: 0; background: var(--surface-2); cursor: pointer;
  box-shadow: 0 0 0 1px var(--line) inset;
  transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.pp-cell img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.pp-cell:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 0 0 2px var(--line-2), 0 8px 22px rgba(0, 0, 0, 0.35); }
.pp-cell:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.pp-cell.is-current { box-shadow: 0 0 0 2px var(--gold), 0 0 22px rgba(217, 183, 122, 0.35); }
.pp-cell.is-busy { opacity: 0.6; pointer-events: none; }
.pp-cell.is-locked { cursor: not-allowed; }
.pp-cell.is-locked img { filter: blur(6px) saturate(0.4) brightness(0.6); }
.pp-check, .pp-lock {
  position: absolute; display: grid; place-items: center; border-radius: 50%;
}
.pp-check { right: -2px; bottom: -2px; width: 22px; height: 22px; background: var(--grad-gold); color: #1b1206; box-shadow: 0 0 0 2px var(--surface-solid); }
.pp-check .ico { width: 13px; height: 13px; stroke-width: 2.6; }
.pp-lock { inset: 0; color: var(--ink); }
.pp-lock .ico { width: 20px; height: 20px; }

/* ---------- gender + rename ---------- */
.pp-gender { margin-top: 4px; }
.pp-gender.is-busy { opacity: 0.6; pointer-events: none; }
.pp-gender .segmented,
.gender-pills {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}
.pp-gender .segmented label,
.gender-pills label { min-width: 0; }
.pp-gender .segmented span,
.gender-pills span {
  width: 100%;
  justify-content: center;
  padding: 0 6px;
  font-size: 13px;
}
.pp-zone { display: grid; gap: 10px; margin-top: 4px; }
.pp-zone.is-busy { opacity: 0.6; pointer-events: none; }
.pp-zone-now { margin: 0; }
.pp-zone-now b { font-variant-numeric: tabular-nums; color: var(--ink); }
.pp-current-name { color: var(--ink); }
.pp-sparks { color: var(--gold-2); }
.pp-short { color: var(--muted); }
.gender-field { border: 0; padding: 0; margin: 0; min-width: 0; }
.gender-field legend { padding: 0; margin-bottom: 8px; }

/* ---------- first-visit gender dialog ---------- */
.gender-ask { width: min(560px, calc(100vw - 28px)); }
.gender-ask .dialog-box { text-align: center; }
.gender-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 4px; }
.gender-card {
  position: relative; display: grid; justify-items: center; gap: 10px;
  padding: 16px 10px 14px; border-radius: var(--r-lg, 18px);
  background: var(--field); border: 1px solid var(--line); cursor: pointer;
  transition: border-color var(--dur-2) var(--ease), transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.gender-card input { position: absolute; opacity: 0; pointer-events: none; }
.gender-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.gender-card-face { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 1px var(--line-2); background: var(--surface-2); }
.gender-card-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gender-card b { font-size: 14px; max-width: 100%; text-align: center; line-height: 1.2; }
.gender-card:has(input:checked) { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset, 0 10px 30px rgba(217, 183, 122, 0.18); }
.gender-card:has(input:checked) .gender-card-face { box-shadow: 0 0 0 2px var(--gold), 0 0 24px rgba(217, 183, 122, 0.35); }
.gender-card:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.gender-ask .dialog-actions { justify-content: stretch; }

@media (max-width: 480px) {
  .gender-cards { gap: 8px; }
  .gender-card { padding: 12px 4px; }
  .gender-card-face { width: 72px; height: 72px; }
  .gender-card b { font-size: 12.5px; }
  .pp-gender .segmented span,
  .gender-pills span { padding: 0 4px; font-size: 12.5px; }
}

.pp-picker + .form-stack { margin-top: 4px; }

/* ==========================================================================
   SETTINGS (/profile/settings): sidebar with a live preview + groups, one group at a time
   ========================================================================== */
.st-head { display: grid; justify-items: start; gap: 10px; margin-bottom: var(--space-6); }
.st-head h1 { margin: 0; }
.st-back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 14px; font-weight: 700; text-decoration: none;
  transition: color var(--dur-2) var(--ease);
}
.st-back .ico { width: 16px; height: 16px; transition: transform var(--dur-2) var(--ease); }
.st-back:hover { color: var(--gold); }
.st-back:hover .ico { transform: translateX(-3px); }

.st-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: var(--gutter); align-items: start; }
.st-side { position: sticky; top: calc(var(--nav-h) + var(--space-4)); display: grid; gap: var(--stack); }

/* live preview card */
.st-preview {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px 16px;
  padding: var(--card-pad); border-radius: var(--r-lg);
  background: radial-gradient(120% 90% at 0% 0%, rgba(217, 183, 122, 0.12), transparent 60%), var(--surface);
  border: 1px solid var(--line);
}
.st-face { box-shadow: 0 0 0 3px var(--bg), 0 8px 24px rgba(0, 0, 0, 0.45); }
.st-face.cos-frame { margin: 6px; }
.st-preview-id { display: grid; justify-items: start; gap: 4px; min-width: 0; }
.st-preview-id .eyebrow { margin: 0; font-size: 10.5px; }
.st-preview-name {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--display); font-size: 26px; font-weight: 600; line-height: 1.1; color: var(--ink);
  transition: color var(--dur-2) var(--ease);
}
.st-preview-name.is-draft { color: var(--gold-2); }
.st-preview-id .cos-title { font-size: 12px; }
.st-preview-motto { grid-column: 1 / -1; min-height: 46px; font-size: 15px; }
.st-preview-motto.has-plaque { height: 50px; min-height: 50px; }
.st-preview .pf-motto.is-empty .pf-motto-text { font-style: normal; font-family: var(--sans); font-size: 13px; }
.st-wallet { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin: 0; padding-top: 12px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 13px; }
.st-wallet .ico { width: 16px; height: 16px; color: var(--gold); }
.st-wallet b { color: var(--gold-2); }

/* group list (sidebar here, a card on the profile) */
.st-nav { display: grid; gap: 4px; padding: 6px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.st-nav-item {
  position: relative; display: grid; grid-template-columns: 38px minmax(0, 1fr) 16px; align-items: center; gap: 12px;
  min-height: 58px; padding: 8px 12px 8px 8px; border-radius: var(--r-md);
  color: var(--ink-2); text-decoration: none;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.st-nav-item:hover { background: var(--surface-2); color: var(--ink); }
.st-nav-item:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.st-nav-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--field); box-shadow: 0 0 0 1px var(--line) inset; color: var(--gold); }
.st-nav-ico .ico { width: 18px; height: 18px; }
.st-nav-text { display: grid; gap: 1px; min-width: 0; }
.st-nav-text b { font-size: 15px; font-weight: 700; color: inherit; }
.st-nav-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--muted); }
.st-nav-go { color: var(--faint); }
.st-nav-go .ico { width: 16px; height: 16px; }
.st-nav-item.is-on { background: linear-gradient(90deg, rgba(217, 183, 122, 0.16), rgba(217, 183, 122, 0.04)); color: var(--ink); }
.st-nav-item.is-on::before { content: ""; position: absolute; left: -6px; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--grad-gold); }
.st-nav-item.is-on .st-nav-ico { background: var(--grad-gold); color: #1b1206; box-shadow: 0 4px 14px rgba(217, 183, 122, 0.3); }
.st-nav-item.is-on .st-nav-go { color: var(--gold); }

/* panels */
.st-panels { min-width: 0; }
/* the panels run to the page edge like every other account page (no own max-width) */
.st-panel { display: grid; gap: var(--stack); animation: st-in var(--dur-2) var(--ease); }
@keyframes st-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.st-panel-title { margin: 0 0 var(--space-1); font-size: 30px; }
.st-card {
  display: grid; gap: var(--space-3); padding: var(--card-pad); border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line);
  scroll-margin-top: calc(var(--nav-h) + var(--space-4));
  transition: box-shadow var(--dur-3) var(--ease), border-color var(--dur-3) var(--ease);
}
.st-card.is-target { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217, 183, 122, 0.18), var(--shadow-1); }
.st-card-quiet { background: transparent; border-style: dashed; }
.st-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.st-card-head h3 { margin: 0; font-family: var(--sans); font-size: 17px; font-weight: 800; letter-spacing: 0; }
.st-note { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.st-note b { color: var(--ink); }
.st-blocks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.st-block { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; padding: 8px 10px; border-radius: var(--r-md, 14px); background: var(--surface); border: 1px solid var(--line-soft); }
.st-block-who { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; }
.st-block-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; }
.st-block .btn { flex: none; }
.st-price {
  display: inline-flex; flex: none; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: var(--r-pill);
  background: rgba(217, 183, 122, 0.1); box-shadow: 0 0 0 1px var(--line-2) inset; color: var(--gold-2);
  font-size: 12.5px; font-weight: 800; white-space: nowrap;
}
.st-price .ico { width: 13px; height: 13px; color: var(--gold); }
.st-price.is-free { background: rgba(95, 207, 152, 0.1); box-shadow: 0 0 0 1px rgba(95, 207, 152, 0.35) inset; color: var(--ok); }
.st-card .pp-picker { margin: 0; }
.st-form { display: grid; gap: var(--space-3); }
.st-form > .btn, .st-actions { justify-self: start; }
.st-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.st-age { grid-template-columns: minmax(0, 220px) auto; align-items: end; }
.st-photo { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-3); align-items: center; }
.st-photo .pp-short { grid-column: 1 / -1; margin: 0; }
.st-clock { color: var(--gold-2); font-size: 22px; font-weight: 600; font-family: var(--display); }

/* switch rows: invisible (a submit button) and sound (a checkbox) */
.st-switch-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; margin: 0; cursor: pointer; }
.st-switch-row[hidden] { display: none; }
.st-switch-row + .st-switch-row { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.st-switch-row.is-off { opacity: 0.55; cursor: default; }
.st-switch-text { display: grid; gap: 4px; }
.st-switch-text b { font-size: 17px; font-weight: 800; color: var(--ink); }
.st-switch-text small { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.st-toggle {
  position: relative; flex: none; width: 52px; height: 30px; padding: 0; border: 0; border-radius: var(--r-pill);
  background: var(--field); box-shadow: 0 0 0 1px var(--line-2) inset; cursor: pointer;
  transition: background var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.st-toggle > span {
  position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink-2); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform var(--dur-2) var(--ease-spring), background var(--dur-2) var(--ease);
}
.st-toggle.is-on, .st-toggle-input:checked + .st-toggle { background: var(--grad-gold); box-shadow: 0 4px 16px rgba(217, 183, 122, 0.3); }
.st-toggle.is-on > span, .st-toggle-input:checked + .st-toggle > span { transform: translateX(22px); background: #1b1206; }
.st-toggle:disabled { opacity: 0.45; cursor: not-allowed; }
.st-toggle.is-busy { opacity: 0.6; pointer-events: none; }
.st-toggle:focus-visible, .st-toggle-input:focus-visible + .st-toggle { outline: 2px solid var(--gold); outline-offset: 3px; }
.st-toggle-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.st-seen { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--r-md); background: var(--field); box-shadow: 0 0 0 1px var(--line-soft) inset; }
.st-seen-label { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.st-seen-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0; }
.st-seen-line .presence { font-size: 14px; font-weight: 700; }
.st-seen-line small { color: var(--faint); font-size: 12.5px; }

.st-link-card {
  display: grid; grid-template-columns: 38px minmax(0, 1fr) 16px; align-items: center; gap: 12px;
  padding: 12px var(--card-pad) 12px 12px; border-radius: var(--r-lg); border: 1px dashed var(--line-2);
  color: var(--ink-2); text-decoration: none; transition: border-color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.st-link-card:hover { border-color: var(--gold); background: var(--surface); }
.st-link-card > span:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.st-link-card b { font-size: 14.5px; color: var(--ink); }
.st-link-card small { font-size: 12.5px; color: var(--muted); }

@media (max-width: 900px) {
  .st-head { margin-bottom: var(--space-5); }
  .st-layout { grid-template-columns: 1fr; gap: var(--stack); }
  .st-side { position: static; }
  /* groups become a 4-up tab strip right above the open group */
  .st-side .st-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; scroll-margin-top: calc(var(--nav-h) + 8px); }
  .st-side .st-nav-item { grid-template-columns: 1fr; justify-items: center; gap: 4px; min-height: 0; padding: 8px 2px 7px; text-align: center; }
  .st-side .st-nav-ico { width: 32px; height: 32px; border-radius: 10px; }
  .st-side .st-nav-ico .ico { width: 16px; height: 16px; }
  .st-side .st-nav-text b { font-size: 12px; letter-spacing: -0.01em; }
  .st-side .st-nav-text small, .st-side .st-nav-go { display: none; }
  .st-side .st-nav-item.is-on::before { left: 22%; right: 22%; top: auto; bottom: -1px; width: auto; height: 3px; }
  .st-panel { max-width: none; }
  .st-panel-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 560px) {
  .st-preview { gap: 12px 14px; }
  .st-face { --size: 60px !important; }
  .st-preview-name { font-size: 22px; }
  .st-photo { grid-template-columns: 1fr; }
  .st-photo .btn { width: 100%; }
  .st-age { grid-template-columns: 1fr; }
  .st-age .btn, .st-form > .btn { justify-self: stretch; }
  .st-actions { justify-self: stretch; }
  .st-actions .btn { flex: 1; }
  .st-card-head h3 { font-size: 16px; }
}

/* ==========================================================================
   PROFILE: per-game ladders, recent games, settings card
   ========================================================================== */
.pf-ladders { margin-top: var(--stack); }
.pf-ladders-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pf-ladder-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.pf-ladder {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 14px 10px 10px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-soft);
  color: inherit; text-decoration: none; transition: border-color var(--dur-2) var(--ease);
}
.pf-ladder:hover { border-color: var(--line-2); }
.pf-ladder img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.pf-ladder-text { display: grid; gap: 1px; min-width: 0; }
.pf-ladder-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.pf-ladder-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.pf-ladder-num { font-family: var(--display); font-size: 24px; font-weight: 600; color: var(--gold-2); }

.pf-games { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.js .pf-games.is-folded .is-more { display: none; }
.pf-game {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 52px 62px; align-items: center; gap: 14px;
  padding: 8px 12px 8px 8px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-soft);
}
.pf-game.is-win { background: radial-gradient(90% 140% at 0% 50%, rgba(217, 183, 122, 0.1), transparent 70%), var(--surface); border-color: var(--line); }
.pf-game-art { width: 44px; height: 44px; border-radius: 11px; object-fit: cover; }
.pf-game-main { display: grid; gap: 2px; min-width: 0; }
.pf-game-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; font-weight: 700; }
.pf-game-main b i { font-style: normal; font-weight: 500; color: var(--muted); }
.pf-game-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--muted); }
.pf-game-v { display: none; }
.pf-game-place { display: grid; justify-items: center; line-height: 1; color: var(--ink-2); }
.pf-game-place b { font-family: var(--display); font-size: 22px; font-weight: 600; }
.pf-game-place small { margin-top: 2px; font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.pf-game-place.is-medal { justify-self: center; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: #1b1206; }
.pf-game-place.is-medal b { font-family: var(--sans); font-size: 16px; font-weight: 900; }
.pf-game-place.is-medal small { display: none; }
.pf-game-place.is-p1 { background: var(--grad-gold); box-shadow: 0 4px 14px rgba(217, 183, 122, 0.35); }
.pf-game-place.is-p2 { background: linear-gradient(135deg, #f1f3f6 0%, #b9c0ca 50%, #7d8693 100%); }
.pf-game-place.is-p3 { background: linear-gradient(135deg, #f0c39a 0%, #c0804d 50%, #7d4a26 100%); }
.pf-game-delta { justify-self: end; min-width: 50px; padding: 4px 9px; border-radius: var(--r-pill); background: var(--line-soft); color: var(--muted); font-size: 13.5px; font-weight: 800; text-align: center; white-space: nowrap; }
.pf-game-delta.is-up { background: rgba(95, 207, 152, 0.14); color: var(--ok); }
.pf-game-delta.is-down { background: rgba(255, 93, 115, 0.12); color: var(--danger); }
.pf-games-more {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 8px; height: 40px;
  border: 1px dashed var(--line-2); border-radius: var(--r-md); background: transparent; color: var(--gold);
  font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.pf-games-more:hover { border-color: var(--gold); background: var(--surface); }
.pf-games-more .ico { width: 15px; height: 15px; }
.pf-games-empty { display: grid; justify-items: center; gap: 12px; padding: var(--space-5) var(--card-pad); text-align: center; }
.pf-games-empty p { margin: 0; max-width: 42ch; color: var(--muted); font-size: 14px; }
.pf-games-empty-ico { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--field); box-shadow: 0 0 0 1px var(--line-2) inset; color: var(--gold); }
.pf-games-empty-ico .ico { width: 22px; height: 22px; }

.pf-quick { display: grid; gap: 10px; }
.pf-quick-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pf-quick-head h2 { margin: 0; font-size: 22px; }
.st-nav.is-compact .st-nav-item { min-height: 52px; }

@media (max-width: 560px) {
  .pf-game { grid-template-columns: 40px minmax(0, 1fr) 34px auto; gap: 10px; padding-right: 10px; }
  .pf-game-art { width: 40px; height: 40px; }
  /* phones: the variant moves to the second line, the player count goes (it is in the place tooltip) */
  .pf-game-main b i, .pf-game-n { display: none; }
  .pf-game-v { display: inline; }
  .pf-game-place b { font-size: 18px; }
  .pf-game-place small { display: none; }
  .pf-game-place.is-medal { width: 30px; height: 30px; }
  .pf-game-place.is-medal b { font-size: 14px; }
  .pf-game-delta { min-width: 44px; padding: 4px 7px; font-size: 12.5px; }
  .pf-ladder-list { grid-template-columns: 1fr; gap: 8px; }
}

/* ==========================================================================
   «Витрина»: compact grid (public/js/showcase.js), zoom dialog, picker
   ========================================================================== */

.sc .section-head { align-items: flex-end; }
.sc-edit { padding: 0; border: 0; background: none; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.sc-edit .ico { width: 15px; height: 15px; }
.sc-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.sc-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  padding: 6px 6px 9px;
  border: 0;
  border-radius: 14px;
  background: var(--surface-solid);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--rar) 42%, transparent) inset, 0 8px 18px rgba(0, 0, 0, 0.2);
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: zoom-in;
  transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.sc-card[data-rarity="epic"], .sc-card[data-rarity="legendary"] {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--rar) 70%, transparent) inset, 0 0 22px color-mix(in srgb, var(--rar) 22%, transparent), 0 8px 18px rgba(0, 0, 0, 0.2);
}
.sc-card:hover, .sc-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 0 0 1px var(--rar) inset, 0 0 26px color-mix(in srgb, var(--rar) 30%, transparent), 0 14px 28px rgba(0, 0, 0, 0.28);
}
.sc-card:active { transform: translateY(-1px) scale(0.98); }
.sc-art {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--rar) 24%, transparent), transparent 70%),
    #0c0a10;
}
.sc-art > .sc-thumb, .sc-art > .sc-fx, .sc-art > .sc-plaque { grid-area: 1 / 1; width: 100%; height: 100%; min-width: 0; }
.sc-thumb .thumb { min-height: 0; background: transparent; }
.sc-thumb .thumb--plaque img { object-fit: contain; padding: 16% 6%; }
.sc-thumb .thumb-bubble { font-size: 12px; padding: 6px 8px; }
.sc-thumb .thumb-face { --size: 74%; }
/* frames with an ornament above the ring (crown, patron crown, ribbon) were cut by the square tile on phones:
   the portrait gets smaller and moves down so the ornament stays inside; the zoom scales the same tile */
.sc-thumb .thumb-face.cos-portrait { width: 74%; height: 74%; }
.sc-thumb .thumb-face.cos-portrait:is(.cos-frame--crown, .cos-frame--vip-patron) { --size: 56%; width: 56%; height: 56%; translate: 0 13%; }
.sc-thumb .thumb-face.cos-portrait.cos-frame--ribbon { --size: 66%; width: 66%; height: 66%; translate: 0 5%; }
.sc-art .sc-dup {
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(7, 6, 10, 0.8);
  color: var(--gold-2);
  font-size: 11px;
  font-weight: 800;
}
/* titles: a plaque on velvet, not an empty gradient */
.sc-plaque {
  display: grid;
  place-items: center;
  padding: 10px 6px;
  background:
    radial-gradient(ellipse at 50% 50%, color-mix(in srgb, var(--rar) 20%, transparent), transparent 70%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 7px),
    linear-gradient(160deg, #2a1822, #0c0a10);
}
.sc-plaque .cos-title {
  justify-content: center;
  max-width: 100%;
  padding: 6px 10px 7px 8px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  overflow-wrap: break-word;
  hyphens: auto;
}
/* a title under a name, the way it reads at a table (ItemZoom nameUnder, /vip) */
.sc-plaque.iz-named { padding: 8px 6px; }
.iz-plate { display: grid; justify-items: center; gap: 5px; max-width: 100%; }
.iz-nick { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; color: #f3ead9; font-size: 12.5px; line-height: 1.1; }
.iz-nick b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.iz-nick .vip-badge { flex: none; transform: scale(0.82); transform-origin: left center; margin-right: -4px; }
.sc-plaque.iz-named .cos-title { font-size: 11.5px; padding: 4px 8px 5px 7px; }
.sc-add {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  min-height: 100%;
  aspect-ratio: auto;
  padding: 10px 6px;
  border: 1px dashed var(--line-2);
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.sc-add .ico { width: 22px; height: 22px; color: var(--gold); }
.sc-add:hover, .sc-add:focus-visible { color: var(--ink); border-color: var(--gold); background: var(--surface); }
.sc-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
}
.sc-rar { font-size: 10px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--rar); }
.sc-card.is-zoomed .sc-art { visibility: hidden; }
.sc-card.is-leaving { animation: sc-leave 240ms var(--ease) forwards; pointer-events: none; }
@keyframes sc-leave { to { opacity: 0; transform: scale(0.82); } }

.sc-empty { display: grid; justify-items: center; gap: 12px; padding: var(--space-5, 28px) var(--card-pad, 20px); text-align: center; }
.sc-empty p { margin: 0; max-width: 44ch; color: var(--muted); font-size: 14px; }
.sc-empty-shelf { display: flex; gap: 8px; }
.sc-empty-shelf i { width: 42px; height: 42px; border-radius: 10px; border: 1px dashed var(--line-2); background: var(--field, transparent); }
.sc-empty-shelf i:nth-child(2) { transform: translateY(-6px); border-color: var(--gold); opacity: 0.8; }

html.sc-lock { overflow: hidden; }

/* zoom — public/js/item-zoom.js (profile showcase and /vip); profile.css is on every page */
dialog.sc-zoom {
  --S: min(400px, 56vh, 40vw);
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: hidden;
}
dialog.sc-zoom::backdrop { background: transparent; }
.sc-zoom-veil {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 38% 45%, color-mix(in srgb, var(--rar) 16%, rgba(8, 6, 10, 0.7)), rgba(4, 3, 6, 0.88) 70%);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
}
.sc-zoom-sheet {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 380px);
  align-items: center;
  justify-content: center;
  gap: 48px;
  height: 100%;
  padding: 32px;
  pointer-events: none;
}
.sc-zoom-sheet > * { pointer-events: auto; }
.sc-zoom-grab { display: none; }
.sc-zoom-x { position: fixed; top: 16px; right: 16px; z-index: 3; background: rgba(10, 8, 12, 0.5); color: #f3ead9; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset; }
.sc-zoom-x:hover { background: rgba(10, 8, 12, 0.75); color: #fff; }
.sc-zoom-stage { position: relative; display: grid; place-items: center; width: var(--S); height: var(--S); perspective: 1000px; }
.sc-zoom-rays {
  position: absolute;
  inset: -28%;
  z-index: -1;
  background: conic-gradient(from 0deg, transparent, color-mix(in srgb, var(--rar) 26%, transparent) 8%, transparent 16%, transparent 33%, color-mix(in srgb, var(--rar) 20%, transparent) 42%, transparent 50%, transparent 66%, color-mix(in srgb, var(--rar) 24%, transparent) 75%, transparent 84%);
  -webkit-mask: radial-gradient(circle, #000 25%, transparent 68%);
  mask: radial-gradient(circle, #000 25%, transparent 68%);
  animation: spin-slow 22s linear infinite;
  pointer-events: none;
}
.sc-zoom-fly { width: 100%; height: 100%; transform-origin: 50% 50%; }
.sc-zoom-tilt {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--rar) 24%, transparent), transparent 70%),
    #0c0a10;
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--rar) 70%, transparent), 0 0 70px color-mix(in srgb, var(--rar) 30%, transparent), 0 30px 60px rgba(0, 0, 0, 0.55);
  transition: transform 220ms ease-out;
}
.sc-zoom-art { position: absolute; left: 0; top: 0; display: grid; transform-origin: 0 0; }
.sc-zoom-art > * { grid-area: 1 / 1; width: 100%; height: 100%; }
.sc-zoom-art .thumb { min-height: 0; background: transparent; }
.sc-zoom-art .thumb--plaque img { object-fit: contain; padding: 16% 6%; }
.sc-zoom-shine {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at var(--gx, 50%) var(--gy, 30%), rgba(255, 255, 255, 0.26), transparent 46%),
    linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.07) 50%, transparent 62%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 260ms ease;
  pointer-events: none;
}
.sc-zoom-tilt.is-lit .sc-zoom-shine { opacity: 1; }
.sc-zoom-info {
  display: grid;
  align-content: start;
  gap: 10px;
  max-height: calc(100dvh - 64px);
  overflow: auto;
  padding: 26px 26px 22px;
  border-radius: var(--r-xl);
  background: color-mix(in srgb, var(--surface-solid) 94%, transparent);
  border: 1px solid var(--line-2);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
/* centred like the inventory item dialog: facts as a compact table around the axis, buttons centred */
.sc-zoom-info { justify-items: center; text-align: center; }
.sc-zoom-eyebrow { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; margin: 0; font-size: 11.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.sc-zoom-rar { color: var(--rar); }
.sc-zoom-slot { color: var(--muted); }
.sc-zoom-name { margin: 0; font-size: 34px; line-height: 1.05; }
.sc-zoom-desc { margin: 0; color: var(--ink-2); }
.sc-zoom-meta { display: grid; grid-template-columns: auto minmax(0, auto); justify-content: center; gap: 7px 14px; margin: 4px 0 0; font-size: 14px; text-align: left; }
.sc-zoom-meta dt { color: var(--muted); text-align: right; }
.sc-zoom-meta dd { margin: 0; }
.sc-zoom-hint { margin: 0; color: var(--muted); font-size: 13px; }
.sc-zoom-desc, .sc-zoom-hint { justify-self: stretch; text-align: justify; text-align-last: center; -webkit-hyphens: auto; hyphens: auto; }
.sc-zoom-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }
.sc-zoom-actions .ico { width: 16px; height: 16px; }
@media (max-width: 560px) { .sc-zoom-actions > .btn-ghost { flex: 1 1 auto; } }
.sc-zoom .cos-fx { position: fixed; }

/* picker */
dialog.sc-pick { width: min(760px, calc(100vw - 24px)); }
.sc-pick-box { grid-template-rows: auto auto auto auto minmax(0, 1fr) auto; max-height: calc(100dvh - 40px); }
.sc-pick-box .dialog-text { margin: 0; }
.sc-pick-chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: thin; }
.sc-pick-chips .fchip { flex: none; height: 32px; padding: 0 12px; font-size: 13px; }
.sc-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; min-height: 140px; overflow: auto; padding: 4px; align-content: start; }
.sc-opt {
  position: relative;
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 5px 5px 7px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--rar) 35%, transparent) inset;
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: box-shadow var(--dur-2) var(--ease), opacity var(--dur-2) var(--ease);
}
.sc-opt .sc-name { font-size: 11.5px; }
.sc-opt .sc-plaque .cos-title { font-size: 12px; padding: 4px 7px; }
.sc-opt[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--gold) inset, 0 0 18px rgba(217, 183, 122, 0.28); }
.sc-opt.is-full { opacity: 0.5; }
.sc-opt-n {
  position: absolute;
  top: 2px;
  left: 2px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gold);
  color: #1a1208;
  font-size: 12.5px;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.sc-opt-n:empty { display: none; }
.sc-pick-foot { align-items: center; }
.sc-pick-count { margin-right: auto; color: var(--muted); font-weight: 700; }

@media (max-width: 760px) {
  .sc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  dialog.sc-zoom { --S: min(64vw, 34dvh, 300px); }
  .sc-zoom-sheet { grid-template-columns: minmax(0, 1fr); align-content: end; justify-items: center; gap: 14px; padding: 12px 12px max(12px, env(safe-area-inset-bottom)); }
  .sc-zoom-grab { display: block; width: 64px; height: 22px; margin-bottom: -6px; touch-action: none; cursor: grab; background: linear-gradient(rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.45)) center / 40px 4px no-repeat; border-radius: 4px; }
  .sc-zoom-stage { touch-action: none; }
  .sc-zoom-x { top: 10px; right: 10px; }
  .sc-zoom-info { width: 100%; max-height: calc(100dvh - var(--S) - 74px); padding: 18px 18px 16px; border-radius: 22px; gap: 8px; }
  .sc-zoom-name { font-size: 28px; }
  .sc-zoom-meta { font-size: 13.5px; }
  .sc-pick-box { padding: 22px 16px 18px; gap: 12px; }
  .sc-pick-box .dialog-title { font-size: 26px; }
  .sc-pick-box .dialog-text { font-size: 14px; }
  .sc-pick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .sc-pick-foot .btn { flex: 1 1 auto; }
  .sc-pick-count { flex-basis: 100%; }
}
@media (max-width: 380px) {
  .sc-grid { gap: 8px; }
  .sc-card { padding: 5px 5px 8px; }
  .sc-plaque .cos-title { font-size: 12.5px; padding: 5px 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .sc-card, .sc-zoom-tilt { transition: none; }
  .sc-zoom-rays { animation: none; }
}
