/* ============================================================
   ΠΥΘΙΑ — design tokens
   Χρώμα:  #0A0810 (άβυσσος)  #160F22 (ναός)  #241A38 (πέτρα)
           #C9A227 (παλαιό χρυσάφι)  #EFD98E (φλόγα χρυσού)
           #6E1423 (κρασόχρωμο)  #EDE6D6 (μάρμαρο)  #8B7F94 (καπνός)
   Τυπογραφία: Cinzel (χαραγμένος τίτλος) / Cormorant Garamond (σώμα)
   Η πύλη και η Πυθία ζωντανεύουν σε πραγματικό 3D (Three.js, #scene3d).
   Το CSS εδώ χειρίζεται μόνο το επίπεδο κειμένου/UI από πάνω.
   ============================================================ */

@import url('fonts/fonts.css');
:root {
    --void: #0a0810;
    --temple: #150e20;
    --stone: #241a38;
    --stone-light: #34274d;
    --gold: #c9a227;
    --gold-bright: #efd98e;
    --wine: #6e1423;
    --marble: #ede6d6;
    --smoke: #9187a0;
    --shadow: rgba(0, 0, 0, .6);
    --serif-display: 'Cinzel', serif;
    --serif-display-deco: 'Cinzel Decorative', serif;
    --serif-body: 'Cormorant Garamond', serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--void);
    color: var(--marble);
    font-family: var(--serif-body);
    overflow-x: hidden;
    position: relative;
}


/* ---- 3D scene canvas: fixed full-viewport background ---- */

#scene3d {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 0;
    background: var(--void);
    opacity: 0;
    transition: opacity .4s ease;
}

body.scene-visible #scene3d {
    opacity: 1;
}


/* permanent twinkling starfield — always visible, independent of the 3D scene */

#starfield {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.star {
    position: absolute;
    border-radius: 50%;
    background: var(--gold-bright);
    box-shadow: 0 0 4px 1px rgba(239, 217, 142, .5);
    animation: twinkle ease-in-out infinite;
}

@keyframes twinkle {
    0%,
    100% {
        opacity: .12;
    }
    50% {
        opacity: .85;
    }
}


/* gentle vignette so text stays readable no matter what's happening in the 3D scene */

#vignette {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(ellipse at 50% 40%, rgba(10, 8, 16, .18) 0%, rgba(10, 8, 16, .55) 60%, rgba(10, 8, 16, .88) 100%);
}

a,
button {
    font-family: inherit;
}

button {
    cursor: pointer;
}

h1,
h2,
h3 {
    margin: 0;
    font-family: var(--serif-display);
    letter-spacing: .04em;
}

.screen {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 6vh 5vw;
    text-align: center;
    pointer-events: none;
}

.screen>* {
    pointer-events: auto;
}

.screen[hidden] {
    display: none !important;
}


/* the gate is a single splash screen — lock it to exactly one viewport,
   never scrollable, so it can't drift relative to the fixed 3D background */

#gate {
    height: 100vh;
    overflow: hidden;
}

#gate:not([hidden])~footer.credit {
    display: none;
}


/* ---------------- SCREEN 1 — GATE : modern glass welcome card (2D, no 3D) ---------------- */

.gate-card {
    position: relative;
    width: min(460px, 88vw);
    padding: 3rem 2.2rem 2.6rem;
    background: linear-gradient(165deg, #2c2044 0%, #120d1c 100%);
    border: 1px solid rgba(201, 162, 39, .35);
    border-radius: 22px;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .03) inset, 0 0 90px rgba(201, 162, 39, .16);
    animation: cardIn .9s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(26px) scale(.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.gate-emblem {
    width: 52px;
    height: 52px;
    margin: 0 auto 1.1rem;
    color: var(--gold);
    filter: drop-shadow(0 0 10px rgba(201, 162, 39, .5));
}

.gate-emblem svg {
    width: 100%;
    height: 100%;
}

.gate-eyebrow {
    font-family: var(--serif-display);
    font-size: .68rem;
    letter-spacing: .35em;
    text-transform: uppercase;
    color: var(--smoke);
    margin: 0 0 .8rem;
}

.gate-title {
    font-family: var(--serif-display-deco);
    font-size: clamp(2.6rem, 9vw, 3.8rem);
    font-weight: 900;
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: .09em;
    line-height: 1;
    margin-bottom: .4rem;
}

.gate-subtitle {
    font-family: var(--serif-display);
    font-size: .72rem;
    letter-spacing: .4em;
    text-transform: uppercase;
    color: var(--smoke);
    margin-bottom: 1.5rem;
}

.gate-desc {
    font-size: 1.02rem;
    line-height: 1.6;
    color: var(--marble);
    opacity: .82;
    max-width: 32ch;
    margin: 0 auto 2.1rem;
}

.enter-btn {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    font-family: var(--serif-display);
    font-size: .9rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--void);
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    border: none;
    padding: 1em 2em;
    border-radius: 999px;
    box-shadow: 0 10px 30px rgba(201, 162, 39, .35);
    transition: transform .25s ease, box-shadow .25s ease, gap .25s ease;
}

.enter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(201, 162, 39, .5);
    gap: .95rem;
}

