/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', 'Courier', monospace;
    background-color: #3a3a3a;
    color: #ffffff;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    width: 100vw;
    width: 100dvw; /* Dynamic viewport width */
}

.toolkit-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    background-color: #3a3a3a;
    padding: 1rem;
    gap: 1rem;
    box-sizing: border-box;
    overflow: hidden;
}

/* Phase Indicator */
.phase-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    background-color: rgba(26, 26, 26, 0.9);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    border: 2px solid #2d2d2d;
    z-index: 1000;
}

.phase-indicator.haunted {
    border-color: #ff4444;
    background-color: rgba(255, 68, 68, 0.2);
}

.phase-status {
    color: #c0c0c0;
    font-weight: bold;
    font-size: 0.9rem;
}

.phase-indicator.haunted .phase-status {
    color: #ff4444;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.phase-toggle-btn {
    margin-left: 0.75rem;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    border: 1px solid #555;
    border-radius: 4px;
    background-color: #2d2d2d;
    color: #ccc;
    cursor: pointer;
}

.phase-toggle-btn:hover {
    background-color: #d4af37;
    color: #0a0a0a;
}

/* Tool Container */
.tool-container {
    flex: 1;
    min-height: 0; /* Important for flexbox overflow */
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.tool-panel {
    display: none;
    width: 100%;
    max-width: 500px;
}

.tool-panel.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Control Panel Base Style */
.control-panel {
    background-color: #c0c0c0;
    border: 4px solid #2d2d2d;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        0 4px 8px rgba(0, 0, 0, 0.5);
    position: relative;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for flexbox overflow */
    box-sizing: border-box;
    overflow: hidden;
}

/* Base Station Control Panel - special layout */
#tool-epv .control-panel {
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.25rem;
}

/* When QR codes are shown, allow control panel to grow */
#tool-epv .control-panel.qr-codes-active {
    max-height: none;
    height: auto;
    flex: 1 1 auto;
}

/* When QR codes are shown, allow the base station view to grow and remove aspect ratio constraint */
.base-station-view.qr-codes-active {
    aspect-ratio: auto;
    min-height: 300px;
    align-items: stretch;
}

/* Panel Label */
.panel-label {
    background-color: #2d2d2d;
    color: #ffffff;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    margin-bottom: 0;
    border-radius: 4px;
    flex-shrink: 0;
}

/* Base Station Panel Label - minimal padding */
#tool-epv .panel-label {
    margin-bottom: 0;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
}

/* LCD Display */
.panel-display {
    background-color: #1a1a1a;
    border: 2px solid #0a0a0a;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.lcd-display {
    font-family: 'Courier New', monospace;
    font-size: 3rem;
    font-weight: bold;
    color: #00ff41;
    text-shadow: 
        0 0 10px #00ff41,
        0 0 20px #00ff41,
        0 0 30px #00ff41;
    letter-spacing: 0.1em;
    font-variant-numeric: tabular-nums;
}

.lcd-display-secondary {
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.5rem;
    text-align: center;
}

.walkie-frequency-display {
    font-size: 1.2rem;
    color: #00ff41;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 
        0 0 5px #00ff41,
        0 0 10px #00ff41;
    font-variant-numeric: tabular-nums;
}

.display-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background-color: #2d2d2d;
    border: 2px solid #0a0a0a;
    border-radius: 4px;
    cursor: pointer;
}

.display-btn:hover {
    background-color: #3d3d3d;
}

