:root {
    --bg: #111111;
    --red: #c41c0c;
    --green: #1a9050;
    --amber: #c88000;
    --surface: #1e1e1e;
    --surface-2: #404040;
    --paper: #ddd0b0;
    --paper-dim: rgba(221, 208, 176, 0.4);
    --paper-faint: rgba(221, 208, 176, 0.2);

    --font-ui: 'Special Elite', 'Courier New', monospace;
    --font: 'Josefin Sans', sans-serif;
}
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

fieldset {
    border: none;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: inherit;
    font-size: inherit;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--paper);
}

/* forms */
form {
    display: flex;
    flex-direction: column;
    gap: .625rem;
}

input[type="text"],
input[type="number"] {
    width: 100%;
    outline: none;
    padding: .50rem .75rem;
    font-size: 1rem;
    font-family: var(--font-ui);
    background: var(--surface);
    border: 1px solid var(--surface-2);
    color: var(--paper);
    letter-spacing: 0.2em;
}

input[type="text"]:focus,
input[type="number"]:focus {
    border-color: var(--red);
}

input::placeholder {
    color: var(--surface-2);
}

input[type="range"] {
    width: 100%;
    height: 4px;
    accent-color: var(--red);
    cursor: pointer;
}

/* buttons */
button{
    padding: 1rem 1.5rem;
    background: var(--bg);
    color: var(--paper);
    border: 1px solid var(--red);
    font-family: var(--font-ui);
    font-size: 1rem;
    letter-spacing: 0.2em;
    cursor: pointer;
}

button:hover{
    background: var(--red);
    color: var(--bg);
}

button:disabled{
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    border-color: var(--red);
    color: var(--red);
}

.hidden {
    display: none !important;
}

.flashlight {
    position: fixed;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* SCREEN MANAGEMENT */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.shown {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, rgba(5, 2, 0, 0.8) 100%), url('./photos/darkroom-bg.png') center/cover no-repeat;
    background-color: #00000042;
    animation: screenFadeIn 0.8s ease;
}

/* INTRO SCREEN */
.screen-inner {
    display: flex;
    flex-direction: column;
    max-width: 700px;
    width: 100%;
    padding: 3rem 2rem;
    gap: 2rem;
}

.header {
    display: flex;
    justify-content: center;
    font-family: var(--font-ui);
    font-size: 5.5rem;
    letter-spacing: 0.2em;
}

.story-section {
    border-radius: 1rem;
    padding: 1.2rem 1rem;
    background:
        linear-gradient(to left, black 0%, transparent 50%),
        linear-gradient(to right, black 0%, transparent 50%);
}

.story-section p {
    font-size: 1.2rem;
    line-height: 1.5rem;
}

.accent-red {
    color: var(--red);
}

.accent-amber {
    color: var(--amber);
}

.accent-green {
    color: var(--green);
}

.time-warning {
    margin-top: 16px;
    font-size: 12.8px;
    letter-spacing: 3.2px;
    color: var(--red);
    border: 1px solid var(--red);
    padding: .6rem 1rem;
    font-family: var(--font-ui);
}

.leaderboard-section{
    padding: 24px 16px;
    border-radius: 1rem;
    background:
        linear-gradient(to left, black 0%, transparent 20%),
        linear-gradient(to right, black 0%, transparent 20%);
}

.leaderboard-title{
    display: flex;
    justify-content: center;
    border-bottom: .0625rem solid var(--paper);
    padding-bottom: 8px;
    font-size: .8rem;
    letter-spacing: .2rem;
    font-family: var(--font-ui);
}

.leaderboard-score {
    display: flex;
    gap: 1rem;
    padding: .35rem 0;
    border-bottom: 1px solid rgba(221, 208, 176, 0.08);
    font-size: .78rem;
}

.leaderboard-rank {
    color: var(--paper-dim);
    width: 2rem;
}

.leaderboard-name {
    flex: 1;
}

.leaderboard-time {
    color: var(--amber);
    font-size: 12px;
}

/* GAME SCREEN */

#game-screen {
    justify-content: flex-start;
    overflow-y: auto;
}

