/* styles.css — All UI styles for Gorilla Banana Beat-Em-Up */

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

body {
    background: #000;
    overflow: hidden;
    font-family: 'Courier New', monospace;
    color: #fff;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

#game-wrapper {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

#game-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#game-container canvas {
    display: block;
    image-rendering: pixelated;
}

/* ===== UI OVERLAY ===== */

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#ui-overlay * {
    pointer-events: auto;
}

/* ===== HUD ===== */

#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.6);
    font-size: 14px;
    z-index: 20;
}

.hud-left, .hud-center, .hud-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hud-label {
    white-space: nowrap;
}

.gp-cooldown {
    display: flex;
    align-items: center;
    gap: 4px;
}

.gp-label {
    font-size: 11px;
    font-weight: bold;
    color: #ff0;
}

.gp-bar-bg {
    width: 60px;
    height: 10px;
    background: #333;
    border-radius: 3px;
    overflow: hidden;
}

.gp-bar-fill {
    width: 100%;
    height: 100%;
    background: #0f0;
    transition: width 0.1s linear;
}

.hud-icon-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.7;
    padding: 4px;
}

.hud-icon-btn:hover {
    opacity: 1;
}

.hud-combo {
    position: absolute;
    right: 20px;
    bottom: 60px;
    font-size: 28px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 2px 2px 4px #000, 0 0 10px #FFD700;
    animation: combo-pulse 0.3s ease-in-out;
}

@keyframes combo-pulse {
    0% { transform: scale(1.5); }
    100% { transform: scale(1); }
}

/* ===== SCREENS ===== */

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    z-index: 30;
}

/* ===== MENU ===== */

.menu-content {
    text-align: center;
}

.game-title {
    font-size: 48px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 3px 3px 6px #000, 0 0 20px rgba(255, 215, 0, 0.3);
    line-height: 1.1;
    margin-bottom: 8px;
}

.menu-subtitle {
    font-size: 16px;
    color: #aaa;
    margin-bottom: 20px;
}

.menu-tokens {
    font-size: 18px;
    color: #FFD700;
    margin-bottom: 24px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.menu-btn {
    background: #333;
    border: 2px solid #555;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    padding: 12px 32px;
    cursor: pointer;
    border-radius: 8px;
    min-width: 200px;
    transition: all 0.15s;
}

.menu-btn:hover {
    background: #444;
    border-color: #777;
    transform: translateY(-2px);
}

.menu-btn.primary {
    background: #2d5016;
    border-color: #5a9a2f;
    font-size: 20px;
}

.menu-btn.primary:hover {
    background: #3d6a20;
}

.menu-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.admin-icon-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: none;
    border: none;
    color: #555;
    font-size: 20px;
    cursor: pointer;
}

.admin-icon-btn:hover {
    color: #aaa;
}

/* ===== LEVEL SELECT ===== */

.level-list {
    display: flex;
    gap: 20px;
    margin: 24px 0;
    flex-wrap: wrap;
    justify-content: center;
}

.level-btn {
    background: #222;
    border: 3px solid #555;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    padding: 20px 28px;
    cursor: pointer;
    border-radius: 12px;
    min-width: 180px;
    text-align: center;
    transition: all 0.15s;
}

.level-btn:hover:not(.locked) {
    background: #333;
    border-color: #FFD700;
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.level-btn.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.level-icon {
    display: block;
    font-size: 40px;
    margin-bottom: 8px;
}

.level-name {
    display: block;
    font-size: 14px;
}

.lock-icon {
    display: block;
    margin-top: 4px;
    font-size: 20px;
}

.back-btn {
    background: #333;
    border: 2px solid #555;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    padding: 8px 20px;
    cursor: pointer;
    border-radius: 6px;
    margin-top: 20px;
}

.back-btn:hover {
    background: #444;
}

/* ===== SHOP ===== */

#shop-screen {
    overflow-y: auto;
    padding: 20px;
    justify-content: flex-start;
}

.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 600px;
    margin-bottom: 16px;
}

.shop-balance {
    font-size: 18px;
    color: #FFD700;
}

