/* ==========================================================================
   app.css - shell, design tokens and Profile tab (owner: C12)
   Tab modules: use the tokens below and scope your own CSS with your tab
   prefix (.op- .mg- .eg- ...). Never restyle .app-* / .pf-* from a tab.
   ========================================================================== */

/* ---------------------------------------------------------------- tokens */
:root {
  --bg: #f3f4f8;
  --bg-glow-1: rgba(129, 182, 76, .16);
  --bg-glow-2: rgba(124, 92, 246, .10);
  --surface: #ffffff;
  --surface-2: #eef0f5;
  --surface-3: #e2e5ed;
  --text: #161920;
  --text-2: #5b6273;
  --text-3: #8a90a0;
  --border: rgba(22, 25, 32, .09);
  --border-strong: rgba(22, 25, 32, .16);
  --accent: #6aa63a;
  --accent-2: #81b64c;
  --accent-deep: #4f8228;
  --accent-ink: #ffffff;
  --accent-soft: rgba(106, 166, 58, .14);
  --good: #3c9a48;
  --bad: #e0504a;
  --warn: #e39a1c;
  --info: #3f7ae0;
  --gold: #f2b230;
  --gold-deep: #c98410;
  --purple: #7c5cf6;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow-1: 0 1px 2px rgba(16, 20, 30, .06), 0 2px 8px rgba(16, 20, 30, .05);
  --shadow-2: 0 10px 30px rgba(16, 20, 30, .12), 0 2px 6px rgba(16, 20, 30, .06);
  --shadow-3: 0 24px 60px rgba(16, 20, 30, .22);
  --font: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --motion: 1;                 /* animation speed multiplier, set by the shell */
  --rail-w: 236px;
  --nav-h: 66px;
  --topbar-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111216;
    --bg-glow-1: rgba(129, 182, 76, .10);
    --bg-glow-2: rgba(124, 92, 246, .10);
    --surface: #1b1d23;
    --surface-2: #24272f;
    --surface-3: #30343e;
    --text: #f2f3f6;
    --text-2: #a3a9b7;
    --text-3: #757b89;
    --border: rgba(255, 255, 255, .07);
    --border-strong: rgba(255, 255, 255, .14);
    --accent: #81b64c;
    --accent-2: #9bd060;
    --accent-deep: #5d8a35;
    --accent-ink: #ffffff;
    --accent-soft: rgba(129, 182, 76, .16);
    --good: #6cc070;
    --bad: #f0645d;
    --warn: #f2b134;
    --info: #6b9cff;
    --purple: #9a80ff;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 10px rgba(0, 0, 0, .2);
    --shadow-2: 0 12px 34px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
    --shadow-3: 0 24px 70px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111216;
  --bg-glow-1: rgba(129, 182, 76, .10);
  --bg-glow-2: rgba(124, 92, 246, .10);
  --surface: #1b1d23;
  --surface-2: #24272f;
  --surface-3: #30343e;
  --text: #f2f3f6;
  --text-2: #a3a9b7;
  --text-3: #757b89;
  --border: rgba(255, 255, 255, .07);
  --border-strong: rgba(255, 255, 255, .14);
  --accent: #81b64c;
  --accent-2: #9bd060;
  --accent-deep: #5d8a35;
  --accent-ink: #ffffff;
  --accent-soft: rgba(129, 182, 76, .16);
  --good: #6cc070;
  --bad: #f0645d;
  --warn: #f2b134;
  --info: #6b9cff;
  --purple: #9a80ff;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 10px rgba(0, 0, 0, .2);
  --shadow-2: 0 12px 34px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
  --shadow-3: 0 24px 70px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  background-image:
    radial-gradient(1000px 520px at 0% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(900px 520px at 110% 0%, var(--bg-glow-2), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 900; letter-spacing: -.01em; }
p { margin: 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; border-radius: 10px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.noscript { padding: 24px; text-align: center; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- boot */
.boot { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--text-2); }
.boot-logo {
  width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; font-size: 44px; color: #fff;
  background: linear-gradient(145deg, var(--accent-2), var(--accent-deep));
  box-shadow: 0 6px 0 var(--accent-deep), var(--shadow-2);
  animation: app-bob calc(1.4s * var(--motion)) var(--ease) infinite alternate;
}
.boot-text { font-weight: 700; }

/* ---------------------------------------------------------------- layout */
.app { min-height: 100vh; min-height: 100dvh; overflow-x: clip; }
.app-shell { display: block; min-height: 100vh; min-height: 100dvh; }

.app-topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.app-brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: var(--text); }
.app-logo {
  flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  font-size: 23px; line-height: 1; color: #fff;
  background: linear-gradient(145deg, var(--accent-2), var(--accent-deep));
  box-shadow: 0 3px 0 var(--accent-deep);
}
.app-brand-name { font-weight: 900; font-size: 19px; letter-spacing: -.02em; white-space: nowrap; }
.app-brand-name small { display: block; font-size: 11px; font-weight: 700; color: var(--text-2); letter-spacing: .02em; margin-top: 1px; }
.app-topbar-title { font-weight: 900; font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-topbar .app-brand-name small { display: none; }
.app-spacer { flex: 1; }

.app-iconbtn {
  flex: none; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); display: grid; place-items: center; padding: 0;
  box-shadow: var(--shadow-1);
  transition: transform calc(.15s * var(--motion)) var(--ease), background .2s;
}
.app-iconbtn:hover { background: var(--surface-2); }
.app-iconbtn:active { transform: scale(.94); }
.app-iconbtn svg { width: 20px; height: 20px; }

.app-userchip {
  flex: none; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 4px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); box-shadow: var(--shadow-1);
  font-weight: 800; font-size: 14px; max-width: 46vw;
}
.app-userchip .app-uname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.app-userchip.is-empty { padding: 0 12px; }
@media (max-width: 480px) {
  .app-topbar .app-userchip:not(.is-empty) { padding: 0 3px; width: 40px; justify-content: center; }
  .app-topbar .app-userchip:not(.is-empty) .app-uname { display: none; }
}

.app-avatar {
  flex: none; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--purple), var(--accent)); color: #fff; font-weight: 900; font-size: 14px;
}
.app-avatar img { width: 100%; height: 100%; object-fit: cover; }

.app-main { position: relative; padding: 14px 16px calc(var(--nav-h) + var(--safe-b) + 28px); min-width: 0; }
.app-main-inner { max-width: 1120px; margin: 0 auto; min-width: 0; }
.app-hud-slot:empty { display: none; }
.app-hud-slot { margin-bottom: 12px; }
.app-panels { position: relative; min-width: 0; }
.app-panel { min-width: 0; }
.app-panel:focus { outline: none; }

/* bottom tab bar (mobile) */
.app-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 6px 8px var(--safe-b);
  display: flex; align-items: stretch; justify-content: space-around; gap: 4px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(18px);
  backdrop-filter: saturate(1.5) blur(18px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .06);
}
.app-nav-ind {
  position: absolute; left: 0; top: 0; width: 0; height: 0; border-radius: 16px;
  background: var(--accent-soft);
  transition: transform calc(.38s * var(--motion)) var(--spring), width calc(.38s * var(--motion)) var(--spring), height calc(.38s * var(--motion)) var(--spring), opacity .2s;
  pointer-events: none; opacity: 0;
}
.app-nav-ind.is-ready { opacity: 1; }
.app-nav-item {
  position: relative; z-index: 1; flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border-radius: 16px; text-decoration: none; color: var(--text-2);
  font-weight: 800; font-size: 11.5px; letter-spacing: .01em;
  -webkit-tap-highlight-color: transparent;
  transition: color .2s;
}
.app-nav-item .app-nav-ico { width: 26px; height: 26px; display: grid; place-items: center; transition: transform calc(.35s * var(--motion)) var(--spring); }
.app-nav-item .app-nav-ico svg { width: 24px; height: 24px; }
.app-nav-item:hover { color: var(--text); }
.app-nav-item[aria-current="page"] { color: var(--accent); }
.app-nav-item[aria-current="page"] .app-nav-ico { transform: translateY(-1px); }
.app-nav-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-nav-dot { position: absolute; top: 6px; right: calc(50% - 20px); width: 9px; height: 9px; border-radius: 50%; background: var(--bad); border: 2px solid var(--surface); }

.app-rail-head, .app-rail-foot { display: none; }

