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

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: "Arial", sans-serif;
    background: linear-gradient(135deg, #0c0c0c 0%, #1a1a2e 50%, #16213e 100%);
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
}

#gameCanvas {
    border: 2px solid #00ffff;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
    background: #000011;
}

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

.top-ui {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.player-stats {
    display: flex;
    gap: 20px;
    background: rgba(0, 0, 0, 0.8);
    padding: 15px 20px;
    border-radius: 10px;
    border: 1px solid #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-label {
    font-size: 12px;
    color: #00ffff;
    font-weight: bold;
}

.stat-value {
    font-size: 16px;
    font-weight: bold;
    color: #ffffff;
}

.item {
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid #ff6b35;
    padding: 8px;
    border-radius: 5px;
    margin-bottom: 5px;
    font-size: 12px;
    color: #ff6b35;
}

.abilities {
    margin: 20px;
    margin-bottom: 20px;
}

.ability {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid #00ffff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.ability-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 255, 255, 0.2);
    border-radius: 50%;
}

.ability-name {
    font-weight: bold;
    color: #00ffff;
    font-size: 14px;
    margin-bottom: 5px;
}

.ability-description {
    font-size: 11px;
    color: #999999;
    margin-bottom: 5px;
    line-height: 1.3;
}

.ability-cooldown {
    font-size: 12px;
    color: #cccccc;
}

.game-menu,
.ship-selector {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    margin: 0;
    padding: 0;
}

.menu-content,
.selector-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #00ffff;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
    margin: 0 auto;
}

.menu-content h1 {
    font-size: 36px;
    color: #00ffff;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    text-align: center;
}

.selector-content h2 {
    font-size: 24px;
    color: #00ffff;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.menu-content p {
    font-size: 16px;
    color: #cccccc;
    margin-bottom: 20px;
    text-align: center;
}

.menu-button {
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    border: none;
    color: white;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    margin: 5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.menu-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.5);
}

.menu-button:disabled {
    background: linear-gradient(45deg, #666666, #999999);
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.menu-button:disabled:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.instructions {
    margin-top: 20px;
    text-align: left;
}

.instructions h3 {
    color: #00ffff;
    margin-bottom: 10px;
    font-size: 16px;
}

.instructions ul {
    list-style: none;
    color: #cccccc;
    font-size: 14px;
}

.instructions li {
    margin-bottom: 6px;
    padding-left: 20px;
    position: relative;
}

.instructions li:before {
    content: "▶";
    color: #ff6b35;
    position: absolute;
    left: 0;
}

.ships-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 30px 0;
}

.ship-option {
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid #00ffff;
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.ship-option:hover {
    background: rgba(0, 255, 255, 0.2);
    transform: scale(1.05);
}

.ship-option.selected {
    background: rgba(255, 107, 53, 0.2);
    border-color: #ff6b35;
}

.ship-option.locked {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #666;
}

.ship-option.locked:hover {
    transform: none;
    background: rgba(0, 255, 255, 0.1);
}

.clan-selector {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    pointer-events: auto;
}

.clans-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 15px 0;
}

.clan-option {
    background: rgba(0, 255, 255, 0.3);
    border: 3px solid #00ffff;
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.clan-option:hover {
    background: rgba(0, 255, 255, 0.2);
    transform: scale(1.05);
}

.clan-option.selected {
    background: rgba(255, 107, 53, 0.2);
    border-color: #ff6b35;
}

.clan-option::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%
    );
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.clan-option:hover::before {
    transform: translateX(100%);
}

.clan-icon {
    font-size: 48px;
    margin-bottom: 15px;
    text-shadow: 0 0 10px currentColor;
}

.clan-name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 0 0 5px currentColor;
}

.clan-description {
    font-size: 14px;
    color: #cccccc;
    margin-bottom: 10px;
}

.clan-base-info {
    font-size: 12px;
    color: #999999;
    font-style: italic;
}

.ship-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.ship-name {
    font-size: 18px;
    font-weight: bold;
    color: #00ffff;
    margin-bottom: 10px;
}

.ship-description {
    font-size: 14px;
    color: #cccccc;
    margin-bottom: 10px;
}

.ship-requirements {
    font-size: 12px;
    color: #ff6b35;
}

