:root {
    --bg-color: #1e1e24;
    --text-color: #f5f5f5;
    --accent: #ff4d4d;
    --panel-bg: #2b2b36;
}

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

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* LEFT SIDE - GAME AREA */
#game-area {
    flex: 0 0 450px; /* Reduced space */
    position: relative;
    background-image: url('assets/bg_plains.png');
    background-size: cover;
    background-position: center;
    border-right: 4px solid #111;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 30px;
    transition: background-image 0.5s ease;
}

#stats-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    pointer-events: none;
    z-index: 20;
}

#stats-panel p {
    margin-bottom: 8px;
    font-size: 1.1rem;
    color: #ddd;
}

.stat-highlight {
    font-size: 1.3rem;
    font-weight: bold;
    color: white;
}

#punching-bag-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

.tier-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
    width: 100%;
    background: rgba(0,0,0,0.5);
    padding: 10px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.2);
}

#tier-name-text {
    font-size: 2rem;
    font-weight: bold;
    text-transform: uppercase;
    text-shadow: 2px 2px 4px #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
    margin: 0 15px;
}

.tier-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
    padding: 5px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: bold;
    transition: background 0.2s, transform 0.1s;
}

.tier-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.tier-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.tier-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#unlock-progress {
    font-size: 1rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 20px;
    text-shadow: 1px 1px 2px #000;
    background: rgba(0,0,0,0.6);
    padding: 4px 10px;
    border-radius: 4px;
}

.floating-arrow {
    font-size: 2.5rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 2px 2px 0 #000;
    animation: bounce 1s infinite;
    pointer-events: none;
    margin-bottom: 10px;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

/* Punching Bag Design */
#punching-bag {
    width: 250px;
    height: 450px;
    position: relative;
    --bag-scale: 1;
    transform: scale(var(--bag-scale));
    transform-origin: top center;
    transition: transform 0.1s ease-out;
    cursor: pointer;
}

#punching-bag.bag-big {
    --bag-scale: 1.3;
}

#punching-bag.color-red { --bag-light: #ff1a1a; --bag-base: #e60000; --bag-dark: #cc0000; --bag-edge: #990000; --bag-border: #660000; }
#punching-bag.color-yellow { --bag-light: #ffcc00; --bag-base: #e6b800; --bag-dark: #cca300; --bag-edge: #997a00; --bag-border: #665200; }
#punching-bag.color-beige { --bag-light: #f5f5dc; --bag-base: #e0e0c9; --bag-dark: #c2c2a3; --bag-edge: #a3a375; --bag-border: #757552; }
#punching-bag.color-grey { --bag-light: #a6a6a6; --bag-base: #8c8c8c; --bag-dark: #737373; --bag-edge: #595959; --bag-border: #404040; }
#punching-bag.color-dusty { --bag-light: #e6e6e6; --bag-base: #cccccc; --bag-dark: #b3b3b3; --bag-edge: #999999; --bag-border: #808080; }
#punching-bag.color-blue { --bag-light: #66b3ff; --bag-base: #3399ff; --bag-dark: #0080ff; --bag-edge: #0066cc; --bag-border: #004d99; }
#punching-bag.color-brown { --bag-light: #a0522d; --bag-base: #8b4513; --bag-dark: #6b3e15; --bag-edge: #522d0c; --bag-border: #3d2209; }
#punching-bag.color-green { --bag-light: #66ff66; --bag-base: #33cc33; --bag-dark: #2eb82e; --bag-edge: #248f24; --bag-border: #1a661a; }
#punching-bag.color-orange { --bag-light: #ffb366; --bag-base: #ff9933; --bag-dark: #e67e22; --bag-edge: #cc6600; --bag-border: #b35900; }
#punching-bag.color-purple { --bag-light: #b266ff; --bag-base: #9933cc; --bag-dark: #8c26c1; --bag-edge: #7300b3; --bag-border: #59008c; }
#punching-bag.color-white { --bag-light: #ffffff; --bag-base: #f2f2f2; --bag-dark: #e6e6e6; --bag-edge: #cccccc; --bag-border: #b3b3b3; }
#punching-bag.color-black { --bag-light: #404040; --bag-base: #262626; --bag-dark: #1a1a1a; --bag-edge: #0d0d0d; --bag-border: #000000; }
#punching-bag.color-gold { --bag-light: #ffe680; --bag-base: #ffd700; --bag-dark: #e6c300; --bag-edge: #cca300; --bag-border: #b38f00; }
#punching-bag.color-deep-purple { --bag-light: #7a00cc; --bag-base: #4b0082; --bag-dark: #3b0066; --bag-edge: #2b004d; --bag-border: #1a0033; }

#punching-bag::before {
    content: '';
    position: absolute;
    top: -500px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 500px;
    background: #444;
    z-index: -1;
}

