:root {
    --bg-color: #06090e;
    --text-color: #e2f1f8;
    --text-muted: #8ca5a1;
    --panel-bg: rgba(9, 15, 20, 0.7);
    --panel-border: rgba(0, 255, 170, 0.2);
    --input-bg: rgba(6, 12, 16, 0.8);
    
    --accent: #00ffaa;      /* Hyper-green/cyan */
    --secondary: #00bfff;   /* Electric blue */
    --tertiary: #b000ff;    /* Deep purple/pink */
    
    --font-heading: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', Courier, monospace;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-heading);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    /* Subtle metallic dot grid background */
    background-image: 
        radial-gradient(rgba(0, 255, 170, 0.08) 1px, transparent 1px);
    background-size: 30px 30px;
}

/* Background Effects */
.robot-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: calc(100vh + 150px); /* Fallback */
    height: calc(100dvh + 150px); /* Dynamic viewport for mobile address bar shifts */
    z-index: 0; /* Behind actual content container, above background layers */
    pointer-events: auto; /* Allow interaction with the 3D model */
}

.background-effects {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    /* Subtly animated ambient lighting */
    background: radial-gradient(circle at top right, rgba(0, 255, 170, 0.04), transparent 45%),
                radial-gradient(circle at bottom left, rgba(0, 191, 255, 0.04), transparent 45%);
}

.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.25;
    animation: drift 20s infinite alternate ease-in-out;
}

@keyframes drift {
    0% { transform: scale(1) translate(0px, 0px); }
    50% { transform: scale(1.1) translate(50px, -50px); }
    100% { transform: scale(0.9) translate(-50px, 50px); }
}

.glow-1 {
    width: 700px;
    height: 700px;
    background: var(--accent);
    top: -300px;
    left: -200px;
}

.glow-2 {
    width: 600px;
    height: 600px;
    background: var(--secondary);
    bottom: -200px;
    right: -200px;
}

.grid-overlay {
    display: none;
}

/* Layout */
.container {
    max-width: 1150px;
    margin: 0 auto;
    padding: 4rem 1.5rem;
    position: relative;
    z-index: 1;
    pointer-events: none; /* Let clicks pass to the 3D robot background */
}

/* Make actual contents of container interactive */
.container > * {
    pointer-events: auto;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
    animation: fadeInDown 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.title {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    color: #fff;
    /* Soft glowing text */
    text-shadow: 0 0 30px rgba(0, 255, 170, 0.4);
}

.title .highlight {
    background: linear-gradient(135deg, var(--accent), var(--secondary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 4px;
}

.subtitle::before {
    content: "SYSTEM OP: ";
    color: var(--secondary);
}

/* Glass Panel Utility */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255,255,255,0.05);
}

/* Search Section */
.search-section {
    padding: 1.8rem;
    margin-bottom: 4rem;
    max-width: 850px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    animation: fadeIn 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Glowing pseudo-border for the search frame */
.search-section::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 17px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--secondary), transparent);
    background-size: 200% 100%;
    z-index: -1;
    opacity: 0.3;
    animation: pulseBorder 4s linear infinite;
}

@keyframes pulseBorder {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.input-group {
    display: flex;
    gap: 1.2rem;
}

input[type="text"] {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid rgba(0, 255, 170, 0.1);
    border-radius: 10px;
    padding: 1.2rem 1.8rem;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 1.2rem;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.8);
}

input[type="text"]::placeholder {
    color: rgba(140, 165, 161, 0.4);
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(0, 255, 170, 0.2), inset 0 0 20px rgba(0, 255, 170, 0.05);
    background: rgba(4, 8, 12, 0.9);
}

.primary-btn {
    position: relative;
    background: rgba(0, 255, 170, 0.05);
    border: 1px solid var(--accent);
    border-radius: 10px;
    padding: 0 2.5rem;
    color: var(--accent);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 180px;
}

.primary-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 170, 0.2), transparent);
    transition: all 0.4s ease;
}

.primary-btn:hover {
    background: rgba(0, 255, 170, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 255, 170, 0.3);
    color: #fff;
    text-shadow: 0 0 10px var(--accent);
}

.primary-btn:hover::before {
    left: 100%;
    transition: all 0.6s ease;
}

