/*
 * Flappy Dragon - Stylesheet
 * Custom vanilla CSS for an apocalyptic, premium glassmorphic UI.
 */

:root {
    --bg-dark: #070303;
    --bg-magma: #1c0502;
    --panel-bg: rgba(18, 8, 8, 0.88);
    --panel-border: rgba(255, 78, 17, 0.2);
    --color-orange: #ff4e11;
    --color-gold: #ffb000;
    --color-text: #f0e6e6;

    /* Skin specific neon glows */
    --glow-inferno: 0 0 15px #ff4e11;
    --glow-shadow: 0 0 15px #a020f0;
    --glow-acid: 0 0 15px #39ff14;
    --glow-frostbite: 0 0 15px #00f3ff;

    /* AdMob Banner Native height placeholder */
    --admob-banner-height: 0px;

    /* New Design Tokens */
    --primary-glow: rgba(255, 68, 0, 0.85);
    --secondary-glow: rgba(255, 140, 0, 0.75);
    --amber-glow: rgba(255, 191, 0, 0.9);
    --glass-border: rgba(255, 60, 0, 0.25);
    --font-epic: 'Cinzel Decorative', serif;
    --font-metal: 'Metal Mania', cursive;
    --font-standard: 'Poppins', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: var(--bg-dark);
    color: var(--color-text);
    font-family: var(--font-standard), system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background-image: radial-gradient(circle at center, rgba(28, 5, 2, 0.6) 0%, rgba(7, 3, 3, 0.9) 80%), url('apocalyptic_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.playing {
    overflow: hidden !important;
    padding: 0 !important;
}

/* Background volcanic haze decoration */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at bottom, rgba(255, 78, 17, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* Game Wrapper Container */
.game-container {
    position: relative;
    width: calc(min(800px, 94vh - var(--admob-banner-height)) * (9 / 15));
    height: min(800px, 94vh - var(--admob-banner-height));
    max-width: 100vw;
    max-height: calc(100dvh - var(--admob-banner-height));
    background-color: #0d0606;
    border: 2px solid rgba(255, 60, 0, 0.3);
    border-radius: 16px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.85), 
                0 0 25px rgba(255, 60, 0, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

/* Screen Shake Effect */
.shake {
    animation: shakeEffect 0.4s cubic-bezier(.36, .07, .19, .97) both;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
}

@keyframes shakeEffect {

    10%,
    90% {
        transform: translate3d(-2px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(4px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-6px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(6px, 0, 0);
    }
}

/* The Canvas itself */
#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: #0b0505;
}

/* Base style for all glass overlays */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 60, 0, 0.2);
    box-shadow: inset 0 0 30px rgba(255, 60, 0, 0.1),
                0 0 25px rgba(255, 60, 0, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px;
    text-align: center;
    z-index: 10;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.overlay-screen.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Epic Headings */
h1 {
    font-family: var(--font-epic), 'Georgia', serif;
    font-size: 2.3rem;
    font-weight: 900;
    color: var(--text-light);
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8),
                 0 0 20px var(--primary-glow);
    letter-spacing: 2px;
    margin-bottom: 25px;
    line-height: 1.1;
}

h2 {
    font-family: var(--font-epic), 'Georgia', serif;
    font-size: 1.8rem;
    color: var(--color-gold);
    margin-bottom: 20px;
    text-shadow: 0 0 8px var(--primary-glow);
}

p {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 20px;
    color: #d8c2c2;
}

/* Typography highlight */
.highlight {
    color: var(--lava-red);
    background: linear-gradient(to right, #ff3c00, #ff8c00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 8px rgba(255, 60, 0, 0.5));
}

.game-subtitle {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 25px;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    line-height: 1.45;
}

/* Animated Preview Item */
.dragon-preview-container {
    height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
}

.preview-dragon {
    width: 75px;
    height: 75px;
    filter: drop-shadow(0 0 10px rgba(255, 60, 0, 0.85));
    animation: fly-preview 2s ease-in-out infinite;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.preview-dragon svg {
    transition: opacity 0.25s ease-in-out, transform 0.25s ease-in-out;
    opacity: 1;
    transform: scale(1);
}

.preview-dragon.fade-out svg {
    opacity: 0;
    transform: scale(0.65);
}

@keyframes fly-preview {
    0%, 100% { transform: translateY(-5px) rotate(-5deg); }
    50% { transform: translateY(8px) rotate(5deg); }
}

.preview-dragon-wing {
    transform-origin: 23px 20px;
    animation: wing-flap-menu 0.35s ease-in-out infinite alternate;
}

@keyframes wing-flap-menu {
    0% {
        transform: scaleY(1.1) rotate(5deg);
    }
    100% {
        transform: scaleY(0.2) rotate(-15deg);
    }
}

/* Premium Navigation & Action Buttons */
.btn {
    background: linear-gradient(135deg, #991a00 0%, #ff4500 50%, #991a00 100%);
    background-size: 200% auto;
    border: none;
    color: var(--text-light);
    padding: 14px 28px;
    font-family: var(--font-epic), serif;
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: 1.5px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 8px 0;
    width: 230px;
    box-shadow: 0 0 15px rgba(255, 60, 0, 0.4),
                0 4px 10px rgba(0, 0, 0, 0.6);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    text-transform: uppercase;
    outline: none;
}

.btn:hover {
    background-position: right center;
    transform: scale(1.03);
    box-shadow: 0 0 25px rgba(255, 60, 0, 0.7),
                0 0 10px rgba(255, 140, 0, 0.4);
}

.btn:active {
    transform: scale(0.97);
}

.btn-secondary {
    background: rgba(18, 8, 8, 0.8);
    border: 1px solid rgba(255, 78, 17, 0.35);
    color: #e5b0a3;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
    text-shadow: none;
}

.btn-secondary:hover {
    background: rgba(40, 20, 20, 0.95);
    border-color: var(--color-orange);
    color: #fff;
    transform: scale(1.03);
    box-shadow: 0 0 20px rgba(255, 78, 17, 0.3), 0 4px 10px rgba(0, 0, 0, 0.4);
}

/* Home Screen Elements */
.menu-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-top: 10px;
}

.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 270px;
    margin: 8px 0;
}

.menu-grid .btn {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 8px !important;
    font-size: 0.76rem !important;
    border-radius: 20px !important;
    letter-spacing: 0.3px !important;
    height: 38px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.high-score-tag {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-gold);
    border: 1px solid rgba(255, 176, 0, 0.3);
    padding: 6px 16px;
    border-radius: 20px;
    background: rgba(255, 176, 0, 0.05);
    margin-top: 25px;
    letter-spacing: 0.5px;
}

.home-orbs-tag {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(18, 9, 9, 0.92);
    border: 1px solid rgba(255, 176, 0, 0.2);
    color: var(--color-gold);
    border-radius: 12px;
    padding: 8px 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 800;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    z-index: 12;
}

/* HUD Overlay during gameplay */
.game-hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    z-index: 5;
}

.hud-item {
    background: rgba(18, 9, 9, 0.92);
    border: 1px solid rgba(255, 78, 17, 0.15);
    border-radius: 12px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 800;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.hud-item i {
    font-style: normal;
}

.score-display {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Georgia', serif;
    font-size: 2.2rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    background: none;
    border: none;
    box-shadow: none;
}

.hud-orbs {
    color: var(--color-gold);
    border-color: rgba(255, 176, 0, 0.2);
}

.hud-fireball {
    color: #ff3c00;
}

.hud-tornado {
    color: #a020f0;
    border-color: rgba(160, 32, 240, 0.18);
}

.tornado-count {
    display: flex;
    gap: 3px;
}

.tornado-gem {
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, #ff00ff, #a020f0);
    border-radius: 50%;
    border: 1px solid #fff;
    display: inline-block;
    transition: transform 0.2s;
}

.tornado-gem.empty {
    background: #23122c;
    border-color: #401850;
}

.fireball-count {
    display: flex;
    gap: 3px;
}

.fireball-gem {
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, #ffcc00, #ff3c00);
    transform: rotate(45deg);
    border: 1px solid #fff;
    display: inline-block;
    transition: transform 0.2s;
}

.fireball-gem.empty {
    background: #331a15;
    border-color: #55332c;
    box-shadow: none;
}

/* Control Config (Modo Canhoto) */
.control-config {
    margin-top: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.config-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #c2b0b0;
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    background: rgba(255, 78, 17, 0.05);
    border: 1px solid rgba(255, 78, 17, 0.15);
    padding: 8px 18px;
    border-radius: 20px;
    transition: border-color 0.2s, background-color 0.2s;
}

.config-label:hover {
    border-color: rgba(255, 78, 17, 0.45);
    background: rgba(255, 78, 17, 0.12);
    color: #fff;
}

.config-label input[type="checkbox"] {
    accent-color: var(--color-orange);
    cursor: pointer;
    width: 15px;
    height: 15px;
}

/* Mobile Play Controls */
.mobile-controls {
    position: absolute;
    bottom: 30px;
    left: 0;
    width: 100%;
    display: none;
    /* Oculto por padrão nos menus */
    justify-content: flex-start;
    align-items: flex-end;
    padding: 0 25px;
    z-index: 6;
    pointer-events: none;
}

body.playing .mobile-controls {
    display: flex;
    /* Exibe apenas durante o jogo */
}

.mobile-controls.canhoto {
    justify-content: flex-end;
}

/* Stacks power buttons vertically */
.power-controls-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.control-btn {
    pointer-events: auto;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(20, 10, 10, 0.92);
    border: 2px solid rgba(255, 78, 17, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform 0.15s, background-color 0.15s;
}

.control-btn:active {
    transform: scale(0.9);
    background: rgba(255, 78, 17, 0.2);
}

.btn-shoot-fire {
    border-color: #ff3c00;
}

.btn-shoot-fire::after {
    content: '🔥';
    font-size: 1.8rem;
}

.btn-shoot-tornado {
    border-color: #a020f0;
}

.btn-shoot-tornado::after {
    content: '🌀';
    font-size: 1.8rem;
}

.btn-flap-wings {
    border-color: var(--color-gold);
}

.btn-flap-wings::after {
    content: '🦅';
    font-size: 1.8rem;
}

/* Shop Layout (Loja de Dragões) */
.shop-title {
    margin-bottom: 10px;
}

.shop-balance {
    color: var(--color-gold);
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.shop-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    overflow-y: auto;
    padding-right: 5px;
    margin-bottom: 25px;
    flex: 0 1 auto;
    max-height: calc(100% - 180px);
}

/* Custom Scrollbar for Shop */
.shop-grid::-webkit-scrollbar {
    width: 6px;
}

.shop-grid::-webkit-scrollbar-track {
    background: rgba(255, 78, 17, 0.05);
    border-radius: 4px;
}

.shop-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 78, 17, 0.3);
    border-radius: 4px;
}

/* Global Ranking Container */
.ranking-container {
    width: 100%;
    max-width: 380px;
    background: rgba(0, 0, 0, 0.5);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #ff3c00;
    margin: 15px auto;
    overflow-y: auto;
    max-height: calc(100% - 160px);
    height: auto;
    box-sizing: border-box;
}

/* Global Achievements Container */
.achievements-container {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: calc(100% - 150px);
    overflow-y: auto;
    box-sizing: border-box;
    padding-right: 5px;
    margin-bottom: 15px;
}

.shop-item {
    background: rgba(30, 15, 15, 0.85);
    border: 1px solid rgba(255, 78, 17, 0.15);
    border-radius: 14px;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transition: border-color 0.2s, background-color 0.2s, transform 0.2s;
    cursor: pointer;
}

.shop-item:hover {
    border-color: rgba(255, 78, 17, 0.4);
    background: rgba(45, 20, 20, 0.95);
    transform: translateY(-2px);
}

.shop-item.selected {
    border-color: var(--color-orange);
    box-shadow: inset 0 0 6px rgba(255, 78, 17, 0.3);
    background: rgba(50, 15, 15, 0.95);
}

.skin-preview-box {
    width: 60px;
    height: 60px;
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    background: rgba(10, 5, 5, 0.6);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    position: relative;
}

/* Colorful glowing circles behind skin icons */
.skin-preview-box::before {
    content: '';
    position: absolute;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    opacity: 0.5;
    filter: blur(3px);
}

.shop-item[data-skin="inferno"] .skin-preview-box::before {
    background-color: #ff4e11;
}

.shop-item[data-skin="shadow"] .skin-preview-box::before {
    background-color: #a020f0;
}

.shop-item[data-skin="acid"] .skin-preview-box::before {
    background-color: #39ff14;
}

.shop-item[data-skin="frostbite"] .skin-preview-box::before {
    background-color: #00f3ff;
}

.skin-preview-svg {
    width: 42px;
    height: 42px;
    z-index: 2;
}

.skin-name {
    font-size: 0.85rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: #fff;
}

.skin-status-btn {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.75rem;
    font-weight: 800;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    text-align: center;
}

.status-buy {
    background: linear-gradient(135deg, var(--color-gold) 0%, #ff8800 100%);
    color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

.status-buy::after {
    content: '🟡';
    font-size: 0.65rem;
}

.status-equip {
    background: rgba(255, 255, 255, 0.1);
    color: #b0a0a0;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.status-equip:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.status-equipped {
    background: rgba(255, 78, 17, 0.2);
    color: var(--color-orange);
    border: 1px solid rgba(255, 78, 17, 0.4);
    cursor: default;
}

/* Instructions Overlay */
.instructions-box {
    background: rgba(15, 7, 7, 0.85);
    border: 1px solid rgba(255, 78, 17, 0.25);
    border-radius: 12px;
    padding: 20px;
    width: 100%;
    text-align: left;
    margin-bottom: 25px;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
}

.instruction-item {
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.instruction-item:last-child {
    margin-bottom: 0;
}

.instruction-icon {
    font-size: 1.4rem;
    min-width: 28px;
    text-align: center;
}

.instruction-text h4 {
    font-size: 0.9rem;
    color: #fff;
    font-weight: 800;
    margin-bottom: 3px;
}

.instruction-text p {
    font-size: 0.8rem;
    color: #aaa4a4;
    margin-bottom: 0;
    line-height: 1.4;
}

/* Sound and Options Toggle Panel */
.sound-toggle-panel {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 12;
}

.sound-toggle-btn {
    background: rgba(20, 10, 10, 0.92);
    border: 1px solid rgba(255, 78, 17, 0.3);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    transition: border-color 0.2s, background-color 0.2s;
}

.sound-toggle-btn:hover {
    border-color: var(--color-orange);
    background: rgba(35, 15, 15, 0.85);
}

.sound-toggle-btn::after {
    content: '🔊';
    font-size: 1.2rem;
}

.sound-toggle-btn.muted::after {
    content: '🔇';
}

/* Game Over Screen Specs */
.game-over-stats {
    background: rgba(20, 10, 10, 0.8);
    border: 1px solid rgba(255, 78, 17, 0.25);
    border-radius: 14px;
    padding: 20px;
    width: 100%;
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: #c2b0b0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

.stat-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.stat-val {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
}

.stat-val-highlight {
    color: var(--color-gold);
}

.new-record-badge {
    background: #ff3c00;
    color: #fff;
    padding: 2px 8px;
    font-size: 0.65rem;
    font-weight: 800;
    border-radius: 6px;
    text-transform: uppercase;
    margin-left: 8px;
    display: inline-block;
    vertical-align: middle;
}

/* Container size is now fully self-adaptive via min() and calc() */

/* 📱 Responsive Mobile Adaptations & Auto-Scaling */

/* Fullscreen on Mobile Viewports preserving 9:15 Aspect Ratio to prevent vertical stretching */
@media (max-width: 480px) {
    .game-container {
        width: 100vw;
        height: auto;
        aspect-ratio: 9 / 15;
        max-width: 100vw;
        max-height: 100dvh;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }
}

/* Advanced Scaling for Shorter Screens and Mobile Devices */
@media (max-height: 780px) or (max-width: 480px) {
    .overlay-screen {
        padding: 16px 14px;
    }

    h1 {
        font-size: 1.6rem;
        margin-bottom: 8px;
    }

    h2 {
        font-size: 1.25rem;
        margin-bottom: 6px;
    }

    p {
        font-size: 0.82rem;
        margin-bottom: 8px;
        line-height: 1.45;
    }

    .btn {
        padding: 9px 18px;
        font-size: 0.84rem;
        margin: 4px 0;
        width: 190px;
    }

    .menu-grid {
        width: 230px;
        gap: 6px;
        margin: 6px 0;
    }

    .menu-grid .btn {
        font-size: 0.68rem !important;
        height: 32px !important;
        padding: 0 4px !important;
        border-radius: 16px !important;
    }

    .dragon-preview-container {
        height: 50px;
        margin-bottom: 8px;
    }

    .preview-dragon {
        width: 55px;
        height: 55px;
    }

    .high-score-tag {
        margin-top: 8px;
        padding: 4px 12px;
        font-size: 0.76rem;
    }

    #userAuthStatus {
        font-size: 10px;
        margin-bottom: 8px;
        padding: 4px 10px;
    }

    .control-config {
        margin-top: 6px;
    }

    .config-label {
        padding: 5px 12px;
        font-size: 0.74rem;
    }

    /* Gameplay HUD smaller scaling */
    .game-hud {
        padding: 8px 12px;
    }

    .hud-item {
        padding: 4px 8px;
        font-size: 0.72rem;
        gap: 5px;
        border-radius: 8px;
    }

    .score-display {
        font-size: 1.7rem;
    }

    .tornado-gem, .fireball-gem {
        width: 9px;
        height: 9px;
    }

    /* Scrollable panels constraints to fit shorter viewports */
    .shop-grid {
        flex: 0 1 auto;
        max-height: calc(100% - 130px);
        gap: 8px;
        margin-bottom: 10px;
        overflow-y: auto;
        padding-right: 5px;
    }

    .shop-balance {
        font-size: 0.88rem;
        margin-bottom: 10px;
    }

    .shop-item {
        padding: 8px 6px;
    }

    .skin-preview-box {
        width: 40px;
        height: 40px;
        margin-bottom: 4px;
    }

    .skin-preview-svg {
        width: 28px;
        height: 28px;
    }

    .skin-name {
        font-size: 0.78rem;
        margin-bottom: 4px;
    }

    .skin-status-btn {
        padding: 5px 8px;
        font-size: 0.7rem;
    }

    .ranking-container {
        max-height: calc(100% - 130px);
        height: auto;
        margin: 10px auto;
        padding: 10px;
        overflow-y: auto;
    }

    .ranking-container th,
    .ranking-container td {
        padding: 5px 8px !important;
        font-size: 0.8rem;
    }

    .mobile-controls {
        bottom: 24px;
        padding: 0 16px;
    }

    .control-btn {
        width: 58px;
        height: 58px;
    }

    .control-btn::after {
        font-size: 1.4rem;
    }

    .power-controls-group {
        gap: 8px;
    }

    /* Achievements view size constraints */
    .achievements-container {
        max-height: calc(100% - 120px);
        overflow-y: auto;
        gap: 10px;
        margin-bottom: 10px;
        padding-right: 5px;
    }

    #achievementsScreen div[style*="padding: 14px"] {
        padding: 10px !important;
    }

    #achievementsScreen h3 {
        font-size: 14px !important;
        margin-bottom: 8px !important;
    }

    #achievementsScreen div[style*="font-size: 13px"] {
        font-size: 12px !important;
        gap: 6px !important;
    }

    /* Instructions view size constraints */
    .instructions-box {
        padding: 12px;
        margin-bottom: 15px;
    }

    .instruction-item {
        margin-bottom: 8px;
        gap: 8px;
    }

    .instruction-icon {
        font-size: 1.2rem;
        min-width: 22px;
    }

    .instruction-text h4 {
        font-size: 0.88rem;
        margin-bottom: 2px;
    }

    .instruction-text p {
        font-size: 0.80rem;
    }

    /* Game Over adjustments */
    .game-over-stats {
        padding: 14px;
        margin-bottom: 14px;
        gap: 8px;
    }

    .stat-row {
        font-size: 0.88rem;
        padding-bottom: 6px;
    }

    .stat-val {
        font-size: 1.05rem;
    }

    #rankingSubmitBlock {
        margin-bottom: 12px;
    }

    #rankingSubmitBlock p {
        font-size: 11px;
        margin-bottom: 6px;
    }

    #rankingSubmitBlock input {
        padding: 8px;
        font-size: 12px;
    }

    #rankingSubmitBlock button {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* Sound adjustments */
    .sound-toggle-btn {
        width: 38px;
        height: 38px;
        bottom: 15px;
        right: 15px;
    }

    .sound-toggle-btn::after {
        font-size: 1rem;
    }
}

