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

html {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    /* Handle safe areas for notched phones */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

/* Player Container - Each takes 50% height */
.player-container {
    position: relative;
    width: 100%;
    height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

/* Player 1 is rotated 180 degrees */
#player1 {
    transform: rotate(180deg);
    background-color: #F0E68C; /* White mana default */
}

#player2 {
    background-color: #4169E1; /* Blue mana default */
}

/* Center Content - Life Display and Color Button */
.center-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 1;
}

/* Player Name */
.player-name {
    font-size: 8vw;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 15px rgba(0,0,0,0.5);
    user-select: none;
    text-align: center;
    opacity: 0.9;
}

/* Life Display */
.life-display {
    font-size: 20vw;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 20px rgba(0,0,0,0.5);
    user-select: none;
    text-align: center;
}

/* Plus/Minus Buttons */
.life-btn {
    position: absolute;
    width: 25vw;
    height: 80%;
    font-size: 15vw;
    font-weight: bold;
    border: none;
    background: rgba(0,0,0,0.2);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
    -webkit-touch-callout: none;
}

.life-btn:active {
    background: rgba(0,0,0,0.4);
}

.life-btn.minus {
    left: 0;
    border-right: 2px solid rgba(255,255,255,0.3);
}

.life-btn.plus {
    right: 0;
    border-left: 2px solid rgba(255,255,255,0.3);
}

/* Color Button */
.color-btn {
    width: 45px;
    height: 45px;
    font-size: 20px;
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 50%;
    background: rgba(0,0,0,0.3);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.color-btn:active {
    background: rgba(0,0,0,0.5);
}

/* Reset Button (Center) */
.reset-btn {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    font-size: 32px;
    border: 3px solid rgba(255,255,255,0.8);
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
    color: #fff;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s;
}

.reset-btn:active {
    background: rgba(0,0,0,0.9);
    transform: translate(-50%, -50%) scale(0.95);
}

/* Menu Button (Middle Left) */
.menu-btn {
    position: fixed;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    font-size: 28px;
    border: 3px solid rgba(255,255,255,0.8);
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
    color: #fff;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s;
}

.menu-btn:active {
    background: rgba(0,0,0,0.9);
    transform: translateY(-50%) scale(0.95);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #2c2c2c;
    border-radius: 15px;
    padding: 30px;
    min-width: 280px;
    text-align: center;
}

.modal-content h2 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 24px;
}

.color-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.color-option {
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    cursor: pointer;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    transition: transform 0.2s;
}

.color-option:active {
    transform: scale(0.95);
}

.modal-close {
    padding: 12px 30px;
    font-size: 16px;
    background: #555;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-close:active {
    background: #666;
}

/* Menu Options */
.menu-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.menu-option {
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    cursor: pointer;
    color: #fff;
    background: #444;
    transition: transform 0.2s;
}

.menu-option:active {
    transform: scale(0.95);
}

/* Prevent text selection and touch callouts */
body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