/* desktop: left rail */
@media (min-width: 900px) {
  .app-shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .app-topbar { display: none; }
  .app-nav {
    position: sticky; top: 0; left: auto; right: auto; bottom: auto;
    height: 100vh; height: 100dvh;
    flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 4px;
    padding: 18px 14px;
    background: color-mix(in srgb, var(--surface) 70%, transparent);
    border-top: 0; border-right: 1px solid var(--border);
    box-shadow: none;
  }
  .app-rail-head { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
  .app-rail-foot { display: flex; flex-direction: column; gap: 10px; margin-top: auto; padding-top: 12px; }
  .app-nav-item {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 12px;
    height: 50px; padding: 0 14px; font-size: 15.5px; border-radius: 14px;
  }
  .app-nav-item .app-nav-ico svg { width: 23px; height: 23px; }
  .app-nav-item[aria-current="page"] .app-nav-ico { transform: scale(1.08); }
  .app-nav-dot { top: 12px; right: auto; left: 34px; }
  .app-nav-ind { border-radius: 14px; }
  .app-main { padding: 26px 32px 48px; }
  .app-rail-foot .app-userchip { flex: 1 1 auto; min-width: 0; width: auto; max-width: none; height: 52px; border-radius: 16px; padding: 0 12px 0 8px; }
  .app-rail-foot .app-userchip .app-avatar { width: 36px; height: 36px; }
  .app-rail-foot .app-userchip .app-uname { flex: 1; text-align: left; }
  .app-rail-foot-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .app-rail-foot-row .app-iconbtn { height: 52px; width: 46px; border-radius: 16px; }
}
/* C85 (FRESH_EYES_2 #8): small windows / tablets in landscape keep the words next to the icons (a narrower rail, not icons only) */
@media (min-width: 900px) and (max-width: 1080px) {
  :root { --rail-w: 200px; }
  .app-rail-head { padding: 4px 6px 18px; }
  .app-nav { padding: 16px 10px; }
  .app-nav-item { padding: 0 12px; gap: 10px; height: 48px; font-size: 14.5px; }
  .app-nav-dot { left: 30px; }
}

/* panel transitions */
@keyframes app-in-right { from { opacity: 0; transform: translate3d(28px, 0, 0); } to { opacity: 1; transform: none; } }
@keyframes app-in-left  { from { opacity: 0; transform: translate3d(-28px, 0, 0); } to { opacity: 1; transform: none; } }
@keyframes app-in-up    { from { opacity: 0; transform: translate3d(0, 14px, 0) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes app-fade     { from { opacity: 0; } to { opacity: 1; } }
@keyframes app-pop      { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
@keyframes app-bob      { from { transform: translateY(0) rotate(-4deg); } to { transform: translateY(-8px) rotate(4deg); } }
@keyframes app-shake    { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
@keyframes app-stripes  { from { background-position: 0 0; } to { background-position: 40px 0; } }
@keyframes app-spin     { to { transform: rotate(360deg); } }
@keyframes app-shimmer  { from { background-position: -200% 0; } to { background-position: 200% 0; } }
@keyframes app-float    { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.app-panel.enter-right { animation: app-in-right calc(.34s * var(--motion)) var(--ease) both; }
.app-panel.enter-left  { animation: app-in-left calc(.34s * var(--motion)) var(--ease) both; }
.app-panel.enter-up    { animation: app-in-up calc(.36s * var(--motion)) var(--ease) both; }

/* ---------------------------------------------------------------- controls */
.btn {
  --btn-bg: var(--surface-2); --btn-fg: var(--text); --btn-sh: var(--surface-3);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 14px; border: 0;
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 800; font-size: 15.5px; letter-spacing: .01em; line-height: 1.1; text-decoration: none; white-space: nowrap;
  box-shadow: 0 4px 0 var(--btn-sh);
  transform: translateY(0);
  transition: transform calc(.12s * var(--motion)) var(--ease), box-shadow calc(.12s * var(--motion)) var(--ease), filter .2s, background .2s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--btn-sh); }
.btn[disabled], .btn.is-disabled { opacity: .55; cursor: not-allowed; filter: saturate(.4); transform: none; }
.btn svg { width: 19px; height: 19px; flex: none; }
.btn-primary { --btn-bg: var(--accent); --btn-fg: var(--accent-ink); --btn-sh: var(--accent-deep); text-shadow: 0 1px 0 rgba(0, 0, 0, .18); }
.btn-gold { --btn-bg: var(--gold); --btn-fg: #3a2606; --btn-sh: var(--gold-deep); }
.btn-danger { --btn-bg: var(--bad); --btn-fg: #fff; --btn-sh: color-mix(in srgb, var(--bad) 70%, #000); }
.btn-ghost { --btn-bg: transparent; --btn-sh: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost:active { transform: scale(.97); box-shadow: none; }
.btn-sm { min-height: 36px; padding: 7px 13px; font-size: 14px; border-radius: 11px; box-shadow: 0 3px 0 var(--btn-sh); }
.btn-sm:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--btn-sh); }
.btn-lg { min-height: 54px; padding: 14px 24px; font-size: 17px; border-radius: 16px; }
.btn-block { width: 100%; }

.input {
  width: 100%; min-height: 50px; padding: 12px 16px; border-radius: 14px;
  border: 2px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 700; font-size: 16px;
  transition: border-color .2s, box-shadow .2s;
}
.input::placeholder { color: var(--text-3); font-weight: 600; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input.is-error { border-color: var(--bad); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 18%, transparent); }
.shake { animation: app-shake calc(.42s * var(--motion)) var(--ease); }

/* switch */
.switch { position: relative; flex: none; width: 52px; height: 30px; border-radius: 999px; border: 0; padding: 0; background: var(--surface-3); transition: background calc(.2s * var(--motion)); }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .25);
  transition: transform calc(.28s * var(--motion)) var(--spring);
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(22px); }

/* segmented */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); max-width: 100%; }
.seg button {
  border: 0; background: transparent; color: var(--text-2); min-height: 34px; padding: 6px 12px; border-radius: 10px;
  font-weight: 800; font-size: 13.5px; white-space: nowrap;
  transition: background .2s, color .2s, box-shadow .2s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"], .seg button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 6px 12px; border-radius: 999px;
  border: 2px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-weight: 800; font-size: 13.5px;
  transition: all .18s;
}
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.chip .chip-n { font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }

/* cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-1); padding: 18px; min-width: 0;
}
.card, .pf-hero { scroll-margin-top: calc(var(--topbar-h) + 12px); }
@media (min-width: 900px) { .card, .pf-hero { scroll-margin-top: 16px; } }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-width: 0; }
.card-head h2 { font-size: 19px; }
.card-head .card-sub { color: var(--text-2); font-size: 13.5px; font-weight: 700; }
.card-ico {
  flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 19px;
  background: linear-gradient(145deg, var(--accent-2), var(--accent-deep));
}
.card-ico svg { width: 21px; height: 21px; }
.card-ico.is-gold { background: linear-gradient(145deg, #ffcf5c, var(--gold-deep)); }
.card-ico.is-purple { background: linear-gradient(145deg, #a88bff, #5b3fd6); }
.card-ico.is-red { background: linear-gradient(145deg, #ff8a7a, #c8362f); }
.card-ico.is-blue { background: linear-gradient(145deg, #7fb0ff, #2f5fc8); }
.card-ico.is-gray { background: linear-gradient(145deg, #9aa1b0, #5a6070); }
.muted { color: var(--text-2); }
.small { font-size: 13.5px; }

/* ---------------------------------------------------------------- toasts */
.app-toasts {
  position: fixed; z-index: 100010; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + var(--safe-b) + 14px);
  width: min(440px, calc(100vw - 32px));
  display: flex; flex-direction: column-reverse; gap: 8px; pointer-events: none;
}
@media (min-width: 900px) { .app-toasts { bottom: 24px; left: calc(50% + var(--rail-w) / 2); } }
.app-toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 16px;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-3); font-weight: 700; font-size: 14.5px;
  animation: app-in-up calc(.3s * var(--motion)) var(--spring) both;
}
.app-toast.is-leaving { opacity: 0; transform: translateY(8px); transition: all calc(.25s * var(--motion)) var(--ease); }
.app-toast-ico { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 900; color: #fff; background: var(--info); }
.app-toast[data-kind="success"] .app-toast-ico { background: var(--good); }
.app-toast[data-kind="warn"] .app-toast-ico { background: var(--warn); }
.app-toast[data-kind="error"] .app-toast-ico { background: var(--bad); }
.app-toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; padding-top: 1px; }