.primary-btn:active {
    transform: translateY(1px);
}

.primary-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: var(--text-muted);
    color: var(--text-muted);
    box-shadow: none;
}

/* Scanning Terminal Animation */
.scanning-terminal {
    max-width: 850px;
    margin: 0 auto 4rem auto;
    background: rgba(4, 8, 12, 0.95);
    border: 1px solid rgba(0, 255, 170, 0.3);
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0, 255, 170, 0.15), inset 0 0 20px rgba(0, 255, 170, 0.05);
    overflow: hidden;
    animation: fadeIn 0.5s ease-out forwards;
}

.terminal-header {
    background: rgba(0, 255, 170, 0.1);
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(0, 255, 170, 0.2);
}

.terminal-header .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.terminal-title {
    margin-left: 1rem;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    letter-spacing: 2px;
}

.terminal-body {
    padding: 1.5rem;
    height: 250px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    text-shadow: 0 0 5px rgba(0, 255, 170, 0.4);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.terminal-line {
    opacity: 0;
    animation: typeLine 0.1s forwards;
    display: flex;
}
.terminal-line::before {
    content: ">";
    margin-right: 10px;
    color: #fff;
}
.terminal-line.success { color: #fff; }
.terminal-line.success::before { content: "[OK]"; color: var(--accent); margin-right: 10px; }
.terminal-line.warning { color: #ffbd2e; text-shadow: 0 0 5px rgba(255, 189, 46, 0.5); }
.terminal-line.warning::before { content: "[!]"; color: #ffbd2e; margin-right: 10px; }

@keyframes typeLine {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.scanning-terminal.hidden {
    display: none !important;
}

/* Loader */
.loader {
    width: 22px;
    height: 22px;
    border: 2px solid rgba(0, 255, 170, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

.hidden {
    display: none !important;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Sleek Cards */
.card {
    padding: 2rem;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
    position: relative;
    border-radius: 16px;
    border-top: 1px solid rgba(0, 255, 170, 0.4);
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 255, 170, 0.1);
    border-color: rgba(0, 191, 255, 0.6);
}

.full-width {
    grid-column: 1 / -1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.8rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.card-header h2 {
    font-size: 1.3rem;
    font-family: var(--font-mono);
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
}

.card-header .icon {
    font-size: 1.8rem;
    opacity: 0.8;
    filter: drop-shadow(0 0 8px rgba(0, 191, 255, 0.5));
}

.card-content {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--text-color);
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 170, 0.2) transparent;
}

.card-content::-webkit-scrollbar {
    height: 4px;
    width: 4px;
}
.card-content::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 170, 0.3);
    border-radius: 4px;
}

/* Data rendering styles */
.data-row {
    margin-bottom: 1.2rem;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    border-bottom: 1px dotted rgba(255,255,255,0.05);
    padding-bottom: 0.6rem;
}

.data-key {
    color: var(--secondary);
    margin-right: 1.2rem;
    min-width: 140px;
    font-weight: 600;
}

.data-value {
    color: #fff;
    flex: 1;
    word-break: break-all;
    line-height: 1.6;
}

.tag {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: rgba(0, 191, 255, 0.1);
    border: 1px solid rgba(0, 191, 255, 0.2);
    border-radius: 6px;
    margin: 0.2rem;
    color: #7dd3fc;
    font-weight: 600;
    transition: all 0.2s ease;
}

.tag:hover {
    background: rgba(0, 191, 255, 0.2);
    border-color: rgba(0, 191, 255, 0.5);
    box-shadow: 0 4px 10px rgba(0, 191, 255, 0.2);
}

.tag.port {
    background: rgba(0, 255, 170, 0.1);
    border-color: rgba(0, 255, 170, 0.3);
    color: var(--accent);
}

.tag.port:hover {
    background: rgba(0, 255, 170, 0.2);
    box-shadow: 0 4px 10px rgba(0, 255, 170, 0.2);
}

/* Animations */
@keyframes fadeInDown {
    0% { transform: translateY(-40px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes slideUpFade {
    0% { transform: translateY(30px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.staggered-anim {
    opacity: 0;
    animation: slideUpFade 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: var(--delay);
}

/* Error/Empty states */
.error-text {
    color: #f87171;
    padding: 0.6rem 1rem;
    background: rgba(248, 113, 113, 0.05);
    border-left: 3px solid #f87171;
    display: inline-block;
    border-radius: 4px;
}

.empty-text {
    color: rgba(140, 165, 161, 0.6);
    font-style: italic;
}

/* =============================================
   MOBILE RESPONSIVENESS (Full Overhaul)
   ============================================= */

/* --- Tablet & Large Mobile (max 768px) --- */
@media screen and (max-width: 768px) {

    /* Hide the heavy 3D Spline viewer on mobile to save performance */
    .robot-bg {
        display: none !important;
    }

    /* Pulse the ambient glow background instead */
    .background-effects {
        z-index: -1;
    }

    /* Show animated cyber grid as alternative background */
    .grid-overlay {
        display: block !important;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background-image:
            linear-gradient(transparent 95%, rgba(0, 255, 170, 0.15) 100%),
            linear-gradient(90deg, transparent 95%, rgba(0, 191, 255, 0.15) 100%);
        background-size: 40px 40px;
        z-index: -1;
        animation: cyberGridMobile 20s linear infinite;
        pointer-events: none;
    }

    @keyframes cyberGridMobile {
        0%   { transform: translateY(0); }
        100% { transform: translateY(40px); }
    }

    /* --- Layout --- */
    .container {
        padding: 2.5rem 1rem 3rem;
    }

    .header {
        margin-bottom: 2.5rem;
    }

    /* --- Typography --- */
    .title {
        font-size: 2.6rem;
        letter-spacing: -0.5px;
    }

    .subtitle {
        font-size: 0.82rem;
        letter-spacing: 2px;
    }

    /* --- Search Bar: stack input & button vertically --- */
    .search-section {
        padding: 1.2rem;
        margin-bottom: 2rem;
    }

    .input-group {
        flex-direction: column;
        gap: 0.9rem;
    }

    input[type="text"] {
        font-size: 1rem;
        padding: 1rem 1.2rem;
        width: 100%;
    }

    .primary-btn {
        width: 100%;
        min-width: unset;
        padding: 1rem 1.2rem;
        font-size: 1rem;
    }

    /* --- Terminal --- */
    .scanning-terminal {
        margin-bottom: 2rem;
    }

    .terminal-title {
        font-size: 0.75rem;
        letter-spacing: 1px;
    }

    .terminal-body {
        height: 180px;
        padding: 1rem;
        font-size: 0.82rem;
    }

    /* --- Results Cards: single column --- */
    .results-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }

    .card {
        padding: 1.4rem;
    }

    .card-header h2 {
        font-size: 1.1rem;
    }

    .card-header .icon {
        font-size: 1.5rem;
    }

    /* --- Data rows: stack key & value --- */
    .data-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .data-key {
        min-width: unset;
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.25rem;
        font-size: 0.82rem;
    }

    .data-value {
        font-size: 0.9rem;
    }

    /* Tags wrap nicely on small screens */
    .tag {
        font-size: 0.8rem;
        padding: 0.25rem 0.6rem;
    }
}

/* --- Small Mobile Phones (max 480px) --- */
@media screen and (max-width: 480px) {

    .container {
        padding: 2rem 0.8rem 2.5rem;
    }

    .header {
        margin-bottom: 2rem;
    }

    .title {
        font-size: 2rem;
        letter-spacing: 0;
    }

    .subtitle {
        font-size: 0.72rem;
        letter-spacing: 1.5px;
    }

    .subtitle::before {
        content: ""; /* Hide SYSTEM OP: prefix on very small screens */
    }

    .search-section {
        padding: 1rem;
    }

    input[type="text"] {
        font-size: 0.95rem;
        padding: 0.9rem 1rem;
    }

    .primary-btn {
        font-size: 0.95rem;
        letter-spacing: 1px;
        padding: 0.9rem 1rem;
    }

    .terminal-body {
        height: 160px;
        font-size: 0.78rem;
    }

    .card {
        padding: 1.2rem;
    }

    .card-header h2 {
        font-size: 1rem;
    }

    .card-content {
        font-size: 0.85rem;
    }
}

