@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=Share+Tech+Mono&family=Special+Elite&display=swap');

:root {
    /* Field Manual (lock page) */
    --ink: #3a2f18;
    --ink-soft: #4a3f22;
    --paper-brown: #6b5d36;
    --stamp: #9a3322;
    --stamp-dark: #7a2418;

    /* Command Terminal (projects page) */
    --term-green: #6effa0;
    --term-dim: #3fbf6f;
    --term-bright: #9dffc1;
    --amber: #e2a32b;

    --radius: 4px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Oswald', 'Trebuchet MS', sans-serif;
    color: #ecead7;
}

button,
input {
    font: inherit;
}

/* ---------- shared layout ---------- */
.lock-page,
.projects-page {
    display: grid;
    place-items: center;
    padding: 40px clamp(32px, 6vw, 120px);
}

.lock-shell {
    width: min(100%, 640px);
}

.projects-shell {
    width: min(100%, 720px);
}

.app-background {
    position: fixed;
    inset: 0;
    z-index: -2;
    overflow: hidden;
}

/* =========================================================
   LOCK PAGE — FIELD MANUAL
   ========================================================= */
.lock-page {
    background: radial-gradient(ellipse at 50% 28%, #24271a, #0f1109 70%, #070803);
}

.lock-page .app-background::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 120%, rgba(0, 0, 0, 0.6), transparent 55%);
}

.pin-panel {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding: 50px 60px 56px;
    border: 2px solid var(--ink-soft);
    border-radius: var(--radius);
    color: var(--ink);
    background:
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.035) 0 2px, transparent 2px 5px),
        linear-gradient(160deg, #d3c69e, #b3a677 55%, #968956);
    box-shadow:
        0 30px 70px rgba(0, 0, 0, 0.6),
        inset 0 0 0 1px rgba(255, 255, 255, 0.25),
        inset 0 0 60px rgba(120, 100, 50, 0.25);
}

.pin-panel::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 8px;
    background: var(--stamp);
    opacity: 0.9;
}

.pin-panel > * {
    position: relative;
    z-index: 1;
}

.lock-page .system-label {
    display: block;
    margin: 0 0 18px;
    text-align: center;
    color: var(--paper-brown);
    font-family: 'Special Elite', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
}

.lock-page h1 {
    margin: 2px 0 30px;
    text-align: center;
    font-family: 'Special Elite', monospace;
    font-weight: 400;
    font-size: clamp(2.8rem, 7vw, 4.2rem);
    line-height: 0.95;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}

.unlock-button {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: min(100%, 460px);
    /* Symmetric vertical padding does the vertical centering of the
       icon + label group; height grows equally above and below the
       content so the label can never drift to the top. */
    min-height: 72px;
    padding: 36px 24px 22px;
    margin: 0 auto 28px;
    border: 2px solid rgba(60, 50, 30, 0.4);
    border-radius: var(--radius);
    color: rgba(50, 42, 24, 0.42);
    background: linear-gradient(180deg, #9c9582, #7e7763);
    box-shadow:
        inset 0 1px rgba(255, 255, 255, 0.22),
        0 3px 0 rgba(70, 60, 35, 0.4);
    cursor: default;
    font-family: 'Special Elite', monospace;
    font-size: 1.2rem;
    line-height: 1;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    filter: saturate(0.7);
    transition: background 0.18s, color 0.18s, border-color 0.18s, filter 0.18s;
}

/* keep the icon + label as one optically centered unit */
.unlock-button .unlock-icon {
    flex: none;
    align-self: center;
}

.unlock-button:focus {
    outline: none;
}

.unlock-button:focus-visible {
    box-shadow:
        0 0 0 3px rgba(154, 51, 34, 0.32),
        inset 0 1px rgba(255, 255, 255, 0.2);
}

.unlock-icon {
    position: relative;
    display: inline-block;
    width: 22px;
    height: 17px;
    margin-right: 14px;
    border: 3px solid currentColor;
    border-radius: 3px;
    vertical-align: -2px;
    opacity: 0.85;
}

.unlock-icon::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 11px;
    width: 12px;
    height: 14px;
    border: 3px solid currentColor;
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
    transform: translateX(-50%);
}

