:root {
    --border-color: #000;
    --bg-color: #fff;
    --text-color: #000;
    --spacing: clamp(16px, 1.5vw, 32px);
    --sidebar-width: clamp(260px, 22vw, 320px);
    --font-base: clamp(12px, 0.9vw, 14px);
}

* { box-sizing: border-box; }

html {
    font-size: var(--font-base);
}

body {
    font-family: 'Courier New', Courier, monospace;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    font-size: 1rem;
    line-height: 1.5;
    height: 100vh;
    overflow-x: hidden;
    text-transform: uppercase;
}

/* =========================================
   LAYOUT
   ========================================= */
.layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.sidebar {
    border-right: 2px solid var(--border-color);
    padding: clamp(16px, 1.8vw, 24px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    background: #fff;
    z-index: 10;
    overflow-y: auto;
}

/* Desktop: Default Split View */
.main-content {
    height: 100%;
    overflow-y: auto;
    position: relative;
}

.split-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 100%;
}

.panel {
    padding: clamp(24px, 3vw, 48px);
    display: flex;
    flex-direction: column;
    border-right: 2px solid #000;
    height: 100%;
    overflow-y: auto;
    position: relative;
    background: #fff;
}
.panel:last-child { border-right: none; }

/* =========================================
   NAV & SIDEBAR ELEMENTS
   ========================================= */
.brand {
    font-weight: bold;
    font-size: clamp(1.1rem, 1.6vw, 1.5rem);
    margin-bottom: clamp(24px, 3vw, 40px);
    padding-bottom: clamp(12px, 1.5vw, 20px);
    border-bottom: 1px solid var(--border-color);
    letter-spacing: -1px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-grow: 1;
}

.nav-item {
    display: block;
    padding: clamp(8px, 1vw, 14px);
    text-decoration: none;
    color: var(--text-color);
    border: 1px solid transparent;
    transition: all 0.1s;
    font-size: clamp(0.85rem, 1vw, 1rem);
}

.nav-item:hover, .nav-item.active {
    border: 1px solid var(--border-color);
    background: #000;
    color: #fff;
}

.status-box {
    border: 1px solid #000;
    padding: 15px;
    margin-bottom: 20px;
    background: #fff;
}