.shop-items {
    width: 100%;
    max-width: 600px;
}

.shop-section h3 {
    color: #FFD700;
    border-bottom: 1px solid #444;
    padding-bottom: 4px;
    margin: 16px 0 8px;
}

.shop-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: #1a1a1a;
    border-radius: 6px;
    margin-bottom: 6px;
}

.shop-item.maxed {
    opacity: 0.5;
}

.item-icon {
    font-size: 24px;
    width: 36px;
    text-align: center;
}

.item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.item-name {
    font-weight: bold;
    font-size: 14px;
}

.item-desc {
    color: #aaa;
    font-size: 11px;
}

.item-owned {
    color: #888;
    font-size: 11px;
}

.item-actions {
    display: flex;
    gap: 6px;
}

.buy-btn, .sell-btn {
    background: #2d5016;
    border: 1px solid #5a9a2f;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    padding: 4px 10px;
    cursor: pointer;
    border-radius: 4px;
    white-space: nowrap;
}

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

.sell-btn {
    background: #501616;
    border-color: #9a2f2f;
}

.sell-btn:hover {
    background: #6a2020;
}

.buy-btn:hover:not(:disabled) {
    background: #3d6a20;
}

/* ===== ADMIN ===== */

#admin-screen {
    overflow-y: auto;
    padding: 20px;
    justify-content: flex-start;
}

.admin-controls {
    width: 100%;
    max-width: 500px;
}

.admin-row {
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-row label {
    cursor: pointer;
    font-size: 14px;
}

.admin-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.admin-row select {
    background: #222;
    color: #fff;
    border: 1px solid #555;
    padding: 4px 8px;
    font-family: 'Courier New', monospace;
    border-radius: 4px;
}

.admin-row button {
    background: #444;
    border: 1px solid #666;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    padding: 6px 16px;
    cursor: pointer;
    border-radius: 4px;
}

.admin-row button:hover {
    background: #555;
}

.admin-controls h4 {
    color: #FFD700;
    margin-top: 16px;
    border-bottom: 1px solid #444;
    padding-bottom: 4px;
}

.admin-input {
    background: #111;
    border: 2px solid #555;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    padding: 10px 16px;
    text-align: center;
    border-radius: 6px;
    width: 250px;
}

.error-text {
    color: #ff4444;
    font-size: 13px;
    min-height: 20px;
}

/* ===== MODAL ===== */

.modal-box {
    background: #1a1a1a;
    border: 2px solid #444;
    border-radius: 12px;
    padding: 28px 36px;
    text-align: center;
    max-width: 500px;
}

.modal-box.wide {
    max-width: 600px;
    width: 90%;
}

.modal-box h2 {
    margin-bottom: 16px;
    color: #FFD700;
}

.modal-box h3 {
    margin-bottom: 12px;
}

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

/* ===== BOSS INTRO ===== */

.boss-intro-content {
    text-align: center;
    animation: boss-shake 0.2s ease-in-out infinite alternate;
}

.boss-warning {
    font-size: 24px;
    color: #ff4444;
    animation: boss-flash 0.5s ease-in-out infinite alternate;
}

.boss-name {
    font-size: 36px;
    color: #FFD700;
    text-transform: uppercase;
}

@keyframes boss-shake {
    0% { transform: translateX(-3px); }
    100% { transform: translateX(3px); }
}

@keyframes boss-flash {
    0% { opacity: 1; }
    100% { opacity: 0.3; }
}

/* ===== TALLY (level complete / game over) ===== */

.tally {
    text-align: left;
    width: 100%;
}

.tally-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 14px;
    border-bottom: 1px solid #222;
}

.tally-row.total {
    font-size: 18px;
    font-weight: bold;
    color: #FFD700;
    border-top: 2px solid #FFD700;
    border-bottom: none;
    padding-top: 8px;
    margin-top: 4px;
}

/* ===== ENDING ===== */

.ending-content {
    text-align: center;
    animation: ending-glow 2s ease-in-out infinite alternate;
}

