/* ============================================================
   JomChess — player account pages (account/...)
   Loaded after style.css and landing.css, uses their tokens.
   ============================================================ */
.ac-main {
    position: relative;
    padding-top: 12px;
    padding-bottom: 56px;
    min-height: 60vh;
}

.ac-main::before {
    content: '';
    position: absolute;
    inset: -80px -10% 0;
    background:
        radial-gradient(35% 45% at 80% 10%, var(--lp-glow-2), transparent 70%),
        radial-gradient(35% 45% at 20% 5%, var(--lp-glow), transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.ac-wrap {
    max-width: 440px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

.ac-wrap.ac-wide { max-width: 640px; }

.ac-card {
    background: var(--lp-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px;
    box-shadow: var(--shadow-md, 0 10px 30px -12px rgba(0, 0, 0, .25));
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    animation: rise .5s var(--ease, ease) both;
}

.ac-card h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--text-primary);
    margin: 0;
}

.ac-card h2 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.ac-sub {
    margin: 6px 0 0;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--text-secondary);
}

.ac-center { text-align: center; }

.ac-form { display: grid; gap: 16px; margin-top: 22px; }

.ac-field { display: grid; gap: 6px; }

.ac-label { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }

.ac-hint { font-size: 12.5px; line-height: 1.45; color: var(--text-muted, var(--text-secondary)); }

.ac-input {
    width: 100%;
    box-sizing: border-box;
    height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--border-strong, var(--border));
    background: var(--bg-inset, transparent);
    color: var(--text-primary);
    font: 500 15px/1.2 inherit;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}

.ac-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.ac-pw { position: relative; display: block; }
.ac-pw .ac-input { padding-right: 48px; }

