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

body {
    background: #0a0a0a;
    color: #ccc;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#scene-container {
    width: 100%;
    max-width: 800px;
    height: 420px;
    position: relative;
    background: radial-gradient(ellipse at center bottom, #1a1410 0%, #0a0a0a 70%);
    border-bottom: 1px solid #222;
}

#scene-container canvas {
    display: block;
}

#film-grain {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
}

.tooltip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.85);
    color: #ff3333;
    padding: 12px 24px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    border: 1px solid #ff0000;
    z-index: 100;
    pointer-events: none;
    transition: opacity 0.8s;
}

.tooltip.hidden {
    opacity: 0;
}

.tooltip.visible {
    opacity: 1;
}

#controls-panel {
    width: 100%;
    max-width: 800px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-top: 2px solid #444;
    padding: 16px 20px;
}

#controls-row {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.control-group label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #777;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

#btn-rrod {
    width: 130px;
    height: 56px;
    background: linear-gradient(180deg, #cc2200 0%, #990000 50%, #770000 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    box-shadow: 0 4px 0 #440000, 0 6px 12px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,100,80,0.3);
    transition: box-shadow 0.05s, transform 0.05s;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    user-select: none;
}

#btn-rrod.pressed {
    box-shadow: 0 1px 0 #440000, 0 2px 4px rgba(0,0,0,0.5), inset 0 2px 4px rgba(0,0,0,0.4);
    transform: translateY(3px);
}

#btn-rrod:active {
    box-shadow: 0 1px 0 #440000, 0 2px 4px rgba(0,0,0,0.5), inset 0 2px 4px rgba(0,0,0,0.4);
    transform: translateY(3px);
}

.led-strip {
    display: flex;
    gap: 12px;
}

.led-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.led-container span {
    font-size: 9px;
    font-weight: 700;
    color: #555;
    letter-spacing: 1px;
    font-family: 'IBM Plex Mono', monospace;
}

.led {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #333;
    border: 1px solid #444;
    transition: all 0.3s;
}

.led.active {
    background: #ff0000;
    border-color: #ff3333;
    box-shadow: 0 0 8px #ff0000, 0 0 20px rgba(255,0,0,0.5), 0 0 40px rgba(255,0,0,0.2);
}

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

#temp-slider {
    width: 140px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #333;
    border-radius: 3px;
    outline: none;
}

#temp-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #d4a843, #8b6914);
    border: 2px solid #6b5210;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

#temp-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #d4a843, #8b6914);
    border: 2px solid #6b5210;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

#temp-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    color: #d4a843;
    min-width: 44px;
}

#severity-select {
    background: #222;
    color: #ccc;
    border: 1px solid #444;
    padding: 8px 12px;
    font-size: 12px;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    cursor: pointer;
    min-width: 160px;
}

#severity-select option {
    background: #222;
    color: #ccc;
}

#btn-reset {
    padding: 10px 20px;
    background: #333;
    color: #888;
    border: 1px solid #555;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    cursor: pointer;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    transition: background 0.2s;
}

#btn-reset:hover {
    background: #444;
}

#log-panel {
    width: 100%;
    max-width: 800px;
    background: #0d0d0d;
    border: 1px solid #222;
    border-top: none;
    max-height: 160px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#log-header {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #555;
    padding: 6px 12px;
    background: #141414;
    border-bottom: 1px solid #222;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

#log-content {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: #33cc33;
    padding: 8px 12px;
    overflow-y: auto;
    flex: 1;
    line-height: 1.6;
    white-space: pre-wrap;
}

#log-content .warn {
    color: #ffaa00;
}

#log-content .error {
    color: #ff3333;
}

#global-counter {
    width: 100%;
    max-width: 800px;
    text-align: center;
    padding: 8px;
    font-size: 10px;
    color: #555;
    font-family: 'IBM Plex Mono', monospace;
}

#footer {
    width: 100%;
    max-width: 800px;
    text-align: center;
    padding: 12px;
    font-size: 10px;
    color: #888;
    font-family: 'Courier New', Courier, monospace;
    border-top: 1px solid #1a1a1a;
    line-height: 1.8;
}

#footer a {
    color: #666;
    text-decoration: none;
}

#footer a:hover {
    color: #999;
}

@media (max-width: 700px) {
    #scene-container {
        height: 320px;
    }
    #controls-row {
        gap: 14px;
    }
    #temp-slider {
        width: 100px;
    }
    #severity-select {
        min-width: 130px;
        font-size: 11px;
    }
}