/* EMF Controls */
.emf-controls {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

/* Unified Power Button Style for All Tools */
.tool-power-btn {
    padding: 0.6rem 1.2rem;
    background-color: #2d2d2d;
    border: 2px solid #d4af37;
    color: #d4af37;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: bold;
    font-size: 0.85rem;
    text-transform: uppercase;
    font-family: 'Courier New', monospace;
}

.tool-power-btn:hover {
    background-color: #d4af37;
    color: #0a0a0a;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.tool-power-btn.power-off {
    background-color: #444;
    border-color: #888;
    color: #aaa;
}

.tool-power-btn.power-off:hover {
    background-color: #555;
    border-color: #999;
    color: #bbb;
    box-shadow: none;
}

/* Keep emf-btn for backward compatibility */
.emf-btn {
    padding: 0.6rem 1.2rem;
    background-color: #2d2d2d;
    border: 2px solid #d4af37;
    color: #d4af37;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: bold;
    font-size: 0.85rem;
    text-transform: uppercase;
    font-family: 'Courier New', monospace;
}

.emf-btn:hover {
    background-color: #d4af37;
    color: #0a0a0a;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

/* EMF Lights Display */
.emf-lights {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem;
    background-color: #1a1a1a;
    border: 2px solid #0a0a0a;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.emf-light {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #333;
    border: 2px solid #0a0a0a;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.emf-light.active {
    border-color: rgba(255, 255, 255, 0.5);
}

/* Keypad */
.panel-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.keypad-btn {
    background-color: #2d2d2d;
    border: 2px solid #0a0a0a;
    border-radius: 6px;
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    padding: 0.8rem;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 
        inset 0 1px 2px rgba(255, 255, 255, 0.1),
        0 2px 4px rgba(0, 0, 0, 0.5);
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.keypad-btn:active {
    transform: translateY(1px);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.5),
        0 1px 2px rgba(0, 0, 0, 0.3);
}

.keypad-btn:hover:not(.keypad-empty) {
    background-color: #3d3d3d;
    border-color: #4a4a4a;
}

.keypad-empty {
    background-color: #2d2d2d;
    cursor: default;
    opacity: 0.5;
}

.keypad-empty:hover {
    background-color: #2d2d2d;
    border-color: #0a0a0a;
}

.keypad-backspace {
    font-size: 1.5rem;
}

/* Panel Status */
.panel-status {
    text-align: center;
    color: #2d2d2d;
    font-size: 0.9rem;
    font-weight: bold;
    margin-top: 0.5rem;
}

/* EPV Specific Styles */
.epv-waveform {
    background-color: #1a1a1a;
    border: 2px solid #0a0a0a;
    border-radius: 4px;
    padding: 0.5rem;
    margin: 1rem 0;
}

#epv-canvas {
    width: 100%;
    height: 100px;
    background-color: #0a0a0a;
}

.epv-controls {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.epv-btn {
    padding: 0.6rem 1.2rem;
    background-color: #2d2d2d;
    border: 2px solid #0a0a0a;
    color: #ffffff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: bold;
    font-size: 0.85rem;
    text-transform: uppercase;
    font-family: 'Courier New', monospace;
}

.epv-btn:hover:not(:disabled) {
    background-color: #3d3d3d;
    border-color: #4a4a4a;
}

.epv-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Camera Specific Styles */
.camera-view {
    margin: 1rem 0;
    background-color: #1a1a1a;
    border: 2px solid #0a0a0a;
    border-radius: 4px;
    overflow: hidden;
}

.camera-preview-container {
    position: relative;
    width: 100%;
    min-height: 200px;
    background-color: #000;
}

#camera-preview,
.captured-photo {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.captured-photo {
    position: absolute;
    top: 0;
    left: 0;
}

.camera-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    z-index: 10;
    animation: flash 0.2s;
}

@keyframes flash {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

.camera-controls {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

/* Base Station View */
.base-station-view {
    width: 100%;
    margin-bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000;
    border: 2px solid #0a0a0a;
    border-radius: 4px;
    padding: 0.25rem;
    min-height: 0;
    flex: 1 1 auto;
    /* Constrain height to leave room for: toolkit padding (32px) + panel label (35px) + connection status (60px) + buttons (60px) + navigation menu (60px) + gaps/padding (20px) = ~267px */
    max-height: calc(100vh - 270px);
    max-height: calc(100dvh - 270px); /* Dynamic viewport height for mobile */
    aspect-ratio: 9 / 16; /* Fixed portrait aspect ratio */
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
}

/* When content-expand is active, change to flex column to allow content to determine height */
.base-station-view.content-expand {
    flex-direction: column;
    align-items: stretch;
}

/* When QR codes are shown, allow the base station view to grow and remove aspect ratio constraint */
.base-station-view.qr-codes-active {
    aspect-ratio: auto;
    min-height: 400px;
    max-height: calc(100vh - 200px);
    max-height: calc(100dvh - 200px);
    align-items: stretch;
    overflow: visible; /* Allow content to expand base station */
    height: auto; /* Allow height to adjust to content */
    flex-direction: column; /* Allow content to determine height */
}

/* Legacy disclaimer-active class - kept for backward compatibility but content-expand is preferred */
.base-station-view.disclaimer-active {
    aspect-ratio: auto;
    min-height: 300px;
    /* Leave room for: panel label (~30px) + connection status (~80px) + navigation (~60px) + padding/gaps (~30px) = ~200px */
    max-height: calc(100vh - 200px);
    max-height: calc(100dvh - 200px);
    align-items: stretch;
    overflow: hidden; /* Prevent content overflow */
    margin-bottom: 0.25rem; /* Small gap before connection status */
    height: auto; /* Allow height to adjust to content */
}

/* Legacy disclaimer-active class for control panel */
#tool-epv .control-panel.disclaimer-active {
    max-height: none;
    height: auto;
    flex: 1 1 auto;
}

/* Content expand mode - for text content that needs to grow (disclaimer, future text overlays) */
.base-station-view.content-expand {
    aspect-ratio: auto;
    min-height: 300px;
    /* Leave room for: panel label (~30px) + connection status (~80px) + navigation (~60px) + padding/gaps (~30px) = ~200px */
    max-height: calc(100vh - 200px);
    max-height: calc(100dvh - 200px);
    align-items: stretch;
    overflow: visible; /* Allow content to expand base station */
    margin-bottom: 0.25rem; /* Small gap before connection status */
    height: auto; /* Allow height to adjust to content */
    /* Flex direction already set in base rule above */
}

/* When content expand is active, allow control panel to grow */
#tool-epv .control-panel.content-expand {
    max-height: none;
    height: auto;
    flex: 1 1 auto;
}

.base-station-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-width: 100%;
    max-height: 100%;
    display: block;
}

/* Base Station Controls */
.base-station-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 0 0 auto;
    flex-shrink: 0;
    min-height: 0;
}

