/* ==========================================================================
   FATECORE — Pixel YES/NO Game Stylesheet
   Retro Pixel Palette:
   Deep Navy:    #0B1026
   Dark Purple:  #1A0B35
   Neon Purple:  #9B5DE5
   Electric Cyan:#00E5FF
   Hot Pink:     #FF4D8D
   Magic Yellow: #FFD166
   Cream:        #FFF4D6
   ========================================================================== */

:root {
    --bg-navy: #0B1026;
    --bg-purple: #1A0B35;
    --neon-purple: #9B5DE5;
    --electric-cyan: #00E5FF;
    --hot-pink: #FF4D8D;
    --magic-yellow: #FFD166;
    --cream: #FFF4D6;
    --dark-orb: #0E0720;
    --orb-border: #3D1E6D;
    
    --font-heading: 'Press Start 2P', monospace, cursive;
    --font-pixel: 'VT323', monospace;
}

/* Reset & Box Sizing */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    background-color: var(--bg-navy);
    background-image: 
        radial-gradient(circle at 50% 30%, var(--bg-purple) 0%, var(--bg-navy) 85%);
    color: var(--cream);
    font-family: var(--font-pixel);
    font-size: 20px;
    line-height: 1.4;
}

/* Accessibility Utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Canvas Background */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* CRT Scanline Overlay */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.25) 50%
    );
    background-size: 100% 4px;
    opacity: 0.6;
}

/* Main Container Layout */
.game-container {
    position: relative;
    z-index: 10;
    max-width: 720px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 20px 16px 40px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

/* Top Header Bar */
.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

/* Question Counter Pill */
.counter-badge {
    font-family: var(--font-heading);
    font-size: 9px;
    background-color: var(--bg-purple);
    color: var(--cream);
    border: 2px solid var(--neon-purple);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 0 8px rgba(155, 93, 229, 0.3);
}

.counter-num {
    color: var(--electric-cyan);
    font-size: 11px;
    text-shadow: 0 0 5px var(--electric-cyan);
}

/* Title Section */
.title-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 5px;
}

.pixel-title {
    font-family: var(--font-heading);
    font-size: clamp(24px, 5vw, 38px);
    color: var(--magic-yellow);
    text-shadow: 
        3px 3px 0px var(--hot-pink),
        -3px -3px 0px var(--neon-purple),
        0 0 12px rgba(255, 209, 102, 0.6);
    letter-spacing: 2px;
    text-align: center;
}

.pixel-sparkle {
    font-size: 24px;
    color: var(--electric-cyan);
    animation: sparklePulse 1.5s infinite alternate ease-in-out;
}

.sparkle-right {
    animation-delay: 0.75s;
}

.pixel-subtitle {
    font-family: var(--font-heading);
    font-size: 11px;
    color: var(--electric-cyan);
    letter-spacing: 3px;
    margin-top: 6px;
    margin-bottom: 15px;
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.6);
}

/* Retro Pixel Buttons */
.pixel-btn {
    font-family: var(--font-heading);
    font-size: 12px;
    padding: 10px 16px;
    background-color: var(--bg-purple);
    color: var(--cream);
    border: none;
    cursor: pointer;
    position: relative;
    box-shadow: 
        inset -3px -3px 0px 0px #090314,
        inset 3px 3px 0px 0px var(--neon-purple),
        0px 4px 0px 0px #000000;
    transition: transform 0.1s ease, background-color 0.1s ease, box-shadow 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pixel-btn:hover:not(:disabled) {
    background-color: var(--neon-purple);
    color: #ffffff;
    box-shadow: 
        inset -3px -3px 0px 0px #1A0B35,
        inset 3px 3px 0px 0px #C78CFF,
        0px 4px 0px 0px #000000,
        0px 0px 10px var(--neon-purple);
}

.pixel-btn:active:not(:disabled) {
    transform: translateY(3px);
    box-shadow: 
        inset -2px -2px 0px 0px #090314,
        inset 2px 2px 0px 0px var(--neon-purple),
        0px 1px 0px 0px #000000;
}

.pixel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.5);
    box-shadow: inset -3px -3px 0px 0px #090314, inset 3px 3px 0px 0px #444;
}

