/* 23.10: «Достижения» — дерево из медальонов (achievements.js). Цвета — переменные оформления (forge / den / rage / poster…),
   редкость — --rc. Свечение статичное (box-shadow, drop-shadow), шифр — одна CSS-анимация opacity; «меньше движения» — без неё.
   ПК: сводка сверху, ветки сеткой, панель деталей справа (липкая). Телефон: разделы — вкладки (прокрутка ленты вкладок), одна ветка,
   детали — лист снизу. Подсказки при наведении — только где есть мышь. */
.ac-wrap > .views { justify-content: center; margin: 0 0 var(--s4); }
.ac2, .ac-pl { --ac-line: var(--line, color-mix(in srgb, var(--ink) 22%, transparent)); }
.ac2 { display: grid; gap: var(--s4); --ac-m: 56px; --ac-lit: var(--accent); }

/* ---------- сводка ---------- */
.ac-sum { display: grid; gap: var(--s3); padding: var(--s3) var(--s4); border: 1px solid var(--ac-line); border-radius: 10px; background: var(--surface2); }
.ac-tot { display: flex; align-items: baseline; gap: var(--s2); flex-wrap: wrap; }
.ac-tot b { font-size: var(--t-2xl); line-height: 1; color: var(--ac-lit); font-variant-numeric: tabular-nums; }
.ac-tot span { color: var(--mute); font-size: var(--t-sm); }
.ac-tot em { margin-left: auto; font-style: normal; font-weight: 800; font-size: var(--t-sm); color: var(--up, var(--accent)); }
.ac-secs { display: flex; gap: var(--s2); overflow-x: auto; scrollbar-width: thin; margin: 0 calc(-1 * var(--s1)); padding: 2px var(--s1) 6px; }
.ac-secs button { flex: none; display: grid; grid-template-columns: 1fr auto; gap: 2px var(--s2); align-items: center; min-width: 136px; min-height: 44px; padding: 6px 10px;
  text-align: left; font: inherit; font-size: var(--t-xs); color: var(--ink); background: var(--surface, var(--bg)); border: 1px solid var(--ac-line); border-radius: 8px; cursor: pointer; }
.ac-secs button span { font-weight: 700; white-space: nowrap; }
.ac-secs button em { font-style: normal; color: var(--mute); font-variant-numeric: tabular-nums; }
.ac-secs button .bar { grid-column: 1 / -1; display: block; height: 4px; border-radius: 2px; background: var(--ac-line); overflow: hidden; }
.ac-secs button .bar i { display: block; height: 100%; background: var(--ac-lit); }
.ac-secs button[aria-selected="true"] { border-color: var(--ac-lit); box-shadow: inset 0 0 0 1px var(--ac-lit); }
.ac-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.ac-tools .filters { margin: 0; }
.ac-sh { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.ac-sb { display: inline-grid; place-items: center; width: 34px; height: 34px; font-size: 18px; border-radius: 50%; background: var(--surface, var(--bg)); border: 1px solid var(--ac-line); }
.ac-sb.empty { border-style: dashed; opacity: .55; }
.ac-tt { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-sm); }
.ac-tt select { min-height: 36px; max-width: 180px; padding: 0 var(--s2); font: inherit; color: var(--ink); background: var(--surface, var(--bg)); border: 1px solid var(--ac-line); border-radius: 6px; }
.ac-note { font-size: var(--t-xs); }