/* ---------------------------------------------------------------- modal */
.app-modal {
  position: fixed; inset: 0; z-index: 100005; display: grid; place-items: center; padding: 16px;
  background: rgba(10, 12, 18, .55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: app-fade calc(.2s * var(--motion)) ease-out both;
}
.app-modal-card {
  width: min(420px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--surface); color: var(--text); border-radius: 22px; padding: 22px; box-shadow: var(--shadow-3);
  border: 1px solid var(--border);
  animation: app-pop calc(.32s * var(--motion)) var(--spring) both;
}
.app-modal-card h3 { font-size: 21px; margin-bottom: 8px; }
.app-modal-card p { color: var(--text-2); font-weight: 600; }
.app-modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.app-modal.is-leaving { opacity: 0; transition: opacity calc(.18s * var(--motion)); }

/* ---------------------------------------------------------------- onboarding */
.app-onb {
  position: fixed; inset: 0; z-index: 100000; overflow-y: auto; overflow-x: hidden;
  display: grid; place-items: center; padding: 24px 16px;
  background: var(--bg);
  background-image:
    radial-gradient(700px 420px at 15% 0%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 65%),
    radial-gradient(700px 460px at 100% 100%, color-mix(in srgb, var(--purple) 24%, transparent), transparent 65%);
  animation: app-fade calc(.3s * var(--motion)) ease-out both;
}
.app-onb.is-leaving { opacity: 0; transform: scale(1.03); transition: opacity calc(.35s * var(--motion)) var(--ease), transform calc(.35s * var(--motion)) var(--ease); }
.app-onb-card {
  position: relative; width: min(460px, 100%); text-align: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--border);
  border-radius: 28px; padding: 30px 22px 22px; box-shadow: var(--shadow-3);
  animation: app-in-up calc(.5s * var(--motion)) var(--spring) both;
}
.app-onb-pieces { position: relative; height: 92px; margin: -6px auto 12px; width: 220px; }
.app-onb-pieces span {
  position: absolute; bottom: 0; display: grid; place-items: center; border-radius: 20px; color: #fff;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .18), var(--shadow-2);
  animation: app-float calc(3s * var(--motion)) ease-in-out infinite;
}
.app-onb-pieces span:nth-child(1) { left: 0; width: 58px; height: 58px; font-size: 36px; background: linear-gradient(145deg, #a88bff, #5b3fd6); transform: rotate(-10deg); animation-delay: -.6s; }
.app-onb-pieces span:nth-child(2) { left: 66px; width: 88px; height: 88px; font-size: 58px; background: linear-gradient(145deg, var(--accent-2), var(--accent-deep)); z-index: 1; }
.app-onb-pieces span:nth-child(3) { right: 0; width: 58px; height: 58px; font-size: 36px; background: linear-gradient(145deg, #ffcf5c, var(--gold-deep)); animation-delay: -1.4s; }
.app-onb h1 { font-size: clamp(26px, 7vw, 32px); margin-bottom: 8px; }
.app-onb-lead { color: var(--text-2); font-weight: 700; font-size: 16px; margin: 0 auto 20px; max-width: 34ch; }
.app-onb-perks { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 8px; text-align: left; }
.app-onb-perks li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); font-weight: 700; font-size: 14.5px; }
.app-onb-perks li b { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: var(--surface); }
.app-onb form { display: grid; gap: 10px; }
.app-onb label { text-align: left; font-weight: 800; font-size: 14px; color: var(--text-2); }
.app-onb-err { min-height: 20px; font-weight: 700; font-size: 13.5px; color: var(--bad); text-align: left; }
.app-onb-skip { margin-top: 8px; }
.app-onb-note { margin-top: 10px; color: var(--text-3); font-size: 12.5px; font-weight: 600; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: app-spin .8s linear infinite; }

/* ---------------------------------------------------------------- placeholder tab */
.ph-wrap { display: grid; place-items: center; min-height: 52vh; text-align: center; padding: 20px 0; }
.ph-card { max-width: 440px; }
.ph-ico { width: 84px; height: 84px; margin: 0 auto 16px; border-radius: 26px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, var(--accent-2), var(--accent-deep)); box-shadow: 0 6px 0 var(--accent-deep); animation: app-float calc(3s * var(--motion)) ease-in-out infinite; }
.ph-ico svg { width: 44px; height: 44px; }
.ph-card h2 { font-size: 26px; margin-bottom: 8px; }
.ph-card p { color: var(--text-2); font-weight: 600; margin-bottom: 18px; }

/* ==========================================================================
   Profile tab (.pf-)
   ========================================================================== */
.pf { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) {
  .pf { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .pf-span { grid-column: 1 / -1; }
  .pf-col { display: grid; gap: 16px; min-width: 0; }
}
.pf-col { display: grid; gap: 16px; min-width: 0; }

.pf-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pf-title h1 { font-size: clamp(26px, 6vw, 34px); }
.pf-title p { color: var(--text-2); font-weight: 700; }

/* hero / player card */
.pf-hero {
  position: relative; overflow: hidden; border-radius: 26px; padding: 20px; color: #fff;
  background:
    radial-gradient(420px 260px at 100% 0%, rgba(255, 255, 255, .18), transparent 60%),
    linear-gradient(135deg, #3d6e1f 0%, #5b9a32 38%, #5b3fd6 100%);
  box-shadow: var(--shadow-2);
  isolation: isolate;
}
.pf-hero::after {
  content: "\265E"; position: absolute; right: -18px; bottom: -58px; font-size: 230px; line-height: 1; color: rgba(255, 255, 255, .08);
  z-index: -1; pointer-events: none; transform: rotate(-8deg);
}
.pf-hero-top { display: flex; align-items: center; gap: 16px; min-width: 0; }
.pf-ava-wrap { position: relative; flex: none; width: 92px; height: 92px; }
.pf-ava-ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--gold) calc(var(--p, 0) * 1%), rgba(255, 255, 255, .22) 0); }
.pf-ava {
  position: absolute; inset: 5px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: linear-gradient(145deg, #a88bff, #3d6e1f); border: 3px solid rgba(0, 0, 0, .18);
  font-size: 34px; font-weight: 900; color: #fff;
}
.pf-ava img { width: 100%; height: 100%; object-fit: cover; }
.pf-lvl {
  position: absolute; right: -4px; bottom: -2px; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 999px;
  display: grid; place-items: center; font-weight: 900; font-size: 15px; color: #3a2606;
  background: linear-gradient(145deg, #ffd66b, var(--gold-deep)); border: 3px solid #2c4d18; box-shadow: 0 3px 8px rgba(0, 0, 0, .3);
}
.pf-id { min-width: 0; flex: 1; }
.pf-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.pf-name h2 { font-size: clamp(21px, 5.6vw, 28px); overflow-wrap: anywhere; min-width: 0; }
.pf-badge-title { padding: 2px 7px; border-radius: 6px; background: #7c2d12; color: #fff; font-weight: 900; font-size: 13px; letter-spacing: .03em; }
.pf-flag { width: 26px; height: 19px; border-radius: 4px; overflow: hidden; box-shadow: 0 0 0 1px rgba(0, 0, 0, .2); background: rgba(255, 255, 255, .2); display: grid; place-items: center; font-size: 10px; font-weight: 900; }
.pf-flag img { width: 100%; height: 100%; object-fit: cover; }
.pf-sub { margin-top: 3px; font-weight: 700; font-size: 14px; color: rgba(255, 255, 255, .82); display: flex; gap: 6px 12px; flex-wrap: wrap; }
.pf-sub a { color: #fff; }
.pf-rank { margin-top: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 800; font-size: 14px; }
.pf-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(0, 0, 0, .22); font-weight: 800; font-size: 13px; color: #fff; white-space: nowrap; }
.pf-xp { margin-top: 16px; }
.pf-xp-row { display: flex; justify-content: space-between; gap: 8px; font-weight: 800; font-size: 13px; color: rgba(255, 255, 255, .88); margin-bottom: 6px; }
.pf-bar { height: 12px; border-radius: 999px; background: rgba(0, 0, 0, .25); overflow: hidden; }
.pf-bar > i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #ffe08a, var(--gold)); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15); transition: width calc(.9s * var(--motion)) var(--ease); }
.pf-ratings { margin-top: 16px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pf-rating {
  min-width: 0; padding: 10px 8px; border-radius: 16px; background: rgba(0, 0, 0, .2); text-align: center;
  border: 2px solid transparent;
}
.pf-rating.is-main { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .35); }
.pf-rating-ico { font-size: 18px; line-height: 1; }
.pf-rating b { display: block; font-size: 21px; font-weight: 900; line-height: 1.15; margin-top: 4px; }
.pf-rating span { display: block; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: rgba(255, 255, 255, .78); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-rating small { display: block; font-size: 11px; font-weight: 700; color: rgba(255, 255, 255, .65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-stats { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.pf-hero-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.pf-hero .btn-glass { --btn-bg: rgba(255, 255, 255, .16); --btn-fg: #fff; --btn-sh: rgba(0, 0, 0, .22); }
.pf-skel { display: inline-block; height: 1em; width: 6em; border-radius: 6px; background: linear-gradient(90deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .3), rgba(255, 255, 255, .12)); background-size: 200% 100%; animation: app-shimmer 1.4s linear infinite; vertical-align: middle; }
@media (max-width: 420px) {
  .pf-hero { padding: 16px; border-radius: 22px; }
  .pf-ava-wrap { width: 76px; height: 76px; }
  .pf-ava { font-size: 28px; }
  .pf-ratings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.pf-switch { display: grid; gap: 8px; margin-top: 14px; }
.pf-switch-row { display: flex; gap: 8px; }
.pf-switch-row .input { min-height: 46px; background: rgba(255, 255, 255, .95); color: #161920; border-color: transparent; }
.pf-switch .app-onb-err { color: #ffd4d1; }

/* analyze */
.pf-an-opts { display: grid; gap: 12px; margin-bottom: 16px; }
.pf-an-opt { display: grid; gap: 6px; }
.pf-an-opt > span { font-weight: 800; font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.pf-an-chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* game modes in the review (C71): Profile > Your stats, first-time setup, player feed */
.pf-modes { display: grid; gap: 8px; margin: 12px 0 6px; min-width: 0; }
.pf-modes-h { font-weight: 800; font-size: 14px; color: var(--text); }
.pf-modes .pf-an-chips { gap: 8px; }
.chip.pf-mode { min-height: 44px; padding: 8px 14px; font-size: 14px; display: inline-flex; align-items: center; }
.pf-mode-n { font-weight: 700; color: var(--text-3); white-space: nowrap; }
.chip.pf-mode[aria-pressed="true"] .pf-mode-n { color: var(--text-2); }
.chip.pf-mode[aria-pressed="true"]::before { content: "✓"; margin-right: 6px; font-weight: 900; color: var(--tab-accent, var(--accent)); }
.pf-modes .pf-an-note { margin: 0; }
/* C104: the modes + "Games per mode" right above every import / analyse button (Profile, Add a profile, Find a player, welcome) */
.imp-choice { display: grid; gap: 8px; margin: 4px 0 12px; padding: 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; text-align: left; }
.imp-choice .pf-modes { margin: 0; }
.imp-choice .chip.pf-mode { background: var(--surface); }
.imp-per { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.imp-per-h { font-weight: 800; font-size: 14px; color: var(--text); }
.imp-per .seg { flex: none; }
.imp-per .seg button { min-height: 40px; min-width: 52px; font-variant-numeric: tabular-nums; }
.imp-why { margin: 0; font-size: 13.5px; font-weight: 800; color: var(--text); line-height: 1.4; }
.imp-plan, .imp-found { margin: 0; font-size: 13px; font-weight: 700; color: var(--text-2); line-height: 1.4; }
.pf-addconf { display: grid; gap: 8px; min-width: 0; }
.pf-addconf-who { margin: 0; font-size: 15px; font-weight: 700; color: var(--text-2); }
.pf-addconf-who b { color: var(--text); font-weight: 900; }
.pf-addconf .imp-choice { margin: 0; }
.pf-addconf-back { justify-self: start; }
.app-onb .imp-choice { margin: 2px 0 10px; }
.app-onb .imp-choice .chip.pf-mode { min-height: 40px; padding: 6px 11px; font-size: 13.5px; }
.pf-an-last { margin-top: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--text-2); font-weight: 700; font-size: 13.5px; }
.pf-prog { display: grid; gap: 12px; }
.pf-prog-top { display: flex; align-items: center; gap: 14px; }
.pf-prog-pct { font-size: 40px; font-weight: 900; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; min-width: 3ch; }
.pf-prog-label { font-weight: 800; min-width: 0; overflow-wrap: anywhere; }
.pf-prog-detail { color: var(--text-2); font-weight: 700; font-size: 13.5px; }
.pf-prog-bar { height: 18px; border-radius: 999px; background: var(--surface-2); overflow: hidden; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .08); }
.pf-prog-bar > i {
  display: block; height: 100%; width: 2%; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .22) 0 10px, transparent 10px 20px), linear-gradient(90deg, var(--accent-2), var(--accent));
  background-size: 40px 100%, 100% 100%;
  animation: app-stripes calc(.8s * var(--motion)) linear infinite;
  transition: width calc(.5s * var(--motion)) var(--ease);
}
.pf-prog-bar.is-indet > i { width: 35% !important; animation: app-stripes .8s linear infinite, pf-indet 1.4s ease-in-out infinite; }
@keyframes pf-indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.pf-prog-steps { display: flex; gap: 6px; flex-wrap: wrap; }
.pf-step { padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-3); font-weight: 800; font-size: 12.5px; }
.pf-step.is-on { background: var(--accent-soft); color: var(--accent); }
.pf-step.is-done { color: var(--text-2); }
.pf-step.is-done::before { content: "\2713  "; color: var(--good); }
.pf-soon { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); font-weight: 700; color: var(--text-2); margin-top: 12px; }

/* weaknesses */
.pf-acc { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.pf-acc-item {
  border: 0; border-radius: 16px; padding: 12px 8px 10px; background: var(--surface-2); text-align: center; min-width: 0;
  transition: transform calc(.15s * var(--motion)) var(--ease), background .2s;
}
.pf-acc-item:hover { background: var(--surface-3); }
.pf-acc-item:active { transform: scale(.97); }
.pf-gauge { --v: 0; --c: var(--accent); width: 64px; height: 64px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--v) * 1%), var(--surface-3) 0); }
.pf-gauge b { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 16px; font-weight: 900; }
.pf-acc-item:hover .pf-gauge b { background: var(--surface-3); }
.pf-acc-item span { display: block; font-weight: 800; font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-acc-item.is-weakest { box-shadow: inset 0 0 0 2px var(--bad); }
.pf-acc-item.is-weakest span::after { content: " \2022 weakest"; color: var(--bad); }
@media (max-width: 380px) { .pf-acc-item.is-weakest span::after { content: ""; } }
.pf-wsec { margin-top: 14px; }
.pf-wsec h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-2); font-weight: 900; margin-bottom: 8px; }
.pf-wlist { display: grid; gap: 8px; }
.pf-witem {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2);
  border: 0; text-align: left; width: 100%; min-width: 0;
  transition: transform calc(.15s * var(--motion)) var(--ease), background .2s;
}
.pf-witem:hover { background: var(--surface-3); }
.pf-witem:active { transform: scale(.985); }
.pf-witem-ico { flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-size: 19px; background: var(--surface); }
.pf-witem-main { flex: 1; min-width: 0; }
.pf-witem-main b { display: block; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-witem-main small { display: block; color: var(--text-2); font-weight: 700; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-witem-meter { flex: none; width: 54px; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.pf-witem-meter i { display: block; height: 100%; background: var(--bad); border-radius: inherit; }
@media (max-width: 400px) { .pf-witem-meter { display: none; } }
.pf-witem-go { flex: none; color: var(--accent); font-weight: 900; font-size: 13px; display: flex; align-items: center; gap: 2px; white-space: nowrap; }
.pf-witem-go svg { width: 16px; height: 16px; }
.pf-results { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin-top: 6px; }
.pf-results i { display: block; height: 100%; }
.pf-results-legend { display: flex; gap: 14px; flex-wrap: wrap; font-weight: 800; font-size: 13px; color: var(--text-2); margin-top: 8px; }
.pf-results-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--c); vertical-align: -1px; }
.pf-empty { text-align: center; padding: 18px 8px 8px; }
.pf-empty-ico { font-size: 44px; line-height: 1; margin-bottom: 8px; }
.pf-empty b { display: block; font-size: 17px; font-weight: 900; margin-bottom: 4px; }
.pf-empty p { color: var(--text-2); font-weight: 600; margin-bottom: 14px; }

/* achievements */
.pf-ach-count { margin-left: auto; font-weight: 900; font-size: 14px; padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--gold-deep); white-space: nowrap; }
:root[data-theme="dark"] .pf-ach-count { color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pf-ach-count { color: var(--gold); } }
.pf-ach-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: -4px 0 14px; }
.pf-ach-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffd66b, var(--gold-deep)); border-radius: inherit; }
.pf-ach { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pf-ach-item {
  position: relative; border: 0; padding: 12px 6px 10px; border-radius: 16px; background: var(--surface-2); text-align: center; min-width: 0;
  transition: transform calc(.18s * var(--motion)) var(--spring);
}
.pf-ach-item:hover { transform: translateY(-2px); }
.pf-ach-ico { width: 48px; height: 48px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; background: var(--surface-3); filter: grayscale(1); opacity: .55; }
.pf-ach-item.is-on .pf-ach-ico { filter: none; opacity: 1; background: radial-gradient(circle at 35% 30%, #fff3c4, #ffc53d 55%, var(--gold-deep)); box-shadow: 0 3px 0 var(--gold-deep), 0 6px 14px color-mix(in srgb, var(--gold) 40%, transparent); }
.pf-ach-item b { display: block; font-size: 12.5px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.pf-ach-item:not(.is-on) b { color: var(--text-2); }
.pf-ach-item small { display: none; font-size: 11.5px; color: var(--text-2); font-weight: 600; margin-top: 4px; line-height: 1.25; }
.pf-ach-item[aria-expanded="true"] small { display: block; }
.pf-ach-lock { position: absolute; top: 8px; right: 8px; width: 16px; height: 16px; color: var(--text-3); }
.pf-ach-more { margin-top: 12px; }
/* Milestones (C44): real improvement, folded inside Your stats. Calm list: next ones first, reached ones below. */
.pf-ms { display: grid; gap: 8px; }
.pf-ms-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); min-width: 0; }
.pf-ms-ico { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; background: var(--surface); color: var(--text-2); }
.pf-ms-item.is-done .pf-ms-ico { background: color-mix(in srgb, var(--good) 18%, var(--surface)); color: var(--good); }
.pf-ms-main { flex: 1 1 auto; min-width: 0; }
.pf-ms-main b { display: block; font-size: 14px; font-weight: 800; line-height: 1.25; }
.pf-ms-main small { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-2); margin-top: 2px; }
.pf-ms-bar { display: block; height: 6px; margin-top: 6px; border-radius: 999px; background: var(--surface); overflow: hidden; }
.pf-ms-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.pf-ms-val { flex: none; font-size: 13px; font-weight: 900; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pf-ms-item.is-done .pf-ms-val { color: var(--good); }
.pf-ms-sub { margin: 4px 2px 8px; font-size: 13px; font-weight: 700; color: var(--text-2); }

/* look: themes / pieces / preview */
.pf-look { display: grid; gap: 16px; }
@media (min-width: 640px) { .pf-look { grid-template-columns: minmax(0, 1fr) 260px; align-items: start; } }
@media (min-width: 1100px) { .pf-look { grid-template-columns: minmax(0, 1fr); } }
.pf-preview { position: relative; width: 100%; max-width: 360px; margin: 0 auto; aspect-ratio: 1; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-2); }
@media (min-width: 640px) and (max-width: 1099px) { .pf-preview { order: 2; } }
.pf-preview > * { width: 100%; }
.pf-mini { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr)); width: 100%; height: 100%; }
.pf-mini > div { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; overflow: hidden; }
.pf-mini > div > .pf-pc { width: 92%; height: 92%; }
.pf-pc svg { width: 100%; height: 100%; }
.pf-mini .pf-co { position: absolute; font-size: 10px; font-weight: 800; line-height: 1; pointer-events: none; }
.pf-mini .pf-co-r { left: 3px; top: 3px; }
.pf-mini .pf-co-f { right: 3px; bottom: 2px; }
.pf-sec-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 900; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-2); margin: 0 0 8px; }
.pf-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; }
.pf-themes.is-collapsed { max-height: 248px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.pf-theme { border: 0; background: none; padding: 0; text-align: center; min-width: 0; color: var(--text-2); }
.pf-theme-sw {
  position: relative; display: block; width: 100%; aspect-ratio: 1; border-radius: 12px; overflow: hidden;
  background: repeating-conic-gradient(var(--d) 0 25%, var(--l) 0 50%) 0 0 / 50% 50%;
  box-shadow: 0 0 0 2px var(--border), var(--shadow-1);
  transition: transform calc(.2s * var(--motion)) var(--spring), box-shadow .2s;
}
.pf-theme:hover .pf-theme-sw { transform: translateY(-2px); }
.pf-theme[aria-checked="true"] .pf-theme-sw { box-shadow: 0 0 0 3px var(--accent), 0 0 0 6px var(--accent-soft); transform: scale(1.03); }
.pf-theme[aria-checked="true"] .pf-theme-sw::after {
  content: "\2713"; position: absolute; right: 5px; bottom: 5px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 900; font-size: 13px; box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
  animation: app-pop calc(.3s * var(--motion)) var(--spring) both;
}
.pf-theme-sw .pf-pc { position: absolute; left: 0; top: 0; width: 50%; height: 50%; padding: 4%; }
.pf-theme-sw .pf-pc svg { width: 100%; height: 100%; }
.pf-theme span { display: block; margin-top: 6px; font-size: 12px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-theme[aria-checked="true"] span { color: var(--text); }
.pf-pieces { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.pf-pieceset { border: 0; padding: 8px; border-radius: 14px; background: var(--surface-2); text-align: center; min-width: 0; box-shadow: 0 0 0 2px transparent; transition: box-shadow .2s, transform calc(.2s * var(--motion)) var(--spring); }
.pf-pieceset:hover { transform: translateY(-2px); }
.pf-pieceset[aria-checked="true"] { box-shadow: 0 0 0 3px var(--accent); background: var(--accent-soft); }
.pf-pieceset-row { display: flex; justify-content: center; gap: 2px; }
.pf-pieceset-row > div { width: 30px; height: 30px; }
.pf-pieceset-row svg { width: 100%; height: 100%; }
.pf-pieceset span { display: block; margin-top: 4px; font-size: 12px; font-weight: 800; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* settings rows */
.pf-rows { display: grid; }
.pf-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); min-width: 0; flex-wrap: wrap; }
.pf-row:first-child { border-top: 0; padding-top: 2px; }
.pf-row-ico { flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.pf-row-ico svg { width: 20px; height: 20px; }
.pf-row-main { flex: 1; min-width: 140px; }
.pf-row-main b { display: block; font-weight: 800; }
.pf-row-main small { display: block; color: var(--text-2); font-weight: 600; font-size: 13px; }
.pf-row .seg { margin-left: auto; }

/* data */
.pf-data { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.pf-data .btn { width: 100%; }
.pf-foot { text-align: center; color: var(--text-3); font-weight: 700; font-size: 12.5px; padding: 8px 0 4px; }
.pf-foot a { color: var(--text-2); }

/* connect card (no username) */
.pf-connect { text-align: center; padding: 26px 18px; }
.pf-connect .pf-empty-ico { font-size: 54px; }
.pf-connect form { display: flex; gap: 8px; max-width: 420px; margin: 14px auto 0; flex-wrap: wrap; }
.pf-connect form .input { flex: 1 1 200px; }
.pf-connect .app-onb-err { max-width: 420px; margin: 6px auto 0; }

/* ---------------------------------------------------------------- period window (1M / 3M / 6M), header + rail + note */
.app-period { display: flex; align-items: center; gap: 8px; min-width: 0; }
.app-period-seg { display: inline-flex; flex: none; gap: 2px; padding: 3px; border-radius: 12px; background: var(--well, var(--surface-2)); border: 1px solid var(--border); }
.app-period-seg button {
  border: 0; background: transparent; color: var(--text-2); height: 32px; min-width: 30px; padding: 0 7px; border-radius: 9px;
  font: inherit; font-weight: 900; font-size: 13px; letter-spacing: .01em; font-variant-numeric: tabular-nums; cursor: pointer;
  transition: background calc(.18s * var(--motion, 1)), color calc(.18s * var(--motion, 1)), box-shadow calc(.18s * var(--motion, 1));
}
.app-period-seg button:hover { color: var(--text); }
.app-period-seg button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 2px 0 var(--edge); }
.app-period-seg button:focus-visible { outline: 2px solid var(--tab-accent, var(--accent)); outline-offset: 1px; }
.app-period-n { font-size: var(--fs-xs, 12px); font-weight: 800; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.app-period-n:empty { display: none; }
.app-period-cap { font-size: var(--fs-xs, 12px); font-weight: 800; color: var(--text-2); }
.app-period-top .app-period-n { display: none; }
@media (min-width: 560px) { .app-period-top .app-period-n { display: inline; } .app-period-top .app-period-n:empty { display: none; } }
@media (max-width: 420px) {
  .app-topbar { gap: 8px; }
  .app-period-seg button { min-width: 28px; padding: 0 5px; }
}
@media (max-width: 350px) { .app-topbar .app-brand-name { display: none; } }
/* C60: with "Find a player" in the header the wordmark only fits from ~450px; the logo stays */
@media (max-width: 449px) { .app-topbar .app-brand-name { display: none; } }
.app-period-rail { flex-direction: column; align-items: stretch; gap: 6px; padding: 10px; border-radius: var(--radius, 16px); background: var(--surface); border: 1px solid var(--border); }
.app-period-rail .app-period-seg { display: flex; }
.app-period-rail .app-period-seg button { flex: 1 1 0; }
@media (min-width: 900px) and (max-width: 1080px) {
  .app-period-rail { padding: 8px; }
  .app-period-rail .app-period-seg button { height: 36px; min-height: 36px; }   /* C60: tap targets (FRESH_EYES 30) */
}
.app-period-note {
  display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; padding: 10px 12px;
  border-radius: var(--radius-sm, 12px); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-1);
  font-size: var(--fs-sm, 13.5px); font-weight: 700; color: var(--text-2);
}
.app-period-note[hidden] { display: none; }
.app-period-note-ico { flex: none; font-size: 18px; line-height: 1.3; }
.app-period-note-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.app-period-note-main b { color: var(--text); font-weight: 900; font-size: var(--fs-md, 15.5px); }
.app-period-note-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.app-period-note-link { border: 0; background: none; padding: 0; font: inherit; font-weight: 800; color: var(--accent-text, var(--accent)); text-decoration: underline; cursor: pointer; }
.app-period-note-x { flex: none; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--text-3); display: grid; place-items: center; padding: 0; cursor: pointer; }
.app-period-note-x:hover { background: var(--surface-2); color: var(--text); }
.app-period-note-x svg { width: 16px; height: 16px; }
.app-period-note[data-kind="partial"] { box-shadow: none; background: transparent; padding: 6px 4px 6px 10px; }

/* ---------------------------------------------------------------- simplify pass (C43): header, tips, onboarding, Profile groups */
/* header: logo · period switch · analysis board */
.app-anbtn {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 44px; height: 44px; padding: 0 11px; border-radius: 12px; border: 0; cursor: pointer;
  font: inherit; font-weight: 900; font-size: 14.5px; color: var(--accent-ink, #fff);
  background: var(--accent); box-shadow: 0 3px 0 var(--accent-deep);
  transition: transform calc(.12s * var(--motion, 1)) var(--ease, ease);
}
.app-anbtn:hover { background: var(--accent-2, var(--accent)); }
.app-anbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-deep); }
.app-anbtn:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }
.app-anbtn svg { width: 21px; height: 21px; stroke-width: 2.4; }
/* C60 (FRESH_EYES 8): board icon + a visible "Analyze" on phones; the magnifier is now "Find a player" (FEED_SPEC) */
.app-anbtn-top { padding: 0 10px; gap: 6px; }
.app-anbtn-top span { display: inline; }
/* C108: the same name as the desktop rail ("Analysis board"), on two short lines so the phone top bar keeps its width */
@media (max-width: 899px) { .app-anbtn-top span { display: block; white-space: normal; max-width: 4.6em; font-size: 12.5px; line-height: 1.05; text-align: left; } }
@media (max-width: 370px) { .app-anbtn-top span { display: none; } }
.app-anbtn-rail { width: 100%; height: 48px; border-radius: 14px; }
.app-findbtn {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; height: 44px; padding: 0 10px;
  border-radius: 12px; border: 1px solid var(--border); cursor: pointer; font: inherit; font-weight: 900; font-size: 14.5px;
  color: var(--text); background: var(--surface); box-shadow: 0 3px 0 var(--edge);
}
.app-findbtn:hover { background: var(--surface-2); }
.app-findbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.app-findbtn:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }
.app-findbtn svg { width: 21px; height: 21px; stroke-width: 2.4; }
.app-findbtn-top span { display: none; }
.app-findbtn-rail { width: 100%; height: 48px; border-radius: 14px; }
/* Profile: "Find a player" search at the top (Feed.mountSearch) */
.pf-find { padding: 14px 16px; }
.pf-find h2 { margin: 0; font-size: var(--fs-md, 15.5px); }
.pf-find .card-sub { margin: 2px 0 10px; font-size: var(--fs-sm, 13.5px); font-weight: 700; color: var(--text-2); }
.app-topbar .app-period-seg button { min-width: 36px; height: 36px; }
/* first-run tip (max 3 in the whole app) */
.app-tip {
  display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 8px 8px 8px 12px;
  border-radius: var(--radius-sm, 12px); background: color-mix(in srgb, var(--xp, var(--accent)) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--xp, var(--accent)) 35%, transparent);
  font-size: 14px; font-weight: 700; color: var(--text); animation: app-in-up calc(.3s * var(--motion, 1)) var(--ease, ease) both;
}
.app-tip-ico { flex: none; font-size: 17px; }
.app-tip-txt { flex: 1; min-width: 0; }
.app-tip-ok {
  flex: none; min-height: 44px; padding: 0 14px; border: 0; border-radius: 10px; cursor: pointer;
  font: inherit; font-weight: 900; font-size: 14px; background: var(--surface); color: var(--text); box-shadow: 0 2px 0 var(--edge);
}
.app-tip-ok:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }
/* onboarding: one short screen */
.app-onb-card { padding: 28px 22px 20px; }
.app-onb-logo { display: grid; place-items: center; margin: 0 auto 14px; }
.app-onb-logo .app-logo { width: 64px; height: 64px; border-radius: 18px; font-size: 40px; }
.app-onb-lead { margin-bottom: 22px; }
.app-onb-skip {
  display: inline-block; margin-top: 10px; min-height: 44px; padding: 0 12px; border: 0; background: none; cursor: pointer;
  font: inherit; font-weight: 800; font-size: 15px; color: var(--text-2); text-decoration: underline; text-underline-offset: 3px;
}
.app-onb-skip:hover { color: var(--text); }
/* Profile: compact player card */
.pf-hero-compact { padding: 16px; }
.pf-hero-compact::after { font-size: 150px; bottom: -36px; }
.pf-hero-compact .pf-ava-wrap { width: 68px; height: 68px; }
.pf-hero-compact .pf-ava { font-size: 26px; inset: 4px; }
.pf-hero-compact .pf-lvl { min-width: 28px; height: 28px; font-size: 13px; border-width: 2px; }
.pf-hero-compact .pf-sub { justify-content: space-between; font-size: 13px; }
.pf-hero-compact .pf-bar { height: 8px; margin-top: 6px; }
.pf-hero-compact .pf-ratings { margin-top: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.pf-hero-compact .pf-rating { padding: 6px 4px; border-radius: 12px; border-width: 1px; }
.pf-hero-compact .pf-rating b { font-size: 18px; margin-top: 0; }
.pf-hero-compact .pf-rating span { font-size: 11px; letter-spacing: .02em; text-transform: none; }
/* Profile: folded rows inside a card (weak spots, more stats, badges, backup) */
.pf-fold { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 4px; }
.pf-fold > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; min-height: 44px;
  font-weight: 900; font-size: 15px; color: var(--text);
}
.pf-fold > summary::-webkit-details-marker { display: none; }
.pf-fold > summary::after {
  content: ""; flex: none; width: 8px; height: 8px; margin: 0 6px 0 0; border-right: 2px solid var(--text-2); border-bottom: 2px solid var(--text-2);
  transform: rotate(45deg); transition: transform calc(.2s * var(--motion, 1));
}
.pf-fold[open] > summary::after { transform: rotate(-135deg); }
.pf-fold > summary > span:first-child { flex: 1; min-width: 0; }
.pf-fold > summary:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; border-radius: 8px; }
.pf-fold-end { font-size: 13px; font-weight: 800; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pf-fold[open] > summary { margin-bottom: 6px; }
.pf-fold .pf-wsec:first-child { margin-top: 4px; }
.pf-empty-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--text-2); font-weight: 700; }
.pf-empty-row p { flex: 1 1 200px; margin: 0; }
/* Profile: Today's plan + daily goal */
.pf-planwrap { display: grid; gap: 8px; min-width: 0; }
.pf-goalrow { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; font-weight: 800; font-size: 13.5px; color: var(--text-2); }
/* Profile: board & pieces */
.pf-allbtn { margin-top: 8px; min-height: 44px; }
.pf-rows-tight { margin-top: 12px; }
.pf-rows-tight .pf-row:first-child { border-top: 1px solid var(--border); padding-top: 12px; }
/* Profile: account & data */
.pf-acct { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pf-acct .app-avatar { width: 40px; height: 40px; }
.pf-acct-name { flex: 1; min-width: 0; }
.pf-acct-name b { display: block; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-acct-name small { display: block; color: var(--text-2); font-weight: 700; font-size: 13px; }
#pf-account .pf-switch-row .input { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
#pf-account .pf-switch .app-onb-err { color: var(--bad); }
.pf-block { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); min-width: 0; }
.pf-block-h { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-2); font-weight: 900; margin: 0 0 10px; }
#pf-data .pf-data { margin-top: 10px; }
.pf-fold .pf-train { margin: 4px 0 10px; }

