:root {
    --panel: rgba(18, 18, 20, 0.9);
    --text: #111;
    --ui-text: #f5f5f7;
    --muted: #c6c6cf;
    --accent: #5ac8fa;
    --ok: #4cd964;
    --warn: #ffd60a;
    --bad: #ff453a;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #fff;
    color: var(--text);
}

body {
    background: #fff;
}

#app {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: #fff;
}

#simCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    background: #fff;
    cursor: crosshair;
}

#video,
#cameraCanvas {
    display: none;
}

#panel {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 400px;
    max-height: calc(100vh - 32px);
    overflow: auto;
    padding: 14px;
    border-radius: 18px;
    background: var(--panel);
    color: var(--ui-text);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(10px);
    z-index: 20;
}

#panel.hidden {
    display: none;
}

h1 {
    margin: 0 0 8px 0;
    font-size: 20px;
    line-height: 1.15;
}

h2 {
    margin: 0 0 10px 0;
    font-size: 15px;
}

p,
li,
label,
button,
input {
    font-size: 13px;
    line-height: 1.4;
}

p,
li,
.mini {
    color: var(--muted);
}

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

.section {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

button,
input[type="number"] {
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--ui-text);
}

button {
    cursor: pointer;
}

button:hover {
    background: rgba(255, 255, 255, 0.12);
}

button.primary {
    background: rgba(90, 200, 250, 0.18);
    border-color: rgba(90, 200, 250, 0.45);
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
}

input[type="range"] {
    width: 100%;
    margin-top: 4px;
    -webkit-appearance: none;
    appearance: none;
    height: 18px;
    background: transparent;
    cursor: pointer;
    --fill-percent: 50%;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(
        to right,
        #1b7cff 0 var(--fill-percent),
        rgba(255, 255, 255, 0.88) var(--fill-percent) 100%
    );
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    margin-top: -5px;
    border-radius: 50%;
    border: none;
    background: #1b7cff;
    box-shadow: 0 0 0 2px rgba(27, 124, 255, 0.18);
}

input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
}

input[type="range"]::-moz-range-progress {
    height: 6px;
    border-radius: 999px;
    background: #1b7cff;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: #1b7cff;
    box-shadow: 0 0 0 2px rgba(27, 124, 255, 0.18);
}

input[type="range"]:focus {
    outline: none;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--muted);
}

#status {
    margin-top: 6px;
    font-size: 12px;
    color: var(--warn);
}

#status.ok {
    color: var(--ok);
}

#status.warn {
    color: var(--warn);
}

#status.bad {
    color: var(--bad);
}

#debugWrap {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.debugPane {
    min-width: 0;
}

.debugLabel {
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 12px;
}

.debugHint {
    margin-bottom: 6px;
    color: rgba(198, 198, 207, 0.8);
    font-size: 11px;
}

#debugWrap canvas,
#debugWrap video {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #111;
    object-fit: cover;
    display: block;
}

#debugVideoView {
    cursor: crosshair;
    touch-action: none;
}

.kbd {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 12px;
}

.hint {
    font-size: 12px;
    color: var(--muted);
}
@media (max-width: 880px) {
    #panel {
        width: min(420px, calc(100vw - 24px));
        top: 12px;
        right: 12px;
        left: 12px;
        max-height: calc(100vh - 24px);
    }
}
