/* Green INK V2.2 — unified electric-green accents */

:root {
    color-scheme: dark;
    --ink: #15121c;
    --white: #f8f6fc;
    --muted: #c9c5d3;
    --edge: #ffffff35;
    --electric-green: #39ff14;
    --accent: var(--electric-green);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    color: var(--white);
    font-family: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
    background: #15121c;
    min-height: 100vh;
    isolation: isolate;
}

/* The two random neon colors are supplied by gradient.php. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: linear-gradient(to bottom, var(--gradient-top, #8f123e), var(--gradient-bottom, #781a0c));
    pointer-events: none;
}

main {
    max-width: 720px;
    margin: auto;
    padding: 24px max(16px,env(safe-area-inset-right)) max(25px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));
}

.hero {
    padding: 22px 3px 28px;
}

.brand {
    font-size: 11px;
    letter-spacing: .23em;
    font-weight: 800;
    max-width: 100%;
    min-width: 0;
}

/* Keep the original logo proportions and prevent mobile overflow. */
.brand img {
    display: block;
    max-width: 100%;
    height: auto;
}

.hero h1 {
    font-size: clamp(42px,11vw,77px);
    letter-spacing: -.085em;
    line-height: .95;
    margin: 12px 0 14px;
    font-weight: 950;
}

.hero h1 span {
    color: var(--accent);
}

sup {
    font-size: 12px;
    vertical-align: top;
    letter-spacing: 0;
    margin-left: 8px;
}

.hero p {
    margin: 0 0 14px;
    font-size: 17px;
}

.privacy {
    font-size: 11px;
    color: var(--accent);
    font-weight: 700;
}

.step {
    border: 1px solid var(--edge);
    border-top: 3px solid var(--accent);
    background: #17141eea;
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 8px 30px #08051038;
}

.step-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.number {
    background: var(--accent);
    color: #17121c;
    padding: 7px 9px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.1;
}

.step h2 {
    font-size: 20px;
    margin: 0 0 4px;
    letter-spacing: -.04em;
}

.step p {
    color: var(--muted);
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
}

.file-control {
    display: block;
    position: relative;
    border: 1px dashed var(--accent);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    color: var(--accent);
    font-weight: 800;
    cursor: pointer;
}

.file-control input {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-control:focus-within {
    outline: 2px solid white;
}

.step .status {
    margin-top: 12px;
    overflow-wrap: anywhere;
}

.view {
    position: relative;
    background: #0c0b10;
    border-radius: 11px;
    overflow: hidden;
    min-height: 200px;
    display: grid;
    place-items: center;
    border: 1px solid #ffffff21;
}

.view canvas {
    display: block;
    width: 100%;
    height: auto;
    max-height: 62vh;
    object-fit: contain;
    touch-action: manipulation;
}

.view:not(.active) canvas {
    height: 240px;
}

.placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #b2acbf;
    font-size: 11px;
    letter-spacing: .12em;
    pointer-events: none;
}

.target {
    font-size: 50px;
    color: var(--accent);
    line-height: 1;
}

.placeholder small {
    letter-spacing: 0;
}

.view-badge,.record-badge {
    position: absolute;
    left: 10px;
    top: 10px;
    background: #15121cce;
    padding: 7px 9px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 800;
    pointer-events: none;
}

.record-badge {
    left: auto;
    right: 10px;
    color: #ff7793;
}

.buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.buttons>* {
    flex: 1 1 auto;
}

