/* ============================================================
   gur.al — STONE_ORACLE.EXE
   Y2K-futurism oracle terminal
   Palette: chrome-metallic + carnelian
   ============================================================ */

:root {
    --void:        #0a0d12;
    --slate-cool:  #1c2028;
    --moss-iron:   #5a5550;
    --chrome-mid:  #c0c8cc;
    --chrome-hi:   #e8ecef;
    --phosphor:    #a8ff80;
    --brass:       #d4a04a;
    --carnelian:   #7a1f1c;
    --bone:        #f0e8d8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--void);
    color: var(--chrome-hi);
    font-family: "VT323", monospace;
    cursor: crosshair;
}

body {
    position: relative;
    min-height: 100dvh;
}

/* ============================================================
   Stratum 0 — Bedrock canvas
   ============================================================ */
#bedrock {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

#bedrock #grainField {
    transform-origin: 960px 1600px;
    animation: grainRotate 660s linear infinite;
}

@keyframes grainRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ============================================================
   Stratum 1 — Petroglyph engravings
   ============================================================ */
#petroglyphs {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    opacity: 0.86;
}

#petroglyphs .petroglyph {
    pointer-events: auto;
    cursor: crosshair;
    transform: translate(calc(var(--cx) * 1px), calc(var(--cy) * 1px));
}

#petroglyphs .petroglyph path {
    fill: none;
    stroke: var(--brass);
    stroke-width: 2.4;
    stroke-linecap: square;
    stroke-linejoin: miter;
    stroke-dasharray: 320;
    stroke-dashoffset: 320;
    animation: glyphDraw 1.2s ease-out forwards, glyphMoss 6s ease-in-out infinite 1.6s;
    filter: drop-shadow(0 0 1px rgba(212, 160, 74, 0.4));
}

#petroglyphs .petroglyph:nth-child(1) path { animation-delay: 0.2s, 1.6s; }
#petroglyphs .petroglyph:nth-child(2) path { animation-delay: 0.44s, 1.84s; }
#petroglyphs .petroglyph:nth-child(3) path { animation-delay: 0.68s, 2.08s; }
#petroglyphs .petroglyph:nth-child(4) path { animation-delay: 0.92s, 2.32s; }
#petroglyphs .petroglyph:nth-child(5) path { animation-delay: 1.16s, 2.56s; }
#petroglyphs .petroglyph:nth-child(6) path { animation-delay: 1.40s, 2.80s; }
#petroglyphs .petroglyph:nth-child(7) path { animation-delay: 1.64s, 3.04s; }

@keyframes glyphDraw {
    to { stroke-dashoffset: 0; }
}

@keyframes glyphMoss {
    0%, 100% { stroke-dashoffset: 0; }
    50%      { stroke-dashoffset: 0.6; }
}

#petroglyphs .petroglyph:hover path {
    stroke: var(--chrome-hi);
    filter: drop-shadow(0 0 3px var(--brass));
}

/* ============================================================
   Stratum 2 — Chrome bevel frames
   ============================================================ */
.bevel-frame {
    position: fixed;
    z-index: 2;
    pointer-events: none;
    background: rgba(192, 200, 204, 0.18);
    border-top: 4px solid var(--chrome-hi);
    border-left: 4px solid var(--chrome-hi);
    border-right: 4px solid var(--moss-iron);
    border-bottom: 4px solid var(--moss-iron);
    box-shadow:
        12px 12px 0 0 rgba(10, 13, 18, 0.4),
        inset 1px 1px 0 0 rgba(232, 236, 239, 0.5),
        inset -1px -1px 0 0 rgba(90, 85, 80, 0.6);
}

.frame-a {
    top: 8%;
    left: 4%;
    width: 22vw;
    height: 18vh;
    transform: rotate(-1deg);
}

.frame-b {
    bottom: 12%;
    right: 6%;
    width: 26vw;
    height: 22vh;
    transform: rotate(1.2deg);
}

.frame-c {
    top: 40%;
    right: 3%;
    width: 14vw;
    height: 12vh;
    transform: rotate(-0.6deg);
}

/* ============================================================
   Stratum 3 — The Wizard Dialog
   ============================================================ */