.icon-btn {
    font-size: 10px;
    padding: 8px 12px;
}

.primary-btn {
    background-color: var(--neon-purple);
    color: var(--cream);
    font-size: 14px;
    padding: 14px 24px;
    box-shadow: 
        inset -4px -4px 0px 0px #582496,
        inset 4px 4px 0px 0px #D8A5FF,
        0px 5px 0px 0px #000000;
}

.primary-btn:hover:not(:disabled) {
    background-color: var(--hot-pink);
    color: #ffffff;
    box-shadow: 
        inset -4px -4px 0px 0px #9E1F4C,
        inset 4px 4px 0px 0px #FFA8C9,
        0px 5px 0px 0px #000000,
        0px 0px 15px var(--hot-pink);
}

.secondary-btn {
    background-color: var(--electric-cyan);
    color: var(--bg-navy);
    font-size: 14px;
    padding: 14px 24px;
    box-shadow: 
        inset -4px -4px 0px 0px #009BB0,
        inset 4px 4px 0px 0px #9EFAFF,
        0px 5px 0px 0px #000000;
}

.secondary-btn:hover:not(:disabled) {
    background-color: var(--magic-yellow);
    color: var(--bg-navy);
    box-shadow: 
        inset -4px -4px 0px 0px #B88E1B,
        inset 4px 4px 0px 0px #FFF3AA,
        0px 5px 0px 0px #000000,
        0px 0px 15px var(--magic-yellow);
}

.mini-btn {
    font-size: 9px;
    padding: 6px 10px;
}

.danger-btn {
    background-color: var(--hot-pink);
}

/* Main Orb Stage */
.orb-stage {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0 20px 0;
}

/* Pixel Moon Decorative Feature */
.pixel-moon {
    position: absolute;
    top: -20px;
    right: 20px;
    width: 44px;
    height: 44px;
    pointer-events: none;
    opacity: 0.85;
}

.moon-shape {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    box-shadow: 7px 7px 0 0 var(--magic-yellow);
    filter: drop-shadow(0 0 6px rgba(255, 209, 102, 0.7));
}

/* Floating Orb Wrapper */
.orb-wrapper {
    position: relative;
    width: 280px;
    height: 280px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.floating {
    animation: orbFloat 4s ease-in-out infinite;
}

.shaking {
    animation: orbShake 0.1s infinite alternate !important;
}

/* Orb Outer Aura & Glow */
.orb-aura {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(155, 93, 229, 0.35) 0%, rgba(0, 229, 255, 0.2) 50%, rgba(0,0,0,0) 75%);
    animation: auraPulse 3s infinite alternate ease-in-out;
    pointer-events: none;
}

/* Pixel Art Orb Container */
.pixel-orb {
    position: relative;
    width: 260px;
    height: 260px;
    background-color: var(--dark-orb);
    border-radius: 50%;
    box-shadow: 
        inset 0 0 0 6px var(--orb-border),
        inset 0 0 0 12px #180933,
        inset -16px -16px 20px rgba(0, 0, 0, 0.9),
        inset 16px 16px 20px rgba(155, 93, 229, 0.3),
        0 16px 30px rgba(0, 0, 0, 0.8),
        0 0 25px rgba(155, 93, 229, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    border: 4px solid #4D268C;
}

/* Glass Reflection Highlight */
.orb-highlight {
    position: absolute;
    top: 24px;
    left: 45px;
    width: 60px;
    height: 30px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0) 70%);
    border-radius: 40px 40px 10px 10px;
    transform: rotate(-25deg);
    pointer-events: none;
}

.orb-inner-ring {
    position: absolute;
    width: 170px;
    height: 170px;
    border-radius: 50%;
    border: 2px dashed rgba(0, 229, 255, 0.25);
    pointer-events: none;
}

