:root {
    --bg: #1b1d22;
    --panel: rgba(30, 33, 40, 0.94);
    --border: #3a3f4b;
    --text: #e6e8ec;
    --muted: #9aa2b1;
    --accent: #f5a623;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
}

#canvas {
    position: fixed;
    inset: 0;
    display: block;
    width: 100vw;
    height: 100vh;
}

#drop-hint {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
    transition: opacity 0.15s;
}
#drop-hint.hidden { opacity: 0; }

.hint-inner {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px 40px;
    text-align: center;
    pointer-events: auto;
    max-width: 460px;
}
.hint-inner h1 { margin: 0 0 8px; font-size: 22px; font-weight: 600; }
.hint-inner p { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.hint-inner code {
    background: rgba(255,255,255,0.08);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.file-btn span {
    display: inline-block;
    background: var(--accent);
    color: #1b1d22;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
}
.file-btn span:hover { filter: brightness(1.1); }

body.dragover #drop-hint .hint-inner {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.25);
}

#props {
    position: fixed;
    top: 12px;
    right: 12px;
    width: 320px;
    max-height: calc(100vh - 24px);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#props header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
}
#props-title {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#props-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
#props-close:hover { color: var(--text); }

#props-list {
    margin: 0;
    padding: 8px 12px 12px;
    overflow-y: auto;
    font-size: 12px;
    line-height: 1.5;
}
#props-list dt {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 8px;
}
#props-list dt:first-child { margin-top: 0; }
#props-list dd {
    margin: 2px 0 0;
    word-break: break-word;
    color: var(--text);
}
#props-list dd.mono { font-family: ui-monospace, Consolas, monospace; }
#props-list dd.empty { color: var(--muted); font-style: italic; }

#hud {
    position: fixed;
    bottom: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    gap: 12px;
    padding: 8px 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--muted);
    align-items: center;
}
#hud-file { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
#hud-stats { white-space: nowrap; }
#reset-cam,
#mode-toggle {
    background: rgba(255,255,255,0.08);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
}
#reset-cam:hover,
#mode-toggle:hover { background: rgba(255,255,255,0.15); }
#mode-toggle.active {
    background: var(--accent);
    color: #1b1d22;
    border-color: var(--accent);
    font-weight: 600;
}

.mode-hint {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

#fp-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 22px;
    text-align: center;
    pointer-events: none;
    transition: opacity 0.15s;
}
#fp-overlay .fp-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
#fp-overlay .fp-keys { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
#fp-overlay .fp-keys b { color: var(--text); }
#fp-overlay .fp-hint { font-size: 11px; color: var(--muted); }
#fp-overlay .fp-hint b { color: var(--accent); }
#fp-overlay.locked { opacity: 0; }

/* --- pedestal controller panel (bottom-left, ported from DynaFam viewer_split) --- */
#pedestal-panel {
    position: fixed;
    left: 16px;
    bottom: 60px;
    background: #22262a;
    border: 1px solid #33383e;
    border-radius: 6px;
    padding: 10px 12px;
    color: #d0d4d8;
    font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    user-select: none;
    z-index: 20;
}
#pedestal-panel .ped-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
#pedestal-panel .ped-title {
    font-size: 11px;
    color: #a9b3bd;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-right: 12px;
}
#pedestal-panel #ped-close {
    background: transparent;
    border: none;
    color: #8a949e;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
#pedestal-panel #ped-close:hover { color: #e07a7a; }

#pedestal-panel #ped-home {
    background: #33383e;
    border: 1px solid #555c66;
    color: #d0d4d8;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border-radius: 3px;
    cursor: pointer;
    margin-right: 6px;
}
#pedestal-panel #ped-home:hover { background: #3d434a; }
#pedestal-panel #ped-home.active {
    background: #2288ff;
    border-color: #4aa3ff;
    color: #fff;
}

#pedestal-panel .ped-row {
    display: flex;
    gap: 12px;
}
#pedestal-panel .ped-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 74px;
}
#pedestal-panel .ped-slot .knob-num {
    font-size: 11px;
    color: #d15b3f;
    font-weight: 700;
    margin-top: 4px;
}
#pedestal-panel .ped-slot .knob-label {
    font-size: 10px;
    color: #8a949e;
    margin-top: 2px;
    text-align: center;
    word-break: break-all;
    min-height: 12px;
    line-height: 1.2;
}
#pedestal-panel .ped-slot.disabled { opacity: 0.35; }

#pedestal-panel .knob-rot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
#pedestal-panel .knob-rot input[type=range] {
    width: 68px;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #444a52;
    border-radius: 2px;
    outline: none;
}
#pedestal-panel .knob-rot input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #d15b3f;
    cursor: pointer;
}
#pedestal-panel .knob-rot input[type=range]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #d15b3f;
    cursor: pointer;
    border: none;
}
#pedestal-panel .knob-rot .angle-val {
    font-size: 10px;
    color: #d0d4d8;
    font-variant-numeric: tabular-nums;
}
#pedestal-panel .knob-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #33383e;
    border: 2px solid #555c66;
    color: #d0d4d8;
    font-size: 18px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
#pedestal-panel .knob-btn:hover { background: #3d434a; }
#pedestal-panel .knob-btn.active {
    background: #d15b3f;
    border-color: #e06b4d;
}
#pedestal-panel .knob-disabled {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #2a2e33;
    border: 2px dashed #444a52;
}
#pedestal-panel .stroke-info {
    font-size: 10px;
    color: #8a949e;
    margin-top: 8px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

#ped-hint {
    position: fixed;
    left: 16px;
    bottom: 60px;
    background: rgba(30, 33, 40, 0.95);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 15;
}

body.pedestal-hover #canvas { cursor: pointer; }

/* crosshair when pointer is locked */
body.fp-locked::after {
    content: "";
    position: fixed;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    background: var(--accent);
    border-radius: 50%;
    pointer-events: none;
    opacity: 0.7;
    transition: width 0.1s, height 0.1s, margin 0.1s, background 0.1s, border 0.1s, box-shadow 0.1s;
}
/* When aiming at a pedestal in FP-locked mode: crosshair becomes a bright blue
   ring — signals "click to grab", the FP analogue of the pointer/hand cursor. */
body.fp-locked.pedestal-hover::after {
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    background: transparent;
    border: 2px solid #2288ff;
    box-shadow: 0 0 8px rgba(34, 136, 255, 0.6);
    opacity: 1;
}
