/* =========================================================
   setup.css — solo setup screen (tone curve + duration)
   ========================================================= */

.setup-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 32px 64px 24px;
    overflow: hidden;
    position: relative;
    z-index: 5;
    min-height: 0;
}

.setup-eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    margin-bottom: 8px;
}

.setup-title {
    font-family: var(--font-ui);
    font-size: 28px;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 36px;
}

.setup-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 56px;
    align-items: start;
    flex: 1;
    min-height: 0;
}

/* Single-column variant — used now that the curve has moved to landing.
   Centers a single column for the controls panel. */
.setup-grid--single {
    grid-template-columns: minmax(0, 460px);
    justify-content: center;
}

/* ---------- Curve panel (left) ---------- */
.setup-curve {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 380px;
    width: 100%;
}

.curve-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.curve-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
}

.curve-meta {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    cursor: pointer;
    border-bottom: 1px dotted var(--text-quaternary);
    padding-bottom: 1px;
    transition: color var(--t);
}

.curve-meta:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.curve-svg {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--bg-elev-1);
    border: 1px solid var(--border-faint);
    border-radius: 2px;
    box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.4);
    display: block;
    user-select: none;
    touch-action: none;
}

.curve-grid line {
    stroke: rgba(255, 255, 255, 0.04);
    stroke-width: 1;
}

.curve-grid line.grid-major {
    stroke: rgba(255, 255, 255, 0.07);
}

.curve-diagonal {
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 1;
    stroke-dasharray: 2 4;
}

.curve-path {
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.5;
    stroke-linecap: round;
    filter: drop-shadow(0 0 8px rgba(212, 165, 116, 0.3));
}

.curve-fill {
    fill: var(--accent);
    fill-opacity: 0.04;
    stroke: none;
}

.cp-line {
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 1;
    stroke-dasharray: 1 3;
}

.cp {
    fill: var(--bg-elev-2);
    stroke: var(--accent);
    stroke-width: 1.5;
    cursor: grab;
    transition: fill var(--t-fast), stroke var(--t-fast), r var(--t-fast);
}

.cp:hover {
    fill: var(--accent);
}

.cp.is-dragging {
    cursor: grabbing;
    fill: var(--accent);
}

.cp-endpoint {
    fill: var(--bg-base);
    stroke: var(--text-tertiary);
    stroke-width: 1.5;
    pointer-events: none;
}

.curve-axes text {
    fill: var(--text-quaternary);
    font-family: var(--font-mono);
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ---------- Controls panel (right) ---------- */
.setup-controls {
    display: flex;
    flex-direction: column;
    gap: 28px;
    max-width: 420px;
    width: 100%;
}

.control-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
}

.control-value {
    font-family: var(--font-ui);
    font-size: 15px;
    color: var(--text-primary);
}

.control-meta {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-tertiary);
    letter-spacing: var(--tracking-mono);
}

/* ---------- Duration display ---------- */
.duration-display {
    font-family: var(--font-mono);
    font-size: 56px;
    font-weight: 300;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 0;
}

.duration-display .colon {
    color: var(--accent);
    margin: 0 1px;
}

