:root {
    --glass-bg: rgba(15, 23, 42, 0.8);
    --glass-border: rgba(51, 65, 85, 0.6);
}

html { scroll-behavior: smooth; }

body { 
    font-family: 'Sarabun', 'Inter', sans-serif; 
    background-color: #020617; 
    background-image: url('https://images.unsplash.com/photo-1506703719300-77a8a39f6fb?q=80&w=2560&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    font-size: 16px;
}

.font-mono { font-family: 'Fira Code', monospace; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0f172a; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

.glass-panel { 
    background: var(--glass-bg); 
    backdrop-filter: blur(16px); 
    -webkit-backdrop-filter: blur(16px); 
    border: 1px solid var(--glass-border); 
}

/* 🌟 Mempool & Chain Cubes */
.block-cube {
    width: 150px; min-width: 85px; height: 125px; border-radius: 10px; padding: 8px;
    display: flex; flex-direction: column; justify-content: center; align-items: center; 
    transition: all 0.2s ease; cursor: pointer; text-align: center; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    border-top: 1px solid rgba(255,255,255,0.15); border-left: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 1; overflow: hidden;
}
.block-cube:hover { transform: translateY(-4px); filter: brightness(1.15); box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.6); }

.mempool-high { background: linear-gradient(180deg, #78350f 0%, #451a03 100%); border: 1px solid #b45309; }
.mempool-med { background: linear-gradient(180deg, #166534 0%, #064e3b 100%); border: 1px solid #15803d; }
.mempool-low { background: linear-gradient(180deg, #14532d 0%, #064e3b 100%); border: 1px solid #166534; }

.chain-latest { background: linear-gradient(180deg, #4c1d95 0%, #1e3a8a 100%); border: 1px solid #3b82f6; }
.chain-inter { background: linear-gradient(180deg, #1e1b4b 0%, #0f172a 100%); border: 1px solid #312e81; }
.chain-genesis { background: linear-gradient(180deg, #9a3412 0%, #451a03 100%); border: 1px solid #f59e0b; }

.my-new-block { background: linear-gradient(180deg, #4c1d95 0%, #1e3a8a 100%); border: 1px solid #3b82f6; box-shadow: 0 0 20px rgba(59, 130, 246, 0.5); flex-shrink: 1; animation: slideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.orphan-block { background: linear-gradient(180deg, #991b1b 0%, #450a0a 100%); border: 1px solid #ef4444; opacity: 0.6; animation: slideInDrop 0.6s ease forwards; }

@keyframes slideIn { 0% { transform: translateX(-20px) scale(0.8); opacity: 0; } 100% { transform: translateX(0) scale(1); opacity: 1; } }
@keyframes slideInDrop { 0% { transform: translateX(-20px) scale(0.8); opacity: 0; } 50% { transform: translateX(0) scale(1); opacity: 1; } 100% { transform: translateY(15px); opacity: 0.6; } }

/* 🛡️ Base Nodes Settings */
.base-node {
    position: absolute; width: 32px; height: 32px; border-radius: 50%;
    background-color: #0f172a; border: 2px solid #475569;
    transform: translate(-50%, -50%); transition: all 0.3s ease;
    background-size: cover; background-position: center; background-repeat: no-repeat;
    box-shadow: 0 4px 10px rgba(0,0,0,0.8); z-index: 20;
}

/* 🛡️ Animations for Nodes */
@keyframes pulse-node { 0%, 100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); } 50% { transform: translate(-50%, -50%) scale(1.15); box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); } }
@keyframes pulse-node-fail { 0%, 100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); } 50% { transform: translate(-50%, -50%) scale(1.15); box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); } }
@keyframes pulse-node-verify { 0%, 100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7); } 50% { transform: translate(-50%, -50%) scale(1.1); box-shadow: 0 0 0 10px rgba(56, 189, 248, 0); } }

.anim-node-success { animation: pulse-node 2s infinite; border-color: #10b981 !important; border-width: 3px !important; }
.anim-node-fail { animation: pulse-node-fail 2s infinite; border-color: #ef4444 !important; border-width: 3px !important; }
.anim-node-verifying { animation: pulse-node-verify 0.4s infinite; border-color: #38bdf8 !important; background-color: rgba(12, 74, 110, 0.9) !important; border-width: 3px !important; }

/* 🌐 Lines & Mesh Network */
.net-link { stroke: #334155; stroke-width: 0.5; opacity: 0.5; z-index: 10; transition: all 0.3s ease; }
@keyframes draw-line { 0% { stroke-dashoffset: 100; } 100% { stroke-dashoffset: 0; } }

.anim-line-flow { stroke-dasharray: 100; stroke-dashoffset: 100; animation: draw-line 0.4s ease-in forwards; stroke: #10b981; stroke-width: 0.8; opacity: 1 !important; filter: drop-shadow(0 0 3px #10b981); }
.anim-line-fail { stroke-dasharray: 100; stroke-dashoffset: 100; animation: draw-line 0.4s ease-in forwards; stroke: #ef4444; stroke-width: 0.8; opacity: 1 !important; filter: drop-shadow(0 0 3px #ef4444); }
.anim-line-transmit { stroke-dasharray: 100; stroke-dashoffset: 100; animation: draw-line 0.3s ease-in forwards; stroke: #38bdf8; stroke-width: 0.8; opacity: 1 !important; filter: drop-shadow(0 0 4px #38bdf8); }

/* 💬 Node Chat Pop-up */
.anim-node-chat {
    animation: float-up-fade 1.2s ease-out forwards;
    transform: translateX(-50%);
}

@keyframes float-up-fade {
    0% { opacity: 0; transform: translate(-50%, 10px) scale(0.8); }
    15% { opacity: 1; transform: translate(-50%, 0px) scale(1.1); }
    85% { opacity: 1; transform: translate(-50%, -5px) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -15px) scale(0.9); }
}

/* 🌟 Gossip Protocol Animations */
.anim-packet-inv {
    stroke-dasharray: 1 1.5 1 1.5 4 200; 
    stroke-linecap: round;
    animation: packet-forward 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    stroke: #f59e0b !important;
    stroke-width: 1 !important; 
    opacity: 1 !important;
    filter: drop-shadow(0 0 5px rgba(245, 158, 11, 0.8));
}

.anim-packet-get {
    stroke-dasharray: 1 1.5 1 1.5 4 200;
    stroke-linecap: round;
    animation: packet-backward 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    stroke: #d946ef !important;
    stroke-width: 1 !important;
    opacity: 1 !important;
    filter: drop-shadow(0 0 5px rgba(217, 70, 239, 0.8));
}

@keyframes packet-forward {
    0% { stroke-dashoffset: 150; }
    100% { stroke-dashoffset: -50; }
}

@keyframes packet-backward {
    0% { stroke-dashoffset: -50; }
    100% { stroke-dashoffset: 150; }
}

/* 🧩 Modals & UI Components */
.modal-show { opacity: 1 !important; pointer-events: auto !important; z-index: 100; }
.modal-show .modal-content { transform: scale(1) !important; }
.tx-card { padding: 10px !important; margin-bottom: 6px; border-radius: 8px; cursor: pointer; transition: transform 0.1s, border-color 0.2s; user-select: none; }
.tx-card:active { transform: scale(0.98); }
.live-badge { animation: blink 2s ease-in-out infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* 💡 TOUR GUIDE HIGHLIGHT */
.tour-highlight {
    position: relative;
    z-index: 155; 
    box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.3), 0 0 20px rgba(34, 211, 238, 0.6) !important;
    border-color: #22d3ee !important;
    animation: tour-pulse 1.5s infinite;
    border-radius: inherit;
    background-color: rgba(15, 23, 42, 0.9) !important; 
}
@keyframes tour-pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(34, 211, 238, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0); }
}

/* ⚖️ Consensus Checklist Animations */
.text-emerald-400-glow { 
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.8), 0 0 20px rgba(16, 185, 129, 0.4); 
    transform: scale(1.2);
    display: inline-block;
    transition: transform 0.2s ease-out;
}
.text-rose-400-glow { 
    text-shadow: 0 0 10px rgba(225, 29, 72, 0.8), 0 0 20px rgba(225, 29, 72, 0.4); 
}
.anim-shake { 
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both; 
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* 🌳 Merkle Tree Visualizer */
.merkle-node {
    min-width: 90px;
    position: relative;
}
.merkle-node:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -10px;
    width: 10px;
    height: 1px;
    background-color: rgba(148, 163, 184, 0.2);
}

.anim-shake-once {
    animation: shake-heavy 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake-heavy {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px) rotate(-2deg); }
    40%, 80% { transform: translateX(5px) rotate(2deg); }
}