.protocol-list {
    list-style: none;
    padding: 0;
    margin-top: 10px;
    font-size: 0.8rem;
}
.protocol-list li {
    margin-bottom: 15px;
    border-left: 3px solid #000;
    padding-left: 10px;
}
.protocol-list strong { display: block; font-weight: bold; margin-bottom: 3px; }
.protocol-list span { color: #555; display: block; text-transform: none; }

/* =========================================
   WIDGETS
   ========================================= */
h1 { font-size: 2rem; margin: 0 0 20px 0; font-weight: normal; text-decoration: underline; }
h3 { font-size: 1rem; margin: 0 0 10px 0; font-weight: bold; border-bottom: 1px solid #ccc; padding-bottom: 5px; }

.counter-display {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 900;
    margin: 20px 0;
    letter-spacing: -5px;
    line-height: 1;
}
.counter-label { font-size: 12px; font-weight: bold; margin-bottom: 5px; }

.info-row { display: flex; justify-content: space-between; margin-bottom: 5px; }
.info-val { font-weight: bold; }

.control-group { margin-bottom: 20px; }
label { display: block; margin-bottom: 10px; font-weight: bold; }

input[type="text"], input[type="number"] {
    width: 100%;
    padding: 15px;
    border: 2px solid #000;
    background: #fff;
    font-family: inherit;
    font-size: 1.2rem;
    color: #000;
    outline: none;
    border-radius: 0;
}
input:focus { background: #000; color: #fff; }

.btn {
    width: 100%;
    padding: clamp(14px, 1.8vw, 24px);
    border: 2px solid #000;
    background: transparent;
    color: #000;
    font-family: inherit;
    font-weight: bold;
    font-size: clamp(1rem, 1.3vw, 1.3rem);
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.1s;
    margin-bottom: clamp(8px, 1vw, 12px);
    position: relative;
}
.btn:hover:not(:disabled) { background: #000; color: #fff; }
.btn:disabled { opacity: 0.3; cursor: not-allowed; border-style: dashed; }
.btn-danger { border-color: #000; }
.btn-danger:hover { background: #000; color: #fff; text-decoration: line-through; }

.timer-display {
    font-size: 2rem;
    font-weight: bold;
    border: 2px solid #000;
    padding: 10px;
    text-align: center;
    margin-bottom: 10px;
    background: repeating-linear-gradient(45deg, #fff, #fff 10px, #eee 10px, #eee 20px);
}

.log-terminal, .bot-log {
    background: #fff;
    border-top: 2px solid #000;
    overflow-y: auto;
    padding: 10px;
    font-size: 12px;
    margin-top: 20px;
    border-bottom: 1px solid #000;
}

.log-terminal { height: 250px; }
/* Increase Bot Log height to align titles since it has no button below it */
.bot-log { height: 305px; background: #f0f0f0; }

.log-entry { margin-bottom: 2px; }
.log-entry.error { font-weight: bold; text-decoration: underline; }
.log-entry.success { font-weight: bold; }

/* =========================================
   OVERLAYS & UTILS
   ========================================= */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.98);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.overlay-content {
    border: 2px solid #000;
    background: #fff;
    padding: 40px;
    width: 100%;
    max-width: 500px;
    box-shadow: 10px 10px 0px #000;
}

.hidden { display: none !important; }

/* =========================================
   TECH SPECS
   ========================================= */
.tech-trigger {
    cursor: help;
    display: inline-block;
    color: #fff;
    background: #000;
    padding: 0 6px;
    font-size: 0.8em;
    margin-left: 8px;
    border: 1px solid #000;
    vertical-align: middle;
}
.tech-trigger:hover { background: #fff; color: #000; }

.tech-explainer {
    background: #1a1a1a;
    color: #00ff00;
    padding: 15px;
    border: 1px solid #000;
    margin: 10px 0 20px 0;
    font-size: 0.85rem;
    display: none;
    box-shadow: 5px 5px 0px rgba(0,0,0,0.2);
    line-height: 1.4;
    text-transform: none;
}
.tech-explainer.active { display: block; }
.tech-title { font-weight: bold; border-bottom: 1px dashed #00ff00; margin-bottom: 8px; display: block; text-transform: uppercase; }

/* =========================================
   MID-SIZED SCREENS (1000px - 1399px)
   ========================================= */
@media (min-width: 1000px) and (max-width: 1399px) {
    :root {
        --font-base: 11px;
        --spacing: 18px;
        --sidebar-width: 240px;
    }
    
    .panel {
        padding: 24px;
    }
    
    .log-terminal { height: 200px; }
    .bot-log { height: 255px; }
}

/* =========================================
   LARGE SCREENS (1400px - 1599px)
   ========================================= */
@media (min-width: 1400px) and (max-width: 1599px) {
    :root {
        --font-base: 12px;
        --spacing: 22px;
        --sidebar-width: 280px;
    }
}

/* =========================================
   EXTRA LARGE SCREENS (Min Width 1600px)
   ========================================= */
@media (min-width: 1600px) {
    :root {
        --font-base: 14px;
        --spacing: 28px;
        --sidebar-width: 320px;
    }
}

/* =========================================
   RESPONSIVE (MOBILE)
   ========================================= */
@media (max-width: 900px) {
    body { overflow-y: auto; height: auto; }
    .layout { display: flex; flex-direction: column; height: auto; width: 100%; overflow: visible; }
    
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 2px solid #000;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 15px; /* Symmetric Padding */
        position: sticky;
        top: 0;
    }
    .brand { margin: 0 20px 0 0; padding: 0; border: none; font-size: 1.1rem; }
    .nav { flex-direction: row !important; gap: 10px; margin-top: 0; }
    .nav-item { padding: 8px; font-size: 11px; }
    
    /* Hide specific desktop elements */
    .protocol-list, .sidebar .status-box { display: none !important; }
    
    #logout-btn { margin-left: auto; width: auto; padding: 5px 10px; font-size: 10px; }
    
    .main-content { display: block; height: auto; width: 100%; }
    .split-view { display: block; height: auto; }
    
    .panel {
        width: 100%;
        border-right: none;
        border-bottom: 2px solid #000;
        height: auto;
        min-height: auto;
        padding: 20px; /* Symmetric Padding */
        overflow: visible;
    }
    
    /* Reset heights for mobile */
    .log-terminal, .bot-log { height: 200px; }
}