/* Orb Shadow on Stage */
.orb-shadow {
    position: absolute;
    bottom: -30px;
    width: 180px;
    height: 20px;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%;
    animation: shadowPulse 4s ease-in-out infinite;
}

/* Inner Display Window */
.orb-display {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background-color: #060212;
    border: 3px solid var(--neon-purple);
    box-shadow: 
        inset 0 0 15px rgba(0, 0, 0, 0.9),
        0 0 12px rgba(155, 93, 229, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    text-align: center;
    padding: 10px;
}

/* Idle Core Symbol "8" */
.core-symbol {
    display: flex;
    justify-content: center;
    align-items: center;
}

.symbol-digit {
    font-family: var(--font-heading);
    font-size: 58px;
    color: var(--cream);
    text-shadow: 
        0 0 8px var(--electric-cyan),
        0 0 16px var(--neon-purple),
        3px 3px 0px var(--bg-purple);
    animation: digitGlow 2.5s infinite alternate ease-in-out;
}

/* Reveal Window - YES/NO Display Container */
.answer-window {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: answerFadeIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.answer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.answer-label {
    font-family: var(--font-heading);
    font-size: 7px;
    color: var(--electric-cyan);
    letter-spacing: 1px;
    text-shadow: 0 0 4px var(--electric-cyan);
}

.answer-text {
    font-family: var(--font-heading);
    font-size: 34px;
    letter-spacing: 2px;
    line-height: 1;
}

/* YES Styling: Vibrant Cyan / Magic Yellow Glow */
.answer-text.yes-answer {
    color: var(--magic-yellow);
    text-shadow: 
        0 0 8px var(--electric-cyan),
        0 0 20px var(--magic-yellow),
        3px 3px 0px #000000;
}

/* NO Styling: Hot Pink Glow */
.answer-text.no-answer {
    color: var(--hot-pink);
    text-shadow: 
        0 0 8px var(--hot-pink),
        0 0 20px #9E1F4C,
        3px 3px 0px #000000;
}

/* Thinking State / Vortex */
.thinking-vortex {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.rune-ring {
    display: flex;
    gap: 6px;
    font-size: 14px;
    color: var(--electric-cyan);
    animation: runeSpin 1s infinite linear;
}

.thinking-text {
    font-family: var(--font-heading);
    font-size: 8px;
    color: var(--hot-pink);
    letter-spacing: 1px;
    animation: pulseText 0.6s infinite alternate;
}

/* Input Section */
.input-section {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.fate-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.input-wrapper {
    position: relative;
    width: 100%;
}

.pixel-input {
    width: 100%;
    font-family: var(--font-pixel);
    font-size: 24px;
    letter-spacing: 1px;
    padding: 14px 44px 14px 18px;
    background-color: #060212;
    color: var(--magic-yellow);
    border: 3px solid var(--neon-purple);
    box-shadow: 
        inset 3px 3px 0px #000000,
        0 0 10px rgba(155, 93, 229, 0.4);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pixel-input::placeholder {
    color: rgba(155, 93, 229, 0.5);
    font-family: var(--font-pixel);
}

.pixel-input:focus {
    border-color: var(--electric-cyan);
    box-shadow: 
        inset 3px 3px 0px #000000,
        0 0 15px rgba(0, 229, 255, 0.6);
}

.clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--hot-pink);
    font-family: var(--font-heading);
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
}

.clear-btn:hover {
    color: var(--cream);
}

.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    width: 100%;
}

/* Preset Question Chips */
.preset-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.preset-label {
    font-family: var(--font-heading);
    font-size: 9px;
    color: rgba(255, 244, 214, 0.6);
    letter-spacing: 1px;
}

.preset-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.preset-chip {
    font-family: var(--font-pixel);
    font-size: 17px;
    background-color: rgba(26, 11, 53, 0.8);
    color: var(--electric-cyan);
    border: 1px solid var(--neon-purple);
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.preset-chip:hover {
    background-color: var(--neon-purple);
    color: #ffffff;
    border-color: var(--electric-cyan);
    box-shadow: 0 0 8px var(--neon-purple);
}

/* Footer Styling */
.game-footer {
    margin-top: 20px;
    text-align: center;
}

.game-footer p {
    font-family: var(--font-heading);
    font-size: 8px;
    color: rgba(0, 229, 255, 0.4);
    letter-spacing: 2px;
}

/* Collapsible History / Fortune Journal Drawer */
.history-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100vh;
    background-color: var(--bg-purple);
    border-left: 4px solid var(--neon-purple);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.8);
    z-index: 200;
    display: flex;
    flex-direction: column;
    padding: 20px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-drawer.hidden {
    transform: translateX(100%);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 2px dashed var(--neon-purple);
    margin-bottom: 16px;
}

.drawer-header h3 {
    font-family: var(--font-heading);
    font-size: 13px;
    color: var(--magic-yellow);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 4px;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: #0B1026;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--neon-purple);
}

.empty-history {
    font-size: 18px;
    color: rgba(255, 244, 214, 0.5);
    text-align: center;
    margin-top: 40px;
}

.history-item {
    background-color: #0B1026;
    border: 2px solid var(--orb-border);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-q {
    font-size: 17px;
    color: var(--electric-cyan);
}

.history-a {
    font-family: var(--font-heading);
    font-size: 12px;
}

.history-a.yes-text {
    color: var(--magic-yellow);
}

.history-a.no-text {
    color: var(--hot-pink);
}

.history-time {
    font-size: 14px;
    color: rgba(255, 244, 214, 0.4);
    text-align: right;
}

.drawer-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px dashed var(--neon-purple);
    display: flex;
    justify-content: center;
}

/* Visibility Helper Classes */
.hidden {
    display: none !important;
}

/* Keyframe Animations */
@keyframes orbFloat {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-12px); }
    100% { transform: translateY(0px); }
}

