:root {
    --bg-dark: #09090b;
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --secondary: #8b5cf6;
    --danger: #ef4444;
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-highlight: rgba(255, 255, 255, 0.25);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { background-color: var(--bg-dark); color: var(--text-main); min-height: 100vh; overflow-x: hidden; position: relative; }

/* --- 3D Background Orbs --- */
.bg-mesh { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1; overflow: hidden; background: #050505; }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.6; animation: float 20s infinite ease-in-out alternate; }
.orb-1 { top: -10%; left: -10%; width: 50vw; height: 50vw; background: #1e1b4b; }
.orb-2 { bottom: -20%; right: -10%; width: 60vw; height: 60vw; background: #0f172a; animation-delay: -5s; }
.orb-3 { top: 40%; left: 40%; width: 30vw; height: 30vw; background: #312e81; animation-delay: -10s; }

@keyframes float { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(10%, 15%) scale(1.1); } }

/* --- Layout & Glassmorphism --- */
.container { max-width: 900px; margin: 0 auto; padding: 4rem 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; }
.glass-panel {
    background: var(--glass-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border); border-top: 1px solid var(--glass-highlight);
    box-shadow: 0 24px 48px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.1);
}
.capsule-panel { border-radius: 99px; }
.main-panel { border-radius: 99px; padding: 0.4rem; }
.table-panel { border-radius: 24px; padding: 1.5rem; }

/* --- Typography --- */
header { text-align: center; margin-bottom: 1rem; }
.gradient-text { background: linear-gradient(135deg, #60a5fa, #c084fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
h1.text-3d { font-size: 3rem; font-weight: 800; letter-spacing: -1px; text-shadow: 0 10px 30px rgba(96, 165, 250, 0.3); }

/* --- IP Badge --- */
.ip-badge {
    display: inline-flex; align-items: center; gap: 0.5rem; background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1.2rem; font-size: 0.85rem; color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.08); box-shadow: inset 0 1px 2px rgba(255,255,255,0.05); margin-bottom: 1rem;
}
.live-dot { width: 8px; height: 8px; background-color: #10b981; border-radius: 50%; box-shadow: 0 0 10px #10b981; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); } 70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); } }

/* --- Inputs --- */
.capsule { border-radius: 9999px; }
.input-group { display: flex; background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.05); box-shadow: inset 0 2px 10px rgba(0,0,0,0.5); padding: 0.25rem; }
input[type="url"] { flex: 1; background: transparent; border: none; padding: 1rem 1.5rem; color: white; font-size: 1rem; outline: none; }
input[type="url"]::placeholder { color: #64748b; }

/* --- Custom DIV Clickables --- */
.custom-div-btn {
    display: inline-flex; align-items: center; justify-content: center; user-select: none; cursor: pointer;
    font-weight: 600; transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); position: relative; overflow: hidden;
}

/* Shiny Main Button */
.shiny-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary)); padding: 0.8rem 2.2rem;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.5), inset 0 -4px 8px rgba(0,0,0,0.3), 0 4px 15px var(--primary-glow);
    color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.shiny-btn::after {
    content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.5), rgba(255,255,255,0)); transform: skewX(-25deg); transition: 0.5s;
}
.shiny-btn:hover { transform: translateY(-2px) scale(1.02); box-shadow: inset 0 2px 4px rgba(255,255,255,0.6), inset 0 -4px 8px rgba(0,0,0,0.3), 0 8px 25px rgba(139, 92, 246, 0.6); }
.shiny-btn:hover::after { left: 200%; transition: 0.7s ease-in-out; }
.shiny-btn:active { transform: translateY(2px) scale(0.98); box-shadow: inset 0 2px 4px rgba(0,0,0,0.3), inset 0 -2px 4px rgba(255,255,255,0.2), 0 2px 8px rgba(139, 92, 246, 0.4); }
.custom-div-btn.disabled { filter: grayscale(1) opacity(0.6); pointer-events: none; transform: none; box-shadow: none; }

/* Mini Action Buttons */
.mini-btn {
    background: rgba(255,255,255,0.05); padding: 0.4rem 1rem; font-size: 0.8rem;
    border: 1px solid rgba(255,255,255,0.1); box-shadow: inset 0 1px 1px rgba(255,255,255,0.1), 0 2px 5px rgba(0,0,0,0.2); color: var(--text-main);
}
.mini-btn:hover { background: rgba(255,255,255,0.15); transform: translateY(-1px); box-shadow: inset 0 1px 1px rgba(255,255,255,0.2), 0 4px 8px rgba(0,0,0,0.3); }
.mini-btn:active { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0,0,0,0.2); }