.unlock-icon::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 5px;
    width: 4px;
    height: 6px;
    border-radius: 2px;
    background: currentColor;
    transform: translateX(-50%);
}

.unlock-button.can-submit {
    color: #fff3e6;
    cursor: pointer;
    background: linear-gradient(180deg, #c14328, #9a3322);
    border-color: var(--stamp);
    filter: none;
    box-shadow:
        inset 0 1px rgba(255, 255, 255, 0.2),
        0 3px 0 rgba(60, 16, 10, 0.55);
}

@keyframes armed-pulse {
    0%, 100% { box-shadow: inset 0 1px rgba(255, 255, 255, 0.28), inset 0 -2px rgba(0, 0, 0, 0.5), 0 4px 0 rgba(70, 16, 10, 0.9), 0 0 18px rgba(216, 65, 47, 0.35); }
    50% { box-shadow: inset 0 1px rgba(255, 255, 255, 0.28), inset 0 -2px rgba(0, 0, 0, 0.5), 0 4px 0 rgba(70, 16, 10, 0.9), 0 0 34px rgba(216, 65, 47, 0.7); }
}

.unlock-button.can-submit .unlock-icon { opacity: 1; }

.unlock-button.is-loading,
.unlock-button.is-loading:disabled {
    color: #fff7e8;
    border-color: var(--amber);
    background:
        linear-gradient(180deg, rgba(226, 163, 43, 0.92), rgba(140, 90, 20, 0.96)),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 4px);
    box-shadow:
        inset 0 2px rgba(255, 255, 255, 0.3),
        inset 0 -2px rgba(0, 0, 0, 0.45),
        0 2px 0 rgba(70, 46, 10, 0.9),
        0 0 36px rgba(226, 163, 43, 0.7);
    cursor: wait;
    transform: translateY(2px);
    animation: unlock-loading-pulse 0.8s ease-in-out infinite;
}

@keyframes unlock-loading-pulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.18); }
}

body.is-unlocking .pin-panel {
    pointer-events: none;
}

.access-loading {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(ellipse at 50% 45%, rgba(226, 163, 43, 0.18), transparent 42%),
        rgba(5, 6, 4, 0.74);
    backdrop-filter: blur(9px) saturate(1.1);
    -webkit-backdrop-filter: blur(9px) saturate(1.1);
    z-index: 30;
}

.access-loading.is-visible {
    display: grid;
}

.access-loading-card {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 8px;
    width: 420px;
    max-width: calc(100vw - 48px);
    padding: 36px 30px 32px;
    border: 2px solid rgba(226, 163, 43, 0.78);
    border-radius: 7px;
    background:
        linear-gradient(160deg, rgba(70, 78, 54, 0.78), rgba(14, 16, 10, 0.96)),
        rgba(20, 24, 15, 0.96);
    box-shadow:
        0 30px 70px rgba(0, 0, 0, 0.7),
        inset 0 0 0 1px rgba(226, 163, 43, 0.22),
        0 0 42px rgba(226, 163, 43, 0.26);
    text-align: center;
    text-transform: uppercase;
}

.access-loading-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 8px;
    border-radius: 5px 5px 0 0;
    background: var(--hazard);
}

.access-loading-icon {
    width: 42px;
    height: 42px;
    border: 3px solid var(--amber);
    border-radius: 50%;
    box-shadow: 0 0 24px rgba(226, 163, 43, 0.55);
    animation: access-loading-spin 0.9s linear infinite;
}

.access-loading-icon::before {
    content: '';
    display: block;
    width: 12px;
    height: 12px;
    margin: -5px auto 0;
    border-radius: 50%;
    background: #fff7e8;
    box-shadow: 0 0 14px rgba(255, 247, 232, 0.8);
}

