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

body {
    font-family: Arial, sans-serif;
    background-color: #000;
    overflow: hidden;
}

.game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* UI Styles */
.game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* This prevents click events from reaching children */
    z-index: 10;
}

/* Elements inside game-ui that need to receive clicks should have pointer-events: auto */
.ui-top-right,
.ui-bottom-left,
.ui-bottom-right,
.abilities-container,
.ability,
#mobile-controls,
#joystick-container,
#action-buttons {
    pointer-events: auto;
}

.ui-top-right {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.ui-bottom-left {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.time-display {
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    padding: 10px 15px;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
}

.time-icon {
    font-size: 24px;
}

/* Player Stats Styles */
.player-stats {
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    padding: 15px;
    color: white;
    width: 300px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
}

.stat-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.stat-row:last-child {
    margin-bottom: 0;
}

.stat-label {
    width: 70px;
    font-size: 16px;
    font-weight: bold;
}

.stat-bar-container {
    flex-grow: 1;
    height: 15px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 7px;
    overflow: hidden;
    margin: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.3s ease;
}

.health-bar {
    background: linear-gradient(to right, #ff3333, #ff6666);
}

.stamina-bar {
    background: linear-gradient(to right, #33cc33, #66ff66);
}

.mana-bar {
    background: linear-gradient(to right, #3333ff, #6666ff);
}

.stat-value {
    width: 70px;
    font-size: 14px;
    text-align: right;
}

/* Controls Hint Styles */
.controls-hint {
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    padding: 10px 15px;
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    margin-top: 10px;
    font-size: 14px;
    max-width: 250px;
}

.hint-title {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 5px;
    text-align: center;
}

.hint-item {
    margin-bottom: 3px;
}

/* Game Styles */
body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Arial', sans-serif;
    background-color: #000;
}

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

/* UI Elements */
.game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* Time Display */
.ui-top-right {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-radius: 20px;
    color: white;
}

.time-icon {
    margin-right: 10px;
    font-size: 1.2em;
}

#timeOfDay {
    font-size: 1.2em;
    font-weight: bold;
}

/* Controls Hint */
.ui-bottom-right {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 10px;
    color: white;
    max-width: 300px;
}

.controls-hint {
    font-size: 0.9em;
}

.controls-hint h3 {
    margin-top: 0;
    margin-bottom: 10px;
    text-align: center;
}

.controls-hint ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.controls-hint li {
    margin-bottom: 5px;
}

/* Player Stats */
.ui-bottom-left {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 100;
}

.player-stats {
    background-color: rgba(0, 0, 0, 0.6);
    padding: 15px;
    border-radius: 10px;
    color: white;
    width: 250px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.stat-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.stat-row:last-child {
    margin-bottom: 0;
}

.stat-label {
    width: 80px;
    font-weight: bold;
}

.stat-bar-container {
    flex-grow: 1;
    height: 15px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 7px;
    overflow: hidden;
    margin: 0 10px;
}

.stat-bar {
    height: 100%;
    width: 100%;
    border-radius: 7px;
    transition: width 0.3s ease;
}

.health-bar {
    background: linear-gradient(to right, #ff3333, #ff6666);
}

.stamina-bar {
    background: linear-gradient(to right, #33cc33, #66ff66);
}

.mana-bar {
    background: linear-gradient(to right, #3366ff, #66ccff);
}

.stat-value {
    width: 60px;
    text-align: right;
    font-size: 0.9em;
}

/* Game Messages */
.game-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
    max-width: 80%;
    opacity: 0;
    transition: opacity 0.5s ease;
    display: none;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Mobile Controls Styles */
.mobile-controls {
    display: none; /* Hidden by default, shown on mobile devices */
}

/* Show mobile controls on touch devices */
@media (pointer: coarse) {
    .mobile-controls {
        display: block;
    }
    
    .desktop-controls {
        display: none;
    }

    .ui-bottom-right {
        bottom: 150px;
    }
}

/* Joystick Styles */
#joystick-container {
    position: absolute;
    bottom: 100px;
    left: 100px;
    width: 120px;
    height: 120px;
    pointer-events: auto;
    z-index: 100;
}

#joystick-base {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

#joystick-thumb {
    width: 50%;
    height: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s ease;
}

/* Action Buttons Styles */
#action-buttons {
    position: absolute;
    bottom: 100px;
    right: 100px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    pointer-events: auto;
    z-index: 100;
}

.action-button {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.action-button:active {
    background-color: rgba(50, 150, 255, 0.7);
    transform: scale(0.95);
}

/* Action button active state */
.action-button.active {
    background-color: rgba(50, 150, 255, 0.7);
    transform: scale(0.95);
    box-shadow: 0 0 15px rgba(50, 150, 255, 0.7);
}

/* Responsive adjustments for small screens */
@media (max-width: 768px) {
    #joystick-container {
        bottom: 50px;
        left: 50px;
        width: 100px;
        height: 100px;
    }
    
    #action-buttons {
        bottom: 50px;
        right: 50px;
    }
    
    .action-button {
        width: 70px;
        height: 70px;
        font-size: 14px;
    }
    
    .player-stats {
        width: 250px;
    }
    
    .ui-bottom-right {
        max-width: 200px;
    }
    
    /* Move player stats to top left on mobile */
    .ui-bottom-left {
        bottom: auto;
        top: 20px;
        left: 20px;
    }
    
    /* Adjust time display to not overlap with player stats */
    .ui-top-right {
        top: 20px;
        right: 20px;
    }
}

/* Class System Styles */
.class-selection {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    border: 2px solid #4a90e2;
    border-radius: 8px;
    padding: 20px;
    color: white;
    text-align: center;
    z-index: 100;
    width: 400px;
}

.class-selection h3 {
    margin-top: 0;
    font-size: 24px;
    color: #4a90e2;
    margin-bottom: 20px;
}

.class-options {
    display: flex;
    justify-content: space-around;
}

.class-option {
    cursor: pointer;
    padding: 15px;
    border-radius: 8px;
    background-color: rgba(74, 144, 226, 0.2);
    transition: all 0.3s ease;
    width: 100px;
}

.class-option:hover {
    background-color: rgba(74, 144, 226, 0.4);
    transform: translateY(-5px);
}

.class-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.class-option.disabled:hover {
    background-color: rgba(74, 144, 226, 0.2);
    transform: none;
}

.class-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.class-name {
    font-weight: bold;
}

/* Abilities UI */
.abilities-row{
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.abilities-container {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 10;
    pointer-events: auto;
}

.resource-display {
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    padding: 5px 10px;
    width: 200px;
    margin-bottom: 5px;
}

.resource-label {
    color: #4a90e2;
    font-weight: bold;
    margin-right: 10px;
    width: 50px;
}

.resource-bar-container {
    flex-grow: 1;
    height: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    overflow: hidden;
    margin-right: 10px;
}

.resource-bar {
    height: 100%;
    transition: width 0.3s ease;
}

.mana-bar {
    background-color: #4a90e2;
}

.resource-value {
    color: white;
    font-size: 12px;
    width: 60px;
    text-align: right;
}

.ability {
    position: relative;
    width: 80px;
    height: 80px;
    background-color: rgba(0, 0, 0, 0.6);
    border: 2px solid #4a90e2;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0 5px;
    pointer-events: auto;
}

.ability:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 10px rgba(74, 144, 226, 0.7);
}

.ability-icon {
    font-size: 30px;
}

.ability-key {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background-color: #4a90e2;
    color: white;
    font-size: 10px;
    width: 15px;
    height: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 3px;
}

.ability-cooldown {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    display: none;
}

.ability-activated {
    animation: ability-pulse 0.3s ease;
}

.ability-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    border: 1px solid #4a90e2;
    border-radius: 4px;
    padding: 10px;
    width: 200px;
    color: white;
    font-size: 12px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    margin-bottom: 10px;
    z-index: 100;
}

.ability:hover .ability-tooltip {
    opacity: 1;
    visibility: visible;
}

.tooltip-name {
    color: #4a90e2;
    font-weight: bold;
    margin-bottom: 5px;
}

.tooltip-description {
    margin-bottom: 5px;
}

.tooltip-cooldown {
    color: #aaa;
    font-style: italic;
}

/* Animations */
@keyframes ability-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); box-shadow: 0 0 15px rgba(74, 144, 226, 0.9); }
    100% { transform: scale(1); }
}

