/* ============================================
   Sneaky's Carnival - Shared Stylesheet
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: Arial, Helvetica, sans-serif;
    color: #fff;
    background: #000;
}

/* --- Full-Viewport Background --- */
.game-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    cursor: pointer;
    z-index: 1;
}

/* --- Help Link (floating "?" top-right) --- */
.help-link {
    position: fixed;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: background 0.3s, border-color 0.3s;
}

.help-link:hover {
    background: rgba(180, 30, 30, 0.8);
    border-color: rgba(255, 255, 255, 0.6);
}

/* --- Forum Link (floating speech bubble, top-right next to help) --- */
.forum-link {
    position: fixed;
    top: 15px;
    right: 60px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: background 0.3s, border-color 0.3s;
}

.forum-link:hover {
    background: rgba(30, 100, 180, 0.8);
    border-color: rgba(255, 255, 255, 0.6);
}

/* --- Level Title (subtle, top-left) --- */
.level-title {
    position: fixed;
    top: 15px;
    left: 15px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    z-index: 1000;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

/* --- Ad Columns --- */
.ad-left, .ad-right {
    position: fixed;
    top: 0;
    width: 160px;
    height: 100%;
    z-index: 500;
    padding-top: 25vh;
    pointer-events: auto;
    overflow: hidden;
}

.ad-left .adsbygoogle,
.ad-right .adsbygoogle {
    display: block;
    width: 160px;
    min-height: 600px;
}

.ad-left {
    left: 0;
    background: rgba(0, 0, 0, 0.3);
}

.ad-right {
    right: 0;
    background: rgba(0, 0, 0, 0.3);
}

@media (max-width: 900px) {
    .ad-left, .ad-right {
        display: none;
    }
}

/* --- Question Dialog --- */
.question-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    display: none;
    animation: slideUp 0.3s ease-out;
}