.access-loading-card p {
    margin: 8px 0 0;
    color: #fff7e8;
    font-family: 'Black Ops One', sans-serif;
    font-size: 1.6rem;
    line-height: 1.2;
    letter-spacing: 0.08em;
    text-shadow: 0 0 18px rgba(226, 163, 43, 0.55);
}

.access-loading-card span:not(.access-loading-icon) {
    color: var(--amber);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.18em;
}

@keyframes access-loading-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Code slots (ammo cells) ---------- */
.pin-slots {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    width: min(100%, 480px);
    margin: 0 auto 24px;
}

.pin-slot {
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 2px solid var(--ink-soft);
    border-radius: 3px;
    outline: none;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.22);
    box-shadow: inset 0 2px 6px rgba(60, 40, 10, 0.25);
    text-align: center;
    font-family: 'Special Elite', monospace;
    font-size: clamp(1.4rem, 4vw, 2.4rem);
    font-weight: 400;
    caret-color: transparent;
    cursor: pointer;
}

.pin-slot:focus {
    border-color: var(--stamp);
    box-shadow:
        0 0 0 3px rgba(154, 51, 34, 0.18),
        inset 0 2px 6px rgba(60, 40, 10, 0.25);
}

.pin-slot.is-filled {
    color: #ecead7;
    background: rgba(58, 47, 24, 0.92);
    border-color: var(--ink);
}

.numpad {
    display: block;
    width: min(100%, 480px);
    margin: 0 auto;
    border: 0;
    padding: 0;
    background: transparent;
}

.numpad.is-open {
    display: block;
}

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

.numpad-key {
    min-height: 62px;
    border: 1.5px solid var(--ink-soft);
    border-radius: var(--radius);
    color: var(--ink);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.32), rgba(214, 200, 150, 0.55));
    box-shadow:
        inset 0 1px rgba(255, 255, 255, 0.45),
        0 2px 0 rgba(90, 70, 30, 0.4);
    cursor: pointer;
    font-family: 'Special Elite', monospace;
    font-size: 1.5rem;
}

.numpad-key:hover,
.numpad-key:focus-visible {
    border-color: var(--stamp);
    color: var(--stamp-dark);
    outline: none;
}

.numpad-key:active {
    transform: translateY(2px);
}

.numpad-key-icon {
    color: var(--stamp);
    font-size: 1.3rem;
}

/* breach alert modal — paper notice */
.modal-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(20, 12, 4, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 20;
}

.modal-backdrop.is-visible {
    display: grid;
}

.modal-card {
    position: relative;
    display: grid;
    justify-items: center;
    width: 380px;
    max-width: calc(100vw - 48px);
    padding: 34px 30px 28px;
    border: 2px solid var(--stamp);
    border-radius: var(--radius);
    color: var(--ink);
    background: linear-gradient(160deg, #d3c69e, #b3a677);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.modal-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 7px;
    background: var(--stamp);
}

.modal-card h2 {
    margin: 14px 0 22px;
    color: var(--stamp-dark);
    font-family: 'Special Elite', monospace;
    font-weight: 400;
    font-size: 1.4rem;
    line-height: 1.3;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.warning-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 44px;
    height: 40px;
    margin: 0 auto;
    color: var(--stamp-dark);
    font-family: 'Special Elite', monospace;
    font-size: 1.2rem;
    line-height: 1;
}

.warning-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    background: rgba(154, 51, 34, 0.18);
    border: 2px solid var(--stamp);
}

.warning-icon::after {
    content: '';
    position: absolute;
    inset: 6px;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    border: 1px solid rgba(154, 51, 34, 0.7);
}

.retry-button {
    width: 260px;
    max-width: 100%;
    min-height: 52px;
    border: 2px solid var(--stamp-dark);
    border-radius: var(--radius);
    color: #f3e8d8;
    background: linear-gradient(180deg, #a83a28, #8a2c1d);
    cursor: pointer;
    font-family: 'Special Elite', monospace;
    font-size: 1.05rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.2);
}