@keyframes cooldown-animation {
    0% { height: 100%; }
    100% { height: 0%; }
}

/* Wizard-specific styles */
.wizard-effect {
    position: absolute;
    pointer-events: none;
    z-index: 5;
}

/* Mobile adjustments for abilities */
@media (max-width: 768px) {
    .abilities-container {
        bottom: 150px;
        right: 10px;
        left: unset;
        transform: translateX(0);
    }
    
    .ability {
        width: 60px;
        height: 60px;
    }
    
    .ability-icon {
        font-size: 28px;
    }
}

/* Multiplayer UI Styles */

/* Login Screen */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.login-form {
  background-color: #2a2a2a;
  border-radius: 8px;
  padding: 30px;
  width: 300px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.login-form h2 {
  color: #ffffff;
  margin-bottom: 20px;
  font-size: 24px;
}

.login-form input {
  width: 100%;
  padding: 12px;
  margin-bottom: 20px;
  background-color: #3a3a3a;
  border: none;
  border-radius: 4px;
  color: #ffffff;
  font-size: 16px;
  box-sizing: border-box;
}

.login-form input:focus {
  outline: none;
  box-shadow: 0 0 0 2px #6565ff;
}

.login-form button {
  width: 100%;
  padding: 12px;
  background-color: #6565ff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: background-color 0.3s;
}

.login-form button:hover {
  background-color: #5252cc;
}

.login-form button:disabled {
  background-color: #4a4a4a;
  cursor: not-allowed;
}

.connection-error {
  color: #ff5555;
  margin-bottom: 15px;
  font-size: 14px;
}

/* Players List */
.players-list {
  position: fixed;
  top: 20px;
  left: 20px;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 8px;
  padding: 15px;
  min-width: 200px;
  z-index: 100;
}

.players-list h3 {
  color: #ffffff;
  margin: 0 0 10px 0;
  font-size: 16px;
  border-bottom: 1px solid #555;
  padding-bottom: 8px;
}

.players-list-container {
  max-height: 300px;
  overflow-y: auto;
}

.player-item {
  color: #ffffff;
  padding: 6px 0;
  border-bottom: 1px solid #333;
}

.player-item.local-player {
  color: #6565ff;
}

/* Reconnection Overlay */
.reconnection-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.reconnection-overlay div {
  color: #ffffff;
  font-size: 20px;
  margin-bottom: 20px;
}

.reconnection-overlay button {
  padding: 12px 24px;
  background-color: #6565ff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: background-color 0.3s;
}

.reconnection-overlay button:hover {
  background-color: #5252cc;
} 