:root {
    --safe-bottom: max(15px, env(safe-area-inset-bottom));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Arial', sans-serif;
    overflow: hidden;
    background: linear-gradient(180deg, #1e3c72, #2a5298);
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh !important;
    padding-bottom: 0;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

img {
    pointer-events: none !important;
    -webkit-touch-callout: none !important;
    -webkit-user-drag: none !important;
}

h1 {
    font-size: clamp(24px, 4vw, 32px);
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

h2 {
    font-size: 28px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

p {
    margin-bottom: 20px;
    font-size: 16px;
}

#mainContainer {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    height: 100dvh !important;
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
}

#gameArea {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#gameArea::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/images/game-background.png');
    background-size: 100% 100%;
    background-position: center center;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1;
    background: transparent;
}

#controlArea {
    width: 100%;
    height: auto !important;
    min-height: auto !important;
    background-image: url('../assets/images/background.png'), linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    background-size: cover, 100% 100%;
    background-position: center center;
    background-repeat: no-repeat;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 10px 20px;
    border-top: 2px solid rgba(255, 255, 255, 0.2);
    z-index: 20;
    flex-shrink: 0;
    pointer-events: none !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

#controlArea::before,
#controlArea::after {
    pointer-events: none !important;
}

#bottomColorArea {
    background-color: #F7A437;
    width: 100%;
    height: var(--safe-bottom) !important;
    flex-shrink: 0;
    z-index: 20;
}

.ui-element {
    position: absolute;
    background: transparent;
    padding: 10px 20px;
    border-radius: 15px;
    box-shadow: none;
    font-size: 18px;
    font-weight: bold;
    z-index: 15;
}

.top-left { top: 20px; left: 20px; }
.top-center { top: 20px; left: 50%; transform: translateX(-50%); }
.top-right { top: 20px; right: 20px; }
.bottom-right { bottom: 20px; right: 20px; }

#lifeDisplay {
    display: flex;
    gap: 5px;
    background: transparent;
    padding: 0;
    align-items: center;
}

.life-icon {
    width: 40px;
    height: 40px;
    display: inline-block;
    transition: filter 0.3s;
    margin-right: 5px;
}

.life-icon.gray {
    filter: grayscale(100%) opacity(0.4);
}

#timeDisplay { background: transparent; padding: 0; }

#time {
    font-size: 32px;
    color: white;
    font-weight: bold;
}

#time.red-time {
    color: #ff0000;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
}

#scoreDisplay { background: transparent; padding: 0; }

#scoreText {
    font-size: 24px;
    color: white;
    font-weight: bold;
}

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    overflow: hidden !important;
    overscroll-behavior: contain !important;
}

.screen-content {
    background: linear-gradient(135deg, #eb7680 0%, #EA5C67 100%);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    color: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    width: 400px;
    max-height: 90vh !important;
    overflow: hidden !important;
}

.scrollable-content {
    max-height: 90vh !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
}

.scrollable-content::-webkit-scrollbar { width: 8px; }
.scrollable-content::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }
.scrollable-content::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.3); border-radius: 10px; }
.scrollable-content::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.5); }

#startScreen,
#gameOverScreen,
#leaderboardScreen,
#howToPlayScreen,
#settingsScreen,
#pkHowToPlayScreen {
    background-image: url('../assets/images/back.png') !important;
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    background-attachment: fixed !important;
}

#startScreen .screen-content {
    background: transparent;
    box-shadow: none;
    padding: 1vh 20px 2vh 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;  
    gap: 0;
    width: 90%;
    max-width: 500px;
    height: 90vh;
    max-height: 90vh;
    overflow: hidden;
}

#startScreen .main-visual {
    width: 90%;
    max-width: 300px;
    margin: 0 auto;
    margin-bottom: 2vh; 
    text-align: center;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

#startScreen .main-visual img {
    max-width: 100%;
    max-height: min(32vh, 280px);  
    width: auto;
    height: auto;
    display: block;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.3));
    user-select: none;
    -webkit-user-drag: none;
}

#startScreen h1, #startScreen p { display: none; }

#startScreen .button-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1vh;
    flex: 0 0 auto;
    margin-bottom: 1.5vh; 
}

