:root {
    --bg: #1a1e18;
    --panel: #23281f;
    --panel-2: #2b3126;
    --line: #33382c;
    --line-soft: #2a2f24;
    --amber: #e8b339;
    --text: #DADBD2;
    --muted: #9aa196;
    --ink: #14170f;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: 'Rajdhani', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

::selection {
    background: var(--amber);
    color: var(--bg);
}

:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 3px;
}

/* ---------- top bar ---------- */

.top-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 56px;
    padding: 0 clamp(20px, 4vw, 48px);
    border-bottom: 1px solid var(--line);
}

.brand {
    font-family: 'Black Ops One', system-ui, sans-serif;
    font-size: 15px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text);
}

.top-actions {
    display: flex;
    gap: 8px;
}

.btn {
    appearance: none;
    padding: 7px 12px;
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.14em;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.btn:hover {
    color: var(--amber);
    border-color: var(--amber);
}

/* ---------- layout ---------- */

.shell {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(280px, 34%) 1fr;
}

/* ---------- mode list ---------- */

.mode-list {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    padding: clamp(24px, 5vh, 56px) clamp(20px, 3vw, 40px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
}

.mode-list::-webkit-scrollbar {
    width: 10px;
}

.mode-list::-webkit-scrollbar-thumb {
    background: var(--line);
}

.mode-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    padding: 16px 18px;
    background: transparent;
    border: 1px solid var(--line-soft);
    color: var(--muted);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease),
        transform 0.2s var(--ease);
}

.mode-row .name {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text);
}

.mode-row .tag {
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.14em;
    white-space: nowrap;
}

.mode-row:hover {
    background: var(--panel);
    border-color: var(--line);
    transform: translateX(2px);
}

.mode-row[aria-pressed="true"] {
    background: var(--panel-2);
    border-color: var(--line);
    border-left-color: var(--amber);
}

/* ---------- preview ---------- */

.preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: clamp(32px, 6vh, 72px) clamp(24px, 5vw, 80px);
    border-left: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(107, 114, 69, 0.12), rgba(107, 114, 69, 0) 62%),
        var(--panel);
}

.preview-inner {
    width: 100%;
    max-width: 34rem;
}

#pv-name {
    margin: 0 0 20px;
    font-family: 'Black Ops One', system-ui, sans-serif;
    font-size: clamp(2.75rem, 6vw, 4.5rem);
    line-height: 0.95;
    letter-spacing: 0.01em;
    color: var(--amber);
}

#pv-desc {
    margin: 0;
    font-size: 19px;
    line-height: 1.5;
    max-width: 52ch;
    color: var(--text);
}

.stats {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.16em;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

#deploy-btn {
    margin-top: 34px;
    padding: 15px 28px;
    border: 0;
    background: var(--amber);
    color: var(--ink);
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.16em;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.45), 0 16px 32px -20px rgba(0, 0, 0, 0.95);
    transition: transform 0.18s var(--ease), background-color 0.18s ease,
        box-shadow 0.18s ease;
}

#deploy-btn:hover {
    background: #f0c65a;
    transform: translateY(-2px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.45), 0 22px 36px -20px rgba(0, 0, 0, 0.95);
}

#deploy-btn:active {
    transform: translateY(0);
}

/* ---------- settings ---------- */

#settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(12, 14, 10, 0.74);
}

#settings-overlay.hidden {
    display: none;
}

.settings-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: min(360px, 90vw);
    padding: 28px 32px;
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.95);
}

.settings-panel h2 {
    margin: 0;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
    font-family: 'Black Ops One', system-ui, sans-serif;
    font-size: 20px;
    letter-spacing: 0.1em;
    color: var(--amber);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.14em;
    color: var(--muted);
}

.field-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

#sensi-val {
    color: var(--amber);
}

#sensi-range {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 2px;
    background: var(--line);
    cursor: pointer;
}

#sensi-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border: 0;
    background: var(--amber);
    cursor: grab;
}

#sensi-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 0;
    border-radius: 0;
    background: var(--amber);
    cursor: grab;
}

#sensi-range:focus-visible {
    outline-offset: 6px;
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .preview {
        border-left: 0;
        border-top: 1px solid var(--line);
    }

    .top-bar {
        height: auto;
        padding: 12px clamp(16px, 5vw, 48px);
    }
}

@media (max-width: 520px) {
    .brand {
        font-size: 13px;
        letter-spacing: 0.12em;
    }

    .btn {
        padding: 6px 9px;
        font-size: 11px;
        letter-spacing: 0.08em;
    }

    .top-actions {
        gap: 6px;
    }

    #deploy-btn {
        width: 100%;
    }
}

/* ---------- motion ---------- */

@keyframes pv-swap {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.preview-inner.swap {
    animation: pv-swap 0.32s var(--ease) both;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}
