html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    height: var(--app-height, 100vh);
    overflow: hidden;
}

body {
    background-color: #111;
    color: white;
    font-family: sans-serif;
    user-select: none;
}

canvas {
    display: block;
    background-color: #1a1a1a;
    cursor: crosshair;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
    transition: background-color 0.8s ease;
}

#ui-layer {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    background: rgba(20, 20, 20, 0.92);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    border: 1px solid #333;
    width: 320px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    transition: max-height 0.3s ease-in-out;
    box-sizing: border-box;
}

#ui-layer.collapsed {
    max-height: 44px;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #222;
    cursor: pointer;
    border-bottom: 1px solid #333;
    position: sticky;
    top: 0;
    z-index: 11;
}

.panel-header:hover {
    background: #2b2b2b;
}

.panel-header h2 {
    margin: 0;
    font-size: 14px;
    color: #fff;
    letter-spacing: 0.5px;
}

.toggle-icon {
    color: #00e5ff;
    font-size: 12px;
    transition: transform 0.3s ease;
}

#ui-layer.collapsed .toggle-icon {
    transform: rotate(180deg);
}

.tab-header {
    display: flex;
    border-bottom: 1px solid #333;
    background: #181818;
}

.tab-btn {
    flex: 1;
    text-align: center;
    padding: 10px 4px;
    font-size: 10px;
    font-weight: bold;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-btn:hover {
    color: #fff;
    background: #222;
}

.tab-btn.active {
    color: #00e5ff;
    border-bottom: 2px solid #00e5ff;
    background: #1a1a1a;
}

.panel-body {
    padding: 15px;
}

p {
    margin-top: 0;
    font-size: 12px;
    color: #aaa;
    margin-bottom: 15px;
    line-height: 1.4;
}

.control-group {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
}

.borderless-group {
    border-bottom: none;
    margin-top: 5px;
}

.control-group label {
    display: block;
    font-size: 11px;
    color: #00e5ff;
    font-weight: bold;
    margin-bottom: 5px;
}

.ratio-display {
    font-family: monospace;
    font-size: 13px;
    color: #fff;
    background: #2a2a2a;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 8px;
}

.slider-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.slider-row span {
    font-size: 11px;
    color: #888;
    flex-shrink: 0;
}

.energy-txt {
    color: #fff;
    font-family: monospace;
}

.transition-info {
    color: #00e5ff;
    font-family: monospace;
    font-size: 11px;
    line-height: 1.4;
}

.selector-group {
    transition: opacity 0.3s;
}

.preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 5px;
}

.preset-grid button:last-child:nth-child(odd) {
    grid-column: span 2;
}

.mode-btn {
    width: 100%;
    padding: 9px;
    background-color: #00e5ff;
    color: #000;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0;
}

.preset-grid .mode-btn {
    background-color: #2a2a2a;
    color: #ddd;
    border: 1px solid #444;
    font-family: monospace;
}

.preset-grid .mode-btn:hover {
    background-color: #00e5ff;
    color: #000;
    border-color: #00e5ff;
}