/* Animaciones */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes glow {
    0% {
        box-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
    }
    100% {
        box-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
    }
}

.glow {
    animation: glow 2s infinite;
}

@keyframes achievementPop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes skillCooldown {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.skill-cooldown {
    animation: skillCooldown 1s linear infinite;
}

/* Skills Equipment */
.skills-equipment {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.skills-container {
    display: flex;
    gap: 40px;
    margin: 20px 0;
}

.available-skills,
.equipped-skills {
    flex: 1;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.skill-item {
    background: rgba(255, 107, 53, 0.2);
    border: 2px solid #ff6b35;
    border-radius: 8px;
    padding: 15px;
    cursor: grab;
    transition: all 0.3s ease;
}

.skill-item:hover {
    background: rgba(255, 107, 53, 0.4);
    transform: translateY(-2px);
}

.skill-item:active {
    cursor: grabbing;
}

.skill-icon {
    font-size: 24px;
    text-align: center;
    margin-bottom: 8px;
}

.skill-name {
    font-weight: bold;
    color: #ff6b35;
    margin-bottom: 5px;
}

.skill-description {
    font-size: 12px;
    color: #ccc;
    margin-bottom: 5px;
}

.skill-cooldown {
    font-size: 11px;
    color: #888;
    text-align: center;
}

.equipped-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.skill-slot {
    background: rgba(100, 100, 100, 0.2);
    border: 2px solid #666;
    border-radius: 8px;
    padding: 15px;
    min-height: 100px;
    transition: all 0.3s ease;
}

.skill-slot:hover {
    border-color: #ff6b35;
    background: rgba(255, 107, 53, 0.1);
}

.skill-slot.dragover {
    border-color: #ff6b35;
    background: rgba(255, 107, 53, 0.3);
}

.slot-key {
    background: #ff6b35;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin: 0 auto 10px;
}

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

.empty-slot {
    color: #888;
    font-style: italic;
    margin-top: 20px;
}

/* Skills Tree Panel */
.skills-tree-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.tree-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid #ff6b35;
    border-radius: 15px;
    padding: 30px;
    max-width: 1200px;
    max-height: 800px;
    overflow-y: auto;
    position: relative;
}

.tree-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ff6b35;
}

.tree-header h2 {
    color: #ff6b35;
    margin: 0;
    font-size: 28px;
}

.tree-header p {
    color: #ccc;
    margin: 0;
    font-size: 14px;
}

.skills-tree-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.skills-tier {
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid #ff6b35;
    border-radius: 10px;
    padding: 20px;
}

.skills-tier h3 {
    color: #ff6b35;
    margin: 0 0 20px 0;
    text-align: center;
    font-size: 20px;
}

.skills-tree-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.skill-tree-item {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #666;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.skill-tree-item.unlocked {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
}

.skill-tree-item.locked {
    border-color: #666;
    background: rgba(100, 100, 100, 0.3);
    opacity: 0.6;
    cursor: not-allowed;
}

.skill-tree-item.unlocked:hover {
    border-color: #ff6b35;
    background: rgba(255, 107, 53, 0.2);
    transform: translateY(-2px);
}

.skill-tree-item .skill-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.skill-tree-item .skill-name {
    font-weight: bold;
    color: #fff;
    margin-bottom: 8px;
    font-size: 16px;
}

.skill-tree-item .skill-description {
    color: #ccc;
    font-size: 12px;
    margin-bottom: 8px;
    line-height: 1.3;
}

.skill-tree-item .skill-cooldown {
    color: #ff6b35;
    font-size: 11px;
    margin-bottom: 8px;
}

.skill-tree-item .skill-status {
    font-size: 11px;
    font-weight: bold;
}

.skill-tree-item .skill-status .equipped {
    color: #4caf50;
}

.skill-tree-item .skill-status .available {
    color: #ff6b35;
}

.skill-tree-item .skill-status .locked {
    color: #666;
}

.equipped-skills-section {
    background: rgba(255, 107, 53, 0.15);
    border: 2px solid #ff6b35;
    border-radius: 10px;
    padding: 20px;
}

.equipped-skills-section h3 {
    color: #ff6b35;
    margin: 0 0 20px 0;
    text-align: center;
    font-size: 20px;
}

.equipped-skills-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.equipped-skill-slot {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #ff6b35;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    position: relative;
    min-height: 100px;
}

.slot-key {
    background: #ff6b35;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin: 0 auto 10px;
    font-size: 14px;
}

.slot-content {
    margin-bottom: 10px;
}

.slot-content .skill-icon {
    font-size: 24px;
    margin-bottom: 5px;
}

.slot-content .skill-name {
    color: #fff;
    font-size: 12px;
    font-weight: bold;
}

.empty-slot {
    color: #888;
    font-style: italic;
    margin-top: 20px;
}

.remove-skill {
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    font-size: 12px;
    cursor: pointer;
    position: absolute;
    top: 5px;
    right: 5px;
    transition: background 0.3s ease;
}

.remove-skill:hover {
    background: #cc0000;
}

/* Skill Assignment Modal */
.skill-assignment-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;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid #ff6b35;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    max-width: 400px;
}