button,.button {
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    border: 1px solid #ffffff36;
    border-radius: 9px;
    padding: 12px;
    color: var(--white);
    background: #ffffff0b;
    min-height: 44px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

button.primary,.button.primary {
    background: var(--accent);
    color: #17121c;
    border-color: var(--accent);
}

button:disabled,.disabled {
    opacity: .4;
    cursor: not-allowed;
    pointer-events: none;
}

button:focus-visible,a:focus-visible,summary:focus-visible,input:focus-visible {
    outline: 2px solid white;
    outline-offset: 3px;
}

.audio {
    padding: 13px 0;
    border-bottom: 1px solid var(--edge);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.audio label {
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.audio input {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}

.audio span,.sample small {
    font-size: 12px;
    color: var(--muted);
}

.sample {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 0;
    border-bottom: 1px solid var(--edge);
}

.sample div {
    flex: 1;
}

.sample strong,.sample small {
    display: block;
}

.sample strong {
    font-size: 14px;
}

.swatch {
    width: 32px;
    height: 32px;
    flex: none;
    background: #25ad45;
    border: 1px solid white;
    border-radius: 50%;
}

.sample button {
    padding: 8px;
    min-height: 36px;
}

details {
    padding-top: 14px;
}

summary {
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
}

.sliders {
    display: grid;
    gap: 9px;
    margin-top: 14px;
}

.sliders label {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 5px;
    font-size: 12px;
}

.sliders input {
    grid-column: 1/-1;
    width: 100%;
    accent-color: var(--accent);
    margin: 0;
    min-height: 24px;
}

.sliders output {
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

#record:not(:disabled) {
    background: #ff4d77;
    color: #19101a;
    border-color: #ff4d77;
}

.dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    background: currentColor;
    border-radius: 50%;
    margin-right: 5px;
}

#result {
    width: 100%;
    max-height: 58vh;
    background: #0c0b10;
    border-radius: 10px;
}

footer {
    font-size: 10px;
    letter-spacing: .1em;
    font-weight: 800;
    color: #e7dfec;
    display: flex;
    gap: 6px;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 10px 2px;
}

footer span {
    font-weight: 400;
    letter-spacing: 0;
}

@media (min-width:600px) {
    .step {
        padding: 24px;
    }

    .sliders {
        grid-template-columns: 1fr 1fr;
        column-gap: 20px;
    }
}

/* Three fixed-position controls, immediately below the live preview. */

.camera-controls {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 6px;
}

.camera-controls button {
    min-width: 0;
    min-height: 48px;
    padding: 9px 5px;
    line-height: 1.2;
    overflow-wrap: normal;
}

.camera-controls #record .dot {
    margin-right: 4px;
}

.camera-controls #record.recording .dot {
    border-radius: 2px;
}

.camera-controls #record.recording:not(:disabled) {
    background: #ff4d77;
    color: #19101a;
    border-color: #ff4d77;
}

@media (max-width:380px) {
    .camera-controls button {
        font-size: 12px;
        padding-inline: 3px;
    }

    .camera-controls #record .dot {
        width: 7px;
        height: 7px;
        margin-right: 3px;
    }
}

/* V2.2 — compact effect selector and camera focus mode */
#shootSection .step-head > div {
    flex: 1;
    min-width: 0;
}

#focusToggle {
    flex: none;
    min-height: 36px;
    padding: 7px 9px;
    font-size: 11px;
    background: var(--accent);
    border-color: var(--accent);
    color: var(--ink);
}

/* Brief, gentle pulse when the available focus button enters the viewport. */
#focusToggle.focus-visible-in-view[aria-pressed="false"]:not([hidden]) {
    animation: focus-button-pulse 1.4s ease-out 3;
}

@keyframes focus-button-pulse {
    0% {
        box-shadow: 0 0 0 0 #39ff1499;
    }

    75%, 100% {
        box-shadow: 0 0 0 6px #39ff1400;
    }
}

@media (prefers-reduced-motion: reduce) {
    #focusToggle.focus-visible-in-view {
        animation: none !important;
    }
}

.torch-toggle {
    position: absolute;
    z-index: 2;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 40px;
    padding: 7px 10px;
    background: #15121ce8;
    color: var(--white);
    font-size: 12px;
}

.torch-toggle[aria-pressed="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--ink);
}

/* Keep the recording timer clear of the torch button. */
#shootSection .record-badge {
    left: 10px;
    right: auto;
    top: 39px;
}

.effect-controls {
    margin-top: 12px;
}

.effect-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
}

.effect-tab {
    min-width: 0;
    min-height: 49px;
    padding: 5px 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    font-size: clamp(9px, 2.5vw, 12px);
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.effect-tab svg {
    flex: none;
}

.effect-tab[aria-pressed="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--ink);
}

.compact-sliders {
    grid-template-columns: minmax(0, 1fr);
    margin-top: 9px;
    gap: 0;
}

.compact-sliders label {
    color: var(--accent);
    font-weight: 700;
}

.compact-sliders input {
    min-width: 0;
    min-height: 32px;
    touch-action: pan-y;
}

/* Focus mode uses the available viewport, not the Fullscreen API. */
body.camera-focus {
    overflow: hidden;
}

body.camera-focus #shootSection {
    position: fixed;
    z-index: 20;
    inset: 0;
    width: 100%;
    max-width: 720px;
    height: 100%;
    height: 100dvh;
    margin: 0 auto;
    padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    border-radius: 0;
    background: #17141e;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
}

body.camera-focus #shootSection > :not(.view) {
    flex-shrink: 0;
}

body.camera-focus #shootSection .step-head {
    align-items: center;
    margin-bottom: 9px;
    gap: 8px;
}

body.camera-focus #shootSection .step-head h2 {
    font-size: 17px;
    margin: 0;
}

body.camera-focus #shootSection .step-head p {
    display: none;
}