.duration-display .unit {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-left: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ---------- Duration wheel (horizontal "knurled barrel" picker à la
   DaVinci Resolve sliders) -----------------------------------------------
   A thin horizontal cylinder of vertical ridges. The user drags /
   scrolls / taps a ridge to pick a value. Edges darken with a vignette
   overlay to suggest the 3D curvature of a rotating barrel. The numeric
   value is shown OUTSIDE the wheel — either in the big duration-display
   (solo) or in the .duration-wheel-readout below it (multi modal). */

.duration-wheel {
    position: relative;
    width: 100%;
    height: 30px;
    margin-top: 12px;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
    overflow: hidden;
    border-radius: 3px;
    /* Subtle barrel shading top→bottom — darker rims, faint highlight
       through the middle so the ridges read as a metal cylinder. */
    background:
        linear-gradient(to bottom,
            rgba(0, 0, 0, 0.55) 0%,
            rgba(255, 255, 255, 0.03) 50%,
            rgba(0, 0, 0, 0.55) 100%);
    border-top:    1px solid rgba(0, 0, 0, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.duration-wheel:active { cursor: grabbing; }
.duration-wheel:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 2px;
}

/* Vignette overlay — darkens the left & right ends of the wheel so the
   visible ridges fade into the barrel's edge instead of getting clipped
   abruptly. Sits above the track but below the centre indicator. */
.duration-wheel::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background: linear-gradient(to right,
        rgba(0, 0, 0, 0.85) 0%,
        rgba(0, 0, 0, 0)    22%,
        rgba(0, 0, 0, 0)    78%,
        rgba(0, 0, 0, 0.85) 100%);
}

.duration-wheel-track {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    display: flex;
    align-items: center;
    will-change: transform;
}

.duration-wheel-tick {
    flex-grow: 0;
    flex-shrink: 0;
    /* flex-basis is set inline by JS so the JS-computed offsets match. */
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Each tick is a single thin vertical ridge — like the knurling on a
   metal dial. Major ticks (every 15 min) are slightly brighter so the
   user has a coarse rhythm to anchor to while scrolling. */
.duration-wheel-tick-mark {
    width: 1px;
    height: 60%;
    background: rgba(220, 220, 220, 0.32);
    transition: background var(--t-fast), height var(--t-fast);
}

.duration-wheel-tick--major .duration-wheel-tick-mark {
    height: 80%;
    background: rgba(240, 240, 240, 0.55);
}

.duration-wheel-tick.is-active .duration-wheel-tick-mark {
    background: var(--accent);
    height: 100%;
}

/* Labels are hidden in the knurled-barrel design — the value lives in
   the big display / readout outside the wheel. Kept in the DOM so the
   component can be reused with labels elsewhere if needed. */
.duration-wheel-tick-label { display: none; }

/* Centre indicator — single thin accent line, no dot caps; the barrel
   look doesn't want the extra visual noise. */
.duration-wheel-center {
    position: absolute;
    top: -2px;
    bottom: -2px;
    left: 50%;
    width: 1px;
    transform: translateX(-50%);
    background: var(--accent);
    box-shadow: 0 0 6px rgba(212, 148, 107, 0.7);
    pointer-events: none;
    z-index: 2;
}

/* Small inline readout used by the multi modal (the solo page already
   has the big duration-display, so it doesn't need this). */
.duration-wheel-readout {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 10px;
    letter-spacing: var(--tracking-mono);
}
.duration-wheel-readout strong {
    color: var(--accent);
    font-weight: 500;
}

/* ---------- Toggle switch ---------- */
.toggle {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle input { display: none; }

.toggle-slider {
    width: 32px;
    height: 18px;
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    position: relative;
    transition: background var(--t-fast), border-color var(--t-fast);
}

.toggle-slider::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 2px;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: left var(--t-fast), background var(--t-fast);
}

.toggle input:checked + .toggle-slider {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.toggle input:checked + .toggle-slider::after {
    left: 17px;
    background: var(--accent);
}

.toggle-text {
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--text-secondary);
}

/* ---------- Select-like control ---------- */
.select-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: var(--bg-elev-1);
    border: 1px solid var(--border-subtle);
    border-radius: 2px;
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--text-primary);
    cursor: not-allowed;
    opacity: 0.7;
    transition: all var(--t-fast);
}

.select-trigger .caret {
    color: var(--text-tertiary);
    font-size: 10px;
}

.select-trigger .badge {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-quaternary);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    border: 1px solid var(--border-subtle);
    padding: 2px 6px;
    border-radius: 2px;
    margin-left: 6px;
}


/* ---------- Real challenge dropdown ----------
   Replaces the old fake .select-trigger (which was a static span
   labeled "mvp"). The native <select> is styled to match the dark
   theme — appearance:none strips the OS chrome so we can paint
   our own caret + hover state. `option:disabled` is what we use
   for locked challenges, the native rendering is already grayed
   out which fits the Pokédex visual. */
.challenge-select {
    width: 100%;
    max-width: 420px;
    padding: 10px 36px 10px 14px;
    background: var(--bg-elev-1);
    border: 1px solid var(--border-subtle);
    border-radius: 2px;
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition:
        border-color var(--t-fast),
        background    var(--t-fast),
        color         var(--t-fast);

    /* Strip native chrome on all major browsers */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    /* Custom caret — a chevron drawn as an inline SVG data-uri */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%237a7a7e' stroke-width='1.4'><path d='M1 1.5 L6 6.5 L11 1.5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 10px 6px;
}

.challenge-select:hover {
    border-color: var(--border);
}

.challenge-select:focus {
    outline: none;
    border-color: var(--accent);
}

.challenge-select option {
    background: var(--bg-elev-1);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 4px;
}

.challenge-select option:disabled {
    color: var(--text-quaternary);
}

.challenge-hint {
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
}


/* ---------- Start button ---------- */
.btn-start {
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 18px 24px;
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--accent);
    transition: all var(--t-fast);
    cursor: pointer;
}

.btn-start:hover {
    background: var(--accent);
    color: var(--bg-base);
    box-shadow: 0 0 24px rgba(212, 165, 116, 0.25);
}

.btn-start .btn-arrow {
    font-size: 16px;
    transition: transform var(--t-fast);
}

.btn-start:hover .btn-arrow {
    transform: translateX(4px);
}

/* ---------- Back link & footer ---------- */
.setup-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
}

.back-link {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 2px;
    transition: color var(--t-fast), border-color var(--t-fast);
}

.back-link:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.setup-summary {
    display: flex;
    gap: 24px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
}

.setup-summary strong {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
    .setup-stage { padding: 24px 32px; }
    .setup-grid { grid-template-columns: 1fr; gap: 40px; }
    .setup-curve { max-width: 460px; margin: 0 auto; }
}