/* ---------------------------------------------------------------- clarity pass (C66): first visit, progress line, Profile */
.app-onb-how { list-style: none; margin: 4px auto 20px; padding: 0; max-width: 34ch; display: grid; gap: 8px; text-align: left; }
.app-onb-how li { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; font-weight: 700; color: var(--text-2); line-height: 1.35; }
.app-onb-how li > span:first-child { flex: none; width: 24px; text-align: center; font-size: 17px; line-height: 1.2; }
.app-onb-how b { color: var(--text); font-weight: 900; }
.app-hud-slot { position: relative; }
.pl-pop { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; max-width: 460px; padding: 12px 14px; border-radius: 14px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong, var(--border)); box-shadow: 0 10px 28px rgba(0, 0, 0, .28); }
.pl-pop-t { display: block; font-weight: 900; font-size: 15px; }
.pl-pop p { margin: 4px 0 10px; font-size: 14px; font-weight: 700; color: var(--text-2); line-height: 1.4; }
.pl-pop-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.pl-pop-acts .btn { min-height: 44px; }
.st-plan .st-task-main small { white-space: normal; overflow: visible; line-height: 1.3; }
.st-plan .st-task-main small.st-task-why { color: var(--text-2); margin-top: 1px; }
.pf-i { flex: none; margin-left: auto; width: 32px; height: 32px; min-width: 32px; border-radius: 999px; border: 1.5px solid var(--border-strong, var(--border)); background: var(--surface-2);
  color: var(--text-2); font: italic 900 15px/1 Georgia, serif; cursor: pointer; display: grid; place-items: center; position: relative; }