/* Extra adaptations for very small viewports */
@media (max-height: 600px) {
    h1 {
        font-size: 1.6rem;
    }

    .btn {
        padding: 8px 14px;
        font-size: 0.82rem;
        margin: 3px 0;
        width: 185px;
    }

    .shop-grid {
        flex: 0 1 auto;
        max-height: calc(100% - 130px);
    }

    .ranking-container {
        max-height: calc(100% - 130px);
        height: auto;
    }

    #achievementsScreen>div {
        max-height: 180px !important;
    }
}

/* Live Pulse Dot for real-time achievements updates */
.pulse-dot {
    width: 6px;
    height: 6px;
    background-color: #ff1414;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px #ff1414;
    animation: livePulse 1.6s infinite;
}

@keyframes livePulse {
    0% {
        transform: scale(0.9);
        opacity: 0.6;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
        box-shadow: 0 0 12px #39ff14;
    }

    100% {
        transform: scale(0.9);
        opacity: 0.6;
    }
}

/* Pulsing effect for Menu Play Button */
#btnPlay {
    width: 250px;
    animation: btnPulse 2s infinite ease-in-out;
}

@keyframes btnPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 78, 17, 0.6);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 12px 6px rgba(255, 78, 17, 0.4);
        border-color: rgba(255, 255, 255, 0.45);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 78, 17, 0.6);
    }
}