/* ---------- ветки ---------- */
.ac-body { display: grid; gap: var(--s4); align-items: start; }
.ac-brs { display: grid; gap: var(--s3); align-items: start; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.ac-br { padding: var(--s3); border: 1px solid var(--ac-line); border-radius: 10px; background: color-mix(in srgb, var(--surface2) 80%, transparent); min-width: 0; }
.ac-br.on { border-color: color-mix(in srgb, var(--ac-lit) 55%, var(--ac-line)); }
.ac-bh { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s2); }
.ac-bh h3 { font-size: var(--t-md); }
.ac-bh .muted { font-size: var(--t-xs); font-variant-numeric: tabular-nums; }
.ac-sc { min-width: 0; }
.ac-tree { position: relative; margin: 0 auto; }
.ac-svg { position: absolute; inset: 0; overflow: visible; }
.ac-l { stroke: var(--ac-line); stroke-width: 2; stroke-dasharray: 3 5; stroke-linecap: round; }
.ac-l.half { stroke: color-mix(in srgb, var(--ac-lit) 55%, var(--ac-line)); stroke-dasharray: none; }
.ac-l.lit { stroke: var(--ac-lit); stroke-width: 3; stroke-dasharray: none; filter: drop-shadow(0 0 3px color-mix(in srgb, var(--ac-lit) 70%, transparent)); }
.ac-n { position: absolute; width: var(--ac-m); height: var(--ac-m); }

/* ---------- медальон ---------- */
.ac-m { --rc0: var(--rc, var(--accent)); position: relative; display: grid; place-items: center; width: var(--ac-m); height: var(--ac-m); padding: 0; border-radius: 50%; cursor: pointer;
  font: inherit; color: var(--ink); background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--rc0) 22%, var(--surface, var(--bg))) 0, var(--surface, var(--bg)) 70%);
  border: 3px solid color-mix(in srgb, var(--rc0) 40%, var(--ac-line)); transition: transform .15s var(--ease), opacity .15s; }
.ac-m .ac-e { font-size: 28px; line-height: 1; }
.ac-m.got { border-color: var(--rc0); box-shadow: 0 0 0 2px color-mix(in srgb, var(--rc0) 25%, transparent), 0 0 14px color-mix(in srgb, var(--rc0) 55%, transparent); }
.ac-m.next { border-style: dashed; }
.ac-m.next .ac-e { filter: grayscale(.6); opacity: .75; }
.ac-m.far { opacity: .42; border-color: var(--ac-line); background: var(--surface, var(--bg)); }
.ac-m.far .ac-e { filter: grayscale(1) brightness(.6); }
.ac-m.dim { opacity: .14; }
.ac-m.sel { outline: 3px solid var(--focus, var(--ac-lit)); outline-offset: 3px; }
.ac-m:hover { transform: translateY(-2px); }
.ac-tb { position: absolute; right: -4px; bottom: -4px; min-width: 22px; height: 22px; padding: 0 4px; display: grid; place-items: center; border-radius: 11px;
  font: 800 10px/1 var(--tx); letter-spacing: .02em; color: var(--bg); background: var(--mute); border: 2px solid var(--surface2); }