.modal-content h3 {
    color: #ff6b35;
    margin: 0 0 15px 0;
}

.modal-content p {
    color: #ccc;
    margin: 0 0 25px 0;
}

.key-selection {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 25px;
}

.key-selection button {
    background: #ff6b35;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.key-selection button:hover {
    background: #e55a2b;
    transform: scale(1.05);
}

.cancel-btn {
    background: #666;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.cancel-btn:hover {
    background: #555;
}

/* Bando Selector Styles */
.bando-selector {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.bando-info {
    margin-bottom: 20px;
    text-align: center;
}

.selected-clan-info {
    background: rgba(0, 255, 255, 0.2);
    border: 2px solid #00ffff;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.selected-clan-info span {
    color: #00ffff;
    font-size: 18px;
    font-weight: bold;
}

.bandos-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 20px 0;
    max-width: 800px;
}

.bando-option {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #666;
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.bando-option:hover {
    border-color: #00ffff;
    background: rgba(0, 255, 255, 0.1);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 255, 255, 0.3);
}

.bando-option.selected {
    border-color: #00ffff;
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.bando-option::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s;
}

.bando-option:hover::before {
    left: 100%;
}

.bando-icon {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
}

.bando-name {
    font-size: 20px;
    font-weight: bold;
    color: #00ffff;
    margin-bottom: 10px;
}

.bando-description {
    font-size: 14px;
    color: #ccc;
    margin-bottom: 15px;
    line-height: 1.4;
}

.bando-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.bando-stat {
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid #00ffff;
    border-radius: 5px;
    padding: 8px;
    font-size: 12px;
}

.bando-stat-label {
    color: #00ffff;
    font-weight: bold;
    display: block;
}

.bando-stat-value {
    color: #fff;
    font-size: 14px;
}

.bando-bonus {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid #ffd700;
    border-radius: 5px;
    padding: 10px;
    margin-top: 15px;
    font-size: 12px;
    color: #ffd700;
}

.bando-bonus-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.bando-bonus-description {
    color: #ccc;
    font-size: 11px;
}

.widget,
.widget-panel,
.widget-control,
.widget-draggable,
.widget-static {
    border: 2px solid #00eaff !important;
    box-shadow: 0 0 10px #00eaff44 !important;
}

/* --- Responsive Styles for Mobile --- */
@media (max-width: 768px) {
    /* Make menus and selectors take up more screen width */
    .menu-content,
    .selector-content {
        width: 95%;
        padding: 20px;
        max-height: 95vh;
    }

    .menu-content h1 {
        font-size: 28px;
    }

    /* Stack grids to a single column */
    .ships-grid,
    .clans-grid,
    .bandos-grid {
        grid-template-columns: 1fr;
    }

    /* Improve readability of player stats */
    .player-stats {
        flex-wrap: wrap; /* Allow stats to wrap onto the next line */
        gap: 10px;
        padding: 10px;
    }

    .stat {
        gap: 2px;
    }

    .stat-label {
        font-size: 10px;
    }

    .stat-value {
        font-size: 14px;
    }

    /* Increase button and text sizes for touch */
    .menu-button {
        padding: 15px 25px;
        font-size: 16px;
    }

    .instructions ul {
        font-size: 13px;
    }
}