/* Attributes block inside each shop item */
.skin-attrs {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 8px;
    font-size: 0.68rem;
    color: #bfa5a5;
    background: rgba(255, 78, 17, 0.05);
    border: 1px solid rgba(255, 78, 17, 0.12);
    border-radius: 8px;
    padding: 4px 6px;
    gap: 2px;
}

.skin-attrs-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.skin-attrs-title {
    font-size: 0.58rem;
    text-transform: uppercase;
    opacity: 0.75;
    margin-bottom: 1px;
}

.skin-attrs-val {
    font-weight: 800;
    color: var(--color-gold);
}

/* --- SIDE PANELS RULES (DESKTOP ONLY) --- */

.side-panel {
    width: 280px;
    height: min(800px, 94vh);
    background: rgba(18, 9, 9, 0.88);
    border: 2px solid rgba(255, 78, 17, 0.25);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    z-index: 5;
    box-sizing: border-box;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    margin: 0 10px;
}

.side-panel::-webkit-scrollbar {
    width: 6px;
}

.side-panel::-webkit-scrollbar-track {
    background: rgba(255, 78, 17, 0.03);
    border-radius: 4px;
}

.side-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 78, 17, 0.25);
    border-radius: 4px;
}

.panel-title {
    font-family: 'Georgia', serif;
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--color-gold);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    border-bottom: 2px solid rgba(255, 78, 17, 0.3);
    padding-bottom: 8px;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.panel-section h4 {
    font-size: 0.92rem;
    color: #fff;
    font-weight: 800;
    margin-bottom: 2px;
}

