:root {
    --bg: #0a0f1a;
    --bg-gradient-end: #121a2e;
    --card: rgba(20, 28, 48, 0.92);
    --card-border: rgba(100, 180, 255, 0.60);
    --text: #f9fbfd;
    --text-dim: #d1d9e6;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.75);
    --success: #22c55e;
    --warn: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --purple: #a855f7;
    --blur: 10px;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: linear-gradient(135deg, var(--bg) 0%, var(--bg-gradient-end) 100%);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    min-height: 100vh;
    padding: 2rem 1.5rem;
    line-height: 1.6;
}

h1 {
    font-size: clamp(2.2rem, 5.5vw, 3.8rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, #c7d2fe, #60a5fa, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-align: center;
    margin: 0 0 2.2rem;
    text-shadow: 0 2px 12px rgba(96, 165, 250, 0.35);
}

#sysinfo,
#output,
#results {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto 1.8rem;
    background: var(--card);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1.5px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1.8rem;
    box-shadow: var(--shadow);
}

#output,
#results {
    min-height: 320px;
    max-height: 480px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.98rem;
    line-height: 1.65;
    background: rgba(10, 15, 30, 0.75);
    border-radius: 10px;
    padding: 1.2rem;
}

#results {
    border-left: 6px solid var(--accent);
}

#controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    justify-content: center;
    margin: 2rem 0;
}

button {
    padding: 0.9rem 2.2rem;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.28s ease;
    border: 2px solid transparent;
    background: rgba(35, 50, 85, 0.9);
    color: white;
    backdrop-filter: blur(8px);
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.45);
}

button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.55), 0 0 40px var(--accent-glow);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.45), rgba(168, 85, 247, 0.35));
    border-color: rgba(59, 130, 246, 0.85);
}

button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

#runChain {
    background: linear-gradient(135deg, #15803d, #22c55e);
    border: none;
    font-size: 1.12rem;
}

#runChain:hover {
    background: linear-gradient(135deg, #166534, #16a34a);
    box-shadow: 0 0 60px rgba(34, 197, 94, 0.65);
}

#progressText {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 600;
    margin: 1rem 0 1.5rem;
    color: var(--warn);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.result {
    margin: 0.45rem 0;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.35);
    font-weight: 500;
    word-break: break-all;
}

.info {
    color: #a5b4fc;
}

.success {
    background: rgba(34, 197, 94, 0.22);
    color: #86efac;
    font-weight: 600;
}

.warn {
    background: rgba(245, 158, 11, 0.22);
    color: #fcd34d;
    font-weight: 600;
}

.danger,
.critical {
    background: rgba(239, 68, 68, 0.28);
    color: #fca5a5;
    font-weight: 700;
}

.stage1,
.stage2,
.stage3 {
    color: var(--purple);
    font-weight: 700;
    font-size: 1.05rem;
    margin: 1.3rem 0 0.6rem;
    display: block;
    border-bottom: 1.5px dashed rgba(168, 85, 247, 0.5);
    padding-bottom: 0.4rem;
}

/* Hex address highlight */
.hex {
    color: #93c5fd;
    font-weight: 500;
}

::-webkit-scrollbar {
    width: 11px;
}

::-webkit-scrollbar-track {
    background: rgba(10, 15, 30, 0.8);
    border-radius: 11px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent), var(--purple));
    border-radius: 11px;
    border: 3px solid rgba(10, 15, 30, 0.8);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #2563eb, #a855f7, #ec4899);
}

@media (max-width: 640px) {
    body {
        padding: 1.4rem 1rem;
    }

    #controls {
        flex-direction: column;
    }

    button {
        width: 100%;
        padding: 1rem;
    }
}