#startScreen .screen-content button {
    width: 90%;
    max-width: 320px;
    padding: clamp(8px, 1.2vh, 14px) 30px;  
    margin: 0;
    display: block;
    font-size: clamp(14px, 2vw, 18px);
}

.social-section {
    margin-top: auto;  
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: clamp(4px, 0.6vh, 8px);
    align-items: center;
    width: 100%;
    max-width: clamp(320px, 90vw, 600px);
    flex: 0 0 auto;
    transform: scale(0.9);
}

.social-icons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(8px, 1.5vw, 15px);
    flex-wrap: wrap;
}

.social-icon {
    width: clamp(45px, 12vw, 70px);  
    height: clamp(45px, 12vw, 70px);  
    background: transparent;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    text-decoration: none;
    flex-shrink: 0;
    color: white;
}

.social-icon img {
    width: clamp(35px, 9vw, 55px);
    height: clamp(35px, 9vw, 55px);
    display: block;
    object-fit: contain; 
}

.social-icon svg {
    width: clamp(28px, 6vw, 40px);
    height: clamp(28px, 6vw, 40px);
    display: block;
    fill: white; 
}

.social-icon:not(:has(svg)) {
    font-size: clamp(28px, 6vw, 40px);
    line-height: 1;
    color: white;
}

.social-icon:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    background: rgba(255,255,255,0.1);
}

.brand-row { display: flex; justify-content: center; }

.brand-badge {
    background-color: transparent;
    color: white;
    padding: 4px 0; 
    border-radius: 20px;
    text-decoration: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    width: calc(5 * clamp(30px, 5vw, 60px) + 4 * clamp(8px, 1.5vw, 15px));
}

.brand-badge:hover { transform: translateY(-5px) scale(1.1); }

.brand-badge .icon-img { 
    width: calc(5 * clamp(30px, 5vw, 60px) + 4 * clamp(8px, 1.5vw, 15px)); 
    object-fit: cover; 
}

.brand-badge .icon { font-size: clamp(16px, 2vw, 24px); }
.brand-badge .text-badge { color: white; }

.loading-content { width: 450px; max-width: 90%; }
.loading-text { font-size: 18px; font-weight: bold; color: #ffeb3b; margin: 0 !important; }
.loading-tip { font-size: 14px; color: rgba(255, 255, 255, 0.8); margin-top: 10px !important; }

.loading-bar-container {
    width: 100%;
    height: 25px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    overflow: hidden;
    margin: 30px 0 20px 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.loading-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A, #CDDC39);
    background-size: 200% 100%;
    animation: gradientFlow 2s infinite;
    transition: width 0.3s ease;
    border-radius: 13px;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.final-score { margin: 20px 0; }
.score-big { font-size: 48px; color: #ffeb3b; text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5); }

.player-info-input {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

#playerName, #playerEmail {
    padding: 12px 20px;
    border: none;
    border-radius: 20px;
    font-size: 16px;
    width: 100%;
    max-width: 300px;
    text-align: center;
    background: white;
}

#playerName::placeholder, #playerEmail::placeholder { color: #999; }
#saveScoreBtn { width: 100%; max-width: 300px; margin-top: 5px; }

.coupon-section {
    margin: 25px 0;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.9), rgba(255, 165, 0, 0.9));
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.4);
    animation: couponGlow 2s ease-in-out infinite;
}

.coupon-congratulations {
    font-size: 22px;
    font-weight: bold;
    color: #8b4513;
    margin-bottom: 15px;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
}

.coupon-code-container { margin: 15px 0; }
.coupon-label { font-size: 16px; color: #8b4513; font-weight: bold; margin-bottom: 8px; }

.coupon-code-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 12px 15px;
    border-radius: 10px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    justify-content: center;
}

.coupon-code {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    letter-spacing: 1px;
    user-select: text;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    flex: 1;
    min-width: 180px;
    text-align: center;
}