.enter-btn:active {
    transform: translateY(0);
}

.enter-btn:focus-visible {
    outline: 3px solid var(--gold-bright);
    outline-offset: 4px;
}

.enter-arrow {
    width: 16px;
    height: 16px;
    flex: none;
}

#gate.opening .gate-card {
    animation: fadeAway .5s ease forwards;
}

@keyframes fadeAway {
    to {
        opacity: 0;
        transform: translateY(-10px) scale(.98);
    }
}


/* ---------------- SCREEN 2 — SANCTUM (Pythia herself renders in 3D behind) ---------------- */

#sanctum {
    padding-top: 4vh;
    padding-bottom: 8vh;
}

.sanctum-header {
    margin-bottom: 1.6rem;
    max-width: 600px;
    width: 100%;
    background: linear-gradient(165deg, #241a38 0%, #120d1c 100%);
    padding: 2.3rem 2.2rem 2.1rem;
    border-radius: 20px;
    border: 1px solid rgba(201, 162, 39, .3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5), 0 0 60px rgba(201, 162, 39, .08);
}

.sanctum-emblem {
    width: 38px;
    height: 38px;
    margin: 0 auto .9rem;
    color: var(--gold);
    filter: drop-shadow(0 0 8px rgba(201, 162, 39, .5));
}

.sanctum-emblem svg {
    width: 100%;
    height: 100%;
}

.sanctum-divider {
    display: block;
    width: 64px;
    height: 1px;
    margin: 1rem auto;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    opacity: .75;
}

.pythia-title {
    font-family: var(--serif-display-deco);
    font-size: clamp(1.9rem, 5vw, 2.6rem);
    color: var(--gold);
    letter-spacing: .06em;
}

.pythia-tagline {
    font-style: italic;
    color: var(--smoke);
    font-size: clamp(1rem, 2vw, 1.2rem);
    max-width: 40ch;
    margin: 0 auto;
    line-height: 1.55;
}

.shuffle-btn {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    font-family: var(--serif-display);
    letter-spacing: .2em;
    text-transform: uppercase;
    font-size: .82rem;
    color: var(--gold-bright);
    background: linear-gradient(180deg, rgba(201, 162, 39, .22), rgba(201, 162, 39, .1)), #1a1329;
    border: 1.5px solid var(--gold);
    border-radius: 999px;
    padding: .85em 1.9em;
    margin: 1.6rem 0 2.2rem;
    box-shadow: 0 10px 26px rgba(0, 0, 0, .45);
    transition: all .25s ease;
}

.shuffle-icon {
    width: 15px;
    height: 15px;
    flex: none;
}

.shuffle-btn:hover {
    background: linear-gradient(180deg, rgba(201, 162, 39, .38), rgba(201, 162, 39, .18)), #1a1329;
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, .5);
}

.shuffle-btn:active {
    transform: translateY(0);
}

.shuffle-btn:focus-visible {
    outline: 3px solid var(--gold-bright);
    outline-offset: 3px;
}

.shuffle-btn[disabled] {
    opacity: .4;
    cursor: default;
    transform: none;
}

.instruction {
    color: var(--marble);
    font-size: 1.05rem;
    margin-bottom: 1.4rem;
    min-height: 1.6em;
    text-shadow: 0 2px 10px #000000b0;
}

.instruction strong {
    color: var(--gold-bright);
    font-weight: 600;
}


/* ---- fanned deck (with 3D tilt-on-hover, driven from JS) ---- */

.deck-wrap {
    position: relative;
    width: 100%;
    max-width: 900px;
    height: 190px;
    margin-bottom: 2.2rem;
}

.deck {
    position: absolute;
    left: 50%;
    top: 0;
    width: 100%;
    height: 100%;
    transform: translateX(-50%);
}

