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

html,
body {
    width: 100%;
    height: 100%;
    background: #000000;
    overflow: hidden;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
}

body {
    display: grid;
    place-items: stretch;
}

#display-shell {
    width: 100vw;
    height: 100vh;
    background: #000000;
}

#display {
    display: block;
    width: 100%;
    height: 100%;
    background: #000000;
}

#panel-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 30;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid #444;
    color: #ccc;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    backdrop-filter: blur(8px);
    animation: pulse-hint 2s ease-in-out 1;
}

@keyframes pulse-hint {
    0%, 100% { border-color: #444; box-shadow: 0 0 0 0 rgba(100, 200, 100, 0); }
    50% { border-color: #8a8; box-shadow: 0 0 12px 2px rgba(100, 200, 100, 0.3); }
}

#panel-toggle:hover {
    background: rgba(30, 30, 30, 0.9);
    color: #ddd;
    border-color: #555;
}

#panel-toggle.open {
    left: 272px;
}

#sim-ui {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 20;
    width: 260px;
    height: 100vh;
    background: rgba(8, 8, 10, 0.92);
    border-right: 1px solid #1a1a1a;
    color: #bbb;
    font-size: 11px;
    line-height: 1.3;
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
}

#sim-ui.open {
    transform: translateX(0);
}

#sim-ui::-webkit-scrollbar {
    width: 4px;
}

#sim-ui::-webkit-scrollbar-track {
    background: transparent;
}

#sim-ui::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}

.panel-inner {
    padding: 44px 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.section-header {
    color: #666;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 10px 0 4px;
    border-bottom: 1px solid #1a1a1a;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-header:hover {
    color: #999;
}

.section-header .arrow {
    font-size: 8px;
    transition: transform 0.15s;
}

.section-header.collapsed .arrow {
    transform: rotate(-90deg);
}

.section-body {
    padding: 6px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
    transition: max-height 0.2s ease, opacity 0.2s ease;
    max-height: 600px;
    opacity: 1;
}

.section-body.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0;
}

.row {
    display: grid;
    grid-template-columns: 72px 1fr;
    align-items: center;
    gap: 6px;
}

.row label {
    color: #777;
    font-size: 11px;
    white-space: nowrap;
}

.row select,
.row input[type="text"],
.row input[type="number"] {
    width: 100%;
    background: #0c0c0c;
    color: #ccc;
    border: 1px solid #222;
    border-radius: 4px;
    padding: 4px 6px;
    font: inherit;
    font-size: 11px;
    outline: none;
    transition: border-color 0.15s;
}

.row select:focus,
.row input:focus {
    border-color: #444;
}

.row select {
    cursor: pointer;
}

.slider-row {
    display: grid;
    grid-template-columns: 72px 1fr 36px;
    align-items: center;
    gap: 6px;
}

.slider-row label {
    color: #777;
    font-size: 11px;
    white-space: nowrap;
}

.slider-row input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: #222;
    border-radius: 2px;
    outline: none;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #666;
    cursor: pointer;
    border: none;
    transition: background 0.15s;
}

.slider-row input[type="range"]::-webkit-slider-thumb:hover {
    background: #999;
}

.slider-row input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #666;
    cursor: pointer;
    border: none;
}

.slider-val {
    color: #999;
    font-size: 10px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 2px 0;
}

button {
    background: #111;
    color: #bbb;
    border: 1px solid #282828;
    border-radius: 4px;
    padding: 5px 8px;
    font: inherit;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.12s;
    text-align: center;
}

button:hover {
    background: #1a1a1a;
    color: #ddd;
    border-color: #444;
}

button:active {
    background: #222;
}

button.primary {
    background: #1a2a1a;
    border-color: #2a4a2a;
    color: #8c8;
}

button.primary:hover {
    background: #223322;
    color: #afa;
}

.upload-area {
    border: 1px dashed #333;
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    color: #555;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 10px;
    line-height: 1.4;
}

.upload-area:hover {
    border-color: #555;
    color: #888;
    background: rgba(255,255,255,0.02);
}

.upload-area.dragover {
    border-color: #8a8;
    color: #8c8;
    background: rgba(100,200,100,0.05);
}

#file-upload-input {
    display: none;
}

#media-info {
    color: #666;
    font-size: 9px;
    padding: 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sim-status {
    color: #555;
    border-top: 1px solid #1a1a1a;
    padding: 8px 12px;
    font-size: 9px;
    line-height: 1.5;
    white-space: pre;
    flex-shrink: 0;
}

.repo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    margin: 0 12px 12px;
    border: 1px solid #222;
    border-radius: 6px;
    color: #888;
    font-size: 10px;
    text-decoration: none;
    transition: all 0.15s;
    flex-shrink: 0;
}

.repo-link:hover {
    color: #ccc;
    border-color: #444;
    background: rgba(255, 255, 255, 0.03);
}

@media (max-width: 500px) {
    #sim-ui {
        width: 100vw;
    }

    #panel-toggle.open {
        left: calc(100vw - 38px);
    }

    .row {
        grid-template-columns: 60px 1fr;
    }

    .slider-row {
        grid-template-columns: 60px 1fr 32px;
    }
}