@keyframes shadowPulse {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(0.85); opacity: 0.4; }
    100% { transform: scale(1); opacity: 0.7; }
}

@keyframes auraPulse {
    0% { opacity: 0.4; transform: scale(0.95); }
    100% { opacity: 0.8; transform: scale(1.05); }
}

@keyframes orbShake {
    0% { transform: translate(4px, 3px) rotate(1.5deg); }
    20% { transform: translate(-4px, -3px) rotate(-1.5deg); }
    40% { transform: translate(-3px, 4px) rotate(2.5deg); }
    60% { transform: translate(4px, 2px) rotate(-1.5deg); }
    80% { transform: translate(-2px, -4px) rotate(1.5deg); }
    100% { transform: translate(3px, -2px) rotate(0deg); }
}

@keyframes digitGlow {
    0% {
        text-shadow: 0 0 6px var(--electric-cyan), 0 0 12px var(--neon-purple);
    }
    100% {
        text-shadow: 0 0 12px var(--hot-pink), 0 0 24px var(--electric-cyan);
        color: #ffffff;
    }
}

@keyframes sparklePulse {
    0% { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(1.3); opacity: 1; }
}

@keyframes answerFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-12deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes runeSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulseText {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Responsive Styles */
@media (max-width: 480px) {
    .orb-wrapper {
        width: 240px;
        height: 240px;
    }

    .pixel-orb {
        width: 220px;
        height: 220px;
    }

    .orb-display {
        width: 130px;
        height: 130px;
    }

    .symbol-digit {
        font-size: 48px;
    }

    .answer-text {
        font-size: 28px;
    }

    .pixel-input {
        font-size: 20px;
        padding: 12px 38px 12px 14px;
    }

    .primary-btn, .secondary-btn {
        font-size: 12px;
        padding: 12px 18px;
    }

    .history-drawer {
        width: 100vw;
    }
}