.deck-card {
    position: absolute;
    left: 50%;
    top: 0;
    width: 78px;
    height: 120px;
    margin-left: -39px;
    border-radius: 8px;
    background: repeating-linear-gradient(45deg, #2a1d40, #2a1d40 4px, #241a38 4px, #241a38 8px);
    border: 1.5px solid var(--gold);
    box-shadow: 0 8px 18px var(--shadow);
    cursor: pointer;
    transform-origin: bottom center;
    transition: transform .12s ease-out, box-shadow .25s ease, filter .3s ease;
    will-change: transform;
    display: flex;
    align-items: center;
    justify-content: center;
}

.deck-card::after {
    content: '';
    position: absolute;
    inset: 6px;
    border: 1px solid rgba(201, 162, 39, .55);
    border-radius: 5px;
}

.deck-card .deck-emblem {
    width: 26px;
    height: 26px;
    opacity: .8;
}

.deck-card:hover:not(.picked):not(.disabled) {
    box-shadow: 0 20px 34px var(--shadow);
    z-index: 5;
}

.deck-card:focus-visible {
    outline: 3px solid var(--gold-bright);
    outline-offset: 2px;
}

.deck-card.picked {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-40px) scale(.7) !important;
}

.deck-card.disabled {
    cursor: default;
    filter: saturate(.5) brightness(.7);
}


/* ---- reading slots ---- */

.reading-table {
    display: flex;
    gap: clamp(1rem, 3vw, 3rem);
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
    margin-bottom: 2.2rem;
}

.slot {
    width: 190px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.slot-label {
    font-family: var(--serif-display);
    letter-spacing: .25em;
    text-transform: uppercase;
    font-size: .72rem;
    color: var(--marble);
    margin-bottom: .15rem;
    text-shadow: 0 2px 8px #000000b0;
}

.slot-sub {
    font-style: italic;
    color: #b7abc7;
    font-size: .8rem;
    margin-bottom: .7rem;
    text-shadow: 0 2px 8px #000000b0;
}

.card-slot {
    width: 148px;
    height: 226px;
    perspective: 1000px;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform .8s cubic-bezier(.2, .7, .3, 1.05);
    border-radius: 10px;
}

.card-slot.empty .card-inner {
    border: 1.5px dashed rgba(201, 162, 39, .45);
    border-radius: 10px;
    background: rgba(10, 8, 16, .25);
}

.card-slot.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: .8rem .6rem;
    box-shadow: 0 10px 26px var(--shadow);
}