.retry-button:disabled {
    opacity: 0.8;
    cursor: wait;
}

/* =========================================================
   PROJECTS PAGE — COMMAND TERMINAL
   ========================================================= */
.projects-page {
    background: #050805;
}

.projects-page .app-background::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(63, 191, 111, 0.14), transparent 55%);
}

.projects-page .app-background::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, 0.4) 2px 3px);
    pointer-events: none;
}

.projects-panel {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding: 30px 34px;
    border: 1px solid rgba(110, 255, 160, 0.4);
    border-radius: 6px;
    background: rgba(6, 12, 7, 0.92);
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.7),
        0 0 30px rgba(63, 191, 111, 0.12),
        inset 0 0 60px rgba(20, 60, 30, 0.25);
    font-family: 'Share Tech Mono', monospace;
}

.projects-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, 0.25) 2px 3px);
}

.projects-panel > * {
    position: relative;
    z-index: 1;
}

.projects-page .system-label {
    display: block;
    margin: 0 0 16px;
    padding-bottom: 10px;
    text-align: left;
    color: var(--term-dim);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 1px dashed rgba(110, 255, 160, 0.3);
}

.projects-page h1 {
    margin: 0 0 20px;
    text-align: left;
    font-family: 'Share Tech Mono', monospace;
    font-weight: 400;
    font-size: clamp(2rem, 6vw, 3rem);
    line-height: 1;
    letter-spacing: 0.12em;
    color: var(--term-bright);
    text-shadow: 0 0 12px rgba(110, 255, 160, 0.5);
}

.project-links {
    display: grid;
    gap: 10px;
}

.project-button,
.lock-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 56px;
    padding: 14px 18px;
    border: 1px solid rgba(110, 255, 160, 0.35);
    border-radius: 3px;
    color: var(--term-bright);
    background: rgba(20, 40, 26, 0.4);
    text-decoration: none;
    font-family: 'Share Tech Mono', monospace;
    font-size: 1rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.project-button .k,
.lock-link .k {
    color: var(--term-dim);
    font-size: 0.78rem;
}

/* primary / selected entry */
.project-button {
    border-color: var(--term-green);
    background: rgba(110, 255, 160, 0.12);
    box-shadow: 0 0 16px rgba(110, 255, 160, 0.2);
}

.project-button .cmd::before {
    content: '> ';
    color: var(--amber);
}

.project-button:hover,
.lock-link:hover {
    border-color: var(--term-green);
    background: rgba(110, 255, 160, 0.16);
    box-shadow: 0 0 18px rgba(110, 255, 160, 0.3);
}

.lock-link {
    width: 100%;
    margin-top: 14px;
    color: var(--term-bright);
    border-color: rgba(110, 255, 160, 0.3);
}

.term-cursor {
    margin-top: 16px;
    color: var(--term-dim);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.82rem;
    letter-spacing: 0.06em;
}

.term-cursor::after {
    content: '_';
    animation: term-blink 1s steps(2) infinite;
}

@keyframes term-blink {
    50% { opacity: 0; }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 520px) {
    .lock-page,
    .projects-page {
        padding: 18px;
    }

    .pin-panel {
        padding: 34px 20px 30px;
    }

    .lock-page h1 {
        font-size: clamp(2.2rem, 13vw, 3.2rem);
        letter-spacing: 0.1em;
    }

    .unlock-button {
        min-height: 54px;
        font-size: 1.05rem;
    }

    .pin-slots {
        gap: 6px;
    }

    .numpad-grid {
        gap: 7px;
    }

    .numpad-key {
        min-height: 52px;
        font-size: 1.25rem;
    }

    .projects-panel {
        padding: 24px 20px;
    }

    .projects-page h1 {
        font-size: clamp(1.7rem, 9vw, 2.4rem);
    }

    .modal-card {
        width: 340px;
        max-width: calc(100vw - 36px);
        padding: 26px 20px;
    }
}