#wizard {
    position: fixed;
    top: 40dvh;
    left: 50%;
    transform: translate(-50%, -40%);
    width: 720px;
    height: 440px;
    max-width: 92vw;
    z-index: 5;
    background: var(--chrome-mid);
    border-top: 2px solid var(--chrome-hi);
    border-left: 2px solid var(--chrome-hi);
    border-right: 2px solid var(--moss-iron);
    border-bottom: 2px solid var(--moss-iron);
    box-shadow:
        4px 4px 0 0 var(--moss-iron),
        8px 8px 24px 0 rgba(10, 13, 18, 0.7),
        inset 1px 1px 0 0 var(--chrome-hi),
        inset -1px -1px 0 0 var(--moss-iron);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#wizard.carnelian-mode .wizard-titlebar {
    background: linear-gradient(180deg,
        var(--chrome-hi) 0%,
        #b08070 30%,
        var(--carnelian) 100%);
}

/* Titlebar */
.wizard-titlebar {
    height: 28px;
    flex-shrink: 0;
    background: linear-gradient(180deg,
        var(--chrome-hi) 0%,
        var(--chrome-mid) 50%,
        var(--moss-iron) 100%);
    display: flex;
    align-items: center;
    padding: 0 8px;
    gap: 8px;
    border-bottom: 1px solid var(--moss-iron);
    box-shadow: inset 0 1px 0 0 rgba(232, 236, 239, 0.8);
}

.wizard-icon {
    width: 14px;
    height: 14px;
    display: inline-block;
}
.wizard-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.wizard-title {
    font-family: "Orbitron", sans-serif;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--void);
    text-transform: uppercase;
    flex: 1;
    text-shadow: 0 1px 0 rgba(232, 236, 239, 0.6);
}

.wizard-window-buttons {
    display: flex;
    gap: 2px;
    margin-left: auto;
}

.winbtn {
    width: 18px;
    height: 16px;
    background: var(--chrome-mid);
    border-top: 1px solid var(--chrome-hi);
    border-left: 1px solid var(--chrome-hi);
    border-right: 1px solid var(--moss-iron);
    border-bottom: 1px solid var(--moss-iron);
    color: var(--void);
    font-size: 10px;
    font-family: "Orbitron", sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Body */
.wizard-body {
    flex: 1;
    display: flex;
    background: var(--chrome-mid);
    border-top: 1px solid var(--chrome-hi);
    overflow: hidden;
}

/* Sidebar (taskbar-like vertical strip) */
.wizard-sidebar {
    width: 110px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #2a2e36 0%, var(--slate-cool) 50%, #14171c 100%);
    border-right: 1px solid var(--moss-iron);
    box-shadow: inset -1px 0 0 0 rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 8px;
    gap: 14px;
}

.sidebar-orb {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%, var(--chrome-hi) 0%, var(--chrome-mid) 30%, var(--moss-iron) 65%, var(--void) 100%);
    box-shadow:
        0 0 0 2px var(--moss-iron),
        0 4px 8px rgba(0,0,0,0.6),
        inset 2px 2px 0 0 rgba(232,236,239,0.4);
}

.sidebar-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.sidebar-bars span {
    display: block;
    height: 4px;
    background: linear-gradient(90deg, var(--brass) 0%, var(--brass) var(--bw, 60%), transparent var(--bw, 60%));
    border-top: 1px solid rgba(232,236,239,0.3);
    border-bottom: 1px solid rgba(0,0,0,0.4);
}
.sidebar-bars span:nth-child(1) { --bw: 78%; }
.sidebar-bars span:nth-child(2) { --bw: 42%; }
.sidebar-bars span:nth-child(3) { --bw: 89%; }
.sidebar-bars span:nth-child(4) { --bw: 31%; }
.sidebar-bars span:nth-child(5) { --bw: 67%; }

.sidebar-stamp {
    font-family: "Orbitron", sans-serif;
    font-weight: 500;
    font-size: 10px;
    letter-spacing: 0.06em;
    color: var(--brass);
    text-transform: uppercase;
}

.sidebar-carnelian {
    width: 1px;
    height: 1px;
    background: var(--carnelian);
    box-shadow: 0 0 0 1px rgba(122, 31, 28, 0.3);
    align-self: flex-start;
    margin-top: auto;
    cursor: crosshair;
}

