.ach {
  --ach-panel: var(--c-card, rgba(4, 12, 22, .86));
  --ach-inset: rgba(0, 0, 0, .38);
  --ach-line: var(--c-border-dim, rgba(0, 173, 238, .16));
  --ach-line2: var(--c-border-cyan, rgba(0, 173, 238, .30));
  --ach-text: var(--c-text, #cce4f0);
  --ach-hi: var(--c-text-hi, #e0f4ff);
  --ach-muted: var(--c-text-dim, #8fb8cc);
  --ach-accent: var(--c-cyan, #00adee);
  --ach-ok: var(--c-success, #3ddc84);
  --t1: #9aa7b6; --t2: #4fd18b; --t3: #3ea8ff; --t4: #b77bff; --t5: #ffb547;
  color: var(--ach-text);
  padding: 8px 0 32px;
}
.ach .tier-1 { --tc: var(--t1); } .ach .tier-2 { --tc: var(--t2); } .ach .tier-3 { --tc: var(--t3); }
.ach .tier-4 { --tc: var(--t4); } .ach .tier-5 { --tc: var(--t5); }
.ach [hidden] { display: none !important; }

.ach-hero, .ach-bar, .ach-card, .ach-tile {
  background-color: var(--ach-panel);
  border: 1px solid var(--ach-line2);
  box-shadow: 0 0 16px rgba(0, 0, 0, .5);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}

.ach-hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end;
  padding: 26px 28px 22px; border-radius: var(--r-lg, 18px);
  background-image: radial-gradient(120% 140% at 0% 0%, rgba(var(--c-cyan-rgb, 0, 173, 238), .14), transparent 55%);
}
.ach-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--line-glow, linear-gradient(90deg, transparent, rgba(0, 173, 238, .8), transparent)); }
.ach-hero h1 { text-align: left; padding: 0; text-indent: 0; margin: 0 0 8px; font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.3rem); line-height: 1.15; color: var(--ach-hi); }
.ach-stats { display: grid; grid-template-columns: repeat(5, auto); gap: 8px; margin: 0; }
.ach-stats div { padding: 10px 14px; border-radius: var(--r-sm, 8px); background: var(--ach-inset); border: 1px solid var(--ach-line); text-align: center; min-width: 84px; }
.ach-stats dt { font-size: .68rem; color: var(--ach-muted); text-transform: uppercase; letter-spacing: .06em; }
.ach-stats dd { margin: 2px 0 0; font-family: var(--f-display, inherit); font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ach-hi); }
.ach-stats .is-calc dd { color: var(--ach-ok); }

.ach-bar {
  position: sticky; top: 72px; z-index: 5;
  display: flex; flex-direction: column; gap: 10px;
  margin: 18px 0 16px; padding: 12px; border-radius: var(--r-md, 14px);
}
.ach-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.ach-tab {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
  padding: 8px 14px; border-radius: var(--r-sm, 8px); border: 1px solid transparent;
  background: transparent; color: var(--ach-muted); font: inherit; font-weight: 700; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.ach-tab span { font-size: .75rem; padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, .07); }