.copy-coupon-btn {
    background: linear-gradient(135deg, #52c8dd, #78ccdb);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.copy-coupon-btn:hover { background: linear-gradient(135deg, #69c9da, #8ccdd8); transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); }
.copy-coupon-btn:active { transform: translateY(0); }
.copy-coupon-btn.copied { background: linear-gradient(135deg, #4CAF50, #66BB6A); animation: copySuccess 0.6s ease; }
.coupon-hint { font-size: 14px; color: #8b4513; margin-top: 12px; font-weight: 500; }

.leaderboard-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    max-height: 600px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.leaderboard-container::-webkit-scrollbar { width: 8px; }
.leaderboard-container::-webkit-scrollbar-track { background: transparent; }
.leaderboard-container::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.3); border-radius: 4px; }

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    transition: all 0.3s;
}

.leaderboard-item:hover { background: rgba(255, 255, 255, 0.3); transform: translateX(5px); }

.rank { font-size: 20px; font-weight: bold; width: 30px; }
.rank-1 { color: #ffd700; }
.rank-2 { color: #c0c0c0; }
.rank-3 { color: #cd7f32; }

.player-name { flex: 1; text-align: left; margin: 0 20px; }
.player-score { font-size: 20px; font-weight: bold; color: #ffeb3b; }

.how-to-play-content { width: 650px; max-width: 95%; max-height: 90vh; overflow-y: auto; padding: 30px; }
.how-to-play-container { text-align: left; margin: 20px 0; }

.instruction-section {
    background: rgba(255, 255, 255, 0.15);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.instruction-section h3 { color: white; font-size: 20px; margin-bottom: 15px; text-align: center; }

.item-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    justify-items: center;
}

.item-card {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.item-card:hover { background: rgba(255, 255, 255, 0.3); transform: translateY(-5px); }
.item-card img { width: 60px; height: 60px; object-fit: contain; margin-bottom: 8px; }
.item-card p { color: white; font-size: 16px; font-weight: bold; margin: 0; }

.life-bonus-section { background: rgba(255, 192, 203, 0.2); }
.life-bonus-section p { color: white; font-size: 16px; text-align: center; margin-bottom: 15px; }
.life-bonus-list { display: flex; flex-direction: column; gap: 15px; }

.bonus-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.life-icons { display: flex; gap: 8px; }
.life-icons img { width: 30px; height: 30px; }
.bonus-item p { color: white; font-size: 18px; font-weight: bold; margin: 0; text-align: left; }

.settings-container { display: flex; flex-direction: column; gap: 25px; margin: 20px 0; }
.setting-item { background: rgba(255, 255, 255, 0.15); padding: 20px; border-radius: 15px; text-align: left; }
.setting-item label { display: block; font-size: 18px; font-weight: bold; margin-bottom: 12px; color: white; }
.setting-note { margin: 8px 0 0 0; font-size: 13px; color: rgba(255, 255, 255, 0.7); }

.volume-control { display: flex; align-items: center; gap: 15px; }
.volume-value { min-width: 60px; text-align: right; font-weight: bold; color: #ffeb3b; font-size: 16px; }

.volume-slider {
    flex: 1; height: 8px; border-radius: 5px;
    background: rgba(255, 255, 255, 0.3);
    outline: none; -webkit-appearance: none; appearance: none; cursor: pointer;
}

.volume-slider::-webkit-slider-thumb, 
.volume-slider::-moz-range-thumb {
    width: 20px; height: 20px; border-radius: 50%;
    background: #ffeb3b; cursor: pointer; border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); transition: all 0.3s;
}

.volume-slider::-webkit-slider-thumb:hover,
.volume-slider::-moz-range-thumb:hover { transform: scale(1.2); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4); }

.test-buttons { display: flex; flex-direction: column; gap: 10px; align-items: center; background: transparent; padding: 0; }
.test-buttons .btn-test { width: 100%; max-width: 250px; }

.mode-buttons { display: flex; gap: 10px; margin: 10px 0; flex-wrap: wrap; justify-content: center; }

.mode-btn {
    flex: 1; min-width: 120px; padding: 12px 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white; border-radius: 15px;
    font-size: 14px; font-weight: bold; cursor: pointer; transition: all 0.3s ease;
}

.mode-btn:not(.mode-btn-active):hover { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.5); }

.mode-btn-active {
    background: linear-gradient(135deg, #69c9da 0%, #8ccdd8 100%) !important;
    border-color: #f5576c !important;
    box-shadow: 0 0 15px rgba(245, 87, 108, 0.8), 0 4px 8px rgba(245, 87, 108, 0.4) !important;
    transform: scale(1.05) !important;
}

.control-mode-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex; justify-content: center; align-items: center;
    z-index: 10000; animation: fadeIn 0.3s ease;
}

.modal-content {
    background: linear-gradient(135deg, #eb7680 0%, #EA5C67 100%);
    border-radius: 20px; width: 90%; max-width: 500px; max-height: 90vh;
    overflow-y: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

.modal-header { padding: 20px; text-align: center; border-bottom: 2px solid rgba(255, 255, 255, 0.3); }
.modal-header h3 { color: white; font-size: 24px; margin: 0; }
.modal-body { padding: 20px; }
.mode-demo { display: flex; flex-direction: column; gap: 20px; }

.demo-screen {
    background: #1e3c72; border-radius: 15px; overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.demo-game-area {
    height: 250px; position: relative;
    background: linear-gradient(180deg, #0a1929, #1e3c72);
    display: flex; justify-content: center; align-items: center;
}

.demo-player {
    width: 60px; height: 80px; position: absolute; bottom: 10px;
    left: 50%; transform: translateX(-50%);
    background-image: url('../assets/images/player.png');
    background-size: contain; background-repeat: no-repeat; background-position: center;
    animation: float 2s ease-in-out infinite;
}

.demo-gift {
    font-size: 40px; position: absolute; top: 20px;
    left: 50%; transform: translateX(-50%);
    animation: fall 3s linear infinite;
}

.demo-control-area { background: #006036; padding: 15px; display: flex; justify-content: center; align-items: center; }
.demo-control-buttons { display: flex; gap: 60px; align-items: center; }
.demo-btn { position: relative; width: 80px; height: 80px; display: flex; justify-content: center; align-items: center; }
.demo-btn img { width: 100%; height: 100%; object-fit: contain; }

.demo-circle-highlight {
    position: absolute; width: 100%; height: 100%;
    border: 3px solid #ffeb3b; border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

.demo-game-area-fullscreen {
    height: 350px; position: relative;
    background: linear-gradient(180deg, #0a1929, #1e3c72); overflow: hidden;
}

.touch-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.1); display: flex;
}

.touch-left-zone, .touch-right-zone {
    flex: 1; display: flex; justify-content: center; align-items: center;
    position: relative; cursor: pointer;
}

.touch-left-zone { background: rgba(100, 150, 255, 0.15); }
.touch-right-zone { background: rgba(255, 100, 150, 0.15); }
.touch-divider { width: 3px; background: white; box-shadow: 0 0 10px rgba(255, 255, 255, 0.5); }
.zone-label { color: white; font-size: 20px; font-weight: bold; text-align: center; z-index: 2; text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); }

.ripple-effect {
    position: absolute; width: 100px; height: 100px;
    border: 3px solid white; border-radius: 50%;
    animation: ripple 2s ease-out infinite;
}

.touch-left-zone .ripple-effect { left: 30%; }
.touch-right-zone .ripple-effect { right: 30%; }

.demo-instructions { padding: 15px; background: rgba(255, 255, 255, 0.1); border-radius: 10px; }
.instruction-item { display: flex; align-items: center; gap: 15px; margin: 10px 0; color: white; }
.instruction-arrow { font-size: 32px; font-weight: bold; min-width: 40px; text-align: center; }
.instruction-item p { margin: 0; font-size: 16px; }
.center-instruction { text-align: center; color: white; font-size: 18px; margin: 0; }

.modal-footer { padding: 20px; text-align: center; border-top: 2px solid rgba(255, 255, 255, 0.3); }

.modal-btn {
    background: white; color: #EA5C67; border: none; border-radius: 25px;
    padding: 12px 40px; font-size: 18px; font-weight: bold;
    cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.modal-btn:hover { background: #fff0f0; transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); }
.modal-btn:active { transform: translateY(0); }

.btn-primary, .btn-secondary, .btn-settings, .btn-shop, .btn-info, .btn-ranking, .btn-test {
    padding: 12px 30px;
    margin: 10px;
    border: none;
    border-radius: 25px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}
.btn-primary { background: linear-gradient(135deg, #fbdf2d 0%, #f7a922 100%); color: rgb(211, 45, 47); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); }
.btn-secondary { background: white; color: #667eea; }
.btn-secondary:hover { background: #f0f0f0; transform: translateY(-2px); }
.btn-settings { background: linear-gradient(135deg, #fbdf2d 0%, #f7a922  100%); color: rgb(211, 45, 47); }
.btn-settings:hover { transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); }
.btn-shop { background: linear-gradient(135deg, #fbdf2d 0%, #f7a922  100%); color: rgb(211, 45, 47); }
.btn-shop:hover { transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); }
.btn-info { background: linear-gradient(135deg, #fbdf2d 0%, #f7a922  100%); color: rgb(211, 45, 47); }
.btn-info:hover { background: linear-gradient(135deg, #fbdf2d 0%, #f7a922  100%); transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); }
.btn-ranking { background: linear-gradient(135deg, #fbdf2d 0%, #f7a922  100%); color: rgb(211, 45, 47); }
.btn-ranking:hover { transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); }
.btn-test { background: rgba(100, 200, 255, 0.8); color: white; padding: 10px 20px; font-size: 16px; margin: 5px; }
.btn-test:hover { background: rgba(100, 200, 255, 1); transform: translateY(-2px); }

.custom-alert {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); display: flex;
    justify-content: center; align-items: center; z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.alert-content {
    background: linear-gradient(135deg, #eb7680 0%, #EA5C67 100%);
    padding: 30px 40px; border-radius: 20px; text-align: center; color: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3); min-width: 300px; max-width: 90%;
    animation: slideIn 0.3s ease;
}

.alert-icon {
    font-size: 48px;
    margin-bottom: 15px !important;
    text-align: center !important;
    width: 100% !important;
    display: block !important;
}

.alert-message {
    font-size: 15px !important;
    margin-bottom: 25px;
    line-height: 1.6 !important;
    white-space: pre-wrap !important;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    text-align: left !important;
    width: 100% !important;
    padding: 0 15px !important;
    max-height: 60vh !important;
    overflow-y: auto !important;
    display: block !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.alert-btn {
    background: white; color: #EA5C67; border: none; border-radius: 25px;
    padding: 12px 40px; font-size: 16px; font-weight: bold; cursor: pointer;
    transition: all 0.3s ease; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    margin: 0 auto !important;
    display: block !important;
}

.alert-btn:hover { background: #fff0f0; transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); }
.alert-btn:active { transform: translateY(0); }

#mobileControls {
    display: none;
    gap: 80px;
    z-index: 20;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 20px 30px;
    box-sizing: border-box;
    transform: translateY(20px) !important;
    touch-action: none !important;
    pointer-events: none !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
}

.control-btn {
    width: auto !important;
    height: clamp(60px, 15dvh, 100px) !important;
    aspect-ratio: 1 / 1 !important;
    background-size: contain; 
    background-repeat: no-repeat; 
    background-position: center;
    background-color: transparent; 
    border: none; 
    cursor: pointer;
    transition: all 0.2s; 
    box-shadow: none; 
    border-radius: 0px; 
    flex-shrink: 0;
    touch-action: none !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
    pointer-events: auto !important;  
    position: relative !important;   
    z-index: 50 !important;           
}

.control-btn:active { transform: scale(0.95); opacity: 0.8; }

#leftBtn { background-image: url('../assets/images/left-btn.png'); }
#rightBtn { background-image: url('../assets/images/right-btn.png'); }

.mobile-only { display: none; }

.mode-switch-container {
    width: 90%;
    max-width: 320px;
    margin-bottom: 15px;
    box-sizing: border-box;
}

.mode-switch-bg {
    display: flex;
    background: rgba(0,0,0,0.3);
    border-radius: 30px;
    padding: 3px;
    width: 100%;
    box-sizing: border-box;
}

.mode-switch-item {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
    font-size: clamp(12px, 3.5vw, 15px) !important;
    padding: 8px 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    overflow: visible;
}

.mode-switch-item.active {
    background: #ffeb3b;
    color: #d32f2f;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.auth-tabs { display: flex; gap: 10px; margin-bottom: 20px; justify-content: center; }
.auth-tab { background: transparent; border: none; color: white; border-bottom: 2px solid transparent; padding: 5px 15px; font-size: 18px; cursor: pointer; opacity: 0.6; }
.auth-tab.active { opacity: 1; border-bottom-color: #ffeb3b; color: #ffeb3b; }

.auth-form { display: flex; flex-direction: column; gap: 10px; width: 100%; align-items: center; }
.auth-form input { width: 100%; padding: 10px 5px; border: none !important; background: transparent !important; text-align: left !important; font-size: 16px; color: #333; outline: none; }
.auth-form input::placeholder { color: #999; font-size: 14px; }
.auth-msg { color: #ffeb3b; font-size: 14px; min-height: 20px; margin-top: 5px; }

.pk-tabs { display: flex; gap: 5px; margin-bottom: 15px; overflow-x: auto; }
.pk-tab { flex: 1; white-space: nowrap; padding: 8px 12px; border: 1px solid rgba(255,255,255,0.3); background: rgba(0,0,0,0.2); color: white; border-radius: 8px; cursor: pointer; }
.pk-tab.active { background: #ffeb3b; color: #d32f2f; font-weight: bold; border-color: #ffeb3b; }
.pk-info-bar { background: rgba(0,0,0,0.3); padding: 8px; border-radius: 8px; margin-bottom: 10px; font-size: 14px; }

.battle-log-container { height: 400px; overflow-y: auto; text-align: left; background: rgba(0,0,0,0.2); padding: 10px; border-radius: 10px; }
.log-item { font-size: 14px; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,0.1); line-height: 1.4; }
.log-critical { color: #ffd700; font-weight: bold; text-shadow: 0 0 5px rgba(255, 215, 0, 0.5); border: 1px solid #ffd700; padding: 5px; border-radius: 5px; background: rgba(255, 215, 0, 0.1); }
.rank-shield { color: #00e676; font-size: 12px; display: block; }

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000 !important;
}

#loadingScreen { z-index: 1500 !important; }

.pk-action-content {
    max-width: 450px;
    width: 95%;
    background: linear-gradient(135deg, #eb7680 0%, #EA5C67 100%);
    color: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.energy-text { color: #ffeb3b; font-weight: bold; font-size: 1.2em; margin-bottom: 10px; text-shadow: 1px 1px 2px rgba(0,0,0,0.2); }
.action-info p { margin: 5px 0; font-size: 16px; }

.action-list {
    margin: 15px 0; max-height: 50vh; overflow-y: auto;
    background: rgba(255, 255, 255, 0.1); border-radius: 8px; padding: 5px;
}

#actionTargetList {
    max-height: 50vh !important; 
    overflow-y: auto !important; 
    -webkit-overflow-scrolling: touch !important; 
    touch-action: pan-y !important; 
    overscroll-behavior: contain; 
}   

.action-item {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    background: rgba(0, 0, 0, 0.2); 
    margin-bottom: 5px; 
    padding: 10px;
    border-radius: 5px; 
    border: 1px solid rgba(255, 255, 255, 0.2);
    touch-action: pan-y !important;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: auto;
}

.action-item.is-me { border: 2px solid #ffd700; background: rgba(255, 215, 0, 0.15); }

.action-info-box { display: flex; flex-direction: column; align-items: flex-start; flex: 1; }
.action-rank { font-weight: bold; color: #aaa; margin-right: 5px; }
.action-name { font-size: 16px; font-weight: bold; }
.action-btns { display: flex; gap: 5px; }

.btn-act {
    padding: 6px 12px; 
    font-size: 14px; 
    border: none; 
    border-radius: 4px;
    cursor: pointer; 
    transition: transform 0.1s; 
    font-weight: bold;
    touch-action: manipulation;
}

.btn-act:active { transform: scale(0.95); }
.btn-atk { background: #e74c3c; color: white; }
.btn-def { background: #2ecc71; color: white; }

.confirm-content {
    background: linear-gradient(135deg, #eb7680 0%, #EA5C67 100%);
    border: none;
    min-width: 320px;
    padding: 30px 40px; border-radius: 20px; text-align: center; color: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.ok-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.cancel-btn {
    background: linear-gradient(135deg, #7f8c8d, #95a5a6);
    color: white;
}

.btn-logout {
    padding: 12px 30px;
    margin: 5px;
    border: none;
    border-radius: 25px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #fbdf2d 0%, #f7a922 100%);
    color: rgb(211, 45, 47);
}

.btn-logout:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.btn-logout.active {
    background: linear-gradient(135deg, #fbdf2d, #f7a922); 
}

.input-group {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.95); 
    border-radius: 30px; 
    padding: 5px 20px;
    width: 100%;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1); 
    border: 2px solid transparent; 
    transition: all 0.3s ease;
}

.input-group:focus-within {
    border-color: #ffeb3b; 
    box-shadow: 0 0 15px rgba(255, 235, 59, 0.6);
    transform: scale(1.02);
}

.input-label {
    font-weight: bold;
    color: #d32f2f; 
    margin-right: 10px;
    font-size: 16px;
    white-space: nowrap; 
    min-width: 70px; 
    text-align: left;
    display: flex;
    align-items: center;
    gap: 5px;
}

#registerFields {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-check {
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 5px;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.2s;
}

.btn-check:hover {
    background: #43a047;
    transform: scale(1.05);
}

.btn-check:active {
    transform: scale(0.95);
}

.privacy-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 5px;
    width: 100%;
}

.privacy-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #ffeb3b; 
    margin: 0;
}

.privacy-row label {
    color: white;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

.privacy-row span {
    color: #ffeb3b;
    text-decoration: underline;
    font-weight: bold;
    cursor: pointer;
}

.privacy-row span:hover {
    color: #fff;
}

#pkSubmitBtn {
    background: rgba(100, 200, 255, 0.8) !important;
    color: white !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

#pkSubmitBtn:hover {
    background: rgba(100, 200, 255, 1) !important;
    transform: translateY(-2px);
}

.txt-def {
    color: #4fc3f7 !important;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(79, 195, 247, 0.4);
}
.txt-atk {
    color: #ff5252 !important;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 82, 82, 0.4);
}
@keyframes gradientFlow {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}

@keyframes fall {
    to { transform: translateY(100vh); }
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(200px); opacity: 0; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateY(-50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.2); opacity: 0.5; } }
@keyframes ripple { 0% { transform: scale(0.8); opacity: 1; } 100% { transform: scale(2); opacity: 0; } }
@keyframes couponGlow { 0%, 100% { box-shadow: 0 8px 20px rgba(255, 215, 0, 0.4); } 50% { box-shadow: 0 8px 30px rgba(255, 215, 0, 0.7); } }
@keyframes copySuccess { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.snowflake {
    position: fixed; top: -10px; color: white; font-size: 1em;
    animation: fall linear infinite; pointer-events: none; z-index: 1;
}

@media (max-width: 400px) {
    .input-label {
        font-size: 14px;
        min-width: 60px;
    }
    .auth-form input {
        font-size: 14px;
    }
}

@media (max-width: 340px) {
    .mode-switch-item {
        font-size: 11px !important;
    }
}

@media (max-width: 768px) {
    #startScreen .screen-content {
        height: 100vh !important;
        max-height: 100vh !important;
        padding-top: 5vh !important;
        padding-bottom: calc(60px + env(safe-area-inset-bottom)) !important;
        justify-content: flex-start !important;
    }

    #startScreen .main-visual {
        max-width: 70% !important;
        width: 300px !important;
        margin-top: 0 !important;
        margin-bottom: 2vh !important;
        margin-left: auto !important;
        margin-right: auto !important;
        flex-shrink: 1;
        display: flex;
        justify-content: center;
    }

    #startScreen .main-visual img {
        width: 100%;
        height: auto;
        max-height: min(30vh, 280px) !important;
        object-fit: contain;
    }

    #startScreen .button-container {
        gap: 1.5vh !important;
        margin-bottom: 1vh !important;
        flex-shrink: 0;
    }

    .social-section {
        margin-top: 15px !important;
        margin-bottom: 0 !important;
        flex-shrink: 0;
        transform: scale(0.9);
        padding-bottom: 10px;
    }
    
    .loading-content { width: 90%; max-width: 350px; }
    .how-to-play-content { width: 95%; padding: 20px; }
    .item-list { grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 10px; }
    .item-card img { width: 50px; height: 50px; }
    .item-card p { font-size: 14px; }
    .bonus-item { flex-direction: column; text-align: center; gap: 10px; }
    .modal-content { width: 95%; max-width: 400px; }
    .coupon-section { padding: 15px; }
}

@media (max-height: 700px) {
    #startScreen .button-container button {
        padding: 8px 20px;
        font-size: 14px;
    }
    .mode-switch-item {
        padding: 5px;
        font-size: 13px;
    }
    #howToPlayScreen .how-to-play-content,
    #pkHowToPlayScreen .how-to-play-content {
        max-height: 85vh !important;
    }
}