.question-overlay.active {
    display: block;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.question-dialog {
    background: rgba(10, 10, 10, 0.95);
    border-top: 2px solid rgba(180, 30, 30, 0.6);
    padding: 25px 30px;
    max-width: 700px;
    margin: 0 auto;
    position: relative;
}

.question-text {
    font-size: 18px;
    line-height: 1.5;
    margin-bottom: 15px;
    color: #e0e0e0;
    font-style: italic;
}

.answer-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.answer-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    font-size: 16px;
    background: rgba(30, 30, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
    outline: none;
    transition: border-color 0.3s;
}

.answer-input:focus {
    border-color: rgba(180, 30, 30, 0.8);
}

.answer-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.btn-submit {
    padding: 10px 25px;
    font-size: 16px;
    background: rgba(180, 30, 30, 0.8);
    border: 1px solid rgba(180, 30, 30, 0.6);
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-submit:hover {
    background: rgba(200, 40, 40, 0.9);
}

.btn-hint {
    padding: 10px 20px;
    font-size: 14px;
    background: rgba(60, 60, 60, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: background 0.3s, color 0.3s;
}

.btn-hint:hover {
    background: rgba(80, 80, 80, 0.9);
    color: #fff;
}

.btn-hint.loading {
    pointer-events: none;
    opacity: 0.5;
}

.hint-text {
    display: none;
    margin-top: 12px;
    padding: 10px 15px;
    background: rgba(50, 50, 20, 0.6);
    border-left: 3px solid rgba(200, 180, 50, 0.7);
    color: rgba(255, 220, 100, 0.9);
    font-size: 14px;
    line-height: 1.4;
}

.hint-text.visible {
    display: block;
    animation: fadeIn 0.5s ease-out;
}

.feedback {
    margin-top: 10px;
    font-size: 14px;
    min-height: 20px;
}

.feedback.incorrect {
    color: #ff4444;
}

.feedback.correct {
    color: #44ff44;
}

/* --- Close Dialog Button --- */
.btn-close-dialog {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
}

.btn-close-dialog:hover {
    color: #fff;
}

/* --- Prompt Text (click to interact) --- */
.click-prompt {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    z-index: 800;
    pointer-events: none;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* --- Level-Specific Content Area --- */
.level-content {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.level-content > * {
    pointer-events: auto;
}

/* --- Puzzle Text Overlay --- */
.puzzle-text {
    position: relative;
    max-width: 600px;
    padding: 30px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(180, 30, 30, 0.4);
    border-radius: 8px;
    text-align: center;
    font-size: 20px;
    line-height: 1.6;
}

/* --- Scroll Text (for cipher levels) --- */
.scroll-text {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 22px;
    letter-spacing: 2px;
    color: #d4a574;
    padding: 20px 30px;
    background: rgba(40, 25, 10, 0.85);
    border: 2px solid rgba(160, 120, 60, 0.5);
    border-radius: 4px;
    margin-bottom: 15px;
}

/* --- Anagram Letters --- */
.anagram-letters {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.anagram-letter {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    background: rgba(180, 30, 30, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    animation: letterBob 2s ease-in-out infinite;
}

.anagram-letter:nth-child(2) { animation-delay: 0.2s; }
.anagram-letter:nth-child(3) { animation-delay: 0.4s; }
.anagram-letter:nth-child(4) { animation-delay: 0.6s; }
.anagram-letter:nth-child(5) { animation-delay: 0.8s; }

@keyframes letterBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* --- Funhouse Words (Level 8) --- */
.funhouse-word {
    position: fixed;
    font-size: 36px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    pointer-events: none;
    z-index: 5;
}

/* --- Balloon (Level 11 - Dart Game) --- */
.balloon-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.balloon {
    width: 60px;
    height: 75px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    color: transparent;
    transition: transform 0.2s;
    position: relative;
}

.balloon::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    width: 2px;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-50%);
}

.balloon:hover {
    transform: scale(1.1);
}

.balloon.popped {
    animation: pop 0.3s ease-out forwards;
    color: #fff;
    background: transparent !important;
}

.balloon.popped::after {
    display: none;
}

@keyframes pop {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.5; }
    100% { transform: scale(0); opacity: 0; }
}

/* --- Flags (Level 11) --- */
.flag-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.flag {
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 30px solid;
}

/* --- Padlock Icons (Level 19) --- */
.padlock-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.padlock {
    width: 60px;
    height: 80px;
    background: rgba(80, 80, 80, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px 8px 4px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.padlock::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-bottom: none;
    border-radius: 15px 15px 0 0;
}

.padlock.unlocked {
    background: rgba(50, 120, 50, 0.8);
    border-color: rgba(100, 200, 100, 0.5);
    color: #fff;
}

.padlock.unlocked::before {
    border-color: rgba(100, 200, 100, 0.5);
    transform: translateX(-50%) rotate(-30deg);
    transform-origin: bottom right;
}

/* --- Lock Wheels (Level 20) --- */
.lock-container {
    text-align: center;
}

.lock-wheel-row {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin: 20px 0;
}

.lock-wheel {
    width: 50px;
    height: 60px;
    background: rgba(40, 40, 40, 0.9);
    border: 2px solid rgba(180, 150, 50, 0.6);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    color: rgba(180, 150, 50, 0.9);
    cursor: pointer;
    user-select: none;
    transition: border-color 0.2s;
}

.lock-wheel:hover {
    border-color: rgba(220, 180, 60, 0.9);
}

.lock-wheel.correct {
    border-color: rgba(100, 200, 100, 0.8);
    color: rgba(100, 200, 100, 0.9);
}

.btn-unlock {
    padding: 12px 40px;
    font-size: 18px;
    font-weight: bold;
    background: rgba(180, 150, 50, 0.8);
    border: 2px solid rgba(180, 150, 50, 0.5);
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 10px;
}

.btn-unlock:hover {
    background: rgba(200, 170, 60, 0.9);
}

/* --- Wax Figures (Level 17) --- */
.wax-gallery {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.wax-figure {
    width: 120px;
    height: 180px;
    background-size: cover;
    background-position: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.3s;
}

.wax-figure:hover {
    border-color: rgba(255, 255, 255, 0.5);
}

.wax-figure.breathing {
    animation: breathe 3s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.01); }
}

/* --- Fireworks / Victory Animations --- */
@keyframes firework {
    0% { transform: translateY(100vh) scale(0); opacity: 1; }
    50% { transform: translateY(30vh) scale(1); opacity: 1; }
    100% { transform: translateY(0) scale(1.5); opacity: 0; }
}

.firework {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    z-index: 2000;
    pointer-events: none;
    animation: firework 1.5s ease-out forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    z-index: 2000;
    pointer-events: none;
    animation: confettiFall 3s ease-in forwards;
}

/* --- General Animations --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.3s ease-in-out;
}

/* --- Smoke Effect (Level 14) --- */
@keyframes smoke {
    0% { opacity: 0; transform: scale(0.5) translateY(0); }
    50% { opacity: 0.8; }
    100% { opacity: 0; transform: scale(2) translateY(-100px); }
}

.smoke-particle {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(150, 150, 150, 0.6), transparent);
    pointer-events: none;
    animation: smoke 1.5s ease-out forwards;
}

/* --- Vanish Button (Level 14) --- */
.btn-vanish {
    padding: 15px 35px;
    font-size: 18px;
    font-weight: bold;
    background: rgba(100, 30, 150, 0.8);
    border: 2px solid rgba(150, 80, 200, 0.6);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn-vanish:hover {
    background: rgba(120, 40, 180, 0.9);
    box-shadow: 0 0 20px rgba(150, 80, 200, 0.5);
}

/* --- Audio Player Styling --- */
.audio-container {
    margin: 20px 0;
    text-align: center;
}

.audio-container audio {
    width: 100%;
    max-width: 400px;
}

/* --- Hidden Fortune Text (Level 3) --- */
.fortune-reading {
    padding: 20px;
    background: #0b0b0b;
    border-radius: 8px;
    line-height: 1.8;
    font-size: 16px;
}

.fortune-hidden {
    color: #0c0c0c;
}

/* --- Number Sequence (Level 9) --- */
.sequence-numbers {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.seq-num {
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: bold;
    background: rgba(60, 30, 80, 0.8);
    border: 2px solid rgba(150, 100, 200, 0.5);
    border-radius: 50%;
}

.seq-num.mystery {
    color: rgba(180, 30, 30, 0.9);
    font-size: 28px;
    border-color: rgba(180, 30, 30, 0.6);
}

/* --- Help Page --- */
.help-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    padding: 40px 20px 60px;
    overflow-y: auto;
    z-index: 1;
}

.help-page h1 {
    text-align: center;
    font-size: 32px;
    color: #b41e1e;
    margin-bottom: 30px;
}

.help-page h2 {
    font-size: 20px;
    color: #d4a574;
    margin: 25px 0 10px;
    border-bottom: 1px solid rgba(180, 30, 30, 0.3);
    padding-bottom: 5px;
}

.help-page p, .help-page li {
    font-size: 16px;
    line-height: 1.6;
    color: #ccc;
    margin-bottom: 8px;
}

.help-page ul {
    padding-left: 25px;
}

.help-page .btn-back {
    display: block;
    width: fit-content;
    margin: 30px auto 0;
    padding: 12px 30px;
    font-size: 16px;
    background: rgba(180, 30, 30, 0.8);
    border: none;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.3s;
}

.help-page .btn-back:hover {
    background: rgba(200, 40, 40, 0.9);
}

/* --- Victory Page --- */
.victory-page {
    min-height: 100vh;
    background: #0a0a0a;
    overflow-y: auto;
    text-align: center;
    padding: 40px 20px;
}

.victory-page h1 {
    font-size: 42px;
    color: #d4a574;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(200, 150, 50, 0.5);
}

.victory-page .subtitle {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 30px;
}

.stats-box {
    display: inline-flex;
    gap: 40px;
    padding: 20px 40px;
    background: rgba(30, 30, 30, 0.8);
    border: 1px solid rgba(180, 150, 50, 0.4);
    border-radius: 8px;
    margin-bottom: 30px;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #d4a574;
}

.stat-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 5px;
}

/* --- Leaderboard Table --- */
.leaderboard {
    max-width: 600px;
    margin: 0 auto 30px;
    text-align: left;
}

.leaderboard h2 {
    font-size: 22px;
    color: #b41e1e;
    margin-bottom: 15px;
    text-align: center;
}

.leaderboard table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard th {
    padding: 10px 15px;
    background: rgba(180, 30, 30, 0.4);
    border-bottom: 2px solid rgba(180, 30, 30, 0.6);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.leaderboard td {
    padding: 8px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
    color: #ccc;
}

.leaderboard tr:hover td {
    background: rgba(255, 255, 255, 0.05);
}

.leaderboard .rank-1 td { color: #ffd700; }
.leaderboard .rank-2 td { color: #c0c0c0; }
.leaderboard .rank-3 td { color: #cd7f32; }

/* --- Entrance Page --- */
.entrance-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.entrance-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Login Prompt (Victory page) --- */
.login-prompt {
    padding: 15px 25px;
    background: rgba(50, 50, 20, 0.6);
    border: 1px solid rgba(200, 180, 50, 0.5);
    border-radius: 8px;
    margin: 20px auto;
    max-width: 500px;
    font-size: 16px;
    color: rgba(255, 220, 100, 0.9);
}

/* --- Utility --- */
.text-center { text-align: center; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none !important; }

/* --- Rate Widget (index page) --- */
.rate-widget {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(10, 10, 10, 0.85);
    border: 1px solid rgba(180, 30, 30, 0.4);
    border-radius: 20px;
    pointer-events: auto;
}

.rate-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
}

.rate-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 2px 4px;
    transition: transform 0.2s;
    filter: grayscale(0.3);
}

.rate-btn:hover:not(:disabled) {
    transform: scale(1.3);
    filter: grayscale(0);
}

.rate-btn:disabled,
.rate-btn.voted {
    opacity: 0.4;
    cursor: default;
    filter: grayscale(0.6);
}

.rate-bar {
    width: 80px;
    height: 8px;
    background: rgba(255, 70, 70, 0.5);
    border-radius: 4px;
    overflow: hidden;
}

.rate-bar-like {
    height: 100%;
    width: 50%;
    background: rgba(70, 200, 70, 0.7);
    border-radius: 4px 0 0 4px;
    transition: width 0.5s ease;
}

.rate-counts {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
}

@media (max-width: 600px) {
    .rate-widget {
        flex-wrap: wrap;
        justify-content: center;
        bottom: 50px;
        max-width: 280px;
    }
    .rate-bar {
        width: 100%;
        order: 10;
    }
    .rate-counts {
        order: 11;
        width: 100%;
        text-align: center;
    }
}
