/* ── Stats Panel ──────────────────────────────────────────────────────────── */
#mid-col{position:relative;}
#stats-panel{display:none;position:absolute;top:0;left:0;right:0;bottom:0;background:#140810;z-index:30;overflow-y:auto;flex-direction:column;zoom:1.1;}
#stats-panel.visible{display:flex;}
.stats-panel-header{display:flex;align-items:center;justify-content:space-between;padding:10px 14px 8px;border-bottom:1px solid #3a1525;background:#1c0c16;position:sticky;top:0;z-index:1;}
.stats-panel-title{font-size:18px;font-weight:700;color:#e0a0c0;letter-spacing:0.04em;}
.stats-close-btn{background:#3a0808;border:1px solid #7a1010;border-radius:6px;color:#ff6060;font-size:17px;font-weight:700;cursor:pointer;padding:3px 9px;line-height:1;transition:background 0.12s,border-color 0.12s;}
.stats-close-btn:hover{background:#5a0c0c;border-color:#cc2020;}
.stats-body{padding:10px 14px 16px;display:flex;flex-direction:column;gap:3px;}
.stats-section-title{font-size:13px;font-weight:700;color:#7a4060;text-transform:uppercase;letter-spacing:0.08em;margin:10px 0 4px;}
.stats-section-title:first-child{margin-top:0;}
.stat-row{display:flex;justify-content:space-between;align-items:center;padding:5px 8px;border-radius:6px;background:#1c0c18;border:0.5px solid #2e1020;}
.stat-row:nth-child(odd){background:#180a14;}
.stat-label{font-size:14px;color:#c090a8;}
.stat-value{font-size:16px;font-weight:700;color:#f0c0d0;}
.stat-row-unseen{opacity:0.38;}
.stat-unseen{color:#555!important;filter:grayscale(1);}

/* ── Achievements Panel ───────────────────────────────────────────────────── */
#achievements-panel{display:none;position:absolute;top:0;left:0;right:0;bottom:0;background:#140810;z-index:30;overflow-y:auto;flex-direction:column;}
#achievements-panel.visible{display:flex;}
.ach-panel-header{display:flex;align-items:center;justify-content:space-between;padding:10px 14px 8px;border-bottom:1px solid #3a1525;background:#1c0c16;position:sticky;top:0;z-index:1;gap:8px;}
.ach-panel-title{font-size:20px;font-weight:700;color:#e0a0c0;letter-spacing:0.04em;flex:1;display:flex;align-items:center;gap:8px;}
.ach-info-btn{background:#2a1028;border:1px solid #6a3050;border-radius:50%;width:24px;height:24px;color:#e0a0c0;font-size:14px;font-weight:900;cursor:pointer;line-height:1;padding:0;font-family:Calibri,sans-serif;transition:background 0.12s,border-color 0.12s,color 0.12s;}
.ach-info-btn:hover{background:#3c1530;border-color:#a060a0;color:#ffd0e0;}
.ach-panel-count{font-size:16px;color:#7a5080;font-weight:600;}
.ach-close-btn{background:#3a0808;border:1px solid #7a1010;border-radius:6px;color:#ff6060;font-size:18px;font-weight:700;cursor:pointer;padding:3px 9px;line-height:1;transition:background 0.12s,border-color 0.12s;}
.ach-close-btn:hover{background:#5a0c0c;border-color:#cc2020;}
.ach-body{padding:12px 10px 16px;flex:1;}
.ach-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;}
.ach-tile{background:#1c0c18;border:1px solid #2e1020;border-radius:10px;padding:10px 12px;display:flex;flex-direction:column;align-items:center;gap:4px;text-align:center;transition:border-color 0.2s,background 0.2s;filter:grayscale(1);opacity:0.45;}
.ach-tile.ach-earned{background:#1e1028;border-color:#7040c0;filter:none;opacity:1;animation:achEarnedGlow 3s ease-in-out infinite;}
@keyframes achEarnedGlow{0%,100%{box-shadow:0 0 6px 1px rgba(160,100,255,0.3);}50%{box-shadow:0 0 14px 4px rgba(160,100,255,0.6);}}
.ach-tile-icon{font-size:32px;line-height:1;}
.ach-tile-label{font-size:15px;font-weight:700;color:#e0c0f0;}
.ach-tile-desc{font-size:13px;color:#7a5080;line-height:1.4;}
/* Achievement progress + category sections */
.ach-progress-wrap{background:#1a0b18;border:1px solid #3a1525;border-radius:10px;padding:10px 12px;margin-bottom:14px;}
.ach-progress-bar{width:100%;height:15px;background:#2a0f1c;border-radius:6px;overflow:hidden;border:0.5px solid #3a1525;margin-bottom:8px;cursor:help;}
.ach-progress-fill{height:100%;background:linear-gradient(90deg,#7040c0,#e080ff,#ffd060);border-radius:6px;transition:width 0.4s ease;box-shadow:0 0 8px rgba(224,128,255,0.4);}
.ach-bonus-note{font-size:16px;color:#b090c0;line-height:1.5;text-align:center;}
.ach-bonus-note b{font-weight:700;}
.ach-bonus-divider{height:1px;background:linear-gradient(90deg,transparent,#5a2040 20%,#7a3060 50%,#5a2040 80%,transparent);margin:8px 0;}
.ach-reveal-wrap{display:flex;justify-content:center;align-items:center;gap:12px;margin:0 0 14px;flex-wrap:wrap;}
.ach-search-wrap{display:inline-flex;align-items:center;gap:6px;background:#0d0610;border:1px solid #4a2038;border-radius:10px;padding:6px 12px;transition:border-color 0.12s,box-shadow 0.12s;box-shadow:inset 0 1px 4px rgba(0,0,0,0.6);}
.ach-search-wrap:focus-within{border-color:#a060a0;box-shadow:inset 0 1px 4px rgba(0,0,0,0.6),0 0 12px rgba(192,96,160,0.4);}
.ach-search-icon{font-size:14px;line-height:1;opacity:0.8;}
.ach-search-input{background:transparent;border:0;outline:0;color:#e0c0e0;font-size:14px;font-weight:700;font-family:inherit;width:200px;letter-spacing:0.02em;padding:0;}
.ach-search-input::placeholder{color:#8a607a;font-weight:700;transition:color 0.12s,opacity 0.12s;}
.ach-search-input:focus::placeholder{color:transparent;opacity:0;}
.ach-reveal-btn{background:linear-gradient(180deg,#2a1228,#1a0a1c);border:1px solid #6a3050;border-radius:10px;color:#e0c0e0;font-size:14px;font-weight:700;cursor:pointer;padding:8px 18px;display:inline-flex;align-items:center;gap:10px;transition:background 0.12s,border-color 0.12s,color 0.12s,box-shadow 0.12s,opacity 0.12s;letter-spacing:0.02em;}
.ach-reveal-btn:hover{background:linear-gradient(180deg,#3c1838,#240e26);border-color:#a060a0;color:#ffd0e8;box-shadow:0 0 12px rgba(192,96,160,0.4);}
.ach-reveal-btn:active{transform:scale(0.97);}
.ach-reveal-btn-disabled,.ach-reveal-btn-disabled:hover{background:linear-gradient(180deg,#1a1018,#100810);border-color:#3a2030;color:#7a5070;box-shadow:none;cursor:not-allowed;filter:grayscale(0.7);opacity:0.7;}
.ach-reveal-btn-disabled:active{transform:none;}
.ach-reveal-cost{background:#1a0d18;border:0;border-radius:6px;padding:2px 8px;font-size:13px;color:#80ff80;font-weight:700;}
.ach-category{margin-bottom:16px;}
.ach-category-title{font-size:15px;font-weight:700;color:#c090d0;text-transform:uppercase;letter-spacing:0.1em;margin:0 4px 8px;display:flex;justify-content:space-between;align-items:baseline;border-bottom:0.5px solid #2e1028;padding-bottom:4px;}
.ach-category-count{font-size:13px;color:#7a5080;font-weight:600;letter-spacing:0.04em;}
.ach-popup-bonus{font-size:10px;color:#ffd080;font-weight:600;margin-top:2px;}
/* Close-all button — shown above the top popup when 2+ popups are stacked */
#ach-popup-close-all{display:none;}
#ach-popup-close-all::before{content:'';position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:24px;height:48px;border-radius:12px;background:#cc0020;box-shadow:0 0 12px rgba(255,0,48,0.6);z-index:0;}
#ach-popup-close-all:hover::before{background:#ff0030;box-shadow:0 0 17px rgba(255,0,48,0.9);}
#ach-popup-close-all > span.ach-x{position:relative;z-index:1;color:#fff;font-size:13px;font-weight:700;line-height:1;}

/* ── DPS History Graph Panel ─────────────────────────────────────────────── */
#graph-panel{display:none;position:absolute;top:0;left:0;right:0;bottom:0;background:#140810;z-index:30;flex-direction:column;zoom:1.1;}
#graph-panel.visible{display:flex;}
.graph-panel-header{display:flex;align-items:center;justify-content:space-between;padding:10px 14px 8px;border-bottom:1px solid #3a1525;background:#1c0c16;position:sticky;top:0;z-index:1;gap:6px;}
.graph-panel-title{font-size:18px;font-weight:700;color:#e0a0c0;letter-spacing:0.04em;}
.graph-panel-sub{font-size:12px;color:#6a4070;font-weight:600;flex:1;}
.graph-close-btn{background:#3a0808;border:1px solid #7a1010;border-radius:6px;color:#ff6060;font-size:17px;font-weight:700;cursor:pointer;padding:3px 9px;line-height:1;transition:background 0.12s,border-color 0.12s;}
.graph-close-btn:hover{background:#5a0c0c;border-color:#cc2020;}
.graph-tabs{display:flex;align-items:stretch;padding:8px 10px;gap:6px;background:#1c0c16;border-bottom:1px solid #2e1028;flex-shrink:0;flex-wrap:nowrap;container-type:inline-size;}
.graph-tab{background:#2a0f1a;border:1px solid #3a1525;border-radius:8px;color:#a070b0;font-size:13px;font-weight:600;letter-spacing:0.03em;cursor:pointer;padding:5px 12px;transition:background 0.12s,color 0.12s,border-color 0.12s,box-shadow 0.12s;flex:1 1 auto;min-width:0;display:inline-flex;align-items:center;justify-content:center;gap:5px;white-space:nowrap;overflow:hidden;}
.graph-tab:hover{background:#3a1528;color:#d090c0;border-color:#6a3050;}
.graph-tab.active{background:#3c1838;color:#f0c0e0;border-color:#a060c0;box-shadow:0 0 8px rgba(160,90,200,0.5);}
.graph-tab-emoji{flex-shrink:0;}
.graph-tab-name{overflow:hidden;text-overflow:ellipsis;}
/* When the tab row gets too narrow to comfortably fit names alongside emojis,
   collapse to emoji-only. Tooltips still surface the full name on hover. */
@container (max-width: 380px) {
  .graph-tab-name { display: none; }
  .graph-tab { padding: 5px 8px; }
}
.graph-stats-row{display:flex;align-items:center;justify-content:space-around;padding:10px 16px 8px;border-bottom:1px solid #251020;gap:6px;flex-shrink:0;}
.graph-stat{display:flex;flex-direction:column;align-items:center;gap:2px;}
.graph-stat-val{font-size:24px;font-weight:700;color:#f0c0d0;line-height:1;}
.graph-stat-lbl{font-size:12px;color:#7a5080;text-transform:uppercase;letter-spacing:0.06em;}
.graph-stat-divider{width:1px;height:28px;background:#2e1028;flex-shrink:0;}
.graph-canvas-wrap{flex:1;min-height:0;padding:10px 8px 4px;display:flex;}
#graph-canvas{width:100%;height:100%;display:block;}

/* ── Achievement cash float ───────────────────────────────────────────────── */
@keyframes achCashFloat{0%{opacity:1;transform:translateY(0) scale(1);}80%{opacity:1;}100%{opacity:0;transform:translateY(-52px) scale(1.15);}}
.ach-cash-float{position:fixed;pointer-events:none;z-index:999999;font-size:13px;font-weight:700;color:#7dff85;text-shadow:0 1px 6px rgba(0,0,0,0.7);white-space:nowrap;animation:achCashFloat 1.1s ease-out forwards;}

/* ── Achievement Popup ────────────────────────────────────────────────────── */
@keyframes achPopIn{0%{opacity:0;transform:translateY(-16px) scale(0.85);}15%{opacity:1;transform:translateY(0) scale(1.05);}25%{transform:translateY(0) scale(1);}100%{opacity:1;transform:translateY(0);}}
/* The rainbow used to animate border-color + box-shadow on 8 keyframes, which
   triggered a full popup repaint ~50× per second per popup. Now the rainbow is
   a separate pseudo-element animating `filter: hue-rotate()` — composited on
   the GPU, no repaint of popup text/background per frame. */
@keyframes achHueCycle{from{filter:hue-rotate(0deg);}to{filter:hue-rotate(360deg);}}
/* Minigame / casino close confirmation popup. Sits on top of the overlay
   container (z 200) so it covers the in-progress minigame. Visual style
   mirrors #cosm-confirm-popup for consistency with the cosmetic-purchase
   confirm — same dark purple panel + soft glow. */
#mg-close-confirm{position:fixed;inset:0;z-index:1000001;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.2);}
#mg-cc-box{background:rgba(26,8,40,0.8);border:1.5px solid #7040c0;border-radius:14px;padding:22px 28px;text-align:center;box-shadow:0 0 32px 8px rgba(112,64,192,0.45);min-width:260px;max-width:380px;}
#mg-cc-msg{font-size:18px;color:#ff5050;margin-bottom:18px;line-height:1.5;font-weight:700;font-family:Calibri,sans-serif;}
#mg-cc-sub{display:block;margin-top:6px;font-size:16px;color:#ff5050;font-weight:700;font-family:Calibri,sans-serif;}
#mg-cc-sub.mg-cc-sub-save{color:#ffffff;}
#mg-cc-btns{display:flex;gap:12px;justify-content:center;}
#mg-cc-yes{background:#5a1010;border:1px solid #c04040;border-radius:10px;padding:8px 26px;font-size:14px;font-weight:700;color:#f0a0a0;cursor:pointer;transition:background 0.15s;}
#mg-cc-yes:hover{background:#902020;color:#ffd0d0;}
#mg-cc-no{background:#3a1060;border:1px solid #7040c0;border-radius:10px;padding:8px 26px;font-size:14px;font-weight:700;color:#c0a0f0;cursor:pointer;transition:background 0.15s;}
#mg-cc-no:hover{background:#5020a0;color:#f0d0ff;}

/* Stack is anchored to the top of the left column. JS (_positionAchPopupStack
   in achievements.js) sets `top`, `left`, and `width` from #left-col's rect on
   init / resize. align-items:center keeps each popup centered horizontally
   inside the column instead of stretching to its full width. */
#ach-popup-stack{position:fixed;top:0;left:0;z-index:999998;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none;contain:layout style;}
#ach-popup-stack > .ach-popup:first-child{margin-top:8px;}
/* `contain: paint` removed — it clipped the ::before pseudo's outside border
   and box-shadow glow. `contain: layout` still isolates layout work. */
.ach-popup{position:relative;background:rgba(30,13,38,0.66);border-radius:14px;padding:10px 44px 10px 18px;display:flex;align-items:center;gap:12px;width:360px;box-sizing:border-box;pointer-events:none;animation:achPopIn 0.4s ease forwards;contain:layout;overflow:hidden;box-shadow:0 0 10px 2px rgba(255,0,96,0.28),0 4px 18px rgba(0,0,0,0.5);}
.ach-popup::before{content:'';position:absolute;inset:0;border-radius:14px;border:2.5px solid #b04070;pointer-events:none;animation:achHueCycle 2.4s linear infinite;box-sizing:border-box;}
#ach-popup-stack.many-popups > .ach-popup::before{animation:none;}
.ach-popup-timer{position:absolute;top:4px;left:5px;height:3px;width:calc(100% - 10px);background:linear-gradient(90deg,#ff2040,#c00020);border-radius:10px 10px 0 0;transform-origin:left center;animation:achTimerShrink 6s linear forwards;z-index:2;pointer-events:none;}
@keyframes achTimerShrink{from{transform:scaleX(1);}to{transform:scaleX(0);}}
.ach-popup-close{pointer-events:auto;z-index:3;font-size:13px;padding:2.4px 7px;}
.ach-popup-icon{font-size:30px;line-height:1;flex-shrink:0;width:34px;text-align:center;}
.ach-popup-text{display:flex;flex-direction:column;gap:2px;flex:1;}
.ach-popup-title{font-size:13px;font-weight:700;color:#c090d0;letter-spacing:0.06em;text-transform:uppercase;}
.ach-popup-name{font-size:17px;font-weight:700;color:#f0e0ff;}