.ac-m.got .ac-tb { background: var(--rc0); }
/* скрытое */
.ac-m.hid { background: #0d0b0a; border-color: #2c2620; border-style: solid; }
.ac-m.hid .ac-q { font: 900 26px/1 var(--hd, serif); color: #6b5f4c; }
/* закрытая система — шифр */
.ac-m.enc { overflow: hidden; background: #06110a; border: 2px solid rgba(61,255,122,.35); border-style: solid; opacity: 1; }
.ac-m.enc .ac-g { font: 700 13px/1 ui-monospace, 'Cascadia Mono', Menlo, monospace; letter-spacing: 1px; color: #6dff9a; text-shadow: 0 0 6px rgba(61,255,122,.6); }
.ac-m.enc::after { content: ''; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(61,255,122,.12) 0 1px, transparent 1px 4px); animation: ac-flick 3.2s steps(4) infinite; }
@keyframes ac-flick { 0%, 100% { opacity: .35; } 50% { opacity: .95; } }
@media (prefers-reduced-motion: reduce) { .ac-m.enc::after { animation: none; opacity: .5; } .ac-m { transition: none; } .ac-m:hover { transform: none; } }
.ac-m.big { --ac-m: 64px; flex: none; cursor: default; }
.ac-m.big:hover { transform: none; }

/* подсказка — только при мыши (на телефоне нажатие открывает панель) */
.ac-tip { display: none; }
@media (hover: hover) {
  .ac-tip { position: absolute; z-index: 5; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%); width: max-content; max-width: 240px; padding: 8px 10px;
    font-size: var(--t-xs); line-height: 1.35; text-align: left; color: var(--ink); background: var(--surface, var(--bg)); border: 1px solid var(--ac-line); border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.45); pointer-events: none; }
  .ac-tip b { display: block; margin-bottom: 2px; font-size: var(--t-sm); }
  .ac-m:hover .ac-tip, .ac-m:focus-visible .ac-tip { display: block; }
}

/* ---------- панель деталей ---------- */
.ac-det { position: relative; display: grid; gap: var(--s3); align-content: start; padding: var(--s4); border: 1px solid var(--ac-line); border-radius: 10px; background: var(--surface2); font-size: var(--t-sm); }
.ac-det .ac-dh { text-align: center; }
.ac-dt { display: flex; gap: var(--s3); align-items: center; padding-right: 28px; }
.ac-dt h4 { font-size: var(--t-lg); line-height: 1.15; overflow-wrap: anywhere; }
.ac-dt h4 em { font-style: normal; font-size: var(--t-xs); font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--ac-line); vertical-align: middle; }
.ac-det .ac-r { font-size: var(--t-xs); font-weight: 800; color: var(--rc, var(--mute)); text-transform: uppercase; letter-spacing: .06em; }
.ac-det .ac-enc-t { font-family: ui-monospace, Menlo, monospace; color: #6dff9a; }
.ac-ts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ac-ts li { padding: 2px 8px; font-size: var(--t-xs); border-radius: 999px; border: 1px dashed var(--ac-line); color: var(--mute); font-variant-numeric: tabular-nums; }
.ac-ts li.on { border-style: solid; border-color: var(--rc); color: var(--ink); }
.ac-ts li.cur { font-weight: 800; }
.ac-pr { display: grid; grid-template-columns: 1fr auto; gap: var(--s2); align-items: center; font-size: var(--t-xs); color: var(--mute); font-variant-numeric: tabular-nums; }
.ac-pr .bar { height: 6px; border-radius: 3px; background: var(--ac-line); overflow: hidden; }
.ac-pr .bar i { display: block; height: 100%; background: var(--ac-lit); }
.ac-dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.ac-dl dt { font-size: var(--t-xs); color: var(--mute); }
.ac-dl dd { margin: 0; font-weight: 800; }
.ac-x { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: var(--mute); font-size: 22px; cursor: pointer; }
.ac-x:hover { color: var(--ink); }

/* фильтр «открытые / в процессе» — линии к скрытым узлам приглушаем */
.ac2.f-got .ac-l:not(.lit), .ac2.f-prog .ac-l.lit { opacity: .25; }

/* ---------- ПК: панель справа ---------- */
@media (min-width: 900px) {
  .ac-body { grid-template-columns: minmax(0, 1fr) 300px; }
  .ac-det { position: sticky; top: 84px; }
  .ac-det:not(.open) { min-height: 120px; place-content: center; }
}
/* ---------- телефон: одна ветка (вкладки), детали — лист снизу ---------- */
@media (max-width: 899px) {
  .ac-brs { grid-template-columns: minmax(0, 1fr); }
  .ac-br:not(.on) { display: none; }
  .ac-sc { overflow-x: auto; }
  .ac-sh { margin-left: 0; }
  .ac-det:not(.open) { display: none; }
  .ac-det.open { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; max-height: 70vh; overflow-y: auto; border-radius: 14px 14px 0 0;
    padding-bottom: calc(var(--s4) + env(safe-area-inset-bottom)); box-shadow: 0 -12px 32px rgba(0,0,0,.5); }
}

/* под именем героя: титул и витрина */
.ac-ttl { margin-top: var(--s1); font-weight: 700; color: var(--accent); }
.ac-pl { margin-top: var(--s2); display: flex; justify-content: center; gap: var(--s2); font-size: 20px; }
.ac-pl span { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--surface2); border: 1px solid var(--ac-line); }