.ach-tab:hover { color: var(--ach-hi); background: var(--c-cyan-dim, rgba(0, 173, 238, .08)); }
.ach-tab[aria-selected="true"] { color: var(--ach-hi); border-color: var(--ach-line2); background: var(--c-cyan-dim, rgba(0, 173, 238, .15)); box-shadow: inset 0 -2px 0 var(--ach-accent); }
.ach-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ach-search { flex: 1 1 240px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: var(--r-sm, 8px); background: var(--c-input, rgba(4, 14, 26, .92)); border: 1px solid var(--ach-line); }
.ach-search:focus-within { border-color: var(--ach-accent); box-shadow: 0 0 0 3px var(--c-cyan-dim, rgba(0, 173, 238, .15)); }
.ach-search i { color: var(--ach-muted); font-size: .85rem; }
.ach-search input { flex: 1; min-width: 0; padding: 9px 0; border: 0; outline: 0; background: transparent; color: var(--ach-hi); font: inherit; }
.ach-tiers, .ach-own { display: flex; gap: 4px; }
.ach-tierbtn, .ach-ownbtn {
  padding: 6px 10px; border-radius: var(--r-sm, 8px); border: 1px solid var(--ach-line); background: var(--ach-inset);
  color: var(--tc, var(--ach-muted)); font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer;
}
.ach-tierbtn[aria-pressed="true"] { background: color-mix(in srgb, var(--tc) 22%, transparent); border-color: var(--tc); }
.ach-ownbtn[aria-pressed="true"] { color: var(--ach-hi); background: var(--c-cyan-dim, rgba(0, 173, 238, .15)); border-color: var(--ach-accent); }
.ach-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--ach-muted); cursor: pointer; user-select: none; }
.ach-toggle input { accent-color: var(--ach-accent); width: 16px; height: 16px; }
.ach-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.ach-cat { padding: 4px 11px; border-radius: 999px; border: 1px solid var(--ach-line); background: transparent; color: var(--ach-muted); font: inherit; font-size: .84rem; cursor: pointer; }
.ach-cat[aria-pressed="true"] { color: var(--ach-hi); border-color: var(--ach-accent); background: var(--c-cyan-dim, rgba(0, 173, 238, .15)); }
.ach-hint { margin: 0; font-size: .86rem; color: var(--ach-muted); }
.ach-hint a { color: var(--ach-accent); }
.ach-save { margin-left: 6px; font-weight: 700; }
.ach-save.is-ok { color: var(--ach-ok); }
.ach-save.is-err { color: var(--c-danger, #f87171); }
.ach-tab:focus-visible, .ach-cat:focus-visible, .ach-tierbtn:focus-visible, .ach-ownbtn:focus-visible, .ach-item:focus-visible, .ach-calc:focus-visible, .ach-icobtn:focus-visible {
  outline: 2px solid var(--ach-accent); outline-offset: 2px;
}

.ach-grid { display: grid; gap: 14px; }
.ach-grid.is-list { grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); align-items: start; }
.ach-grid.is-avatar, .ach-grid.is-skin { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.ach-grid.is-title { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

.ach-card {
  display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: var(--r-md, 14px);
  transition: border-color .18s, box-shadow .18s;
}
.ach-card:hover { border-color: var(--c-glow-strong, rgba(0, 173, 238, .5)); box-shadow: 0 0 16px rgba(0, 0, 0, .5), 0 0 18px var(--c-glow, rgba(0, 173, 238, .28)); }
.ach-card.is-complete { border-color: color-mix(in srgb, var(--ach-ok) 55%, transparent); }
.ach-card-head {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 2px; border: 0; border-radius: var(--r-sm, 8px);
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.ach-card-head:focus-visible { outline: 2px solid var(--ach-accent); outline-offset: 2px; }
.ach-thumb { flex-shrink: 0; width: 64px; height: 64px; border-radius: var(--r-sm, 10px); overflow: hidden; background: var(--ach-inset); border: 1px solid var(--ach-line); display: grid; place-items: center; }
.ach-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ach-ph { display: grid; place-items: center; width: 100%; height: 100%; color: rgba(255, 255, 255, .22); font-size: 1.6rem; }
.ach-head-text { flex: 1; min-width: 0; }
.ach-meta { display: block; font-size: .74rem; letter-spacing: .05em; color: var(--ach-accent); font-weight: 700; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ach-name { display: block; margin: 3px 0 0; font-family: var(--f-display, inherit); font-size: .95rem; font-weight: 700; letter-spacing: .02em; color: var(--ach-hi); line-height: 1.3; }
.ach-ended { margin-left: 4px; padding: 0 6px; border-radius: 999px; font-style: normal; font-size: .66rem; color: var(--ach-muted); border: 1px solid var(--ach-line); }
.ach-progress { flex-shrink: 0; padding: 3px 9px; border-radius: 999px; font-family: var(--f-display, inherit); font-size: .72rem; font-weight: 700; color: var(--ach-muted); background: var(--ach-inset); border: 1px solid var(--ach-line); }
.ach-progress.is-some { color: var(--ach-accent); border-color: var(--ach-line2); }
.is-complete .ach-progress { color: #04140c; background: var(--ach-ok); border-color: var(--ach-ok); }
.ach-open-ico { color: var(--ach-muted); font-size: .8rem; opacity: .6; }
.ach-card-head:hover .ach-open-ico { opacity: 1; color: var(--ach-accent); }
.is-hidden-ach .ach-thumb { filter: grayscale(1); opacity: .6; }

.ach-tierlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ach-tierrow {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: var(--r-sm, 8px); background: var(--ach-inset);
  border-left: 3px solid color-mix(in srgb, var(--tc, #8d9cad) 70%, transparent);
  transition: background .15s;
}
/* ami megvan: halványabb (a kapcsoló és a cél gomb jól látható marad), rámutatva visszaáll */
.ach-tierrow.is-done { background: color-mix(in srgb, var(--ach-ok) 6%, rgba(0, 0, 0, .3)); }
.ach-tierrow.is-done .ach-tierno, .ach-tierrow.is-done .ach-tiertext, .ach-tierrow.is-done .ach-rw, .ach-tierrow.is-done .ach-calcbtn { opacity: .45; transition: opacity .15s; }
.ach-tierrow.is-done .ach-rw { filter: grayscale(.6); }
.ach-tierrow.is-done:hover .ach-tierno, .ach-tierrow.is-done:hover .ach-tiertext, .ach-tierrow.is-done:hover .ach-rw, .ach-tierrow.is-done:hover .ach-calcbtn { opacity: 1; filter: none; }
.ach-card.is-complete .ach-card-head { opacity: .55; transition: opacity .15s; }
.ach-card.is-complete:hover .ach-card-head { opacity: 1; }
.ach-tile.is-owned .ach-art, .ach-tile.is-owned .ach-tile-name, .ach-tile.is-owned .ach-title-name, .ach-tile.is-owned .ach-tile-sub { opacity: .4; filter: grayscale(.7); transition: opacity .15s, filter .15s; }
.ach-tile.is-owned:hover .ach-art, .ach-tile.is-owned:hover .ach-tile-name, .ach-tile.is-owned:hover .ach-title-name, .ach-tile.is-owned:hover .ach-tile-sub { opacity: 1; filter: none; }
.ach-tierno { font-family: var(--f-display, inherit); font-size: .7rem; font-weight: 700; color: var(--tc, var(--ach-muted)); text-align: center; }
.ach-tierrow.is-auto .ach-tierno::after { content: "P"; display: block; margin-top: 1px; font-size: .55rem; color: var(--ach-ok); letter-spacing: 0; }
.ach-tools-row { display: inline-flex; align-items: center; gap: 6px; }
.ach-icobtn {
  width: 30px; height: 30px; padding: 0; display: grid; place-items: center; border-radius: var(--r-sm, 8px); cursor: pointer;
  background: rgba(0, 0, 0, .4); border: 1px solid var(--ach-line); color: var(--ach-muted); font-size: .8rem;
  transition: border-color .15s, color .15s, background .15s, filter .15s;
}
.ach-icobtn:hover { border-color: var(--ach-accent); color: var(--ach-hi); }
.ach-calcbtn { color: var(--ach-accent); border-color: var(--ach-line2); }
.ach-goal { filter: grayscale(1); opacity: .55; }
.ach-goal:hover { opacity: 1; filter: none; }
.ach-goal[aria-pressed="true"] { filter: none; opacity: 1; border-color: var(--c-warn, #fbbf24); background: rgba(251, 191, 36, .14); }
.ach-sw { position: relative; display: inline-block; width: 30px; height: 17px; flex-shrink: 0; cursor: pointer; }
.ach-sw input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.ach-sw span { position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid var(--ach-line2); transition: background .15s, border-color .15s; pointer-events: none; }
.ach-sw span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--ach-muted); transition: transform .15s, background .15s; }
.ach-sw input:checked + span { background: color-mix(in srgb, var(--ach-ok) 30%, transparent); border-color: var(--ach-ok); }
.ach-sw input:checked + span::after { transform: translateX(13px); background: var(--ach-ok); }
.ach-sw input:focus-visible + span { outline: 2px solid var(--ach-accent); outline-offset: 2px; }
.ach-card.is-goal { box-shadow: 0 0 16px rgba(0, 0, 0, .5), inset 0 2px 0 var(--c-warn, #fbbf24); }

.ach-admin { margin: 14px 0 0; padding: 10px 14px; border-radius: var(--r-md, 14px); background: var(--ach-panel); border: 1px dashed var(--c-warn, #fbbf24); }
.ach-admin summary { cursor: pointer; font-weight: 700; color: var(--ach-hi); }
.ach-admin summary span { margin-left: 6px; color: var(--ach-muted); font-weight: 400; }
.ach-admin-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 12px; }
.ach-admin-form .ach-hint { flex-basis: 100%; }
.ach-sw-row { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.ach-tiertext { font-size: .9rem; line-height: 1.4; color: var(--ach-text); }
.ach-rw {
  display: inline-flex; align-items: center; gap: 6px; max-width: 150px; height: 34px; border-radius: var(--r-sm, 8px); overflow: hidden;
  background: rgba(0, 0, 0, .45); border: 1px solid color-mix(in srgb, var(--tc, #fff) 45%, transparent);
}
.ach-rw img { width: 34px; height: 34px; object-fit: cover; }
.ach-rw.is-skin img { border-radius: 50%; }
.ach-rw em { font-style: normal; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ach-tierlist:not(.is-modal) .ach-rw:not(.is-title) em { display: none; }
.ach-rw.is-title { padding: 0 8px; font-size: .78rem; color: var(--ach-hi); }
.ach-rw.is-title i { color: var(--tc, var(--ach-accent)); font-size: .7rem; }

.ach-calc {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: var(--r-sm, 8px); cursor: pointer;
  background: linear-gradient(135deg, rgba(var(--c-cyan-rgb, 0, 173, 238), .9), rgba(0, 110, 170, .9)); border: 1px solid var(--ach-accent);
  color: #fff; font: inherit; font-size: .86rem; font-weight: 700;
  box-shadow: 0 0 12px var(--c-glow, rgba(0, 173, 238, .28)); transition: filter .15s, transform .15s;
}
.ach-calc:hover { filter: brightness(1.12); transform: translateY(-1px); }

.ach-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%;
  padding: 12px 10px; border-radius: var(--r-md, 14px); cursor: pointer; text-align: center; color: inherit; font: inherit;
  background-image: radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--tc, #00adee) 18%, transparent), transparent 70%);
  border-color: color-mix(in srgb, var(--tc, #00adee) 40%, transparent);
  transition: transform .18s ease, box-shadow .18s, border-color .18s;
}
.ach-tile:hover { transform: translateY(-3px); border-color: var(--tc, var(--ach-accent)); box-shadow: 0 0 16px rgba(0, 0, 0, .5), 0 0 18px color-mix(in srgb, var(--tc, #00adee) 35%, transparent); }
.ach-art { width: 100%; aspect-ratio: 1; border-radius: var(--r-sm, 10px); overflow: hidden; background: var(--ach-inset); }
.ach-art img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.ach-tile:hover .ach-art img { transform: scale(1.05); }
.is-skin .ach-art { border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .06), rgba(0, 0, 0, .45)); }
.ach-tile-name { font-size: .86rem; color: var(--ach-text); line-height: 1.3; min-height: 2.6em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.is-title .ach-tile { justify-content: center; min-height: 92px; gap: 4px; }
.ach-tile-sub { font-size: .76rem; color: var(--ach-muted); line-height: 1.3; }
.ach-title-name { font-family: var(--f-display, inherit); font-weight: 700; font-size: .86rem; letter-spacing: .02em; color: var(--ach-hi); text-shadow: 0 0 14px color-mix(in srgb, var(--tc, #00adee) 60%, transparent); }
.ach-badge, .ach-season {
  position: absolute; top: 8px; padding: 1px 7px; border-radius: 999px; font-size: .68rem; font-weight: 800;
  background: rgba(0, 0, 0, .7); border: 1px solid var(--tc, var(--ach-line)); color: var(--tc, var(--ach-muted));
}
.ach-badge { right: 8px; }
.ach-season { left: 8px; color: var(--c-gold, #ffd166); border-color: rgba(255, 209, 102, .5); }
.ach-tile.is-owned { border-color: color-mix(in srgb, var(--ach-ok) 40%, transparent); background-image: none; }
.ach-tile.is-owned::after {
  content: "✓"; position: absolute; left: 8px; bottom: 8px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: .78rem; font-weight: 900; color: #04140c; background: var(--ach-ok);
}

.ach-empty, .ach-none { text-align: center; color: var(--ach-muted); padding: 40px 0; }

.ach-modal { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; color: var(--ach-text, #cce4f0); text-align: left; }
.ach-modal-art { width: 200px; aspect-ratio: 1; border-radius: var(--r-md, 14px); overflow: hidden; background: var(--ach-inset, rgba(0, 0, 0, .38)); border: 1px solid var(--ach-line2); display: grid; place-items: center; }
.ach-modal-art img { width: 100%; height: 100%; object-fit: cover; }
.ach-modal-art.is-skin { border-radius: 50%; }
.ach-modal-art .ach-title-name { padding: 12px; text-align: center; font-size: 1rem; }
.ach-modal-kicker { margin: 0 0 4px; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ach-accent, #00adee); font-weight: 700; }
.ach-modal-name { display: block; margin: 0 0 10px; font-family: var(--f-display, inherit); font-size: 1.2rem; color: var(--ach-hi, #fff); }
.ach-modal-sub { display: block; margin: 14px 0 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ach-muted, #8fb8cc); }
.ach-tierlist.is-modal .ach-tierrow { grid-template-columns: 30px minmax(0, 1fr) auto; padding: 8px 10px; }
.ach-tierlist.is-modal .ach-calc { grid-column: 2 / -1; justify-self: start; }
.ach-tierlist.is-modal .ach-rw { height: 46px; max-width: 220px; padding-right: 10px; font-size: .8rem; color: var(--ach-hi, #fff); }
.ach-tierlist.is-modal .ach-rw img { width: 46px; height: 46px; }

@media (max-width: 900px) {
  .ach-hero { grid-template-columns: 1fr; }
  .ach-stats { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); }
}
@media (max-width: 640px) {
  .ach-bar { position: static; }
  .ach-cats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .ach-cat { flex-shrink: 0; }
  .ach-hero { padding: 20px 16px; }
  .ach-grid.is-avatar, .ach-grid.is-skin { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
  .ach-grid.is-title { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .ach-card { padding: 10px; }
  .ach-thumb { width: 52px; height: 52px; }
  .ach-tierrow { grid-template-columns: 26px minmax(0, 1fr); gap: 6px 8px; }
  .ach-tools-row { grid-column: 2; justify-self: end; }
  .ach-rw { max-width: 110px; }
  .ach-modal { grid-template-columns: 1fr; }
  .ach-modal-art { width: 160px; margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .ach-card, .ach-tile, .ach-art img, .ach-calc, .ach-icobtn, .ach-sw span, .ach-sw span::after { transition: none; }
}
