:root {
    --bg-dark: #090a0f;
    --card-bg: #13151c;
    --card-border: #262a36;
    --text-main: #f1f2f6;
    --text-dim: #8c93a4;
    --color-aperture: #ff4757;
    --color-shutter: #2ed573;
    --color-iso: #1e90ff;
    --color-ev: #eccc68;
    --color-speed: #a855f7;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', sans-serif;
    padding: 12px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-layout {
    width: 100%;
    max-width: 1380px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* TOP BAR */
.top-bar {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand-dot { width: 8px; height: 8px; background: var(--color-aperture); border-radius: 50%; }
.brand-title { font-weight: 800; letter-spacing: 1px; font-size: 0.95rem; }
.brand-badge { background: var(--color-ev); color: #000; font-size: 0.6rem; font-weight: 800; padding: 2px 6px; border-radius: 4px; }

/* BASCULE JOUR / NUIT */
.env-toggle-box {
    display: flex;
    background: #08090d;
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    gap: 4px;
}

.env-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.env-btn:hover { color: #fff; }
.env-btn.active { background: #3b82f6; color: #fff; font-weight: 700; }

/* MODE SELECTOR */
.mode-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #08090d;
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
}

.mode-label { font-size: 0.65rem; color: var(--text-dim); font-weight: 700; padding: 0 6px; }

.mode-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn:hover { color: #fff; background: rgba(255,255,255,0.05); }
.mode-btn.active { background: #fff; color: #000; font-weight: 700; }

/* POSEMÈTRE */
.exposure-meter {
    background: #08090d;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 6px 16px;
    width: 250px;
    position: relative;
}

.meter-title { font-size: 0.58rem; color: var(--text-dim); letter-spacing: 0.5px; margin-bottom: 2px; text-align: center; }
.meter-scale { display: flex; justify-content: space-between; font-family: 'Space Mono', monospace; font-size: 0.7rem; color: var(--text-dim); }
.meter-scale .zero { color: #fff; font-weight: bold; }

.meter-pointer {
    position: absolute;
    bottom: 3px;
    left: 50%;
    width: 3px;
    height: 10px;
    background: #fff;
    transform: translateX(-50%);
    transition: left 0.15s ease-out;
    box-shadow: 0 0 6px #fff;
}

.meter-target-marker {
    position: absolute;
    bottom: 2px;
    left: 50%;
    width: 6px;
    height: 6px;
    background: var(--color-ev);
    transform: translateX(-50%) rotate(45deg);
    transition: left 0.2s ease;
}

/* MAIN CONTENT LAYOUT */
.main-content {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 12px;
    align-items: start;
}

@media (max-width: 1024px) {
    .main-content { grid-template-columns: 1fr; }
}

/* PHOTO VIEWPORT PROPORTIONNÉ (16:9) */
.photo-view-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: calc(100vh - 120px);
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 15px 35px rgba(0,0,0,0.7);
}

canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.hud-bar {
    position: absolute;
    bottom: 12px;
    left: 12px;
    display: flex;
    gap: 8px;
}

.hud-item {
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'Space Mono', monospace;
    font-size: 0.78rem;
    color: #fff;
}

.hud-mode { background: var(--color-aperture); font-weight: bold; border: none; }
.hud-ev { color: var(--color-ev); }

/* CONTROLS COLUMN */
.controls-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* TRIANGLE SVG DESIGN */
.triangle-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    justify-content: center;
}

.triangle-wrapper {
    position: relative;
    width: 250px;
    height: 190px;
}

.triangle-svg { width: 100%; height: 100%; }
.triangle-bg { fill: rgba(255,255,255,0.015); stroke: rgba(255,255,255,0.05); stroke-width: 1; }
.triangle-inner-grid { fill: none; stroke: rgba(255,255,255,0.03); stroke-dasharray: 4 4; }

.edge { stroke-width: 3.5; stroke-linecap: round; }
.edge-aperture { stroke: url(#gradAperture); }
.edge-shutter { stroke: url(#gradShutter); }
.edge-iso { stroke: url(#gradIso); }

.vertex-halo { fill-opacity: 0.25; }
.vertex-aperture-halo { fill: var(--color-aperture); }
.vertex-shutter-halo { fill: var(--color-shutter); }
.vertex-iso-halo { fill: var(--color-iso); }

.vertex-aperture { fill: #fff; stroke: var(--color-aperture); stroke-width: 2; }
.vertex-shutter { fill: #fff; stroke: var(--color-shutter); stroke-width: 2; }
.vertex-iso { fill: #fff; stroke: var(--color-iso); stroke-width: 2; }

.node-tag {
    position: absolute;
    display: flex;
    flex-direction: column;
    font-size: 0.6rem;
}

.tag-title { color: var(--text-dim); font-weight: 700; letter-spacing: 0.5px; }
.node-tag strong {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    color: #fff;
}

.tag-aperture { top: -14px; left: 50%; transform: translateX(-50%); text-align: center; }
.tag-shutter { bottom: -8px; right: -15px; text-align: right; }
.tag-iso { bottom: -8px; left: -15px; text-align: left; }

/* CONTROLS CARD */
.controls-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ctrl-group {
    background: #090a0f;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 10px;
    transition: opacity 0.25s;
}

.ctrl-group.is-disabled { opacity: 0.5; }
.ctrl-group.is-disabled input[type="range"] { pointer-events: none; }

.group-aperture { border-left: 3px solid var(--color-aperture); }
.group-shutter { border-left: 3px solid var(--color-shutter); }
.group-iso { border-left: 3px solid var(--color-iso); }
.group-ev { border-left: 3px solid var(--color-ev); }
.group-speed { border-left: 3px solid var(--color-speed); }

.ctrl-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.ctrl-name { font-size: 0.7rem; font-weight: 700; color: var(--text-main); text-transform: uppercase; }
.ctrl-value { font-family: 'Space Mono', monospace; font-size: 0.8rem; font-weight: 700; color: #fff; }
.ctrl-hint { font-size: 0.62rem; color: var(--text-dim); margin-top: 3px; }

.badge-auto {
    display: none;
    background: var(--color-ev);
    color: #000;
    font-size: 0.55rem;
    font-weight: 800;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 4px;
}

.ctrl-group.is-disabled .badge-auto { display: inline-block; }

/* Sliders */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: #242836;
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(255,255,255,0.4);
}

/* ISO Toggle */
.iso-toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.toggle-switch { position: relative; display: inline-block; width: 30px; height: 16px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #242836;
    border-radius: 16px;
    transition: 0.25s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 12px; width: 12px;
    left: 2px; bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: 0.25s;
}

input:checked + .toggle-slider { background-color: var(--color-iso); }
input:checked + .toggle-slider:before { transform: translateX(14px); }

.toggle-label { font-size: 0.68rem; color: var(--text-dim); }