.volume-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.volume-label {
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Courier New', monospace;
}

.volume-dial {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #2d2d2d;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.volume-dial::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #d4af37;
    border: 2px solid #0a0a0a;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.volume-dial::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #d4af37;
    border: 2px solid #0a0a0a;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.base-station-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.base-btn {
    padding: 0.8rem 2rem;
    border: 2px solid;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: bold;
    font-size: 1rem;
    text-transform: uppercase;
    font-family: 'Courier New', monospace;
    min-width: 120px;
}

/* Base station buttons - small rectangles with rounded corners, no text */
#base-station-green,
#base-station-red {
    padding: 0;
    border-radius: 8px;
    width: 45px;
    height: 35px;
    min-width: 45px;
    min-height: 35px;
    font-size: 0;
    line-height: 0;
    text-indent: -9999px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.green-btn {
    background-color: #009922;
    border-color: #009922;
    color: #0a0a0a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

.green-btn:hover {
    background-color: #007711;
    border-color: #007711;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

.red-btn {
    background-color: #cc3333;
    border-color: #cc3333;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

.red-btn:hover {
    background-color: #aa2222;
    border-color: #aa2222;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

/* QR Codes Overlay */
/* QR Codes Overlay - Highest priority overlay */
/* Z-index hierarchy: Video (1) < Task/Interaction (10) < Disclaimer (12) < QR Codes (15) */
.qr-codes-overlay {
    position: absolute; /* Absolute positioning by default */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 15; /* Highest priority overlay */
    overflow: visible;
    padding: 0.5rem;
    box-sizing: border-box;
}

/* When base station is in qr-codes-active mode, make overlay position relative to affect parent height */
.base-station-view.qr-codes-active .qr-codes-overlay {
    position: relative; /* Change to relative so it affects parent height */
    height: auto; /* Allow height to adjust to content */
    min-height: 100%; /* Still fill at minimum */
}

.qr-overlay-content {
    text-align: center;
    color: #ffffff;
    max-width: 100%;
    width: 100%;
    height: auto; /* Allow height to adjust to content */
    min-height: 100%; /* Fill overlay at minimum */
    padding: 0.25rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    overflow: visible; /* No scrolling - base station will expand */
    gap: 0.25rem;
}

/* Scrollbar styles removed - no scrolling needed */

.qr-overlay-content h2 {
    font-family: "Metal Mania", system-ui;
    font-size: clamp(1.2rem, 3vw, 2rem);
    margin: 0;
    color: #00ff41; /* Same green as interaction prompts and disclaimer */
    text-transform: uppercase;
    word-wrap: break-word;
    flex-shrink: 0;
    font-weight: 400;
    font-style: normal;
    text-shadow: 
        0 0 2.5px #00ff41,
        0 0 5px #00ff41,
        0 0 7.5px rgba(0, 255, 65, 0.125); /* Match disclaimer title glow */
}

.qr-overlay-content p {
    font-family: "Special Elite", system-ui; /* Standardize text font */
    font-size: clamp(1.1rem, 2.5vw, 1.5rem); /* Match disclaimer text size */
    margin: 0;
    color: #00ff41; /* Match disclaimer text color */
    text-shadow: 
        0 0 5px #00ff41,
        0 0 10px rgba(0, 255, 65, 0.5); /* Match disclaimer text glow */
    word-wrap: break-word;
    flex-shrink: 0;
    line-height: 1.6;
}

.qr-codes-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-items: center;
    align-items: center;
    margin: 0;
    flex: 0 0 auto;
    width: 100%;
    justify-content: flex-start;
}

.qr-code-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
}

.qr-code-wrapper {
    width: 100%;
    max-width: 100%;
}

.qr-code-wrapper canvas,
.qr-code-wrapper img {
    max-width: 100%;
    max-height: 300px; /* Increased from 180px for better scanning */
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.qr-code-wrapper a {
    display: block;
    margin-top: 0.25rem;
    font-size: clamp(0.65rem, 1.5vw, 0.75rem);
    padding: 0 0.5rem;
    word-break: break-all;
    line-height: 1.3;
}

/* Scale QR codes down on smaller screens */
@media (max-height: 700px) {
    .qr-code-wrapper canvas,
    .qr-code-wrapper img {
        max-height: 240px; /* Increased from 140px */
    }
}

@media (max-height: 600px) {
    .qr-code-wrapper canvas,
    .qr-code-wrapper img {
        max-height: 220px; /* Increased from 120px */
    }
}

@media (max-height: 500px) {
    .qr-code-wrapper canvas,
    .qr-code-wrapper img {
        max-height: 200px; /* Increased from 100px */
    }
}

.qr-code-wrapper p {
    font-family: "Metal Mania", system-ui; /* Standardize QR label font - use title font */
    font-size: clamp(1rem, 2vw, 1.3rem);
    font-weight: 400;
    font-style: normal;
    color: #00ff41; /* Match disclaimer/display green */
    text-shadow: 
        0 0 2.5px #00ff41,
        0 0 5px #00ff41,
        0 0 7.5px rgba(0, 255, 65, 0.125); /* Match title glow */
    margin: 0;
    text-transform: uppercase;
}

.qr-code-wrapper a {
    font-size: 0.7rem;
    color: #4a9eff;
    word-break: break-all;
    text-decoration: none;
}

.qr-code-wrapper a:hover {
    text-decoration: underline;
}

.qr-overlay-content .base-btn {
    font-family: "Special Elite", system-ui; /* Standardize button font */
    flex-shrink: 0;
    margin-top: 0.25rem;
    padding: 0.5rem 1.2rem;
    font-size: clamp(1.1rem, 2.5vw, 1.4rem); /* Match disclaimer button size */
    white-space: nowrap;
}

/* Tool Connection Status */
.tool-connection-status {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 0;
    padding: 0.75rem;
    background-color: #2d2d2d;
    border: 2px solid #0a0a0a;
    border-radius: 4px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* Add spacing between connection lights and buttons */
.tool-connection-status > .connection-indicator:not(.connection-buttons) {
    margin-right: 0;
}

.tool-connection-status > .connection-buttons {
    margin-left: 2rem;
}

.connection-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

/* Connection buttons container */
.connection-buttons {
    flex-direction: row;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
}

.connection-label {
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Courier New', monospace;
}

.connection-light {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #444;
    border: 2px solid #0a0a0a;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.connection-light.connected {
    background-color: #ffffff !important;
    border-color: #ffffff !important;
    box-shadow: 
        0 0 10px rgba(255, 255, 255, 0.8),
        inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    animation: pulse-light 2s infinite;
}

@keyframes pulse-light {
    0%, 100% { 
        opacity: 1;
        box-shadow: 
            0 0 10px rgba(255, 255, 255, 0.8),
            inset 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    50% { 
        opacity: 0.7;
        box-shadow: 
            0 0 15px rgba(255, 255, 255, 1),
            inset 0 2px 4px rgba(0, 0, 0, 0.3);
    }
}

.camera-btn {
    padding: 0.6rem 1.2rem;
    background-color: #2d2d2d;
    border: 2px solid #0a0a0a;
    color: #ffffff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: bold;
    font-size: 0.85rem;
    text-transform: uppercase;
    font-family: 'Courier New', monospace;
}

.camera-btn:hover:not(:disabled) {
    background-color: #3d3d3d;
    border-color: #4a4a4a;
}

.camera-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.camera-album {
    background-color: #1a1a1a;
    border: 2px solid #0a0a0a;
    border-radius: 4px;
    padding: 1rem;
    margin-top: 1rem;
}

.camera-album h3 {
    color: #00ff41;
    margin-bottom: 1rem;
    text-align: center;
    font-size: 1rem;
    text-transform: uppercase;
}

.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.album-photo {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    border: 2px solid #2d2d2d;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
}

.album-photo:hover {
    transform: scale(1.05);
    border-color: #00ff41;
}

/* Walkie Talkie Specific Styles */
.walkie-controls {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.walkie-btn {
    padding: 0.6rem 1.2rem;
    background-color: #2d2d2d;
    border: 2px solid #d4af37;
    color: #d4af37;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: bold;
    font-size: 0.85rem;
    text-transform: uppercase;
    font-family: 'Courier New', monospace;
}

.walkie-btn:hover:not(:disabled) {
    background-color: #d4af37;
    color: #0a0a0a;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.walkie-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #888;
    color: #aaa;
}

.walkie-btn.pressed {
    background-color: #ff3b30;
    color: #0a0a0a;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.7), 0 0 8px rgba(255, 59, 48, 0.6);
    transform: translateY(1px);
}
.walkie-btn.pressed:hover {
    background-color: #ff3b30;
    color: #0a0a0a;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.7), 0 0 8px rgba(255, 59, 48, 0.6);
}

.walkie-display-area {
    background-color: #1a1a1a;
    border: 2px solid #0a0a0a;
    border-radius: 4px;
    padding: 1rem;
    min-height: 150px;
    margin: 1rem 0;
}

.walkie-transmission {
    color: #ffffff;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
}

.static-noise {
    color: #888;
    font-style: italic;
}

.walkie-response {
    color: #00ff41;
    font-size: 0.9rem;
    font-weight: bold;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #2d2d2d;
    font-family: 'Courier New', monospace;
}

.walkie-status {
    text-align: center;
    color: #2d2d2d;
    font-size: 0.85rem;
    font-weight: bold;
}

/* Navigation */
.toolkit-nav {
    display: none; /* Hidden by default - will be shown after coupling is complete */
    grid-template-columns: repeat(4, 1fr);
    background-color: #2d2d2d;
    border: 2px solid #0a0a0a;
    border-radius: 4px;
    padding: 0.5rem;
    gap: 0.5rem;
    width: 100%;
}

.nav-btn {
    padding: 0.8rem 0.5rem;
    background-color: #1a1a1a;
    border: 2px solid #0a0a0a;
    color: #ffffff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: bold;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    font-family: 'Courier New', monospace;
}

.nav-btn:hover {
    background-color: #2d2d2d;
    border-color: #4a4a4a;
}

.nav-btn.active {
    background-color: #00ff41;
    color: #0a0a0a;
    border-color: #00ff41;
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
}

.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .toolkit-container {
        padding: 0.5rem;
        gap: 0.5rem;
        max-height: 100vh;
        max-height: 100dvh;
    }

    .tool-container {
        padding: 0.5rem;
    }

    .control-panel {
        padding: 1rem;
    }

    .lcd-display {
        font-size: clamp(2rem, 5vw, 2.5rem);
    }

    .panel-keypad {
        gap: 0.4rem;
    }

    .keypad-btn {
        padding: 0.6rem;
        font-size: clamp(0.9rem, 2vw, 1rem);
        min-height: 45px;
    }

    .toolkit-nav {
        grid-template-columns: repeat(4, 1fr);
        padding: 0.4rem;
        gap: 0.4rem;
    }

    .nav-btn {
        padding: 0.6rem 0.3rem;
        font-size: clamp(0.7rem, 1.5vw, 0.75rem);
    }
    
    .base-station-view {
        flex: 1 1 auto;
        max-height: calc(100vh - 230px);
        max-height: calc(100dvh - 230px);
    }
    
    .base-station-controls {
        flex: 0 0 auto;
        flex-shrink: 0;
    }
    
    #tool-epv .control-panel {
        padding: 0.75rem;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .toolkit-container {
        padding: 0.3rem;
        gap: 0.5rem;
    }

    .control-panel {
        padding: 0.8rem;
    }

    .lcd-display {
        font-size: clamp(1.5rem, 4vw, 2rem);
    }

    .lcd-display-secondary {
        font-size: clamp(0.55rem, 1.5vw, 0.6rem);
    }

    .panel-label {
        font-size: clamp(0.7rem, 2vw, 0.75rem);
        padding: 0.4rem 0.6rem;
    }

    .panel-keypad {
        gap: 0.3rem;
    }

    .keypad-btn {
        padding: 0.5rem;
        font-size: clamp(0.85rem, 2vw, 0.9rem);
        min-height: 40px;
    }

    .toolkit-nav {
        padding: 0.3rem;
        gap: 0.3rem;
    }

    .nav-btn {
        padding: 0.5rem 0.2rem;
        font-size: clamp(0.6rem, 1.5vw, 0.65rem);
        letter-spacing: 0.5px;
    }

    .epv-btn,
    .camera-btn,
    .walkie-btn {
        padding: 0.5rem 0.8rem;
        font-size: clamp(0.7rem, 2vw, 0.75rem);
    }

    .camera-preview-container {
        min-height: 150px;
        max-height: 40vh;
        max-height: 40dvh;
    }

    .walkie-display-area {
        min-height: 120px;
        padding: 0.8rem;
        max-height: 30vh;
        max-height: 30dvh;
        overflow-y: auto;
    }
    
    .base-station-view {
        flex: 1 1 auto;
        max-height: calc(100vh - 220px);
        max-height: calc(100dvh - 220px);
        margin-bottom: 0;
    }
    
    .tool-connection-status {
        gap: 1rem;
        padding: 0.5rem;
        flex-wrap: wrap;
    }
    
    #tool-epv .control-panel {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .base-station-buttons {
        gap: 0.75rem;
    }
    
    /* Base station buttons - smaller on mobile */
    #base-station-green,
    #base-station-red {
        width: 40px;
        height: 30px;
        min-width: 40px;
        min-height: 30px;
        border-radius: 6px;
    }
    
    .base-btn {
        padding: 0.6rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .connection-label {
        font-size: clamp(0.65rem, 1.5vw, 0.75rem);
    }
    
    .qr-overlay-content {
        padding: 0.15rem;
        gap: 0.25rem;
    }
    
    .qr-overlay-content h2 {
        font-size: clamp(0.7rem, 2vw, 1rem);
    }
    
    .qr-overlay-content p {
        font-size: clamp(0.65rem, 1.5vw, 0.75rem);
    }
    
    .qr-code-wrapper canvas,
    .qr-code-wrapper img {
        max-height: 40vh; /* Increased from 25vh for better scanning */
        max-height: 40dvh;
    }
    
    .qr-codes-container {
        gap: 0.5rem;
    }
    
    .base-btn {
        padding: 0.5rem 1rem;
        font-size: clamp(0.7rem, 2vw, 0.85rem);
        margin-top: 0.25rem;
    }
}

/* Tablet Landscape */
@media (min-width: 769px) and (max-width: 1024px) {
    .tool-panel {
        max-width: 600px;
    }

    .lcd-display {
        font-size: 3.5rem;
    }
}

/* Large Desktop */
@media (min-width: 1025px) {
    .tool-panel {
        max-width: 550px;
    }
}