.ending-content h1 {
    font-size: 48px;
    color: #FFD700;
    margin-bottom: 16px;
}

.ending-content p {
    font-size: 18px;
    margin: 8px 0;
}

.ending-gorilla {
    font-size: 80px;
    margin: 24px 0;
    animation: chest-beat 0.3s ease-in-out infinite alternate;
}

.ending-title {
    animation: victory-pulse 0.8s ease-in-out infinite alternate;
}

@keyframes ending-glow {
    0% { text-shadow: 0 0 20px rgba(255, 215, 0, 0.3); }
    100% { text-shadow: 0 0 40px rgba(255, 215, 0, 0.6); }
}

@keyframes chest-beat {
    0% { transform: scale(1); }
    100% { transform: scale(1.15); }
}

@keyframes victory-pulse {
    0% { transform: scale(1); filter: brightness(1); }
    100% { transform: scale(1.05); filter: brightness(1.3); }
}

/* Banana Rain */
.banana-rain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.banana-rain .banana-drop {
    position: absolute;
    top: -40px;
    font-size: 28px;
    animation: banana-fall linear infinite;
    opacity: 0.9;
}

@keyframes banana-fall {
    0% { transform: translateY(-40px) rotate(0deg); opacity: 0.9; }
    100% { transform: translateY(calc(100vh + 40px)) rotate(360deg); opacity: 0.6; }
}

/* ===== LEADERBOARD ===== */

.leaderboard-container {
    width: 100%;
    max-width: 500px;
}

.lb-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.lb-tab {
    background: #222;
    border: 1px solid #444;
    color: #aaa;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    padding: 6px 14px;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    flex: 1;
}

.lb-tab.active, .lb-tab:hover {
    background: #333;
    color: #FFD700;
    border-color: #FFD700;
}

.lb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.lb-table th {
    background: #222;
    padding: 6px 8px;
    text-align: left;
    color: #888;
}

.lb-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #222;
}

.lb-table tr.lb-top td {
    color: #FFD700;
}

.lb-empty {
    text-align: center;
    color: #666;
    padding: 20px;
}

/* ===== NAME INPUT ===== */

.name-input-chars {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin: 20px 0;
}

.name-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.name-char {
    font-size: 36px;
    font-weight: bold;
    color: #FFD700;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #222;
    border: 2px solid #555;
    border-radius: 6px;
}

.char-btn {
    background: #333;
    border: 1px solid #555;
    color: #fff;
    width: 44px;
    height: 32px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.char-btn:hover {
    background: #444;
}

/* ===== TOUCH CONTROLS ===== */

.touch-controls {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 140px;
    pointer-events: auto;
    z-index: 25;
}

.touch-joystick {
    position: absolute;
    left: 20px;
    bottom: 20px;
    width: 120px;
    height: 120px;
}

.joystick-ring {
    width: 100%;
    height: 100%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
}

.touch-buttons {
    position: absolute;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.touch-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.4);
    background: rgba(0, 0, 0, 0.4);
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.touch-btn:active {
    background: rgba(255, 255, 255, 0.2);
}

.punch-btn {
    width: 72px;
    height: 72px;
    border-color: rgba(255, 100, 100, 0.6);
}

/* Show touch controls on mobile */
@media (hover: none) and (pointer: coarse) {
    .touch-controls {
        display: flex;
    }
}

/* ===== RESPONSIVE ===== */

@media (max-width: 600px) {
    .game-title {
        font-size: 32px;
    }

    .menu-btn {
        font-size: 14px;
        padding: 10px 24px;
        min-width: 160px;
    }

    .level-list {
        flex-direction: column;
        gap: 12px;
    }

    .level-btn {
        min-width: 140px;
        padding: 14px 20px;
    }

    .modal-box {
        padding: 20px;
        margin: 0 12px;
    }

    #hud {
        font-size: 12px;
        height: 36px;
    }

    .boss-name {
        font-size: 24px;
    }
}

@media (max-width: 400px) {
    .game-title {
        font-size: 24px;
    }

    .hud-center {
        display: none;
    }
}