/* Content */
.wizard-content {
    flex: 1;
    padding: 18px 22px;
    background:
        linear-gradient(180deg, rgba(232,236,239,0.6) 0%, var(--chrome-mid) 8%, var(--chrome-mid) 92%, rgba(90,85,80,0.4) 100%);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.step-heading {
    font-family: "Orbitron", sans-serif;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 0.06em;
    color: var(--void);
    text-transform: uppercase;
    text-shadow: 1px 1px 0 var(--chrome-hi);
    border-bottom: 1px solid var(--moss-iron);
    padding-bottom: 8px;
}

.step-stage {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.step {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-out;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.step.active {
    opacity: 1;
    pointer-events: auto;
}

/* Step 1 — loading bar */
.step-instruction {
    font-family: "VT323", monospace;
    font-size: 16px;
    line-height: 1.5;
    color: var(--phosphor);
    background: var(--void);
    padding: 10px 12px;
    border-top: 1px solid var(--moss-iron);
    border-left: 1px solid var(--moss-iron);
    border-right: 1px solid var(--chrome-hi);
    border-bottom: 1px solid var(--chrome-hi);
    text-shadow: 0 0 0.5px var(--phosphor);
    min-height: 60px;
}

.loadbar-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.loadbar-track {
    flex: 1;
    height: 18px;
    background: var(--void);
    border-top: 1px solid var(--moss-iron);
    border-left: 1px solid var(--moss-iron);
    border-right: 1px solid var(--chrome-hi);
    border-bottom: 1px solid var(--chrome-hi);
    overflow: hidden;
    position: relative;
}

.loadbar-fill {
    height: 100%;
    width: 0%;
    background:
        repeating-linear-gradient(90deg,
            var(--brass) 0px,
            var(--brass) 8px,
            var(--moss-iron) 8px,
            var(--moss-iron) 10px);
    box-shadow: inset 0 1px 0 0 rgba(232,236,239,0.3);
    transition: width 0.12s linear;
}

.loadbar-pct {
    font-family: "VT323", monospace;
    font-size: 16px;
    color: var(--phosphor);
    min-width: 48px;
    text-align: right;
}

.step-status {
    font-family: "VT323", monospace;
    font-size: 16px;
    color: var(--phosphor);
    text-shadow: 0 0 0.5px var(--phosphor);
}

/* Step 2 — typewriter stream */
.terminal-stream {
    font-family: "VT323", monospace;
    font-size: 16px;
    line-height: 1.5;
    color: var(--phosphor);
    background: var(--void);
    padding: 12px 14px;
    border-top: 1px solid var(--moss-iron);
    border-left: 1px solid var(--moss-iron);
    border-right: 1px solid var(--chrome-hi);
    border-bottom: 1px solid var(--chrome-hi);
    text-shadow: 0 0 0.5px var(--phosphor);
    flex: 1;
    overflow: hidden;
    white-space: pre-wrap;
    word-break: break-word;
}

.terminal-stream::after {
    content: "_";
    animation: caret 1s step-end infinite;
}

@keyframes caret {
    50% { opacity: 0; }
}

/* Step 3 — prophecy couplet */
.step-3 {
    justify-content: center;
    align-items: center;
}

.prophecy-line {
    font-family: "Cinzel", serif;
    font-weight: 600;
    font-size: 22px;
    line-height: 1.15;
    letter-spacing: 0.04em;
    color: var(--bone);
    text-align: center;
    text-shadow: 1px 1px 0 var(--moss-iron), -1px -1px 0 var(--bone);
    opacity: 0;
    transition: opacity 1.4s ease-out;
}

.prophecy-line.shown { opacity: 1; }

/* Step 4 — selection */
.select-prompt {
    font-family: "Orbitron", sans-serif;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 0.06em;
    color: var(--void);
    text-transform: uppercase;
    text-shadow: 1px 1px 0 var(--chrome-hi);
}

.select-hint {
    font-family: "VT323", monospace;
    font-size: 16px;
    color: var(--phosphor);
    background: var(--void);
    padding: 8px 10px;
    border-top: 1px solid var(--moss-iron);
    border-left: 1px solid var(--moss-iron);
    border-right: 1px solid var(--chrome-hi);
    border-bottom: 1px solid var(--chrome-hi);
    text-shadow: 0 0 0.5px var(--phosphor);
}

.reading {
    flex: 1;
    overflow-y: auto;
    background: var(--void);
    padding: 12px 14px;
    border-top: 1px solid var(--moss-iron);
    border-left: 1px solid var(--moss-iron);
    border-right: 1px solid var(--chrome-hi);
    border-bottom: 1px solid var(--chrome-hi);
}

.reading-title {
    font-family: "Cinzel", serif;
    font-weight: 600;
    font-size: 22px;
    letter-spacing: 0.04em;
    color: var(--bone);
    text-shadow: 1px 1px 0 var(--moss-iron), -1px -1px 0 var(--bone);
    margin-bottom: 6px;
}

.reading-inscription {
    font-family: "Cinzel", serif;
    font-weight: 600;
    font-size: 16px;
    color: var(--brass);
    margin-bottom: 12px;
    letter-spacing: 0.04em;
}

.reading-body p {
    font-family: "VT323", monospace;
    font-size: 16px;
    line-height: 1.5;
    color: var(--phosphor);
    text-shadow: 0 0 0.5px var(--phosphor);
    margin-bottom: 10px;
}

.reading::-webkit-scrollbar { width: 10px; }
.reading::-webkit-scrollbar-track { background: var(--slate-cool); }
.reading::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--chrome-hi), var(--chrome-mid), var(--moss-iron));
    border: 1px solid var(--moss-iron);
}

