:root {
    --primary-color: #ff003c;
    --primary-hover: #cc0030;
    --background-color: #0d0d0d;
    --card-bg: #1a1a1a;
    --text-color: #e0e0e0;
    --secondary-text: #a0a0a0;
    --border-color: #333333;
    --input-bg: #2a2a2a;
    --glow-color: rgba(255, 0, 60, 0.4);
}

body {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    /* Hacker font */
    background-color: var(--background-color);
    background-image: linear-gradient(0deg, transparent 24%, rgba(255, 0, 60, .05) 25%, rgba(255, 0, 60, .05) 26%, transparent 27%, transparent 74%, rgba(255, 0, 60, .05) 75%, rgba(255, 0, 60, .05) 76%, transparent 77%, transparent), linear-gradient(90deg, transparent 24%, rgba(255, 0, 60, .05) 25%, rgba(255, 0, 60, .05) 26%, transparent 27%, transparent 74%, rgba(255, 0, 60, .05) 75%, rgba(255, 0, 60, .05) 76%, transparent 77%, transparent);
    background-size: 50px 50px;
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    width: 90%;
    max-width: 900px;
    background: var(--card-bg);
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    box-shadow: 0 0 20px var(--glow-color);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
    overflow: hidden;
}

/* Optional: "Top Secret" or scanline effect overlay */
.container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
}

header {
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--glow-color);
    font-size: 2rem;
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9rem;
}

input {
    width: 100%;
    padding: 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: white;
    border-radius: 2px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
    /* Fix padding issue */
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--glow-color);
}

button {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 1rem 1.5rem;
    border-radius: 2px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: bold;
    text-transform: uppercase;
    width: 100%;
    margin-top: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 0 5px var(--glow-color);
}

button:hover {
    background-color: var(--primary-color);
    color: black;
    box-shadow: 0 0 20px var(--glow-color);
}

.connection-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    border-left: 1px solid var(--border-color);
    padding-left: 3rem;
}

@media (max-width: 850px) {
    body {
        align-items: flex-start;
        /* Better for mobile scrolling */
        padding: 1rem 0;
        background-size: 25px 25px;
        /* Smaller pattern on mobile */
    }

    .container {
        width: 95%;
        padding: 1.5rem;
        gap: 1.5rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
        box-shadow: none;
        /* Simplify on mobile for performance */
    }

    header h1 {
        font-size: 1.5rem;
        /* Smaller title */
    }

    main {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .connection-section {
        border-left: none;
        padding-left: 0;
        border-top: 1px dashed var(--border-color);
        /* Dashed separator */
        padding-top: 2rem;
    }

    /* Mobile specific input/button sizes for touch targets */
    input,
    button {
        font-size: 16px;
        /* Prevent zoom on iOS */
        padding: 1.2rem;
        /* Larger touch area */
    }

    #qr-container {
        min-width: 100%;
        /* Full width for QR */
        width: 100%;
        min-height: 200px;
    }
}

#qr-container {
    margin-top: 1.5rem;
    border: 1px solid var(--primary-color);
    padding: 1rem;
    border-radius: 4px;
    min-width: 260px;
    min-height: 260px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    /* QR code needs white background to scan reliably */
    box-shadow: 0 0 15px var(--glow-color);
}

#qr-code {
    max-width: 100%;
    height: auto;
}

#status-container {
    font-weight: bold;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    font-size: 1.2rem;
    text-align: center;
    padding: 0.5rem;
    border: 1px dashed var(--border-color);
    width: 100%;
}

/* Status specific colors */
.status-connected {
    color: #00ff00 !important;
    text-shadow: 0 0 10px #00ff00;
}

.status-disconnected {
    color: #ff003c !important;
    text-shadow: 0 0 10px #ff003c;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--background-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}