#game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 16px 32px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 1) 40%, rgba(0, 0, 0, 0.1) 100%);
}

#timer {
    display: flex;
    justify-content: center;
    font-size: 1.6rem;
    letter-spacing: 0.1em;
    padding-top: .5rem ;
}

#timer.warning {
    color: var(--amber);
    animation: pulse 1.5s ease-in-out infinite;
}

#timer.critical {
    color: var(--red);
    animation: pulse 0.5s ease-in-out infinite;
}

#game-steps {
    display: flex;
    align-items: center;
    gap: .4rem;
    justify-content: center;
}

.header-label{
    display: flex;
    justify-content: center;
    margin: .5rem;
    font-size: 1rem;
    letter-spacing: 0.2em;
    color: var(--paper);
    font-family: var(--font-ui);
}

.step{
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-bottom: 1px solid var(--surface-2);
    font-size: .8rem;
    letter-spacing: 0.2em;
    color: var(--surface-2);
}

.step.active {
    border-color: var(--red);
    color: var(--red);
}

.step.done {
    border-color: var(--green);
    color: var(--green);
}

.step-separator{
    color: var(--surface-2);
    font-size: 1rem;
    width: .625rem;
    border: none;
}

#hint-wrap {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: .5rem;
}

#btn-hint, .btn-flash{
    font-size: .8rem;
    padding: .6rem .8rem;
    margin-bottom: .25rem;
}


/* --- HINT OVERLAY --- */
#hint-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
}

#hint-box {
    background: var(--surface);
    border: 2px solid var(--amber);
    padding: 2rem;
    max-width: 30rem;
}

.hint-title {
    font-size: .6rem;
    letter-spacing: 0.2em;
    color: var(--amber);
    margin-bottom: 1rem;
}

#hint-text {
    font-size: .82rem;
    line-height: 1.8;
    color: rgba(221, 208, 176, 0.8);
    margin-bottom: 1.25rem;
}

#hint-overlay:not(.hidden) {
    animation: screenFadeIn 0.25s ease;
}

/* STAGE */
#stage-area {
    max-width: 62.5rem;
    width: 100%;
}

.stage-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background:
        linear-gradient(to left, black 0%, transparent 20%),
        linear-gradient(to right, black 0%, transparent 50%);
    padding: 2rem 1.5rem;
    border-radius: 1rem;
}

.stage-number {
    font-size: .8rem;
    letter-spacing: .2rem;
    color: var(--red);
    font-family: var(--font-ui);
}

.stage-title {
    font-size: 2rem;
    letter-spacing: 0.2em;
    padding-bottom: .7rem;
    border-bottom: 1px solid var(--surface-2);
    font-family: var(--font-ui);
}

.stage-description {
    font-size: 1rem;
    line-height: 1.5;
    color: color-mix(in srgb, var(--paper) 60%, transparent);
}

/*STATUS BAR*/
.status {
    text-align: center;
    padding: 8px 12px;
    border: .0625rem solid rgba(221, 208, 176, 0.15);
    font-size: 11.2px;
    letter-spacing: 0.1em;
    color: rgba(221, 208, 176, 0.5);
}

.status.error {
    color: var(--red);
    border-color: var(--red);
}

.status.half.success {
    color: color-mix(in srgb, var(--green) 30%, black);
    border-color: color-mix(in srgb, var(--green) 30%, black);
}

.status.full.success {
    color: var(--green);
    border-color: var(--green);
}

.status.ready {
    color: var(--amber);
    border-color: var(--amber);
}

/* STAGE 1 — SWITCHES + RANGES */

.protocol-section {
    display: flex;
    flex-direction: column;
    gap: 19.2px;
}

.section-label {
    font-size: 12.8px;
    letter-spacing: 0.2em;
    color: var(--paper-dim);
    border-bottom: 1.6px solid var(--surface-2);
    padding-bottom: 6.4px;
    font-family: var(--font-ui);
}