.control-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-list li {
    font-size: 0.8rem;
    color: #dfd0d0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.key-badge {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.72rem;
    font-weight: bold;
    color: #ff9900;
}

.skill-item,
.collectible-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: rgba(255, 78, 17, 0.04);
    border: 1px solid rgba(255, 78, 17, 0.12);
    border-radius: 10px;
    padding: 10px;
    transition: border-color 0.2s, background-color 0.2s;
}

.skill-item:hover,
.collectible-item:hover {
    border-color: rgba(255, 78, 17, 0.35);
    background: rgba(255, 78, 17, 0.08);
}

.skill-icon,
.item-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.skill-desc,
.item-desc {
    font-size: 0.75rem;
    color: #cbbaba;
    line-height: 1.35;
}

.skill-desc strong,
.item-desc strong {
    color: #fff;
}

/* Monster Cards Styles */
.panel-scroll-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.monster-card {
    background: rgba(255, 78, 17, 0.04);
    border: 1px solid rgba(255, 78, 17, 0.12);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform 0.2s, border-color 0.2s, background-color 0.2s;
}

.monster-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 78, 17, 0.35);
    background: rgba(255, 78, 17, 0.08);
}

.monster-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #fff;
    font-weight: 800;
}

.monster-emoji {
    font-size: 1.1rem;
}