body.camera-focus #shootSection .view {
    flex: 1 0 120px;
    min-height: 120px;
    min-width: 0;
    display: block;
}

body.camera-focus #shootSection .view canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
}

body.camera-focus #shootSection .camera-controls {
    margin-top: 8px;
}

body.camera-focus #shootSection .effect-controls {
    margin-top: 8px;
}

body.camera-focus #shootSection .sample {
    padding: 6px 0;
    gap: 7px;
}

body.camera-focus #shootSection .sample small {
    font-size: 11px;
}

body.camera-focus #shootSection .swatch {
    width: 26px;
    height: 26px;
}

body.camera-focus #shootSection .audio {
    padding: 6px 0;
    gap: 2px;
}

body.camera-focus #shootSection .audio label {
    font-size: 12px;
}

body.camera-focus #shootSection .audio input {
    margin: 0;
}

body.camera-focus #shootSection .audio span,
body.camera-focus #shootSection .status {
    font-size: 11px;
}

body.camera-focus #shootSection .status {
    margin-top: 5px;
}

/* In landscape, put the preview beside the controls instead of above them. */
@media (orientation: landscape) and (max-height: 600px) and (min-width: 550px) {
    body.camera-focus #shootSection {
        max-width: none;
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(270px, 1fr);
        grid-template-rows: auto auto auto auto auto 1fr;
        column-gap: 12px;
        align-content: start;
    }

    body.camera-focus #shootSection .step-head {
        grid-column: 1 / -1;
    }

    body.camera-focus #shootSection .view {
        grid-column: 1;
        grid-row: 2 / 7;
        min-height: 140px;
    }

    body.camera-focus #shootSection .camera-controls,
    body.camera-focus #shootSection .effect-controls,
    body.camera-focus #shootSection .sample,
    body.camera-focus #shootSection .audio,
    body.camera-focus #shootSection .status {
        grid-column: 2;
    }
}

@media (orientation: landscape) and (max-height: 420px) and (min-width: 550px) {
    body.camera-focus #shootSection .step-head {
        margin-bottom: 4px;
    }

    body.camera-focus #shootSection .camera-controls,
    body.camera-focus #shootSection .effect-controls {
        margin-top: 4px;
    }

    body.camera-focus #shootSection .camera-controls button {
        min-height: 42px;
        padding-block: 5px;
    }

    body.camera-focus #shootSection .effect-tab {
        min-height: 42px;
    }

    body.camera-focus #shootSection .compact-sliders {
        margin-top: 4px;
    }

    body.camera-focus #shootSection .sample,
    body.camera-focus #shootSection .audio {
        padding-block: 3px;
    }
}

/* ===== V3: PRESET VIDEO LIBRARY ===== */
.preset-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
}

.preset-heading span {
    color: var(--muted);
    font-size: 11px;
}

.preset-library {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: clamp(96px, 28vw, 126px);
    gap: 8px;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
    padding: 4px 3px 10px;
}

.preset-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 3px;
    border: 2px solid transparent;
    background: #ffffff0b;
    border-radius: 10px;
    scroll-snap-align: start;
    text-align: center;
}

.preset-card[aria-pressed="true"] {
    border-color: var(--accent);
    color: var(--accent);
}

.preset-art {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border-radius: 5px;
    background: var(--ink);
}

.preset-art img,
.preset-art video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.preset-art video {
    position: absolute;
    inset: 0;
}

.preset-check {
    display: none;
    position: absolute;
    z-index: 1;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    line-height: 20px;
    border-radius: 50%;
    color: var(--ink);
    background: var(--accent);
    font-weight: 900;
}

.preset-card[aria-pressed="true"] .preset-check {
    display: block;
}

.preset-name {
    font-size: 11px;
    line-height: 1.2;
    min-height: 2.4em;
    display: grid;
    place-items: center;
    overflow-wrap: anywhere;
}

.preset-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 13px 0;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
}

.preset-divider::before,
.preset-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--edge);
}

/* Session refresh — separate from camera and effect controls. */
.session-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-top: 14px;
}

#refreshSession {
    background: var(--ink);
    border-color: var(--accent);
    color: var(--accent);
}

#refreshSession span {
    margin-right: 4px;
}

.session-tools small {
    color: var(--white);
    font-size: 11px;
    line-height: 1.4;
}

/* V3.2 — independent recording audio options. */
.audio-option {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.audio-option + .audio-option {
    margin-top: 4px;
}

.audio-option input {
    flex: none;
}

.audio-option input:disabled {
    opacity: .45;
}

body.camera-focus #shootSection .audio-option {
    gap: 1px;
}

body.camera-focus #shootSection .audio-option + .audio-option {
    margin-top: 2px;
}