.pf-i::after { content: ""; position: absolute; inset: -6px; }
.pf-i[aria-expanded="true"] { background: var(--accent); color: var(--on-accent, #fff); border-color: transparent; }
.pf-i:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.pf-info { margin: 8px 0 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; font-weight: 600; color: var(--text-2); line-height: 1.45; }
.pf-info b { color: var(--text); }
.pf-stat-note { margin: 8px 2px 0; font-size: 13.5px; font-weight: 700; color: var(--text-2); line-height: 1.4; }
.pf-clock { display: flex; gap: 6px; align-items: flex-start; margin-top: 12px; }
.st-phase-val .pf-unit { font-size: 11.5px; font-weight: 800; color: var(--text-3, var(--text-2)); margin-left: 4px; }
.pf-lose-sec h4 { margin: 10px 0 6px; font-size: 13px; font-weight: 900; color: var(--text-2); }
.pf-lose-side + .pf-lose-side { margin-top: 4px; }
.pf-lose { margin-bottom: 6px; }
.pf-lose .pf-lose-crit { display: block; font-weight: 700; color: var(--text-2); }
.pf-lose > svg { flex: none; width: 16px; height: 16px; color: var(--text-3, var(--text-2)); }
.pf-lose-pct { flex: none; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.pf-lose-pct b { color: var(--bad); font-weight: 900; font-size: 14px; white-space: nowrap; }
.pf-lose-pct small { color: var(--text-3, var(--text-2)); font-weight: 700; font-size: 12px; white-space: nowrap; }
.pf-tok { margin: 12px 0 2px; }
.pf-tok-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.pf-tok-ico svg { width: 22px; height: 22px; }
.pf-tok .pf-acct-name b, .pf-tok .pf-acct-name small { white-space: normal; }

/* ---------------------------------------------------------------- Home (C82, js/tab-home.js, prefix hm-) */
.hm-root { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.hm-top { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.hm-rest { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.hm-rest:empty { display: none; }
.hm-hero h1 { margin: 6px 0 8px; font-size: clamp(24px, 6vw, 32px); line-height: 1.12; overflow-wrap: anywhere; }
.hm-hero p { margin: 0 0 14px; font-size: 15.5px; line-height: 1.45; max-width: 62ch; }
.hm-hero .hero-go { margin-top: 2px; white-space: normal; height: auto; line-height: 1.2; }
.hm-hero .hm-why { margin: 10px 0 0; font-size: 13.5px; font-weight: 800; opacity: .9; }
.hm-hero .hm-imp { margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .22); }
.hm-scope { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 0 4px; color: var(--text-2); font-size: 13.5px; font-weight: 700; line-height: 1.4; }
.hm-scope svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.hm-plan[hidden] { display: none; }
.hm-plan > .card { margin: 0; }
.hm-sec { min-width: 0; }
.hm-h2 { margin: 4px 4px 10px; font-size: 19px; font-weight: 900; color: var(--text); }
.hm-areas { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 760px) { .hm-areas { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.hm-area { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 16px; min-width: 0; border-top: 4px solid var(--tab-accent); }
.hm-area-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hm-area-ico { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: var(--tab-accent); box-shadow: 0 3px 0 var(--tab-accent-deep); }
.hm-area-ico svg { width: 22px; height: 22px; }
.hm-area-t { min-width: 0; display: flex; flex-direction: column; }
.hm-area-t h3 { margin: 0; font-size: 18px; font-weight: 900; line-height: 1.15; }
.hm-area-t span { font-size: 13px; font-weight: 700; color: var(--text-2); }
.hm-area-status { margin: 0; font-size: 14.5px; line-height: 1.45; color: var(--text); flex: 1 1 auto; overflow-wrap: anywhere; }
.hm-area-status b { font-weight: 900; }
.hm-area-num { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.hm-area-num b { font-size: 24px; font-weight: 900; line-height: 1; color: var(--tab-accent); white-space: nowrap; }
.hm-area-num span { font-size: 13px; font-weight: 800; color: var(--text-2); line-height: 1.3; }
/* C98: "Inside: Fix mistakes · Practice · ..." under each area button: one link per subtab (NAV_SPEC 4.2.2) */
.hm-inside { margin: 2px 0 0; font-size: 13px; line-height: 1.3; color: var(--text-3); font-weight: 700; }
.hm-inside > span:first-child { color: var(--text-2); font-weight: 800; }
.hm-inside a { display: inline-block; padding: 12px 0; color: var(--text-2); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--text-2) 35%, transparent); text-underline-offset: 3px; }
.hm-inside a:hover { color: var(--tab-accent-deep, var(--accent-deep)); }
.hm-pg:empty { display: none; }
.hm-pg { margin-top: 18px; }
.hm-area-go { display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: normal; height: auto; line-height: 1.2; text-align: center; }
.hm-area-go svg { flex: none; width: 18px; height: 18px; }
.hm-recent { padding: 14px 16px; border-radius: var(--radius, 16px); background: var(--surface); box-shadow: var(--shadow-1, none); }
.hm-rec-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; }
.hm-rec-head .hm-h2 { margin: 0; }
.hm-streak { display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 800; color: var(--text-2); }
.hm-streak svg { width: 18px; height: 18px; color: var(--gold, #f5b021); }
.hm-recent ul { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.hm-recent li { font-size: 14.5px; line-height: 1.45; color: var(--text-2); font-weight: 700; }
.hm-recent li b { color: var(--text); font-weight: 900; }
/* the bottom tab bar holds 5 tabs (Home · Openings · Middlegame · Endgame · Profile): keep every label whole at 375px */
@media (max-width: 899px) {
  .app-nav { padding-left: 4px; padding-right: 4px; gap: 2px; }
  .app-nav-item { font-size: 11px; letter-spacing: 0; }
}
@media (max-width: 380px) {
  .app-nav-item { font-size: 10.5px; }
}

/* ---------------------------------------------------------------- Profiles (C86, js/profiles.js, prefix pf-pc / pf-prof / pfs-) */
.pf-profiles { padding: 16px; min-width: 0; }
.pf-prof-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pf-prof-head h2 { margin: 0; font-size: 19px; font-weight: 900; }
.pf-prof-n { font-size: 13px; font-weight: 800; color: var(--text-2); }
.pf-prof-sub { margin: 4px 0 12px; font-size: 14px; font-weight: 700; color: var(--text-2); line-height: 1.45; }
.pf-prof-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 900px) { .pf-prof-list { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
.pf-pc { min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid var(--border); }
.pf-pc.is-active { border-color: color-mix(in srgb, var(--accent) 70%, transparent); background: color-mix(in srgb, var(--accent) 8%, var(--surface-2)); }
.pf-pc-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pf-pc-av { flex: none; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--surface-3); color: var(--text); font-weight: 900; font-size: 18px; }
.pf-pc-av.is-li { background: color-mix(in srgb, var(--text) 82%, var(--surface)); color: var(--surface); }
.pf-pc-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-pc-id { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.pf-pc-id b { font-size: 16px; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-pc-id small { font-size: 13px; font-weight: 700; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-pc-ttl { display: inline-block; margin-right: 6px; padding: 0 5px; border-radius: 5px; background: var(--bad); color: #fff; font-size: 11.5px; line-height: 18px; vertical-align: 2px; }
.pf-pc-chip { flex: none; padding: 4px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-ink, #fff); font-size: 12.5px; font-weight: 900; }
.pf-pc-sw { flex: none; min-height: 44px; }
.pf-pc-sw svg, .pf-pc-home svg, .pf-add-btn svg { width: 18px; height: 18px; flex: none; }
.pf-pc-ready { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.pf-pc-ready > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.pf-pc-ready b { font-weight: 900; font-size: 14.5px; }
.pf-pc-ready small { font-size: 13px; font-weight: 700; color: var(--text-2); line-height: 1.4; }
.pf-pc-ok { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--good); color: #fff; }
.pf-pc-ok svg { width: 16px; height: 16px; }
.pf-pc-more > summary { cursor: pointer; min-height: 36px; display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 800; color: var(--text-2); list-style: none; }
.pf-pc-more > summary::-webkit-details-marker { display: none; }
/* the open/closed chevron (inline-flex drops the browser's own marker) */
.pf-pc-more > summary::after { content: ''; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
.pf-pc-more[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.pf-pc-more > summary:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; border-radius: 6px; }
.pf-pc-more[open] > summary { margin-bottom: 6px; }
.pf-pc-home { min-height: 48px; height: auto; white-space: normal; text-align: center; line-height: 1.25; padding-left: 14px; padding-right: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; overflow-wrap: anywhere; }
.pf-pc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--border); font-size: 12.5px; font-weight: 700; color: var(--text-3, var(--text-2)); }
.pf-pc-foot > span { min-width: 0; }
.pf-pc-rm { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 10px; border-radius: 10px; border: 0; background: none; cursor: pointer; font: inherit; font-weight: 800; font-size: 13px; color: var(--text-2); }
.pf-pc-rm svg { width: 16px; height: 16px; }
.pf-pc-rm:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.pf-pc-rm:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }
.pf-prof-add { margin-top: 12px; display: grid; gap: 10px; }
.pf-add-btn { min-height: 48px; }
.pf-addbox[hidden] { display: none; }
.pf-add-help { margin: 0 0 8px; font-size: 13.5px; font-weight: 700; color: var(--text-2); line-height: 1.45; }
/* the setup checklist (Profile cards, Home hero) */
.pf-check { min-width: 0; }
.pfs-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pfs-step { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.pfs-ico { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 900;
  background: var(--surface-3); color: var(--text-2); }
.pfs-ico svg { width: 16px; height: 16px; }
.pfs-step.is-done .pfs-ico { background: var(--good); color: #fff; }
.pfs-step.is-now .pfs-ico { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.pfs-step.is-err .pfs-ico { background: var(--bad); color: #fff; }
.pfs-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; padding-top: 2px; }
.pfs-main b { font-size: 14.5px; font-weight: 900; line-height: 1.25; }
.pfs-step.is-todo .pfs-main b { color: var(--text-2); }
.pfs-main small { font-size: 13px; font-weight: 700; color: var(--text-2); line-height: 1.4; overflow-wrap: anywhere; }
.pfs-step.is-err .pfs-main small { color: var(--bad); }
.pfs-bar { display: block; height: 8px; margin-top: 6px; border-radius: 999px; background: color-mix(in srgb, currentColor 16%, transparent); overflow: hidden; }
.pfs-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s ease; }
.pf-spin { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, var(--accent) 30%, transparent); border-top-color: var(--accent); animation: pf-spin .9s linear infinite; }
@keyframes pf-spin { to { transform: rotate(360deg); } }
.pf-check-note { margin: 8px 0 0; font-size: 13px; font-weight: 700; color: var(--text-2); line-height: 1.4; }
.pf-check-act { display: grid; gap: 8px; margin-top: 4px; }
.pf-check-act p { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--text-2); line-height: 1.4; }
.pf-check-act .btn { min-height: 48px; white-space: normal; }
.pf-check-act .btn svg { width: 16px; height: 16px; flex: none; }
/* the checklist on Home's green hero: white on the accent */
.pf-hero-setup .pf-check { margin: 4px 0 2px; padding: 12px; border-radius: 14px; background: rgba(0, 0, 0, .16); }
.pf-hero-setup .pfs-ico { background: rgba(255, 255, 255, .2); color: #fff; }
.pf-hero-setup .pfs-step.is-done .pfs-ico { background: #fff; color: var(--tab-accent-deep, var(--accent-deep)); }
.pf-hero-setup .pfs-step.is-err .pfs-ico { background: #fff; color: var(--bad); }
.pf-hero-setup .pfs-main b, .pf-hero-setup .pfs-step.is-todo .pfs-main b { color: #fff; }
.pf-hero-setup .pfs-step.is-todo .pfs-main b { opacity: .8; }
.pf-hero-setup .pfs-main small, .pf-hero-setup .pfs-step.is-err .pfs-main small { color: rgba(255, 255, 255, .86); }
.pf-hero-setup .pfs-bar i { background: #fff; }
.pf-hero-setup .pf-spin { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
.pf-hero-setup .pf-check-note, .pf-hero-setup .pf-check-act p { color: rgba(255, 255, 255, .86); }
.pf-hero-setup .pf-check-act { margin-top: 10px; }
/* Home: "Plan ready for <name>" */
.pf-ready { display: flex; align-items: center; gap: 12px; margin: 0; padding: 12px 8px 12px 14px; border-left: 4px solid var(--good); }
.pf-ready-t { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.pf-ready-t b { font-size: 16px; font-weight: 900; }
.pf-ready-t small { font-size: 13.5px; font-weight: 700; color: var(--text-2); line-height: 1.4; }
.pf-ready-x { flex: none; width: 44px; height: 44px; border-radius: 12px; border: 0; background: none; color: var(--text-2); cursor: pointer; display: grid; place-items: center; }
.pf-ready-x svg { width: 20px; height: 20px; }
.pf-ready-x:hover { background: var(--surface-2); color: var(--text); }
.pf-ready-x:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }
/* onboarding: chess.com / lichess choice */
.app-onb-sites { display: flex; gap: 8px; }
.app-onb-sites .chip { flex: 1 1 0; justify-content: center; min-height: 40px; cursor: pointer; font-weight: 900; }
.app-onb-sites .chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink, #fff); border-color: transparent; }

/* ---------------------------------------------------------------- motion */
:root[data-motion="off"] *, :root[data-motion="off"] *::before, :root[data-motion="off"] *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