.monster-lore {
    font-size: 0.75rem;
    color: #bfa5a5;
    line-height: 1.35;
    margin: 0;
}

/* Specific glows for monster cards to look extra premium */
.monster-card.inferno {
    border-left: 3px solid #ff4e11;
}

.monster-card.shadow {
    border-left: 3px solid #a020f0;
}

.monster-card.acid {
    border-left: 3px solid #39ff14;
}

.monster-card.frostbite {
    border-left: 3px solid #00f3ff;
}

.monster-card.tectonic {
    border-left: 3px solid #ff3c00;
}

.monster-card.lightning {
    border-left: 3px solid #ffd700;
}

.monster-card.tempest {
    border-left: 3px solid #008080;
}

.monster-card.iron {
    border-left: 3px solid #555555;
}

.monster-card.aureum {
    border-left: 3px solid #ffd700;
}

/* --- INFO OVERLAY SCREEN & CUSTOM SCROLL STYLING --- */

#infoOverlayScreen {
    justify-content: flex-start;
    padding: 25px 20px;
}

.info-overlay-scroll {
    width: 100%;
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
    margin: 10px 0;
    box-sizing: border-box;
}

/* Custom Scrollbar for Info Scroll */
.info-overlay-scroll::-webkit-scrollbar {
    width: 6px;
}