.ac-eye {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.ac-eye:hover { color: var(--text-primary); background: var(--chip-bg); }
.ac-eye svg { width: 18px; height: 18px; }
.ac-eye[aria-pressed="true"] { color: var(--accent); }

.ac-check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.ac-check input { width: 17px; height: 17px; accent-color: var(--accent); }

.ac-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    padding: 0 22px;
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: var(--lp-ink-on-accent, #1a1300);
    font: 700 15px/1 inherit;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: filter .15s, transform .1s;
}

.ac-btn:hover { filter: brightness(1.08); }
.ac-btn:active { transform: translateY(1px); }
.ac-btn[disabled] { opacity: .6; cursor: progress; }
.ac-btn-inline { height: 40px; font-size: 14px; }

.ac-btn-ghost {
    height: 40px;
    font-size: 14px;
    background: var(--btn-secondary-bg);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.ac-btn-danger { background: var(--danger); color: #fff; }

.ac-links { margin: 18px 0 0; font-size: 14px; }
.ac-links a:not(.ac-btn), .ac-switch a, .ac-fine a { color: var(--accent); font-weight: 600; text-decoration: none; }
.ac-links a:not(.ac-btn):hover, .ac-switch a:hover, .ac-fine a:hover { text-decoration: underline; }

.ac-switch { text-align: center; font-size: 14px; color: var(--text-secondary); margin: 0; }

.ac-fine { font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); margin: 4px 0 0; }

/* Honeypot: hidden from people and screen readers */
.ac-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.ac-alert {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid transparent;
}

.ac-alert.is-error { background: var(--btn-danger-bg); color: var(--danger); border-color: rgba(239, 68, 68, .3); }
.ac-alert.is-ok { background: rgba(34, 197, 94, .12); color: var(--success-strong); border-color: rgba(34, 197, 94, .3); }
[data-theme="dark"] .ac-alert.is-ok, :root:not([data-theme]) .ac-alert.is-ok { color: var(--success); }
.ac-alert-top { margin-top: 0; }

.ac-big-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: var(--accent-bg);
    color: var(--accent);
}

.ac-big-icon svg { width: 28px; height: 28px; }

/* Overview */
.ac-profile { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ac-profile-text { flex: 1; min-width: 0; }
.ac-profile h1 { overflow-wrap: anywhere; }

.ac-avatar-lg {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #1a1300;
    font-size: 26px;
    font-weight: 800;
}

.ac-row { margin: 0 0 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ac-email { font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }

.ac-badge { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.ac-badge.is-ok { background: rgba(34, 197, 94, .14); color: var(--success-strong); }
.ac-badge.is-warn { background: rgba(245, 158, 11, .16); color: #b45309; }
[data-theme="dark"] .ac-badge.is-warn { color: #fbbf24; }
[data-theme="dark"] .ac-badge.is-ok { color: var(--success); }

.ac-danger { border-color: rgba(239, 68, 68, .25); }
.ac-danger details { margin-top: 14px; }
.ac-danger summary { list-style: none; height: 40px; font-size: 14px; width: max-content; }
.ac-danger summary::-webkit-details-marker { display: none; }
.ac-danger details[open] summary { display: none; }

@media (max-width: 480px) {
    .ac-card { padding: 22px 18px; border-radius: 18px; }
    .ac-card h1 { font-size: 24px; }
}

/* ============================================================
   Progress page (/me/)
   ============================================================ */
.me-wrap { max-width: 980px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.me-wrap > * { min-width: 0; }
.me-hero { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.me-hero-text { flex: 1; min-width: 200px; }
.me-hero h1 { overflow-wrap: anywhere; }
.me-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.me-chip {
    font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px;
    background: var(--chip-bg); border: 1px solid var(--border); color: var(--text-primary);
}
.me-chip b { color: var(--accent); }
.me-chip-rating { border-color: var(--accent); background: var(--accent-bg); }

.me-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.me-tile {
    position: relative; overflow: hidden; display: grid; gap: 2px;
    background: var(--lp-card); border: 1px solid var(--border); border-radius: 18px; padding: 16px 18px;
}
.me-tile::after {
    content: ""; position: absolute; right: -22px; top: -22px; width: 72px; height: 72px; border-radius: 50%;
    background: var(--tc); opacity: .16;
}
.me-tile-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); }
.me-tile-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; color: var(--text-primary); }
.me-tile-sub { font-size: 12.5px; color: var(--text-secondary); }

.me-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.me-head h2 { margin: 0; }
.me-note { font-size: 13px; color: var(--text-secondary); }
.me-more { font-size: 13.5px; font-weight: 700; color: var(--accent); text-decoration: none; }
.me-more::after { content: " \2192"; }
.me-more:hover { text-decoration: underline; }
.me-start { display: flex; flex-wrap: wrap; gap: 8px; }
.me-sub { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); margin: 18px 0 8px; }
.me-sub:first-child { margin-top: 0; }

.me-bar { display: block; height: 7px; border-radius: 99px; background: var(--range-bg); overflow: hidden; }
.me-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-hover)); }

/* Activity calendar */
.me-cal { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.me-cal-col { display: grid; grid-template-rows: repeat(7, 1fr); gap: 4px; }
.me-cal i, .me-cal-legend i { display: block; width: 14px; height: 14px; border-radius: 4px; background: var(--range-bg); }
.me-cal i.future { background: transparent; }
.me-cal .l1, .me-cal-legend .l1 { background: color-mix(in srgb, var(--c-play) 30%, transparent); }
.me-cal .l2, .me-cal-legend .l2 { background: color-mix(in srgb, var(--c-play) 55%, transparent); }
.me-cal .l3, .me-cal-legend .l3 { background: color-mix(in srgb, var(--c-play) 80%, transparent); }
.me-cal .l4, .me-cal-legend .l4 { background: var(--c-play); }
.me-cal-legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin-top: 8px; font-size: 11.5px; color: var(--text-secondary); }
.me-cal-legend span { margin: 0 4px; }

/* Badges */
.me-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.me-badge {
    display: grid; justify-items: center; align-content: start; text-align: center; gap: 4px; padding: 14px 10px;
    border-radius: 16px; border: 1px dashed var(--border-strong, var(--border)); color: var(--text-secondary);
}
.me-badge .me-badge-icon { color: var(--text-primary); font-size: 28px; filter: grayscale(1); opacity: .45; line-height: 1.2; }
.me-badge-name { font-size: 13.5px; font-weight: 700; color: var(--text-primary); opacity: .7; }
.me-badge-desc { font-size: 11.5px; line-height: 1.35; }
.me-badge .me-bar { width: 80%; margin-top: 4px; height: 5px; }
.me-badge-prog { font-size: 11px; font-weight: 600; }
.me-badge.earned { border-style: solid; border-color: var(--accent); background: var(--accent-bg); }
.me-badge.earned .me-badge-icon { filter: none; opacity: 1; }
.me-badge.earned .me-badge-name { opacity: 1; }

/* Character ladder */
.me-ladder { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.me-char {
    position: relative; display: grid; justify-items: center; text-align: center; gap: 3px; padding: 14px 8px 12px;
    border-radius: 16px; border: 1px solid var(--border); background: var(--chip-bg);
}
.me-char-step { position: absolute; top: 8px; left: 10px; font-size: 11px; font-weight: 700; color: var(--text-secondary); }
.me-char-face {
    width: 56px; height: 56px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--oc1), var(--oc2)); color: #fff; font-weight: 800; font-size: 20px; margin-bottom: 4px;
}
.me-char-face img { width: 100%; height: 100%; object-fit: cover; }
.me-char-name { font-weight: 700; font-size: 14px; color: var(--text-primary); }
.me-char-rating { font-size: 12px; color: var(--text-secondary); }
.me-char-rec { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.me-char.unplayed { opacity: .55; }
.me-char.unplayed .me-char-face { filter: grayscale(.8); }
.me-char.beaten { border-color: var(--success); background: rgba(34, 197, 94, .08); }
.me-char-badge { font-size: 11px; font-weight: 700; color: var(--success-strong); }
[data-theme="dark"] .me-char-badge { color: var(--success); }

/* Tactics */
.me-focus { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.me-focus:empty { display: none; }
.me-focus-chip { font-size: 13px; padding: 6px 12px; border-radius: 10px; }
.me-focus-chip.good { background: rgba(34, 197, 94, .12); color: var(--success-strong); }
.me-focus-chip.work { background: rgba(245, 158, 11, .14); color: #b45309; }
[data-theme="dark"] .me-focus-chip.good { color: var(--success); }
[data-theme="dark"] .me-focus-chip.work { color: #fbbf24; }
.me-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 6px 22px; }
.me-theme { display: grid; grid-template-columns: minmax(0, 1fr) 90px 52px; align-items: center; gap: 10px; padding: 5px 0; }
.me-theme-name { font-size: 14px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-theme-num { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); text-align: right; font-variant-numeric: tabular-nums; }
.me-theme.idle .me-theme-name { color: var(--text-secondary); font-weight: 500; }
.me-theme.done .me-bar i { background: var(--success); }
.me-theme.done .me-theme-num { color: var(--success); }

/* Drills */
.me-drills { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.me-drill { display: grid; gap: 3px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--chip-bg); }
.me-drill-name { font-weight: 700; font-size: 14px; color: var(--text-primary); }
.me-drill-level { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.me-drill-best { font-size: 12px; color: var(--text-secondary); }
.me-drill.done { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.me-drill:not(.done):not(.tried) { opacity: .6; }
.me-stars span { color: var(--range-bg); font-size: 16px; }
.me-stars span.on { color: var(--accent); }

/* Openings */
.me-legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-secondary); margin: -6px 0 12px; }
.me-legend .me-step { margin-left: 6px; }
.me-openings { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.me-opening { padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--chip-bg); }
.me-opening-name { display: block; font-weight: 700; font-size: 14px; color: var(--text-primary); margin-bottom: 6px; }
.me-opening-name small { font-weight: 600; font-size: 11.5px; color: var(--text-secondary); margin-left: 4px; }
.me-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 0; }
.me-line-name { font-size: 13px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-steps { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.me-step {
    display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px;
    font-size: 11px; font-weight: 800; background: var(--range-bg); color: var(--text-secondary);
}
.me-step.on { background: var(--c-openings); color: #fff; }
.me-star { width: 16px; font-size: 15px; color: var(--accent); text-align: center; }
.me-star.off { visibility: hidden; }

/* Play vs Stockfish */
.me-play-sum { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; }
.me-play-sum span { color: var(--text-primary); font-weight: 600; }
.me-play-sum .w { color: var(--success); }
.me-play-sum .l { color: var(--danger); }
.me-levels { display: flex; flex-wrap: wrap; gap: 6px; }
.me-level { display: grid; justify-items: center; min-width: 48px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--chip-bg); }
.me-level-n { font-weight: 800; font-size: 14px; color: var(--text-primary); }
.me-level-rec { font-size: 11px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.me-level.won { border-color: var(--success); }

@media (max-width: 720px) {
    .me-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .me-tile-value { font-size: 22px; }
    .me-themes, .me-openings { grid-template-columns: minmax(0, 1fr); }
    .me-badges { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .me-ladder { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
    .me-drills { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .me-drill { padding: 10px 11px; }
    .me-badge { padding: 10px 8px; }
    .me-badge .me-badge-icon { font-size: 24px; }
    .me-theme { grid-template-columns: minmax(0, 1fr) 70px 46px; padding: 3px 0; }
}

/* Numbers like "75 / 1,200" keep their order in right-to-left languages */
.me-badge-prog, .me-theme-num, .me-level-rec, .me-tile-value { direction: ltr; unicode-bidi: isolate; }
.me-tile-value { justify-self: start; }
.me-char-rec, .me-drill-best { unicode-bidi: plaintext; }

/* Progress page: no blur or entrance animation on its many cards. On phones a long page full of
   backdrop-filter layers was sometimes left half-painted until it was scrolled a few times. */
[data-account-page="profile"] .ac-card {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    animation: none;
    background: var(--bg-panel-solid);
}

/* Up next */
.me-next { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 4px; }
.me-next-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px;
    border: 1px solid var(--border); background: var(--chip-bg); text-decoration: none; color: var(--text-primary);
    border-left: 4px solid var(--tc);
    transition: transform .15s, border-color .15s;
}
.me-next-item:hover { transform: translateY(-1px); border-color: var(--tc); }
.me-next-icon {
    width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; border-radius: 12px;
    font-size: 22px; background: color-mix(in srgb, var(--tc) 16%, transparent); color: var(--text-primary);
}
.me-next-icon.face { border-radius: 50%; padding: 3px; background: linear-gradient(135deg, var(--oc1), var(--oc2)); color: #fff; font-weight: 800; }
.me-next-icon.face img { width: 100%; height: 100%; border-radius: 50%; background: #fff; object-fit: cover; }
.me-next-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.me-next-text b { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-next-text small { font-size: 12.5px; color: var(--text-secondary); }
.me-next-go { color: var(--tc); font-weight: 800; font-size: 18px; }

/* This week */
.me-week { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 14px; }
.me-week-chip { font-size: 13px; font-weight: 600; padding: 5px 11px; border-radius: 999px; background: var(--chip-bg); border: 1px solid var(--border); color: var(--text-primary); }
.me-week-chip.up { color: var(--success-strong); border-color: rgba(34, 197, 94, .35); background: rgba(34, 197, 94, .1); }
.me-week-chip.down { color: #b45309; border-color: rgba(245, 158, 11, .35); background: rgba(245, 158, 11, .1); }
[data-theme="dark"] .me-week-chip.up { color: var(--success); }
[data-theme="dark"] .me-week-chip.down { color: #fbbf24; }

/* Recent activity */
.me-recent { display: grid; gap: 10px; margin-top: 6px; }
.me-day { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; align-items: start; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.me-day:last-child { border-bottom: 0; padding-bottom: 0; }
.me-day-date { font-size: 13px; font-weight: 700; color: var(--text-secondary); padding-top: 4px; }
.me-day-items { display: flex; flex-wrap: wrap; gap: 6px; }
.me-pill { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--chip-bg); border: 1px solid var(--border); color: var(--text-primary); }
.me-pill.win { font-weight: 700; color: var(--success-strong); border-color: rgba(34, 197, 94, .35); background: rgba(34, 197, 94, .1); }
[data-theme="dark"] .me-pill.win { color: var(--success); }

/* Badges: only the first ones until "Show all" */
.me-badges:not(.show-all) .me-badge-extra { display: none; }
.me-more-btn { margin-top: 14px; }

@media (max-width: 720px) {
    .me-next { grid-template-columns: minmax(0, 1fr); }
    .me-day { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}

/* Recent activity: this week as seven dots */
.me-weekrow { margin: 4px 0 18px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.me-week-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.me-week-streak { font-size: 17px; font-weight: 800; color: var(--text-primary); }
.me-dots { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin: 14px 0 12px; max-width: 460px; }
.me-dot { display: grid; justify-items: center; gap: 5px; }
.me-dot i {
    width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-style: normal;
    font-size: 17px; font-weight: 800; color: #fff; background: var(--range-bg); border: 2px solid transparent;
}
.me-dot.on i { background: var(--c-play); }
.me-dot.today i { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.me-dot small { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.me-dot.today small { color: var(--accent); font-weight: 800; }
.me-week-line { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (max-width: 400px) { .me-dot i { width: 32px; height: 32px; font-size: 15px; } }

/* ---- Avatars (opsmonetization1, free pilot) ---- */
.ac-avatar-link { position: relative; text-decoration: none; overflow: visible; }
.ac-avatar-face { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; }
.ac-avatar-face.has-avatar { box-shadow: 0 4px 12px -4px rgba(0, 0, 0, .35); }
.ac-avatar-face.has-avatar svg { width: 100%; height: 100%; display: block; }
.ac-avatar-edit {
    position: absolute; right: -4px; bottom: -4px; width: 24px; height: 24px; border-radius: 50%;
    display: grid; place-items: center; font-size: 12px; color: var(--text-primary);
    background: var(--bg-panel-solid); border: 1px solid var(--border); box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}
.ac-avatar-link:hover .ac-avatar-edit { border-color: var(--accent); color: var(--accent); }
.ac-avatar-cta { color: var(--accent); font-weight: 700; text-decoration: none; }
.ac-avatar-cta:hover { text-decoration: underline; }
.ac-profile-text .ac-avatar-cta { display: inline-block; margin-top: 4px; font-size: 14px; }

/* Builder (me/avatar/) */
.av-layout { margin-top: 18px; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.av-side { position: sticky; top: 16px; display: grid; justify-items: center; gap: 12px; }
.av-preview { width: 220px; height: 220px; border-radius: 50%; overflow: hidden; box-shadow: 0 16px 34px -18px rgba(0, 0, 0, .55); }
.av-preview svg { width: 100%; height: 100%; display: block; }
.av-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.av-tab {
    height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-panel-solid);
    color: var(--text-secondary); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.av-tab:hover { border-color: var(--accent); color: var(--text-primary); }
.av-tab.active { background: var(--accent); border-color: var(--accent); color: #1a1300; }
.av-part { margin-top: 16px; }
.av-part h3 { margin: 0 0 8px; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--text-secondary); }
.av-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.av-opt {
    aspect-ratio: 1; padding: 0; border-radius: 50%; overflow: hidden; cursor: pointer;
    border: 3px solid transparent; background: none; box-shadow: 0 0 0 1px var(--border);
}
.av-opt svg { width: 100%; height: 100%; display: block; }
.av-opt:hover { box-shadow: 0 0 0 1px var(--accent); }
.av-opt.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.av-colors { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); max-width: 520px; }
.av-swatch {
    aspect-ratio: 1; border-radius: 50%; cursor: pointer; border: 3px solid var(--bg-panel-solid);
    box-shadow: 0 0 0 1px var(--border);
}
.av-swatch.active { box-shadow: 0 0 0 3px var(--accent); }
.av-foot { margin-top: 20px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.av-foot .ac-btn[disabled] { opacity: .5; cursor: default; }
@media (max-width: 700px) {
    .av-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .av-side { position: static; }
    .av-preview { width: 160px; height: 160px; }
    .av-grid { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }
}

/* Power Chess Race on /me/ */
.me-race { display: grid; gap: 8px; }
.me-race-row { --rc: #ef4444; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px;
    background: linear-gradient(120deg, color-mix(in srgb, var(--rc) 12%, var(--bg-panel-solid)), var(--bg-panel-solid) 70%); border: 1px solid var(--border); }
.me-race-row[data-tier="bronze"] { --rc: #d97706; }
.me-race-row[data-tier="silver"] { --rc: #64748b; }
.me-race-row[data-tier="gold"] { --rc: #eab308; }
.me-race-medal { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; font-size: 20px; color: #fff;
    background: linear-gradient(135deg, var(--rc), color-mix(in srgb, var(--rc) 65%, #000)); }
.me-race-name { flex: 1; min-width: 0; }
.me-race-name b { display: block; font-size: 14.5px; line-height: 1.25; overflow-wrap: anywhere; }
.me-race-name small, .me-race-best small { display: block; font-size: 12px; color: var(--text-secondary); }
.me-race-best { text-align: right; }
@media (max-width: 480px) { .me-race-best { max-width: 40%; } .me-race-best small { line-height: 1.3; } }
.me-race-best b { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.me-race-best b.me-race-none { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }

/* ---- /me/ as a dashboard: colourful area cards, details in dialogs (2026-11-30) ---- */
.me-hero {
    background: linear-gradient(120deg, color-mix(in srgb, #8b5cf6 16%, var(--bg-panel-solid)), color-mix(in srgb, #ec4899 12%, var(--bg-panel-solid)) 55%, color-mix(in srgb, #f59e0b 14%, var(--bg-panel-solid)));
    border-color: color-mix(in srgb, #8b5cf6 30%, var(--border));
}
.me-settings { flex: none; }
.me-tile { border: none; color: #fff; background: linear-gradient(135deg, var(--tc), color-mix(in srgb, var(--tc) 60%, #000)); box-shadow: 0 14px 28px -18px var(--tc); }
.me-tile::after { background: #fff; opacity: .14; }
.me-tile-label, .me-tile-sub { color: rgba(255, 255, 255, .85); }
.me-tile-value { color: #fff; }

.me-hub { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.me-hub-card {
    position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    min-height: 150px; padding: 16px; border: none; border-radius: 20px; cursor: pointer; text-align: left; font: inherit; color: #fff;
    background: linear-gradient(140deg, var(--h1), var(--h2)); box-shadow: 0 16px 30px -18px var(--h2);
    transition: transform .2s var(--ease, ease), box-shadow .2s var(--ease, ease);
}
.me-hub-card::after {
    content: ''; position: absolute; right: -30px; bottom: -30px; width: 110px; height: 110px; border-radius: 50%;
    background: rgba(255, 255, 255, .14); pointer-events: none;
}
.me-hub-card:hover, .me-hub-card:focus-visible { transform: translateY(-3px); box-shadow: 0 22px 36px -18px var(--h2); outline: none; }
.me-hub-icon {
    display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 8px; border-radius: 12px; font-size: 21px;
    background: rgba(255, 255, 255, .22);
}
.me-hub-faces { width: auto; padding: 0 4px; background: none; display: flex; }
.me-hub-faces img { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .85); margin-right: -10px; background: #fff; }
.me-hub-title { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: rgba(255, 255, 255, .9); }
.me-hub-val { font-size: 28px; font-weight: 900; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.me-hub-sub { font-size: 12.5px; color: rgba(255, 255, 255, .88); }
.me-hub-card .me-hub-sub::after { content: ' →'; }

.me-modal { width: min(760px, calc(100vw - 24px)); padding: 0 22px 22px; }
.me-modal-head {
    position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; margin: 0 -22px 16px; padding: 16px 56px 16px 22px;
    color: #fff; background: linear-gradient(120deg, var(--h1), var(--h2));
}
.me-modal-head h2 { margin: 0; font-size: 20px; color: #fff; flex: 1; min-width: 0; }
.me-modal-head .me-modal-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; font-size: 20px; background: rgba(255, 255, 255, .22); }
.me-modal-head .me-more, .me-modal-head .me-note { color: #fff; opacity: .92; }
.me-modal-head .me-more { font-weight: 800; }
.me-modal-head .gs-x { top: 50%; right: 14px; transform: translateY(-50%); background: rgba(255, 255, 255, .22); color: #fff; border-color: transparent; }
.me-account { display: grid; gap: 12px; }
.me-account .ac-card { margin: 0; }

@media (max-width: 860px) { .me-hub { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
    .me-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .me-hub-card { min-height: 128px; padding: 14px; }
    .me-hub-val { font-size: 24px; }
    .me-settings { width: 100%; }
    .me-modal { padding: 0 14px 16px; }
    .me-modal-head { margin: 0 -14px 14px; padding: 14px 52px 14px 14px; }
}

/* The dialog's main action sits at the bottom, away from the close button */
.me-modal-foot {
    position: sticky; bottom: -22px; margin: 18px -22px -22px; padding: 14px 22px;
    background: linear-gradient(180deg, transparent, var(--bg-panel-solid) 30%); display: flex; justify-content: flex-end;
}
.me-modal-go { width: auto; min-width: 200px; color: #fff !important; border: none; background: linear-gradient(120deg, var(--h1), var(--h2)); }
.me-modal-go:hover { filter: brightness(1.08); }
@media (max-width: 600px) {
    .me-modal-foot { bottom: -16px; margin: 14px -14px -16px; padding: 12px 14px; }
    .me-modal-go { width: 100%; }
}