/* Footer */
.wizard-footer {
    flex-shrink: 0;
    height: 44px;
    background: var(--chrome-mid);
    border-top: 1px solid var(--chrome-hi);
    box-shadow: inset 0 1px 0 0 var(--chrome-hi);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 10px;
}

.acoustics-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: crosshair;
}

.acoustics-toggle input {
    width: 12px;
    height: 12px;
    accent-color: var(--brass);
    cursor: crosshair;
}

.acoustics-label {
    font-family: "VT323", monospace;
    font-size: 16px;
    color: var(--void);
    letter-spacing: 0.04em;
}

.wizard-buttons {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.wbtn {
    font-family: "Orbitron", sans-serif;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--void);
    background: var(--chrome-mid);
    border-top: 1px solid var(--chrome-hi);
    border-left: 1px solid var(--chrome-hi);
    border-right: 1px solid var(--moss-iron);
    border-bottom: 1px solid var(--moss-iron);
    padding: 4px 12px;
    cursor: crosshair;
    box-shadow: 1px 1px 0 0 rgba(0,0,0,0.3);
}

.wbtn:active {
    border-top: 1px solid var(--moss-iron);
    border-left: 1px solid var(--moss-iron);
    border-right: 1px solid var(--chrome-hi);
    border-bottom: 1px solid var(--chrome-hi);
    box-shadow: none;
    transform: translate(1px, 1px);
}

.wbtn-primary {
    color: var(--brass);
    text-shadow: 0 1px 0 rgba(232,236,239,0.6);
}

.wbtn-primary::before {
    content: "\25B6 ";
    color: var(--brass);
}

/* ============================================================
   Stratum 4 — Floating mineral specimens
   ============================================================ */
#stones {
    position: fixed;
    inset: 0;
    z-index: 4;
    pointer-events: none;
}

.stone {
    position: absolute;
    width: 140px;
    height: 140px;
    left: var(--sx);
    top: var(--sy);
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    transition: transform 0.18s ease-out, filter 0.3s ease;
    will-change: transform;
    filter: drop-shadow(0 8px 18px rgba(28, 32, 40, 0.7));
    --tx: 0deg;
    --ty: 0deg;
    --px: 0px;
    --py: 0px;
}

.stone.appeared {
    opacity: 1;
    animation: stoneFadeIn 0.8s ease-out forwards;
}

.stone .stone-sigil {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: "Orbitron", sans-serif;
    font-weight: 800;
    font-size: 38px;
    color: var(--void);
    text-shadow:
        1px 1px 0 var(--chrome-hi),
        -1px -1px 0 var(--moss-iron);
    pointer-events: none;
}