.card-back-face {
    background: repeating-linear-gradient(45deg, #2a1d40, #2a1d40 4px, #241a38 4px, #241a38 8px);
    border: 1.5px solid var(--gold);
}

.card-back-face::after {
    content: '';
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(201, 162, 39, .55);
    border-radius: 6px;
}

.card-front-face {
    background: linear-gradient(160deg, #2d2145 0%, #1a1329 100%);
    border: 1.5px solid var(--gold);
    transform: rotateY(180deg);
    text-align: center;
}

.card-front-face.reversed .card-emblem-wrap {
    transform: rotate(180deg);
}

.card-emblem-wrap {
    width: 46px;
    height: 46px;
    margin-bottom: .4rem;
}

.card-emblem-wrap svg {
    width: 100%;
    height: 100%;
}

.card-name {
    font-family: var(--serif-display);
    font-size: .95rem;
    color: var(--gold-bright);
    line-height: 1.15;
}

.card-epithet {
    font-style: italic;
    font-size: .72rem;
    color: var(--smoke);
    margin-top: .15rem;
}

.card-orient {
    margin-top: .5rem;
    font-size: .65rem;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: var(--wine);
    background: rgba(110, 20, 35, .18);
    border: 1px solid rgba(110, 20, 35, .5);
    padding: .15em .6em;
    border-radius: 3px;
}

.card-front-face:not(.reversed) .card-orient {
    color: var(--gold-bright);
    background: rgba(201, 162, 39, .12);
    border-color: rgba(201, 162, 39, .5);
}

.slot-meaning {
    margin-top: .8rem;
    font-size: .92rem;
    line-height: 1.35;
    color: var(--marble);
    max-width: 190px;
    opacity: 0;
    transition: opacity .5s ease .3s;
    background: rgba(10, 8, 16, .5);
    padding: .6rem .7rem;
    border-radius: 6px;
}

.slot-meaning .kw {
    display: block;
    color: var(--gold-bright);
    font-weight: 600;
    margin-bottom: .3rem;
    font-size: .85rem;
}

.card-slot.flipped+.slot-meaning,
.slot.revealed .slot-meaning {
    opacity: 1;
}


/* ---- prophecy panel ---- */

.prophecy {
    max-width: 640px;
    width: 100%;
    background: linear-gradient(160deg, #2c2245 0%, #150e20 100%);
    border: 1px solid rgba(201, 162, 39, .4);
    box-shadow: 0 20px 50px var(--shadow), inset 0 0 40px rgba(201, 162, 39, .05);
    padding: 2.2rem clamp(1.2rem, 4vw, 2.6rem);
    border-radius: 4px;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .7s ease, transform .7s ease;
    margin-top: 1rem;
}

.prophecy.show {
    opacity: 1;
    transform: translateY(0);
}

.prophecy-title {
    font-family: var(--serif-display);
    letter-spacing: .2em;
    text-transform: uppercase;
    font-size: .85rem;
    color: var(--gold);
    margin-bottom: 1rem;
}

.prophecy-text {
    font-size: 1.18rem;
    line-height: 1.65;
    font-style: italic;
    color: var(--marble);
}

.prophecy-text b {
    color: var(--gold-bright);
    font-style: normal;
}

.prophecy-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .9rem;
    justify-content: center;
    margin-top: 2rem;
}

.restart-btn,
.download-btn {
    font-family: var(--serif-display);
    letter-spacing: .18em;
    text-transform: uppercase;
    font-size: .78rem;
    border: none;
    padding: .9em 1.8em;
    transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
}

.restart-btn {
    color: var(--void);
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    box-shadow: 0 8px 22px rgba(201, 162, 39, .25);
}

.restart-btn:hover {
    transform: translateY(-2px);
}

.download-btn {
    color: var(--gold-bright);
    background: transparent;
    border: 1px solid var(--gold);
}

.download-btn:hover {
    background: rgba(201, 162, 39, .15);
    transform: translateY(-2px);
}

.download-btn:disabled {
    opacity: .55;
    cursor: default;
    transform: none;
}

.restart-btn:focus-visible,
.download-btn:focus-visible {
    outline: 3px solid var(--gold-bright);
    outline-offset: 3px;
}

footer.credit {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2rem 1rem 3rem;
    color: #8f849c;
    font-size: .78rem;
    letter-spacing: .08em;
    text-shadow: 0 2px 8px #000000b0;
}


/* ============================================================
   Offscreen high-resolution "share card" — captured via html2canvas
   and exported as a JPG. Kept out of the visible viewport but still
   laid out (not display:none) so it renders correctly for capture.
   ============================================================ */

.share-card {
    position: fixed;
    top: 0;
    left: -99999px;
    width: 960px;
    padding: 64px 72px 72px;
    background: linear-gradient(160deg, #2a1d40 0%, #150e20 100%);
    border: 3px solid var(--gold);
    font-family: var(--serif-body);
    color: var(--marble);
    text-align: center;
}

.share-eyebrow {
    font-family: var(--serif-display);
    letter-spacing: .45em;
    font-size: 16px;
    color: var(--gold);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.share-title {
    font-family: var(--serif-display-deco);
    font-size: 58px;
    color: var(--gold-bright);
    letter-spacing: .06em;
    margin-bottom: 8px;
}

.share-date {
    font-size: 16px;
    color: var(--smoke);
    font-style: italic;
    margin-bottom: 40px;
}

.share-cards {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 44px;
    flex-wrap: wrap;
}

.share-mini-card {
    width: 220px;
    padding: 18px 10px;
    border: 1px solid rgba(201, 162, 39, .5);
    background: rgba(0, 0, 0, .15);
}

.share-mini-pos {
    font-family: var(--serif-display);
    letter-spacing: .2em;
    text-transform: uppercase;
    font-size: 14px;
    color: var(--smoke);
    margin-bottom: 8px;
}

.share-mini-name {
    font-family: var(--serif-display);
    font-size: 21px;
    color: var(--gold-bright);
    line-height: 1.25;
}

.share-mini-orient {
    font-size: 14px;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: var(--wine-bright, #c98a97);
    margin-top: 8px;
}

.share-text {
    font-size: 25px;
    line-height: 1.75;
    font-style: italic;
    color: var(--marble);
    text-align: left;
}

.share-text b {
    color: var(--gold-bright);
    font-style: normal;
}

.share-footer {
    margin-top: 48px;
    font-size: 15px;
    letter-spacing: .2em;
    color: var(--smoke);
    text-transform: uppercase;
}


/* reduced motion */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: .001s !important;
        animation-iteration-count: 1 !important;
        transition-duration: .1s !important;
    }
}

@media (max-width: 560px) {
    .deck-card {
        width: 56px;
        height: 86px;
        margin-left: -28px;
    }
    .card-slot {
        width: 118px;
        height: 178px;
    }
    .slot {
        width: 130px;
    }
}
