/* Достижения (public/achievements.php, elements/achievements/*, js/pages/achievements.js) */

.ac {
    --ac-card: var(--card-bg, #141419);
    --ac-border: var(--border-color, #22222b);
    --ac-soft: var(--hover-bg-color, #1c1c24);
    --ac-text: var(--text-color, #fff);
    --ac-muted: var(--text-muted, #8b8b98);
    --ac-accent: var(--primary-color, #6a5aff);
    --ac-ok: var(--success-color, #28c76f);

    max-width: var(--page-max);
    margin: 0 auto;
    padding: 26px var(--page-pad) 44px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    color: var(--ac-text);
}
.ac h1 { font-weight: normal; margin: 0; font-size: 30px; }
.ac h2, .ac h3 { font-weight: normal; margin: 0; }
.ac :is(a, button):focus-visible { outline: 2px solid var(--ac-accent); outline-offset: 2px; }
.ac-lbl { font-size: 12px; color: var(--ac-muted); }
.ac-card { padding: 16px; border-radius: 16px; border: 1px solid var(--ac-border); background: var(--ac-card); min-width: 0; }
.ac-card h2 { font-size: 15px; margin-bottom: 12px; }
.ac-btn { padding: 9px 16px; border-radius: 10px; background: var(--ac-accent); color: #fff; text-decoration: none; font-size: 14px; }

.ac-bar-track { display: block; height: 6px; border-radius: 3px; background: var(--ac-soft); overflow: hidden; }
.ac-bar-track > span { display: block; height: 100%; border-radius: 3px; background: var(--c, var(--ac-accent)); }

/* Шапка */
.ac-owner { display: flex; align-items: center; gap: 12px; color: var(--ac-text); text-decoration: none; }
.ac-owner img { width: 52px; height: 52px; border-radius: 13px; object-fit: cover; image-rendering: pixelated; background: var(--ac-soft); }
.ac-owner span { display: flex; flex-direction: column; font-size: 26px; line-height: 1.15; }
.ac-owner small { font-size: 13px; color: var(--ac-muted); }
.ac-owner:hover span { color: var(--ac-accent); }

.ac-fresh { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--ac-ok) 40%, var(--ac-border)); background: color-mix(in srgb, var(--ac-ok) 10%, var(--ac-card)); animation: ac-pop 0.5s ease-out; }
.ac-fresh > i { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--ac-ok); color: #fff; font-size: 17px; }
.ac-fresh div { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 14px; }
.ac-fresh b { font-weight: normal; font-size: 16px; }
@keyframes ac-pop { from { opacity: 0; transform: translateY(-6px); } }

/* Сводка */
.ac-summary { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.ac-total { display: flex; align-items: center; gap: 20px; }
.ac-ring { position: relative; width: 120px; height: 120px; flex: none; }
.ac-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ac-ring circle { fill: none; stroke-width: 10; }
.ac-ring-bg { stroke: var(--ac-soft); }
.ac-ring-fg { stroke: var(--ac-accent); stroke-linecap: round; transition: stroke-dashoffset 0.8s ease; }
.ac-ring > span { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ac-ring b { font-weight: normal; font-size: 26px; line-height: 1; }
.ac-ring small { font-size: 12px; color: var(--ac-muted); margin-top: 4px; }
.ac-total-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ac-total-info div { display: flex; flex-direction: column; gap: 1px; }
.ac-total-info b { font-weight: normal; font-size: 18px; }
.ac-total-info small { font-size: 13px; color: var(--ac-muted); }

.ac-next, .ac-latest { display: flex; flex-direction: column; gap: 10px; }
.ac-next h2, .ac-latest h2 { margin-bottom: 2px; }
.ac-next-row { display: flex; align-items: center; gap: 10px; }
.ac-next-row > i, .ac-latest-row > i { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 9px; background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); font-size: 13px; }
.ac-next-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ac-next-title, .ac-latest-title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-latest-row { display: flex; align-items: center; gap: 10px; }
.ac-latest-title { flex: 1; min-width: 0; }
.ac-rarest { margin: 2px 0 0; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, #d4a72c 13%, transparent); color: #c99a1e; font-size: 12px; line-height: 1.4; }

/* Фильтр */
.ac-bar { display: flex; gap: 10px; flex-wrap: wrap; }
.ac-seg { display: flex; padding: 3px; border-radius: 11px; border: 1px solid var(--ac-border); background: var(--ac-card); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.ac-seg button { padding: 6px 14px; border: 0; border-radius: 8px; background: none; color: var(--ac-muted); font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; }
.ac-seg button:hover { color: var(--ac-text); }
.ac-seg button small { opacity: 0.75; }
.ac-seg button.is-on { background: var(--ac-accent); color: #fff; }

/* Категории */
.ac-cats { display: flex; flex-direction: column; gap: 12px; }
.ac-cat { padding: 14px; border-radius: 18px; border: 1px solid var(--ac-border); background: var(--ac-card); }
.ac-cat[hidden] { display: none; }
.ac-cat-head { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 10px; margin-bottom: 12px; }
.ac-cat-head > i { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); font-size: 15px; }
.ac-cat-head h2 { font-size: 17px; text-align: left; }
.ac-cat-count { font-size: 13px; color: var(--ac-muted); font-variant-numeric: tabular-nums; }
.ac-cat-head .ac-bar-track { grid-column: 4; width: min(200px, 30vw); }

.ac-tiers { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }
.ac-ach { position: relative; display: flex; gap: 12px; padding: 13px; border-radius: 14px; border: 1px solid var(--ac-border); background: var(--ac-soft); min-width: 0; }
.ac-ach[hidden] { display: none; }
.ac-ach.is-earned { border-color: color-mix(in srgb, var(--c) 45%, var(--ac-border)); background: color-mix(in srgb, var(--c) 7%, var(--ac-card)); }
.ac-ach.is-locked, .ac-ach.is-hidden { opacity: 0.6; }
.ac-ach.is-hidden { border-style: dashed; background: none; }
.ac-ach-icon { position: relative; width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--ac-card); color: var(--ac-muted); font-size: 18px; }
.ac-ach.is-earned .ac-ach-icon { background: var(--c); color: #fff; }
.ac-ach.is-progress .ac-ach-icon { color: var(--c); }
.ac-ach-check { position: absolute; right: -5px; bottom: -5px; width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; background: var(--ac-ok); color: #fff; font-size: 9px; border: 2px solid var(--ac-card); }
.ac-ach-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ac-ach-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ac-ach h3 { font-size: 15px; overflow-wrap: anywhere; }
.ac-ach-pts { flex: none; font-size: 12px; color: var(--ac-accent); }
.ac-ach p { margin: 0; font-size: 13px; line-height: 1.4; color: var(--ac-muted); }
.ac-ach-prog { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ac-muted); font-variant-numeric: tabular-nums; }
.ac-ach-prog b { font-weight: normal; color: var(--ac-text); }
.ac-ach-got { font-size: 12px; color: var(--ac-ok); }
.ac-ach-lock { font-size: 12px; color: var(--ac-muted); }
.ac-ach-foot { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: auto; font-size: 11px; color: var(--ac-muted); }
.ac-rar { color: var(--ac-muted); }
.ac-rar.is-uncommon { color: #3fb950; }
.ac-rar.is-rare { color: #5a7aff; }
.ac-rar.is-legendary { color: #c99a1e; }

.ac-nothing { margin: 0; padding: 40px 20px; border-radius: 16px; border: 1px dashed var(--ac-border); text-align: center; color: var(--ac-muted); }
.ac-empty { padding: 60px 20px; border-radius: 16px; border: 1px dashed var(--ac-border); display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--ac-muted); text-align: center; }
.ac-empty i { font-size: 30px; opacity: 0.6; }
.ac-empty p { margin: 0; }

@media (max-width: 1100px) {
    .ac-summary { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .ac-total { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
    .ac { padding: 16px var(--page-pad) 30px; gap: 12px; }
    .ac h1 { font-size: 24px; }
    .ac-summary { grid-template-columns: minmax(0, 1fr); }
    .ac-total { gap: 16px; }
    .ac-ring { width: 100px; height: 100px; }
    .ac-cat { padding: 12px; }
    .ac-cat-head { grid-template-columns: auto minmax(0, 1fr) auto; }
    .ac-cat-head .ac-bar-track { grid-column: 1 / -1; width: 100%; }
    .ac-seg button { padding: 6px 10px; font-size: 13px; }
    .ac-tiers { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    .ac-fresh { animation: none; }
    .ac-ring-fg { transition: none; }
}