.stone .stone-label {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-family: "Orbitron", sans-serif;
    font-weight: 500;
    font-size: 10px;
    letter-spacing: 0.06em;
    color: var(--brass);
    white-space: nowrap;
    text-shadow: 0 1px 2px var(--void);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.stone.selectable {
    pointer-events: auto;
    cursor: crosshair;
}

.stone.selectable:hover .stone-label {
    opacity: 1;
}

.stone.selectable:hover {
    filter: drop-shadow(0 0 12px var(--brass)) drop-shadow(0 8px 18px rgba(28, 32, 40, 0.7));
}

.stone[data-stone="varri"].carnelian-tinted .stone-sigil {
    color: var(--carnelian);
    text-shadow:
        1px 1px 0 var(--chrome-hi),
        -1px -1px 0 var(--carnelian);
}

@keyframes stoneFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, calc(-50% + 12px));
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* ============================================================
   Stratum 5 — Lens flare layer
   ============================================================ */
#lensFlare {
    position: fixed;
    inset: 0;
    z-index: 6;
    pointer-events: none;
    overflow: hidden;
}

#lensFlare::before,
#lensFlare::after {
    content: "";
    position: absolute;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(232, 236, 239, 0.55) 0%,
        rgba(232, 236, 239, 0.25) 25%,
        rgba(232, 236, 239, 0.08) 55%,
        transparent 70%);
    filter: blur(8px);
    mix-blend-mode: screen;
    animation: lensFlareTraverse 38s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
    top: -240px;
    left: -240px;
}

#lensFlare::after {
    width: 220px;
    height: 220px;
    background: radial-gradient(circle,
        rgba(212, 160, 74, 0.28) 0%,
        rgba(212, 160, 74, 0.1) 40%,
        transparent 70%);
    animation-delay: -2.5s;
    top: -110px;
    left: -110px;
}

@keyframes lensFlareTraverse {
    0% {
        transform: translate(-10vw, 100vh);
    }
    25% {
        transform: translate(35vw, 65vh);
    }
    50% {
        transform: translate(75vw, 32vh);
    }
    75% {
        transform: translate(105vw, 8vh);
    }
    100% {
        transform: translate(-10vw, 100vh);
    }
}

/* ============================================================
   Stratum 6 — Cursor trail
   ============================================================ */
#cursorTrail {
    position: fixed;
    inset: 0;
    z-index: 7;
    pointer-events: none;
    width: 100vw;
    height: 100vh;
}

/* ============================================================
   Petroglyph tooltip
   ============================================================ */
#glyphTooltip {
    position: fixed;
    z-index: 8;
    background: var(--void);
    border-top: 1px solid var(--chrome-hi);
    border-left: 1px solid var(--chrome-hi);
    border-right: 1px solid var(--moss-iron);
    border-bottom: 1px solid var(--moss-iron);
    padding: 10px 14px;
    pointer-events: none;
    max-width: 320px;
    box-shadow: 4px 4px 0 0 rgba(0,0,0,0.6);
}

#glyphTooltip[hidden] { display: none; }

.glyph-name {
    display: block;
    font-family: "Cinzel", serif;
    font-weight: 600;
    font-size: 22px;
    letter-spacing: 0.04em;
    color: var(--bone);
    text-shadow: 1px 1px 0 var(--moss-iron), -1px -1px 0 var(--bone);
    margin-bottom: 8px;
}

.glyph-couplet {
    font-family: "VT323", monospace;
    font-size: 16px;
    line-height: 1.5;
    color: var(--phosphor);
    text-shadow: 0 0 0.5px var(--phosphor);
    white-space: pre-line;
}

/* ============================================================
   Mobile
   ============================================================ */
@media (max-width: 720px) {
    #wizard {
        width: 92vw;
        height: 76dvh;
        top: 50dvh;
        transform: translate(-50%, -50%);
    }

    .wizard-sidebar {
        width: 70px;
        padding: 8px 4px;
    }

    .sidebar-orb {
        width: 38px;
        height: 38px;
    }

    .step-heading {
        font-size: 14px;
    }

    .frame-a, .frame-b, .frame-c {
        display: none;
    }

    #stones {
        position: relative;
        top: auto;
        left: auto;
        height: auto;
        z-index: 3;
    }

    .stone {
        position: absolute;
    }

    .wbtn {
        padding: 4px 8px;
        font-size: 10px;
    }
}