.info-overlay-scroll::-webkit-scrollbar-track {
    background: rgba(255, 78, 17, 0.05);
    border-radius: 4px;
}

.info-overlay-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 78, 17, 0.3);
    border-radius: 4px;
}

.info-section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 78, 17, 0.4), transparent);
    margin: 20px 0;
    width: 100%;
}

.info-sub-title {
    font-family: 'Georgia', serif;
    font-size: 1.1rem;
    color: var(--color-gold);
    margin-bottom: 12px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-left: 3px solid #ff4e11;
    padding-left: 8px;
}

.faq-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-box h3 {
    font-family: 'Georgia', serif;
    font-size: 1.05rem;
    font-weight: bold;
    color: var(--color-gold);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid rgba(255, 78, 17, 0.22);
    padding-bottom: 6px;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
}

.faq-box p {
    font-size: 0.76rem;
    color: #dfd0d0;
    line-height: 1.45;
    margin: 0;
    text-align: left;
}

/* --- HYBRID LAYOUT RESPONSIVENESS (PC VS MOBILE) --- */

/* By default (Mobile layout, width < 1100px): Hide outer layout and keep screen fixed */
.top-faq-pc {
    display: none !important;
}

.side-panel {
    display: none !important;
}

.main-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

/* For larger desktop/PC screens (width >= 1100px): Display everything inline with page scroll */
@media (min-width: 1100px) {
    body {
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding: 30px 10px;
    }

    .top-faq-pc {
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 24px;
        width: 100%;
        max-width: 1060px;
        background: rgba(18, 9, 9, 0.88);
        border: 2px solid rgba(255, 78, 17, 0.25);
        border-radius: 16px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
        padding: 20px 24px;
        box-sizing: border-box;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        margin-bottom: 25px;
    }

    .main-layout {
        display: flex !important;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 20px;
        width: 100%;
        height: auto;
    }

    .side-panel {
        display: flex !important;
    }

    /* Hide the mobile-only Guia & Dragões menu button on PC */
    #btnScrollToInfo {
        display: none !important;
    }

    /* Force mobile-only overlay to remain hidden on PC */
    #infoOverlayScreen {
        display: none !important;
    }

    /* Override body.playing to keep page scrollable and maintain padding on PC */
    body.playing {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 30px 10px !important;
    }
}