.switches-row {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.switch-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.switch-label {
    padding-bottom: 8px;
    font-size: 16px;
    color: var(--paper);
}

.switch-btn {
    width: 3rem;
    height: 3rem;
    border: 1.6px solid var(--surface-2);
    background: var(--surface);
}


.switch-btn.active {
    display: flex;
    justify-content: center;
    align-items: center;
    border-color: var(--green);
    background-color: color-mix(in srgb, var(--green) 20%, transparent);
    animation: switchPop 0.2s ease;
}

.ranges-row {
    display: flex;
    gap: 2rem;
    padding-top: 1.5rem;
}

.range-unit {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.range-unit label {
    font-size: 12.8px;
    letter-spacing: 1.6px;
}

.range-val {
    text-align: right;
}

/*STAGE 2 — DRAG & DROP*/
.drag-workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.drag-title {
    font-size: 12.5px;
    letter-spacing: 0.2em;
    color: var(--paper-dim);
    margin-bottom: 11px;
}

.process-cards,
.process-slots {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.process-card {
    border: .0625rem solid rgba(221, 208, 176, 0.18);
    padding: 11px;
    background: var(--surface);
    cursor: grab;
}

.process-card:active {
    opacity: 0.5;
}

.process-card-name {
    font-size: 12.8px;
    letter-spacing: 3.2px;
}

.process-card-hint {
    font-size: 12px;
    letter-spacing: 1.6px;
    color: var(--paper-dim);
    padding: 5px 0 5px 0;
}

.process-card-time {
    font-size: 10px;
    letter-spacing: 1.5px;
    color: var(--amber);
}

.process-slot {
    min-height: 4rem;
    border: .0625rem dashed var(--paper-faint);
    color: var(--paper-faint);
}

.process-slot.over {
  border: 2px dashed var(--green);
}

.time-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 11.2px;
}

.time-row {
    display: flex;
    flex-direction: column;
    gap: 4.8px;
}

.time-row-header {
    display: flex;
    align-items: center;
}

.time-row-name {
    font-size: .7rem;
    letter-spacing: .1rem;
    padding: .4rem 0 .2rem 0;
}

.time-check {
    font-size: .7rem;
    padding-left: 1rem;
}

input.time-field {
    font-size: .9rem;
}

input.ok {
    border-color: var(--green);
}

input.error {
    border-color: var(--red);
}

/* STAGE 3 */
.bath-row{
    display: flex;
    flex-direction: column;
    gap: 11.2px;
}

.bar-wrap {
    width: 100%;
    height: 10px;
    background: var(--surface-2);
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    width: 0%;
    background: var(--amber);
    transition: background 0.3s;
}

.bar-fill.correct {
    background: var(--green);
}

.bar-fill.overexposed {
    background: var(--red);
}

#code-wrap{
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}

#photos-grid{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.photo{
    animation: fadeIn 0.5s ease forwards;
}

.photo img{
    width: 100%;
    padding-bottom: 5px;
}

#pinpad{
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    padding:16px;
}

#pin-display{
    text-align: center;
    padding: 8px;
    font-size: 32px;
    border-radius: 3.125rem;
    border-bottom: .0625rem solid var(--red);
    color: var(--paper);
    font-style: var(--font-ui);
}

.pin-btn{
    padding:  20px 0 20px 0;
}

.pin-btn:last-child{
    grid-column: 2;
}

#pin-display:not(:empty){
    border-top: .0625rem solid color-mix(in srgb, var(--red) 35%, black);
}

#pin-display.error{
    color: var(--red);
    animation: shake 0.4s ease;
}

#pin-display.correct{
    color: var(--green);
}

.pin-buttons{
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.photo figcaption {
    font-size: .9rem;
    font-family: var(--font-ui);
    font-weight: 900;
    line-height: 1.6;
    color: var(--paper-dim);
    border-top: 1px solid var(--surface-2);
    padding-top: .6rem;
    text-wrap: pretty;
}

/* END SCREENS */

.result-title{
    font-size: 35px;
}

.result-time{
    margin-bottom: 25px;
}

.result-body {
    font-size: 20px;
}

/* ANIMATIONS */

@keyframes screenFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes switchPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

