body.achievements-page-active { overflow: hidden; }
body.achievements-page-active .content { display: flex; width: 100%; max-width: none; height: 100dvh; min-height: 0; flex-direction: column; padding: 0 1rem; }
body.achievements-page-active .topbar,
body.achievements-page-active .app-footer { display: none; }
body.achievements-page-active .sidebar-copy { display: none; }
body.achievements-page-active .sidebar-stat { margin-top: .4rem; }
body.achievements-page-active #page-achievements { display: flex; min-height: 0; flex: 1; overflow: hidden; }
body.achievements-page-active .achievements-panel { display: flex; flex-direction: column; width: 100%; min-height: 0; padding: 0; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }

.atlas-toolbar { position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto auto; align-items: center; gap: .55rem; min-height: 98px; padding: .7rem 0; border-bottom: 1px solid var(--line); background: var(--bg); }
.atlas-modes { display: flex; grid-column: 1 / -1; grid-row: 1; align-items: center; gap: .2rem; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.atlas-back { grid-column: 1; grid-row: 2; }
.atlas-control { min-height: 36px; padding: .45rem .72rem; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #b7c9dc; cursor: pointer; font: inherit; font-size: .72rem; font-weight: 750; white-space: nowrap; }
.atlas-control:hover, .atlas-control.active { border-color: #35697b; background: #15384b; color: var(--cyan); }
.atlas-control:disabled { opacity: .35; cursor: default; }
.atlas-control:focus-visible, .atlas-category-card:focus-visible, .atlas-chapter-card:focus-visible, .atlas-node:focus-visible, .atlas-port:focus-visible, .atlas-parent-link:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.atlas-toolbar label { display: block; flex: 0 0 auto; }
.atlas-toolbar select { width: auto; max-width: 235px; min-height: 36px; padding: .5rem .6rem; border-radius: 8px; font-size: .7rem; }
.atlas-section-picker { grid-column: 2; grid-row: 2; min-width: 0; }
.atlas-section-picker select { max-width: 220px; }
.atlas-toolbar #atlasFilterPicker { grid-column: 3; grid-row: 2; }
.achievement-summary { grid-column: 4; grid-row: 2; color: var(--cyan); font-size: .78rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.atlas-zoom { grid-column: 5; grid-row: 2; display: flex; align-items: center; gap: .2rem; }
.atlas-toolbar #atlasCenter { grid-column: 6; grid-row: 2; }
.atlas-zoom output { min-width: 42px; color: var(--muted); font-size: .7rem; text-align: center; }

.atlas-viewport { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-color: #355670 #07172b; cursor: grab; }
.atlas-viewport:focus-visible { outline: 1px solid var(--cyan); outline-offset: -2px; }
.atlas-viewport.is-panning { cursor: grabbing; user-select: none; }
.atlas-canvas { width: min(100%, 1180px); min-height: 100%; margin: 0 auto; padding: 28px 0 40px; }
.atlas-canvas.atlas-overview, .atlas-canvas.atlas-group-overview { padding-inline: 8px; }
.empty-state { padding: 3rem 1rem; color: var(--muted); text-align: center; }

.atlas-overview-intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 2rem; padding: .3rem 0 1.5rem; }
.atlas-overview-copy { max-width: 660px; }
.atlas-overview-copy h1, .atlas-section-intro h1 { margin: 0; color: var(--text); font-size: clamp(1.65rem, 3vw, 2.35rem); letter-spacing: -.04em; line-height: 1.05; }
.atlas-overview-copy > p:last-child, .atlas-section-intro p { max-width: 650px; margin: .7rem 0 0; color: var(--muted); line-height: 1.55; }
.atlas-overview-total { display: grid; gap: .25rem; min-width: 150px; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 12px; background: #091b34; text-align: right; }
.atlas-overview-total strong { color: var(--cyan); font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.atlas-overview-total span { color: var(--muted); font-size: .7rem; }
.atlas-summary-progress { display: block; width: 100%; height: 4px; margin-top: .35rem; overflow: hidden; border-radius: 4px; background: #203b54; }
.atlas-summary-progress i { display: block; height: 100%; border-radius: inherit; background: var(--cyan); }
.atlas-category-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.atlas-category-card, .atlas-chapter-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .85rem; width: 100%; min-height: 132px; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: #091b34; color: var(--text); cursor: pointer; text-align: left; transition: border-color .15s, background .15s, transform .15s; }
.atlas-category-card:hover, .atlas-chapter-card:hover { transform: translateY(-2px); border-color: rgba(130, 227, 238, .55); background: #0d2946; }
.atlas-category-icon, .atlas-chapter-card-icon, .atlas-section-icon { display: grid; flex: 0 0 auto; width: 48px; height: 48px; place-items: center; border: 1px solid rgba(130, 227, 238, .24); border-radius: 12px; background: #102d48; font-size: 1.45rem; }
.atlas-category-copy, .atlas-chapter-card-copy { display: grid; gap: .3rem; min-width: 0; }
.atlas-category-copy strong, .atlas-chapter-card-copy strong { overflow: hidden; color: var(--text); font-size: .9rem; text-overflow: ellipsis; white-space: nowrap; }
.atlas-category-copy small, .atlas-chapter-card-copy small { min-height: 2.3em; color: var(--muted); font-size: .7rem; line-height: 1.45; }
.atlas-category-copy > span:last-child, .atlas-chapter-card-copy > span:last-child { color: #a8bfd3; font-size: .66rem; }
.atlas-category-arrow { color: var(--cyan); font-size: .75rem; font-weight: 800; white-space: nowrap; }

.atlas-section-intro { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 1rem; padding: .3rem 0 1.5rem; }
.atlas-section-intro > strong { color: var(--cyan); font-size: 1.25rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.atlas-chapter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.atlas-chapter-card { min-height: 126px; }

.atlas-chapter { width: 100%; margin: 0; overflow: visible; border: 0; border-radius: 0; background: transparent; }
.atlas-chapter-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 0; padding: 0 0 1rem; border-bottom: 1px solid var(--line); background: transparent; }
.atlas-chapter-heading { min-width: 0; }
.atlas-chapter-header h2 { margin: 0; overflow: hidden; color: #d1e2ef; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.atlas-chapter-header > span { color: #a0b6c9; font-size: .72rem; font-variant-numeric: tabular-nums; }
.atlas-board { position: relative; margin: 0 auto; }
.atlas-lines { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: visible; }
.atlas-edge { fill: none; stroke: #4b6176; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: none; }
.atlas-edge.is-available { stroke: #a99bd8; }
.atlas-edge.is-unlocked { stroke: #6bba99; stroke-width: 2.5; }
.atlas-edge.is-optional { opacity: .58; }
.atlas-node { --accent: #82e3ee; position: absolute; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 78px; height: 78px; padding: 5px 6px; border: 2px solid var(--accent); border-radius: 12px; background: #102a42; color: var(--text); cursor: pointer; font: inherit; transition: box-shadow .15s, background .15s; }
.rarity-common { --accent: #82e3ee; }
.rarity-uncommon { --accent: #83e0bb; }
.rarity-rare { --accent: #b9a7ff; }
.rarity-epic { --accent: #f7c87b; }
.rarity-legendary { --accent: #ff8fa3; }
.atlas-node.is-locked { border-color: #48586f; background: #101f32; color: #97a9bd; }
.atlas-node.is-locked .atlas-node-icon { opacity: .47; filter: grayscale(.55); }
.atlas-node.is-available { box-shadow: 0 0 13px color-mix(in srgb, var(--accent) 14%, transparent); }
.atlas-node.is-unlocked { background: #153a3b; box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 25%, transparent); }
.atlas-node[data-node-type="mastery"] { border-width: 3px; border-radius: 18px; box-shadow: 0 0 0 4px #07192d, 0 0 0 5px color-mix(in srgb, var(--accent) 35%, transparent); }
.atlas-node.is-context { border-style: solid; opacity: .8; }
.atlas-node:hover, .atlas-node.is-active { outline: 2px solid var(--accent); outline-offset: 4px; background: #1b3e54; }
.atlas-node-icon { font-size: 1.65rem; line-height: 1; }
.atlas-node-state { position: absolute; right: 4px; top: 3px; color: #c8d7e8; font-size: .62rem; }
.is-unlocked .atlas-node-state { color: var(--green); font-weight: 900; }
.atlas-node-count { color: #b6c9da; font-size: .59rem; font-variant-numeric: tabular-nums; }
.atlas-node-progress { display: block; width: 100%; height: 3px; overflow: hidden; border-radius: 3px; background: #304659; }
.atlas-node-progress i { display: block; height: 100%; background: var(--accent); }
.atlas-node-name { position: absolute; top: calc(100% + 6px); left: -17px; width: 112px; overflow: hidden; color: #91a9bf; font-size: .59rem; text-align: center; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.atlas-node:hover .atlas-node-name, .atlas-node:focus-visible .atlas-node-name { color: var(--text); }
.atlas-port { position: absolute; z-index: 3; overflow: hidden; padding: 5px 9px; border: 1px solid #37506b; border-radius: 7px; background: #102338; color: #a5c5df; cursor: pointer; font: inherit; font-size: .64rem; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.atlas-port:hover { border-color: var(--cyan); color: var(--cyan); }
.atlas-region { position: absolute; border: 1px solid #29455c; border-radius: 10px; background: #0a1d30; }
.atlas-region h3 { margin: 9px 10px 0; overflow: hidden; color: #b1c6d8; font-size: .66rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }

.atlas-legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 10px 4px; border-top: 1px solid var(--line); color: #8fa7c0; font-size: .64rem; }
.atlas-legend .available { color: #b9a7ff; }
.atlas-legend .unlocked { color: var(--green); }
#atlasVisibleCount { margin-left: auto; }
.atlas-tooltip { position: fixed; z-index: 100; display: grid; gap: 6px; width: 260px; max-width: calc(100vw - 16px); padding: 13px 16px; border: 1px solid #426783; border-radius: 10px; background: #122a40; color: #dae7f3; box-shadow: 0 8px 30px #0008; pointer-events: none; font-size: .75rem; line-height: 1.5; }
.atlas-tooltip[hidden] { display: none; }
.atlas-tooltip span { color: #adc1d4; }
.atlas-tooltip small { color: var(--cyan); }
.atlas-prerequisites { display: grid; gap: 7px; margin: 18px 0; font-size: .78rem; }
.atlas-parent-link { border: 1px solid #38536a; border-radius: 8px; padding: 9px; background: #102d44; color: var(--cyan); cursor: pointer; font: inherit; }

.achievement-dialog { position: fixed; width: min(92vw, 420px); max-height: 90dvh; overflow: auto; border: 1px solid var(--line-strong); border-radius: 18px; padding: 1.5rem; background: #0a2140; color: var(--text); box-shadow: var(--shadow); text-align: center; }
.achievement-dialog::backdrop { background: rgba(0, 8, 21, .8); backdrop-filter: blur(10px); }
.achievement-dialog-close { position: absolute; top: .7rem; right: .7rem; }
.achievement-dialog-icon { display: grid; width: 94px; height: 94px; margin: .4rem auto 1rem; place-items: center; border: 3px solid var(--amber); border-radius: 14px; background: #18435e; font-size: 2.5rem; }
.achievement-dialog h2 { margin: 0; font-size: 1.3rem; }
.achievement-dialog .muted { line-height: 1.55; }
.achievement-dialog-progress { margin-top: 1.2rem; color: var(--cyan); font-size: .8rem; font-weight: 800; }
.achievement-dialog .achievement-count { color: #a1b9cf; font-size: .7rem; line-height: 1.5; }
.achievement-evidence { margin: 1.15rem 0 .7rem; padding: .7rem .8rem; border: 1px solid rgba(130, 227, 238, .22); border-radius: 10px; background: #0d2a45; }
.achievement-evidence p { margin: 0; font-size: .72rem; }
.achievement-dialog > #achievementEvidenceButton { width: 100%; margin-top: .7rem; }
.achievement-photo-dialog { width: min(92vw, 520px); text-align: left; }
.achievement-photo-dialog .dialog-heading { margin-bottom: .7rem; }
.achievement-photo-dialog .muted { margin: .2rem 0 1rem; line-height: 1.5; }
.achievement-photo-dialog .hint { margin: .8rem 0 0; }
.achievement-photo-dialog .dialog-actions { margin-top: 1rem; }

@media (max-width: 900px) {
  .atlas-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .atlas-toolbar { grid-template-columns: auto minmax(0, 1fr) auto auto; }
  .atlas-toolbar #atlasFilterPicker { grid-column: 3; }
  .achievement-summary { grid-column: 4; }
  .atlas-zoom, .atlas-toolbar #atlasCenter { display: none; }
}

@media (max-width: 600px) {
  body.achievements-page-active .content { padding: 0 .5rem; }
  .atlas-toolbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .35rem; min-height: 0; padding: .5rem 0; }
  .atlas-back { grid-column: 1; grid-row: 1; font-size: 0; }
  .atlas-back::first-letter { font-size: 1rem; }
  .atlas-modes { grid-column: 1 / -1; grid-row: 2; order: initial; padding-bottom: .1rem; }
  .atlas-modes .atlas-control { font-size: .65rem; }
  .achievement-summary { grid-column: 3; grid-row: 1; margin: 0; font-size: .7rem; }
  .atlas-section-picker { grid-column: 1 / -1; grid-row: 3; }
  .atlas-toolbar #atlasFilterPicker { grid-column: 1 / -1; grid-row: 4; }
  .atlas-toolbar > label:not(.atlas-section-picker) { grid-column: 1 / -1; grid-row: 4; }
  .atlas-toolbar > .atlas-zoom { display: none; }
  .atlas-toolbar #atlasCenter { grid-column: 2; grid-row: 1; justify-self: end; font-size: 0; }
  #atlasCenter::after { content: "⌗"; font-size: 1.1rem; }
  .atlas-toolbar select { width: 100%; max-width: none; min-width: 0; font-size: .67rem; }
  .atlas-canvas { width: 100%; padding: 18px 0 28px; }
  .atlas-canvas.atlas-overview, .atlas-canvas.atlas-group-overview { padding-inline: 0; }
  .atlas-overview-intro { grid-template-columns: 1fr; gap: 1rem; padding-bottom: 1rem; }
  .atlas-overview-total { grid-template-columns: auto auto; align-items: center; min-width: 0; text-align: left; }
  .atlas-overview-total .atlas-summary-progress { grid-column: 1 / -1; }
  .atlas-category-grid, .atlas-chapter-grid { grid-template-columns: 1fr; }
  .atlas-category-card, .atlas-chapter-card { min-height: 112px; padding: .85rem; }
  .atlas-section-intro { grid-template-columns: auto minmax(0, 1fr); gap: .7rem; padding-bottom: 1rem; }
  .atlas-section-intro > strong { grid-column: 2; grid-row: 2; font-size: .9rem; }
  .atlas-section-intro p { margin-top: .35rem; font-size: .75rem; }
  .atlas-chapter { width: 100%; }
  .atlas-chapter-header { padding: 0 0 .8rem; }
  .atlas-chapter-header h2 { font-size: .8rem; }
  .atlas-chapter-header p { white-space: normal; }
  .atlas-legend { gap: 9px; font-size: .57rem; }
  #atlasVisibleCount { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .atlas-category-card, .atlas-chapter-card, .atlas-node { transition: none; }
}