/* Pulsing countdown style for revive modal */
#reviveCountdownVal {
    animation: countdownPulse 1s ease-in-out infinite;
}

@keyframes countdownPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.25); opacity: 0.8; color: #ff3c00; text-shadow: 0 0 25px rgba(255, 60, 0, 0.8); }
    100% { transform: scale(1); opacity: 1; }
}

/* Button override layout for revive modal to prevent overflow and wrapping issues */
#reviveModal .btn {
    width: auto !important;
    min-width: 0 !important;
    letter-spacing: 0 !important;
    padding: 12px 6px !important;
    font-size: 0.82rem !important;
    margin: 0 !important;
}

/* --- LANGUAGE SELECTOR --- */
.language-selector {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 15;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    overflow: hidden;
    outline: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.lang-btn svg {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    filter: grayscale(40%);
    transition: filter 0.2s ease-in-out;
}

.lang-btn:hover, .lang-btn.active {
    background: rgba(255, 78, 17, 0.18);
    border-color: rgba(255, 78, 17, 0.65);
    box-shadow: 0 0 10px rgba(255, 78, 17, 0.45), 0 4px 8px rgba(0, 0, 0, 0.5);
    transform: scale(1.1);
}

.lang-btn:hover svg, .lang-btn.active svg {
    filter: grayscale(0%);
}