.preset-grid .mode-btn.active {
    background-color: #00e5ff;
    color: #000;
    border-color: #00e5ff;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

.temp-header-row {
    justify-content: space-between;
    font-family: monospace;
}

.temp-header-row span:first-child {
    letter-spacing: 0.5px;
}

.temp-display {
    color: #ffffff !important;
    font-weight: bold;
    font-size: 13px !important;
    text-shadow: 0 0 5px #ff3366;
}

.temp-slider-container {
    background: linear-gradient(90deg, #333333 0%, #ff3366 100%);
    padding: 12px 10px;
    border-radius: 6px;
    margin-bottom: 12px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

#tempSlider {
    width: 100%;
    cursor: pointer;
    accent-color: #ffffff;
    margin: 0;
    display: block;
}

.wave-btn {
    background-color: #ff9900;
    margin-bottom: 8px;
}

.laser-settings-box {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #333;
    margin-bottom: 10px;
}

.laser-input-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.laser-input-row span {
    font-size: 11px;
}

.laser-input {
    width: 70px;
    background: #111;
    color: #c8a2c8;
    font-family: monospace;
    font-weight: bold;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 4px;
}

.laser-desc {
    margin-top: 8px;
}

.guide-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
    font-size: 11px;
    color: #bbb;
    line-height: 1.4;
}

.guide-key {
    flex-shrink: 0;
    min-width: 68px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid #444;
    border-radius: 4px;
    padding: 4px 6px;
    font-family: monospace;
    font-size: 11px;
    color: #00e5ff;
    text-align: center;
}

/* Device Notice */
.device-notice {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(5, 7, 10, 0.92);
    backdrop-filter: blur(4px);
}

.device-card {
    width: min(92vw, 380px);
    background: rgba(20, 20, 20, 0.98);
    border: 1px solid #2d2d2d;
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.45);
    padding: 14px;
    text-align: center;
}

.device-card strong {
    display: block;
    color: #00e5ff;
    font-size: 13px;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
}

.device-card p {
    font-size: 11px;
    line-height: 1.45;
    color: #ddd;
    margin-bottom: 8px;
}

.device-card span {
    display: inline-block;
    font-size: 10px;
    color: #8fd8ff;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

/* Telemetry Box styling */
#telemetry-control {
    position: absolute;
    bottom: 25px;
    right: 25px;
    z-index: 10;
    min-width: 190px;
}

#telemetryBtn {
    display: block;
    width: 100%;
    background: rgba(20, 20, 20, 0.92);
    color: #00e5ff;
    border: 1px solid #333;
    padding: 6px 14px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    transition: background 0.2s;
}

#telemetryBtn:hover {
    background: #2b2b2b;
    border-color: #555;
}

#telemetry-dropdown {
    display: block;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid #333;
    border-radius: 6px;
    padding: 8px 0;
    margin-bottom: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.telem-label {
    font-size: 9px;
    color: #555;
    font-weight: bold;
    letter-spacing: 0.5px;
    padding: 2px 12px 6px 12px;
    border-bottom: 1px solid #2a2a2a;
    margin-bottom: 4px;
}

.telem-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 11px;
    color: #aaa;
    transition: background 0.15s;
    user-select: none;
}

.telem-row:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.telem-pip {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid #555;
    background: #222;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s;
}

.telem-pip.on {
    background: #00e5ff;
    border-color: #00e5ff;
    box-shadow: 0 0 4px rgba(0, 229, 255, 0.5);
}

/* ----------------------------------------------------
   PENDULUM UI DESIGN CLONE FOR SPECIFIC BUTTONS
------------------------------------------------------- */

/* Alloy Mode Toggle (Purple Theme) */
.alloy-toggle-btn {
    background-color: #222;
    color: #e040fb;
    border: 1px solid #e040fb !important;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.alloy-toggle-btn:hover,
.alloy-toggle-btn.active {
    background-color: #e040fb;
    color: #000;
    box-shadow: 0 0 10px rgba(224, 64, 251, 0.4);
}

/* Laser Target Toggle Mode (Teal Theme) */
.laser-toggle-btn {
    background-color: #222;
    color: #00bfa5;
    border: 1px solid #00bfa5 !important;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.laser-toggle-btn:hover,
.laser-toggle-btn.active {
    background-color: #00bfa5;
    color: #000;
    box-shadow: 0 0 10px rgba(0, 191, 165, 0.4);
}

/* Fire Photon Beam Action Button (Lilac Theme) */
.laser-fire-btn {
    background-color: #222;
    color: #c8a2c8;
    border: 1px solid #c8a2c8 !important;
    font-weight: bold;
    transition: all 0.2s ease;
}

.laser-fire-btn:hover,
.laser-fire-btn:active {
    background-color: #c8a2c8;
    color: #000;
    box-shadow: 0 0 10px rgba(200, 162, 200, 0.4);
}