.bag-top {
    width: 100%;
    height: 60px;
    background: linear-gradient(to bottom, var(--bag-dark, #cc0000), var(--bag-edge, #990000));
    border-radius: 50% 50% 10% 10%;
    border: 4px solid var(--bag-border, #660000);
    border-bottom: none;
}

.bag-body {
    width: 100%;
    height: 390px;
    background: linear-gradient(to right, var(--bag-base, #e60000), var(--bag-light, #ff1a1a) 30%, var(--bag-dark, #cc0000) 70%, var(--bag-edge, #990000));
    border-radius: 10% 10% 40% 40%;
    border: 4px solid var(--bag-border, #660000);
    border-top: none;
    box-shadow: inset -15px -15px 30px rgba(0,0,0,0.4), inset 15px 15px 30px rgba(255,255,255,0.2);
}

/* Hit Animation */
@keyframes hitWobble {
    0% { transform: scale(var(--bag-scale)) rotate(0deg) translateX(0); }
    25% { transform: scale(var(--bag-scale)) rotate(5deg) translateX(15px); }
    50% { transform: scale(var(--bag-scale)) rotate(-3deg) translateX(-8px); }
    75% { transform: scale(var(--bag-scale)) rotate(1deg) translateX(4px); }
    100% { transform: scale(var(--bag-scale)) rotate(0deg) translateX(0); }
}

.hit {
    animation: hitWobble 0.2s ease-out;
}

/* Respawn Animation */
@keyframes dropFromSky {
    0% { transform: translateY(-800px); opacity: 0; }
    60% { transform: translateY(40px); opacity: 1; }
    80% { transform: translateY(-15px); }
    100% { transform: translateY(0); }
}

.respawning {
    pointer-events: none;
    opacity: 0;
}

.dropping {
    animation: dropFromSky 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

#health-bar-container {
    width: 320px;
    height: 40px;
    background: rgba(0,0,0,0.8);
    border-radius: 8px;
    margin-top: 30px;
    border: 3px solid #333;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

#health-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: #00cc44;
    transition: width 0.1s ease-out, background-color 0.2s;
    z-index: 1;
}

#health-text {
    position: relative;
    z-index: 2;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
}

/* RIGHT SIDE - UI AREA */
#ui-area {
    flex: 1;
    background: var(--panel-bg);
    display: flex;
    flex-direction: column;
    padding: 30px;
    box-shadow: -5px 0 15px rgba(0,0,0,0.3);
    z-index: 20;
}

.header {
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}

.header h1 {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 10px;
}

.money-container {
    font-size: 2.5rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

.upgrades-panel {
    flex: 1;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 20px;
    color: #888;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.upgrades-panel h2 {
    color: var(--accent);
    margin-bottom: 20px;
    text-align: center;
}

.upgrade-item {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upg-info {
    flex: 1;
}

.upg-info h4 {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.upg-info p {
    font-size: 0.9rem;
    color: #ccc;
    margin-bottom: 3px;
}

.upg-btn {
    min-width: 130px;
    font-size: 0.95rem;
}

.upg-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #444;
}

.btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.1s, background 0.2s;
}

.btn:hover {
    background: #ff6666;
    transform: scale(1.05);
}

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

/* Damage Popup */
.damage-popup {
    position: absolute;
    color: #ffcc00;
    font-weight: bold;
    font-size: 2.5rem;
    pointer-events: none;
    text-shadow: 2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
    animation: floatUp 0.8s ease-out forwards;
    z-index: 50;
}

.damage-popup.crit {
    font-size: 3.8rem;
    color: #ff3333;
    text-shadow: 2px 2px 0 #fff, -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff, 3px 3px 10px rgba(255,0,0,0.8);
    z-index: 60;
}

@keyframes floatUp {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-80px) scale(1.3); opacity: 0; }
}

/* Cutscene Overlay */
#cutscene-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
}

#cutscene-overlay.cutscene-hidden {
    display: none;
}

.cutscene-flash {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #fff;
    opacity: 0;
}

.cutscene-active .cutscene-flash {
    animation: flashAnim 4s ease-out forwards;
}

.cutscene-content {
    position: relative;
    z-index: 2;
    text-align: center;
    opacity: 0;
    transform: scale(0.5);
}

.cutscene-active .cutscene-content {
    animation: textZoom 4s ease-in-out forwards;
}

#cutscene-title {
    color: #ffcc00;
    font-size: 5rem;
    text-shadow: 0 0 20px #ffaa00;
    letter-spacing: 10px;
    margin-bottom: 10px;
}

#cutscene-sub {
    color: #fff;
    font-size: 1.5rem;
    font-style: italic;
    opacity: 0.8;
}

@keyframes flashAnim {
    0% { opacity: 0; }
    10% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 0; }
}

@keyframes textZoom {
    0% { opacity: 0; transform: scale(0.5); }
    20% { opacity: 1; transform: scale(1); }
    80% { opacity: 1; transform: scale(1.1); }
    100% { opacity: 0; transform: scale(1.5); }
}

/* Settings Modal */
#settings-modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}
#settings-modal.modal-hidden {
    display: none;
}
.settings-content {
    background: #2b2b36;
    border: 2px solid #555;
    border-radius: 12px;
    padding: 30px;
    width: 600px;
    max-width: 90vw;
    color: #eee;
}
.settings-columns {
    display: flex;
    gap: 30px;
}
.settings-col {
    flex: 1;
}
.settings-col p {
    margin-bottom: 8px;
    font-size: 1.05rem;
}
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.dropdown {
    background: #1e1e24;
    color: #fff;
    border: 1px solid #555;
    padding: 8px;
    border-radius: 4px;
}

/* Boxer Sprite */
#boxer-sprite {
    position: absolute;
    width: 150px;
    height: 150px;
    left: -120px;
    bottom: 50px;
    background-image: url('assets/boxer_transparent.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 10;
}

@keyframes punchAnim {
    0% { transform: translateX(0); }
    50% { transform: translateX(50px) scale(1.1); }
    100% { transform: translateX(0); }
}

#boxer-sprite.punching {
    animation: punchAnim 0.2s ease-out;
}