/* Danger Button (Smart Delete) */
.danger-btn { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.3); color: #fca5a5; }
.danger-btn:hover { background: rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.5); box-shadow: inset 0 1px 1px rgba(255,255,255,0.2), 0 4px 8px rgba(239, 68, 68, 0.2); color: #fff;}
.danger-btn.confirming { background: var(--danger); color: white; font-weight: bold; animation: pulseRed 1s infinite alternate; }
@keyframes pulseRed { 0% { box-shadow: 0 0 10px rgba(239,68,68,0.4); } 100% { box-shadow: 0 0 20px rgba(239,68,68,0.8); } }

/* Stats Badge Button (Click Count) */
.stats-badge { background: rgba(96, 165, 250, 0.15); border: 1px solid rgba(96, 165, 250, 0.3); color: #93c5fd; padding: 0.3rem 0.8rem; }
.stats-badge:hover { background: rgba(96, 165, 250, 0.3); color: #fff; box-shadow: 0 0 10px rgba(96, 165, 250, 0.4); }

/* Custom Div Links */
.custom-div-link { display: inline-flex; align-items: center; color: #93c5fd; font-weight: 600; letter-spacing: 0.5px; cursor: pointer; padding: 0.3rem 0.6rem; border-radius: 8px; transition: all 0.2s; }
.custom-div-link:hover { background: rgba(147, 197, 253, 0.1); text-shadow: 0 0 8px rgba(147, 197, 253, 0.6); transform: translateX(3px); }

/* --- Table & Action Layout --- */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 1rem; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.05); }
th { font-weight: 500; color: var(--text-muted); padding-top: 0.5rem; border-bottom: 1px solid rgba(255,255,255,0.1); }
tr:last-child td { border-bottom: none; }
.action-cell { display: flex; gap: 0.5rem; }

/* --- Modal --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 1000; display: flex; align-items: center; justify-content: center; opacity: 0; animation: fadeIn 0.3s forwards; }
.modal-panel { width: 90%; max-width: 450px; padding: 1.5rem; transform: scale(0.9); animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 1rem; }
.modal-header h3 { font-size: 1.2rem; font-weight: 600; }
.stats-list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.5rem; padding-right: 0.5rem; }
.stat-row { display: flex; justify-content: space-between; background: rgba(255,255,255,0.03); padding: 0.8rem 1rem; border-radius: 12px; border: 1px solid rgba(255,255,255,0.05); font-size: 0.9rem; }
.stat-ip { font-family: monospace; color: #cbd5e1; }
.stat-count { font-weight: bold; color: #3b82f6; }

/* Scrollbar for modal */
.stats-list::-webkit-scrollbar { width: 6px; }
.stats-list::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); border-radius: 10px; }
.stats-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

@keyframes fadeIn { to { opacity: 1; } }
@keyframes popIn { to { transform: scale(1); } }

/* --- Custom Toasts --- */
#toast-container { position: fixed; top: 2rem; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none; }
.toast { background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.1); border-top: 1px solid rgba(255,255,255,0.3); color: white; padding: 0.8rem 1.8rem; border-radius: 99px; font-size: 0.9rem; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,0.6); animation: toastSlideDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.toast-success { border-left: 3px solid #10b981; border-right: 3px solid #10b981; }
.toast-error { border-left: 3px solid #ef4444; border-right: 3px solid #ef4444; }
.toast-out { animation: toastSlideUp 0.3s ease-in forwards; }
@keyframes toastSlideDown { 0% { transform: translateY(-30px) scale(0.9); opacity: 0; } 100% { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes toastSlideUp { 0% { transform: translateY(0) scale(1); opacity: 1; } 100% { transform: translateY(-30px) scale(0.9); opacity: 0; } }

/* --- Loader & Redirect --- */
.fullscreen-center { height: 100vh; display: flex; align-items: center; justify-content: center; }
.redirect-box { padding: 3rem 5rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1.5rem; }
.loader { border: 3px solid rgba(255,255,255,0.05); border-top: 3px solid var(--primary); border-radius: 50%; width: 40px; height: 40px; animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }