/*
 * achievement.css — ACHIEVEMENT page (route /achievement, js/pages/achievement.js).
 * Left category rail (each category = one swipeable page) + a centered
 * "constellation" stage: a featured achievement medallion with ◀/▶,
 * the rest of the category orbiting it, and a detail panel with the
 * flavor line, level bar, next reward and claim button. Left/right
 * (arrows or swipe) slides between category pages — per the user's
 * reference screenshot. Cream rail keeps the app palette; the orbit
 * stage goes darker so medallions + the accent glow read like the ref.
 */

.ach-wrap {
    position: relative; z-index: 2; flex: 1; min-height: 0;
    display: flex; gap: 14px; padding: 14px 18px;
}

/* ── Left category rail ─────────────────────────────────────────────── */
.ach-nav {
    flex: 0 0 216px; display: flex; flex-direction: column; min-height: 0;
    background: rgba(255,248,236,.5);
    border: 1px solid rgba(58,36,16,.16); border-radius: 12px;
    padding: 12px 10px;
}
.ach-nav-head {
    font-size: 13px; font-weight: 800; letter-spacing: 1px; color: #2c1a08;
    padding: 2px 6px 10px; border-bottom: 1px solid rgba(58,36,16,.14);
}
.ach-nav-head span { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: 1.5px; color: #8a6a48; margin-top: 3px; }

.ach-acct {
    display: flex; align-items: center; gap: 8px;
    margin: 8px 4px 10px; padding: 7px 9px;
    background: linear-gradient(180deg,#2c1a08,#3a2410); border-radius: 10px;
}
.ach-acct-lv { font-size: 12.5px; font-weight: 800; color: #ffd88a; letter-spacing: .5px; flex-shrink: 0; }
.ach-acct-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ach-acct-track { height: 5px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.ach-acct-fill { display: block; height: 100%; background: linear-gradient(90deg,#f0883e,#ffd88a); border-radius: 3px; }
.ach-acct-lbl { font-size: 9px; letter-spacing: .5px; color: rgba(255,240,220,.65); font-family: var(--font-mono); }

.ach-nav-list { flex: 1; overflow-y: auto; scrollbar-width: none; display: flex; flex-direction: column; gap: 3px; }
.ach-nav-list::-webkit-scrollbar { display: none; }

.ach-nav-item {
    position: relative; display: flex; align-items: center; gap: 8px;
    padding: 8px 8px 8px 10px; border-radius: 9px; cursor: pointer;
    transition: background .12s;
}
.ach-nav-item::before {
    content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
    border-radius: 3px; background: var(--accent, #c8641a); opacity: 0; transition: opacity .12s;
}
.ach-nav-item:hover { background: rgba(58,36,16,.06); }
.ach-nav-item.active { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.ach-nav-item.active::before { opacity: 1; }
.ach-nav-ic { font-size: 16px; flex-shrink: 0; }
.ach-nav-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ach-nav-title { font-size: 12px; font-weight: 700; color: #2c1a08; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ach-nav-track { height: 3px; border-radius: 2px; background: rgba(58,36,16,.14); overflow: hidden; }
.ach-nav-fill { display: block; height: 100%; background: var(--accent, #c8641a); border-radius: 2px; }
.ach-nav-count { font-size: 10.5px; font-weight: 700; font-family: var(--font-mono); color: #8a6a48; flex-shrink: 0; }
.ach-nav-dot {
    position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%;
    background: #f0883e; box-shadow: 0 0 0 2px rgba(240,136,62,.35);
    animation: ach-pulse 1.4s ease-in-out infinite;
}
@keyframes ach-pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.35); opacity: .6; } }

/* ── Stage ─────────────────────────────────────────────────────────── */
.ach-stage {
    position: relative; flex: 1; min-width: 0; display: flex; min-height: 0;
    border-radius: 12px; overflow: hidden;
    background:
        radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--accent, #c8641a) 26%, transparent), transparent 60%),
        linear-gradient(180deg, #1c1206, #241608 60%, #1a1005);
    border: 1px solid rgba(255,216,138,.16);
    touch-action: pan-y;
}
.ach-stage-inner {
    flex: 1; min-width: 0; display: flex; flex-direction: column;
    padding: 16px 18px 14px; --accent: #c8641a;
}
.ach-stage-inner.slide-in-l { animation: ach-slide-l .22s ease; }
.ach-stage-inner.slide-in-r { animation: ach-slide-r .22s ease; }
@keyframes ach-slide-l { from { transform: translateX(24px); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes ach-slide-r { from { transform: translateX(-24px); opacity: .3; } to { transform: none; opacity: 1; } }

.ach-page-arrow {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 6;
    width: 30px; height: 54px; border: none; cursor: pointer;
    background: rgba(0,0,0,.32); color: rgba(255,240,220,.7);
    font-size: 22px; line-height: 1; display: flex; align-items: center; justify-content: center;
    transition: background .12s, color .12s;
}
.ach-page-arrow:hover { background: rgba(0,0,0,.5); color: #ffd88a; }
.ach-page-arrow.left { left: 0; border-radius: 0 10px 10px 0; }
.ach-page-arrow.right { right: 0; border-radius: 10px 0 0 10px; }

.ach-stage-head {
    flex-shrink: 0; display: flex; align-items: center; gap: 12px;
    padding: 0 30px 9px; margin-bottom: 3px;
    border-bottom: 1px solid rgba(255,216,138,.14);
}
.ach-stage-ic {
    font-size: 22px; width: 42px; height: 42px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; border-radius: 11px;
    background: color-mix(in srgb, var(--accent) 20%, transparent);
    border: 1.5px solid color-mix(in srgb, var(--accent) 55%, transparent);
}
.ach-stage-headtext { flex: 1; min-width: 0; }
.ach-stage-title { font-size: 15px; font-weight: 800; color: #fff4e2; letter-spacing: .5px; }
.ach-stage-sub { font-size: 11px; color: rgba(255,235,210,.55); margin-top: 2px; }
.ach-stage-tools { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.ach-stage-count { font-size: 11px; color: rgba(255,235,210,.6); font-family: var(--font-mono); letter-spacing: .5px; }
.ach-claim-all {
    border: none; cursor: pointer; white-space: nowrap;
    background: linear-gradient(180deg,#f0883e,#c8641a); color: #fff8ec;
    font-size: 11px; font-weight: 800; letter-spacing: 1px;
    padding: 7px 12px; border-radius: 8px; transition: filter .12s;
}
.ach-claim-all:hover:not(:disabled) { filter: brightness(1.08); }
.ach-claim-all:disabled { opacity: .55; cursor: default; }

/* ── Orbit ─────────────────────────────────────────────────────────── */
.ach-orbit {
    position: relative; flex: 1; min-height: 214px;
    margin: 6px 52px 2px;
}
.ach-orbit-ring {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
    width: min(84%, 330px); height: 82%; max-height: 236px; border-radius: 50%;
    border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
    animation: ach-spin 44s linear infinite;
}
@keyframes ach-spin { to { transform: translate(-50%,-50%) rotate(360deg); } }

/* Featured medallion (center) */
.ach-featured {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
    z-index: 4; width: 100px; display: flex; flex-direction: column; align-items: center;
    cursor: pointer;
}
.ach-feat-arrow {
    position: absolute; top: 50%; margin-top: -13px; z-index: 5;
    width: 26px; height: 26px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(0,0,0,.45); color: #ffd88a; font-size: 12.5px;
    display: flex; align-items: center; justify-content: center;
    transition: background .12s, transform .12s;
}
.ach-feat-arrow:hover { background: rgba(0,0,0,.7); transform: scale(1.14); }
.ach-feat-arrow.left { left: -34px; }
.ach-feat-arrow.right { right: -34px; }

.ach-medallion {
    position: relative; width: 100px; height: 100px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 34%, #fff0d6, #f2c078 62%, #b9782f);
    border: 4px solid color-mix(in srgb, var(--accent) 70%, #fff2dc);
    box-shadow: 0 10px 30px rgba(0,0,0,.45), inset 0 0 22px rgba(255,255,255,.4);
}
.ach-medallion-ring {
    position: absolute; inset: -12px; border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--accent) 50%, transparent);
    border-top-color: color-mix(in srgb, var(--accent) 95%, #fff);
    animation: ach-spin2 6s linear infinite;
}
@keyframes ach-spin2 { to { transform: rotate(360deg); } }
.ach-medallion-ic { font-size: 40px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.25)); }
.ach-medallion-lv {
    position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%);
    background: #1c1206; color: #ffd88a; border: 1.5px solid color-mix(in srgb, var(--accent) 70%, #fff2dc);
    font-size: 10px; font-weight: 800; letter-spacing: 1px; padding: 3px 10px; border-radius: 999px;
    white-space: nowrap;
}
.ach-medallion-badge {
    position: absolute; top: -6px; right: -6px; z-index: 3;
    background: linear-gradient(180deg,#ffd54a,#f0883e); color: #3a2410;
    font-size: 9px; font-weight: 900; letter-spacing: .5px; padding: 3px 7px; border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,.4); animation: ach-bob 1.3s ease-in-out infinite;
}
@keyframes ach-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

.ach-featured.claimable .ach-medallion { animation: ach-glow 1.5s ease-in-out infinite; }
@keyframes ach-glow {
    0%,100% { box-shadow: 0 10px 30px rgba(0,0,0,.45), inset 0 0 22px rgba(255,255,255,.4), 0 0 0 0 rgba(255,213,74,0); }
    50%     { box-shadow: 0 10px 30px rgba(0,0,0,.45), inset 0 0 22px rgba(255,255,255,.4), 0 0 0 8px rgba(255,213,74,.28); }
}
.ach-featured:not(.active):not(.claimable):not(.maxed) .ach-medallion { filter: grayscale(.55) brightness(.82); }
.ach-featured.maxed .ach-medallion { border-color: #ffd54a; box-shadow: 0 10px 30px rgba(0,0,0,.45), inset 0 0 22px rgba(255,255,255,.45), 0 0 24px rgba(255,213,74,.4); }

/* Satellite medallions (orbit) */
.ach-sat {
    position: absolute; transform: translate(-50%,-50%); z-index: 3;
    width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 50% 35%, #ffedd0, #e7b478 68%, #a86f2c);
    border: 2px solid rgba(255,242,220,.7);
    box-shadow: 0 4px 12px rgba(0,0,0,.4);
    transition: transform .12s, box-shadow .12s;
}
.ach-sat:hover { transform: translate(-50%,-50%) scale(1.16); box-shadow: 0 6px 18px rgba(0,0,0,.5); z-index: 5; }
.ach-sat-ic { font-size: 17px; }
.ach-sat-lv {
    position: absolute; bottom: -4px; right: -4px;
    background: #1c1206; color: #ffd88a; border: 1px solid rgba(255,216,138,.6);
    font-size: 8px; font-weight: 800; font-family: var(--font-mono);
    min-width: 12px; height: 12px; line-height: 11px; text-align: center; border-radius: 999px; padding: 0 2px;
}
.ach-sat.locked { background: radial-gradient(circle at 50% 35%, #4a4136, #322b24); border-color: rgba(255,255,255,.14); }
.ach-sat.locked .ach-sat-ic { font-size: 13px; opacity: .5; }
.ach-sat.claimable { border-color: #ffd54a; animation: ach-glow-sm 1.5s ease-in-out infinite; }
@keyframes ach-glow-sm {
    0%,100% { box-shadow: 0 4px 12px rgba(0,0,0,.4), 0 0 0 0 rgba(255,213,74,0); }
    50%     { box-shadow: 0 4px 12px rgba(0,0,0,.4), 0 0 0 5px rgba(255,213,74,.3); }
}
.ach-sat.maxed { border-color: #ffd54a; box-shadow: 0 4px 12px rgba(0,0,0,.4), 0 0 14px rgba(255,213,74,.35); }

/* ── Detail panel ──────────────────────────────────────────────────── */
.ach-detail {
    flex-shrink: 0; margin: 2px 6px 0; padding: 10px 14px;
    background: rgba(0,0,0,.3); border: 1px solid rgba(255,216,138,.16); border-radius: 12px;
    display: flex; flex-direction: column; gap: 7px;
}
.ach-detail-top { display: flex; flex-direction: column; gap: 2px; padding-bottom: 5px; border-bottom: 1px solid rgba(255,216,138,.1); }
.ach-detail-name { font-size: 13px; font-weight: 800; color: #fff4e2; letter-spacing: .4px; }
.ach-detail-flavor { font-size: 11px; font-style: italic; line-height: 1.4; color: rgba(255,235,210,.62); }
.ach-detail-metricrow { display: flex; justify-content: space-between; align-items: baseline; }
.ach-detail-metric { font-size: 10.5px; letter-spacing: 1px; color: rgba(255,235,210,.55); text-transform: uppercase; }
.ach-detail-metricval { font-size: 13px; font-weight: 800; font-family: var(--font-mono); color: #ffd88a; }

.ach-detail-barrow { display: flex; align-items: center; gap: 10px; }
.ach-detail-lv { font-size: 11.5px; font-weight: 800; color: #fff4e2; flex-shrink: 0; }
.ach-detail-lv i { color: rgba(255,235,210,.5); font-style: normal; font-weight: 600; }
.ach-xpbar { flex: 1; height: 8px; border-radius: 5px; background: rgba(255,255,255,.1); overflow: hidden; }
.ach-xpbar-fill { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--accent), #ffd88a); transition: width .4s ease; }
.ach-xpnum { font-size: 10px; font-weight: 700; font-family: var(--font-mono); color: rgba(255,235,210,.6); flex-shrink: 0; }

.ach-detail-rwlbl { font-size: 9px; letter-spacing: 1.5px; color: rgba(255,235,210,.45); font-weight: 700; }
.ach-detail-rewards, .ach-rung-rewards { display: flex; flex-wrap: wrap; gap: 5px; }
.ach-rw {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 10.5px; font-weight: 700; font-family: var(--font-mono);
    background: rgba(255,216,138,.12); color: #ffe0b0;
    border: 1px solid rgba(255,216,138,.24); border-radius: 6px; padding: 3px 7px;
}
.ach-rw span { font-size: 12.5px; }
.ach-rw.xp { background: rgba(163,113,247,.16); color: #d9c4ff; border-color: rgba(163,113,247,.34); }
.ach-detail-maxed { font-size: 11.5px; font-weight: 700; color: #ffd54a; text-align: center; padding: 4px; }

.ach-detail-foot { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.ach-claim-btn {
    flex: 1; padding: 10px; border: none; border-radius: 9px; cursor: pointer;
    background: linear-gradient(180deg,#ffd54a,#f0883e); color: #3a2410;
    font-size: 12.5px; font-weight: 900; letter-spacing: 1.5px; transition: filter .12s;
}
.ach-claim-btn:hover:not(:disabled) { filter: brightness(1.06); }
.ach-claim-btn:disabled { opacity: .55; cursor: default; }
.ach-detail-more {
    border: 1px solid rgba(255,216,138,.28); background: transparent; color: rgba(255,235,210,.75);
    font-size: 10.5px; font-weight: 700; letter-spacing: .5px; padding: 8px 12px; border-radius: 8px; cursor: pointer;
    white-space: nowrap; transition: background .12s;
}
.ach-detail-more:hover { background: rgba(255,216,138,.12); }

.ach-pager { display: flex; justify-content: center; gap: 5px; margin-top: 10px; }
.ach-pager-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,235,210,.25); transition: background .15s, transform .15s; }
.ach-pager-dot.active { background: #ffd88a; transform: scale(1.35); }

/* ── Modal: full ladder ────────────────────────────────────────────── */
.ach-modal-layer:empty { display: none; }
.ach-overlay {
    position: fixed; inset: 0; z-index: 400; background: rgba(15,8,3,.66);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.ach-modal {
    position: relative; width: 100%; max-width: 400px; max-height: 84vh; overflow-y: auto;
    scrollbar-width: none;
    background: linear-gradient(180deg,#241608,#1a1005);
    border: 2px solid color-mix(in srgb, var(--accent, #c8641a) 60%, #ffd88a);
    border-radius: 16px; padding: 18px 18px 20px;
    box-shadow: 0 24px 60px rgba(0,0,0,.55);
}
.ach-modal::-webkit-scrollbar { display: none; }
.ach-modal-x {
    position: absolute; top: 10px; right: 12px; cursor: pointer;
    font-size: 13px; color: rgba(255,235,210,.6); width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center; border-radius: 50%;
}
.ach-modal-x:hover { background: rgba(255,255,255,.1); color: #fff4e2; }
.ach-modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ach-medallion.sm {
    width: 52px; height: 52px; border-width: 3px; flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.ach-medallion.sm .ach-medallion-ic { font-size: 24px; }
.ach-modal-title { font-size: 15px; font-weight: 800; color: #fff4e2; }
.ach-modal-sub { font-size: 11px; color: rgba(255,235,210,.55); margin-top: 2px; }
.ach-modal-flavor { font-size: 11.5px; font-style: italic; color: rgba(255,235,210,.6); line-height: 1.5; margin-bottom: 12px; }
.ach-modal-lbl {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: 10px; letter-spacing: 1.5px; font-weight: 700; color: rgba(255,235,210,.5);
    margin: 6px 0 8px;
}
.ach-modal-lbl span { font-family: var(--font-mono); color: #ffd88a; letter-spacing: 0; }

.ach-rungs { display: flex; flex-direction: column; gap: 6px; }
.ach-rung {
    background: rgba(255,255,255,.04); border: 1px solid rgba(255,216,138,.14);
    border-radius: 9px; padding: 8px 10px;
}
.ach-rung.claimed { background: rgba(63,185,80,.1); border-color: rgba(63,185,80,.3); }
.ach-rung.reached { border-color: rgba(255,213,74,.4); }
.ach-rung.locked { opacity: .58; }
.ach-rung-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ach-rung-lv { font-size: 11.5px; font-weight: 800; color: #fff4e2; }
.ach-rung-req { flex: 1; font-size: 10.5px; font-family: var(--font-mono); color: rgba(255,235,210,.55); }
.ach-rung-mark { font-size: 12.5px; color: #ffd54a; }
.ach-rung.claimed .ach-rung-mark { color: #3fb950; }

.ach-modal-foot { margin-top: 14px; }
.ach-modal-claim {
    width: 100%; padding: 11px; border: none; border-radius: 9px; cursor: pointer;
    background: linear-gradient(180deg,#ffd54a,#f0883e); color: #3a2410;
    font-size: 12px; font-weight: 900; letter-spacing: 2px; transition: filter .12s;
}
.ach-modal-claim:hover:not(:disabled) { filter: brightness(1.06); }
.ach-modal-claim:disabled { opacity: .55; cursor: default; }
.ach-modal-state { text-align: center; font-size: 11px; font-weight: 700; color: rgba(255,235,210,.6); padding: 8px; line-height: 1.5; }
.ach-modal-state.done { color: #ffd54a; }

/* ── Responsive ────────────────────────────────────────────────────── */
@container (max-width: 900px) {
    .ach-wrap { flex-direction: column; padding: 10px 12px; gap: 10px; }
    .ach-nav { flex: 0 0 auto; max-height: 34vh; }
    .ach-nav-list { flex-direction: row; overflow-x: auto; overflow-y: hidden; }
    .ach-nav-item { flex: 0 0 158px; }
    .ach-acct { display: none; }
    .ach-orbit { min-height: 300px; margin-left: 40px; margin-right: 40px; }
}
@container (max-width: 560px) {
    .ach-orbit { min-height: 260px; margin-left: 30px; margin-right: 30px; }
    .ach-orbit-ring { width: 92%; }
    .ach-featured { width: 92px; }
    .ach-medallion { width: 92px; height: 92px; }
    .ach-medallion-ic { font-size: 36px; }
    .ach-feat-arrow.left { left: -30px; }
    .ach-feat-arrow.right { right: -30px; }
    .ach-stage-head { flex-wrap: wrap; padding: 0 26px 10px; }
}
