/* MineDuel - Professional Game Styles */

:root {
    --primary: #00d4ff;
    --primary-dark: #0099cc;
    --secondary: #ff6b6b;
    --success: #4ecdc4;
    --warning: #ffd93d;
    --dark: #0a0a1a;
    --darker: #050510;
    --card: #151530;
    --card-light: #1e1e40;
    --text: #ffffff;
    --text-muted: #8888aa;
    --border: rgba(255, 255, 255, 0.1);
    --glow: 0 0 20px rgba(0, 212, 255, 0.3);
}

/* Power flash animation for opponent section */
@keyframes powerFlash {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
    100% {
        opacity: 0;
        transform: scale(1.2);
    }
}

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

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

body {
    font-family: 'Rajdhani', sans-serif;
    background: var(--darker);
    color: var(--text);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

#app {
    height: 100%;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Screen Management */
.screen {
    display: none;
    width: 100%;
    flex: 1;
    position: relative;
    overflow: auto;
}

.screen.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==================== MENU SCREEN ==================== */
.menu-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    padding-top: 70px; /* Space for fixed nav bar */
    background: radial-gradient(ellipse at center, var(--card) 0%, var(--darker) 100%);
}

.logo-container {
    text-align: center;
    margin-bottom: 40px;
}

.game-logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 42px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-shadow: var(--glow);
}

.logo-mine {
    font-size: 48px;
    animation: bounce 2s infinite;
}

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

.logo-text {
    color: var(--text);
}

.logo-duel {
    color: var(--primary);
    text-shadow: 0 0 30px var(--primary);
}

.tagline {
    color: var(--text-muted);
    font-size: 16px;
    margin-top: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.menu-content {
    width: 100%;
    max-width: 300px;
}

.player-name-input {
    margin-bottom: 20px;
}

.player-name-input label {
    display: block;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.player-name-input input {
    width: 100%;
    padding: 15px 20px;
    font-size: 18px;
    font-family: 'Rajdhani', sans-serif;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    outline: none;
    transition: all 0.3s ease;
}

.player-name-input input:focus {
    border-color: var(--primary);
    box-shadow: var(--glow);
}

.player-name-input input::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 30px;
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 700;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--dark);
    border-color: var(--primary);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    border-color: var(--text);
    background: rgba(255, 255, 255, 0.1);
}

.btn-large {
    width: 100%;
    padding: 20px;
    font-size: 18px;
}

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

.menu-stats {
    margin-top: 30px;
    display: flex;
    justify-content: center;
}

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

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

.stat-label {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
}

.stat-value {
    color: var(--primary);
    font-size: 20px;
    font-weight: 700;
}

.menu-footer {
    margin-top: 40px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ==================== MATCHMAKING SCREEN ==================== */
.matchmaking-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: radial-gradient(ellipse at center, var(--card) 0%, var(--darker) 100%);
}

.searching-animation {
    position: relative;
    width: 150px;
    height: 150px;
    margin-bottom: 30px;
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid var(--primary);
    border-radius: 50%;
    animation: pulse 2s ease-out infinite;
}

.pulse-ring.delay-1 { animation-delay: 0.5s; }
.pulse-ring.delay-2 { animation-delay: 1s; }

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

.search-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    animation: searchPulse 1.5s ease-in-out infinite;
}

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

.searching-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    color: var(--primary);
    margin-bottom: 10px;
}

.searching-subtext {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.search-timer {
    font-family: 'Orbitron', sans-serif;
    font-size: 32px;
    color: var(--text);
    margin-bottom: 30px;
}

/* ==================== GAME SCREEN ==================== */
#game-screen {
    background: linear-gradient(180deg, var(--dark) 0%, var(--darker) 100%);
    padding: 5px;
    gap: 5px;
    overflow-y: auto;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: var(--card);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.match-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    color: var(--warning);
}

.timer-icon {
    font-size: 18px;
}

.game-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    color: var(--text-muted);
}

.icon-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.icon-btn:hover {
    background: var(--card-light);
}

/* Player Sections */
.player-section {
    background: var(--card);
    border-radius: 10px;
    padding: 8px;
    border: 1px solid var(--border);
}

.opponent-section {
    border-color: var(--secondary);
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.1);
}

.player-section-main {
    flex: 1;
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.player-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 20px;
}

.player-avatar.opponent {
    background: linear-gradient(135deg, var(--secondary) 0%, #cc5555 100%);
}

.player-avatar.you {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.player-details {
    flex: 1;
}

.player-name-label {
    display: block;
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 2px;
}

.player-score {
    display: flex;
    align-items: center;
    gap: 5px;
}

.score-label {
    color: var(--text-muted);
    font-size: 14px;
}

.score-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    color: var(--warning);
}

.completion-bar {
    width: 60px;
    height: 6px;
    background: var(--dark);
    border-radius: 3px;
    overflow: hidden;
}

.completion-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success) 0%, var(--primary) 100%);
    width: 0%;
    transition: width 0.3s ease;
}

.shield-indicator {
    font-size: 28px;
    animation: shieldGlow 1.5s ease-in-out infinite;
}

@keyframes shieldGlow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.board-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
    background: #0a0a1a;
    border-radius: 10px;
}

.player-board {
    flex: 1;
}

.board-container canvas {
    border-radius: 8px;
    display: block;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

.opponent-board canvas {
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.2);
}

.board-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 150, 255, 0.7);
    border-radius: 8px;
    font-size: 32px;
    gap: 10px;
}

.frozen-overlay {
    background: rgba(0, 150, 255, 0.8);
    animation: frozenPulse 1s ease-in-out infinite;
}

.bot-thinking-overlay {
    background: rgba(150, 50, 255, 0.7);
    animation: botThinking 1.5s ease-in-out infinite;
}

@keyframes botThinking {
    0%, 100% { background: rgba(150, 50, 255, 0.7); }
    50% { background: rgba(100, 30, 200, 0.8); }
}

@keyframes frozenPulse {
    0%, 100% { background: rgba(0, 150, 255, 0.8); }
    50% { background: rgba(0, 150, 255, 0.6); }
}

.frozen-timer {
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
}

/* Powers Section */
.powers-section {
    background: var(--card);
    border-radius: 10px;
    padding: 8px;
    border: 1px solid var(--border);
}

.energy-display {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.energy-icon {
    font-size: 20px;
}

.energy-bar-main {
    flex: 1;
    height: 8px;
    background: var(--dark);
    border-radius: 4px;
    overflow: hidden;
}

.energy-fill-main {
    height: 100%;
    background: linear-gradient(90deg, var(--warning) 0%, #ffaa00 100%);
    width: 100%;
    transition: width 0.3s ease;
}

.energy-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    color: var(--warning);
    min-width: 35px;
    text-align: right;
}

/* Points Row - Container for points and notifications */
.points-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    width: 100%;
}

/* Points Display (replaces energy) */
.points-display {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--card-light), var(--dark));
    border-radius: 12px;
    border: 2px solid var(--success);
    flex-shrink: 0;
}

/* Power Notification */
.power-notification {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 15px;
    background: linear-gradient(135deg, var(--card-light), var(--dark));
    border-radius: 12px;
    border: 2px solid var(--primary);
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    color: var(--primary);
    min-height: 48px;
    flex: 1;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s, transform 0.3s;
}

.power-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.power-notification.freeze {
    border-color: #00bcd4;
    color: #00bcd4;
    background: linear-gradient(135deg, rgba(0, 188, 212, 0.2), var(--dark));
}

.power-notification.radar {
    border-color: #ff9800;
    color: #ff9800;
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.2), var(--dark));
}

.power-notification.shield {
    border-color: #4fc3f7;
    color: #4fc3f7;
    background: linear-gradient(135deg, rgba(79, 195, 247, 0.2), var(--dark));
}

.power-notification.safeburst {
    border-color: #e91e63;
    color: #e91e63;
    background: linear-gradient(135deg, rgba(233, 30, 99, 0.2), var(--dark));
}

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

.points-label {
    font-size: 14px;
    color: var(--text-muted);
}

.points-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 28px;
    color: var(--success);
    font-weight: 700;
    text-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

.points-change {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 700;
    margin-left: 10px;
    animation: pointsPopup 1.5s ease forwards;
}

.points-change.error {
    color: var(--secondary);
}

.points-change.success {
    color: var(--success);
}

@keyframes pointsPopup {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-10px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px) scale(0.8);
    }
}

/* Difficulty Selection */
.difficulty-selection {
    width: 100%;
    margin-bottom: 20px;
}

.difficulty-selection label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-muted);
}

.difficulty-buttons {
    display: flex;
    gap: 10px;
}

.difficulty-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 12px 10px;
    background: var(--card-light);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.difficulty-btn.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), transparent);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

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

.diff-name {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}

.diff-info {
    font-size: 11px;
    color: var(--text-muted);
}

.difficulty-display {
    margin-top: 10px;
    font-size: 14px;
    color: var(--primary);
}

.difficulty-display span {
    font-weight: 700;
    text-transform: uppercase;
}

/* Bot Difficulty Section */
.bot-difficulty-section {
    width: 100%;
    margin-top: 15px;
    padding: 20px;
    background: var(--card);
    border-radius: 16px;
    border: 1px solid var(--border);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bot-difficulty-section.hidden {
    display: none;
}

.bot-section-title {
    text-align: center;
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--primary);
}

.bot-difficulty-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.bot-diff-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 15px 10px;
    background: var(--card-light);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.bot-diff-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.bot-diff-btn.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), transparent);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

.bot-diff-icon {
    font-size: 28px;
}

.bot-diff-name {
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
}

.bot-diff-desc {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

#start-bot-game-btn {
    width: 100%;
    margin-bottom: 10px;
}

#cancel-bot-btn {
    width: 100%;
    padding: 8px;
    font-size: 14px;
}

.power-buttons {
    display: flex;
    gap: 8px;
}

.power-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 5px;
    background: var(--card-light);
    border: 2px solid var(--success);
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.power-btn.sabotage {
    border-color: var(--secondary);
}

.power-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.power-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.power-btn.power-exhausted {
    opacity: 0.3;
    background: var(--card) !important;
    border-color: var(--border) !important;
}

.power-btn .power-uses {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-dim);
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 4px;
    border-radius: 4px;
}

.power-btn.power-exhausted .power-uses {
    color: var(--secondary);
}

.power-btn .power-icon {
    font-size: 20px;
}

.power-btn .power-name {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.power-btn .power-cost {
    font-size: 10px;
    color: var(--warning);
}

/* ==================== MODAL ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: linear-gradient(135deg, var(--card) 0%, var(--dark) 100%);
    padding: 30px;
    border-radius: 20px;
    border: 2px solid var(--border);
    text-align: center;
    max-width: 350px;
    width: 90%;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.result-icon {
    font-size: 64px;
    margin-bottom: 15px;
    animation: bounce 1s ease infinite;
}

.result-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 32px;
    margin-bottom: 20px;
}

.result-title.victory {
    color: var(--success);
    text-shadow: 0 0 30px var(--success);
}

.result-title.defeat {
    color: var(--secondary);
}

.result-title.draw {
    color: var(--warning);
}

.result-scores {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.result-player {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.result-name {
    font-size: 14px;
    color: var(--text-muted);
}

.result-score {
    font-family: 'Orbitron', sans-serif;
    font-size: 28px;
}

.result-player.you .result-score {
    color: var(--primary);
}

.result-player.opponent .result-score {
    color: var(--secondary);
}

.result-vs {
    font-family: 'Orbitron', sans-serif;
    color: var(--text-muted);
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-actions .btn {
    width: 100%;
}

/* ==================== NOTIFICATIONS ==================== */
#notifications {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
    max-width: 300px;
}

.notification {
    background: var(--card);
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    animation: slideDown 0.4s ease, notifyOut 0.3s ease 2.7s forwards;
    pointer-events: auto;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notification.success {
    border-color: var(--success);
    color: var(--success);
}

.notification.error {
    border-color: var(--secondary);
    color: var(--secondary);
}

.notification.info {
    border-color: var(--primary);
    color: var(--primary);
}

@keyframes notifyIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes notifyOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* ==================== CONNECTION STATUS ==================== */
#connection-status {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card);
    padding: 10px 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
}

#connection-status.hidden {
    display: none;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--warning);
    animation: blink 1s ease infinite;
}

.status-dot.connected {
    background: var(--success);
    animation: none;
}

.status-dot.disconnected {
    background: var(--secondary);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ==================== UTILITIES ==================== */
.hidden {
    display: none !important;
}

/* ==================== MOBILE ACTION MENU ==================== */
.mobile-action-menu {
    position: static;
    display: none;
    gap: 6px;
    padding: 0;
    margin-left: auto;
    background: transparent;
    border-radius: 0;
    border: none;
    box-shadow: none;
    z-index: 1;
}

.mobile-action-menu:not(.hidden) {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-action-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3px;
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-action-btn span:first-child {
    font-size: 12px;
}

.mobile-action-btn.dig {
    background: linear-gradient(135deg, var(--success), #2d9d94);
    color: white;
}

.mobile-action-btn.flag {
    background: linear-gradient(135deg, var(--warning), #cc9900);
    color: #333;
}

.mobile-action-btn.cancel {
    background: linear-gradient(135deg, #666, #444);
    color: white;
}

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

/* Mobile cell highlight */
.mobile-selected-cell {
    position: fixed;
    border: 3px solid var(--primary);
    border-radius: 4px;
    pointer-events: none;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.6);
    animation: pulse 1s ease infinite;
    z-index: 999;
    background: rgba(0, 212, 255, 0.2);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 15px rgba(0, 212, 255, 0.6); }
    50% { box-shadow: 0 0 25px rgba(0, 212, 255, 0.9); }
}

/* Responsive */
@media (max-height: 700px) {
    .opponent-board canvas {
        max-height: 140px;
    }
    
    .power-btn {
        padding: 8px 4px;
    }
    
    .power-btn .power-icon {
        font-size: 16px;
    }
}

@media (max-width: 360px) {
    .game-logo {
        font-size: 32px;
    }
    
    .logo-mine {
        font-size: 36px;
    }
}

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

/* Phones - Portrait (max-width: 480px) */
@media (max-width: 480px) {
    html, body {
        height: 100dvh;
        overflow: hidden;
    }
    
    #app {
        max-width: 100%;
        height: 100dvh;
        overflow: hidden;
    }
    
    .game-screen {
        height: 100%;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    
    .game-screen .game-header {
        order: 0;
        flex-shrink: 0;
    }
    
    /* REORDER with flexbox order */
    /* Opponent section (ENEMY board) - TOP */
    .opponent-section {
        order: 1 !important;
        padding: 4px 6px;
        flex-shrink: 0;
        background: var(--card);
        border-radius: 8px;
    }
    
    /* Powers section - MIDDLE */
    .powers-section {
        order: 2 !important;
        padding: 4px 6px;
        flex-shrink: 0;
    }
    
    /* Player section (MY board) - BOTTOM and BIGGEST */
    .player-section-main {
        order: 3 !important;
        padding: 4px;
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }
    
    /* Player (MY) board - MAXIMIZE */
    .player-section-main .player-info {
        display: flex !important;
        align-items: center;
        padding: 8px 10px;
        margin-bottom: 4px;
        flex-shrink: 0;
        background: rgba(21, 21, 48, 0.8);
        border-radius: 8px;
        border: 1px solid var(--primary);
        gap: 8px;
    }
    
    .player-section-main .player-avatar {
        width: 28px;
        height: 28px;
        font-size: 14px;
        flex-shrink: 0;
    }
    
    .player-section-main .player-details {
        display: flex;
        flex-direction: column;
        gap: 0;
        min-width: 60px;
    }
    
    .player-section-main .player-name-label {
        font-size: 12px;
        font-weight: 600;
    }
    
    .player-section-main .player-score {
        display: flex !important;
        gap: 4px;
        font-size: 11px;
    }
    
    .player-section-main .player-score .score-label {
        opacity: 0.7;
    }
    
    .player-section-main .player-score .score-value {
        font-size: 12px;
        font-weight: 700;
        color: var(--success);
    }
    
    .board-container.player-board {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 0;
        padding: 4px;
        overflow: hidden;
    }
    
    #player-canvas {
        width: auto !important;
        height: auto !important;
        max-width: calc(100vw - 40px);
        max-height: calc(100dvh - 420px);
        aspect-ratio: 1;
        object-fit: contain;
    }
    
    /* Opponent (ENEMY) section - show info, hide board on small screens */
    .opponent-section .player-info {
        padding: 0;
        margin-bottom: 0;
    }
    
    .opponent-section .player-avatar {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    
    .opponent-section .player-name-label,
    .opponent-name {
        font-size: 12px;
    }
    
    .opponent-section .player-score .score-value {
        font-size: 14px;
    }
    
    /* Hide opponent board on very small screens */
    .board-container.opponent-board {
        display: none !important;
    }
    
    .opponent-section .completion-bar {
        display: none;
    }
    
    /* Powers section - compact inline */
    .points-row {
        flex-direction: row;
        gap: 4px;
        margin-bottom: 4px;
    }
    
    .points-display {
        padding: 4px 8px;
    }
    
    .points-icon {
        font-size: 14px;
    }
    
    .points-label {
        font-size: 9px;
    }
    
    .points-value {
        font-size: 18px;
    }
    
    .power-notification {
        flex: 1;
        min-height: 28px;
        font-size: 10px;
        padding: 4px 6px;
    }
    
    .power-buttons {
        gap: 4px;
    }
    
    .power-btn {
        padding: 4px 2px;
    }
    
    .power-btn .power-icon {
        font-size: 14px;
    }
    
    .power-btn .power-name {
        font-size: 8px;
    }
    
    .power-btn .power-cost {
        font-size: 7px;
    }
    
    /* Top nav compact */
    .top-nav {
        padding: 6px 10px;
        min-height: 40px;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }
    
    .nav-logo {
        font-size: 12px !important;
    }
    
    .nav-timer {
        font-size: 11px !important;
        padding: 3px 6px !important;
    }
    
    .nav-btn {
        padding: 4px 8px;
        font-size: 10px;
    }
    
    #user-section .btn-primary {
        padding: 4px 10px;
        font-size: 10px;
    }
    
    /* Game header compact */
    .game-header {
        padding: 4px 8px;
        min-height: 32px;
    }
    
    .match-timer {
        font-size: 14px;
    }
    
    .game-title {
        font-size: 14px;
    }
}

/* Medium phones - show small opponent board if space */
@media (min-width: 380px) and (max-width: 480px) and (min-height: 700px) {
    .board-container.opponent-board {
        display: flex !important;
        justify-content: center;
        margin-top: 4px;
    }
    
    #opponent-canvas {
        max-width: 100px !important;
        max-height: 100px !important;
    }
    
    .opponent-section .completion-bar {
        display: block;
        height: 3px;
        margin-top: 4px;
    }
}
}

/* Tablets - Portrait & Small Laptops (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    #app {
        max-width: 100%;
    }
    
    .game-layout {
        padding: 8px;
        gap: 8px;
    }
    
    /* Show opponent board but smaller */
    .opponent-board canvas {
        max-height: 120px;
        max-width: 120px;
    }
    
    .power-btn {
        padding: 10px 8px;
    }
    
    /* Larger player board */
    #player-canvas {
        max-width: 400px;
        max-height: 400px;
    }
}

/* Tablets - Landscape & Large Tablets (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    #app {
        max-width: 600px;
    }
    
    .game-layout {
        padding: 10px;
        gap: 10px;
    }
    
    .opponent-board canvas {
        max-height: 160px;
        max-width: 160px;
    }
    
    #player-canvas {
        max-width: 450px;
        max-height: 450px;
    }
}

/* Desktop (1025px+) - Default styles apply */

/* Touch device specific - action menu visibility */
@media (pointer: coarse) {
    .mobile-action-menu {
        /* Show on touch devices */
    }
}

@media (pointer: fine) {
    .mobile-action-menu {
        display: none !important;
    }
}

/* Small phones (max-width: 380px) */
@media (max-width: 380px) {
    .points-value {
        font-size: 18px;
    }
    
    .power-btn .power-icon {
        font-size: 14px;
    }
    
    #player-canvas {
        max-width: calc(100vw - 30px);
        max-height: calc(100dvh - 400px);
    }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .board-container.opponent-board {
        display: none !important;
    }
    
    .game-layout {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .opponent-section {
        width: 100%;
        order: 1;
    }
    
    .powers-section {
        width: 30%;
        order: 2;
    }
    
    .player-section {
        width: 65%;
        order: 3;
    }
    
    #player-canvas {
        max-height: calc(100dvh - 100px);
    }
}

/* ==================== TOP NAVIGATION ==================== */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--card);
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
}

/* Hide nav bar when not in menu */
.top-nav.hidden {
    display: none !important;
}

.nav-left {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.nav-left .nav-logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.nav-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.nav-timer {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--warning);
    background: var(--dark);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--warning);
}

.nav-timer.hidden {
    display: none;
}

.nav-timer.danger {
    color: var(--secondary);
    border-color: var(--secondary);
    animation: timerPulse 0.5s ease infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: var(--card-light);
    border-color: var(--primary);
}

/* ==================== USER SECTION ==================== */
#user-section {
    display: flex;
    align-items: center;
}

#user-section .btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    color: var(--dark);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

#user-section .btn-primary:hover {
    transform: scale(1.05);
    box-shadow: var(--glow);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    font-size: 20px;
}

.user-name {
    font-weight: 600;
    color: var(--primary);
}

.btn-small {
    background: var(--card-light);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    transition: all 0.3s ease;
}

.btn-small:hover {
    background: var(--primary);
    color: var(--dark);
}

.btn-small.secondary {
    background: transparent;
}

.btn-small.secondary:hover {
    background: var(--secondary);
    border-color: var(--secondary);
}

/* ==================== MODAL BASE ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--card);
    border-radius: 16px;
    padding: 30px;
    max-width: 450px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 5px;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--secondary);
}

/* ==================== AUTH MODAL ==================== */
.auth-modal-content h2 {
    text-align: center;
    margin-bottom: 25px;
    font-size: 24px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 25px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-tab.active {
    background: var(--primary);
    color: var(--dark);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-form.hidden {
    display: none;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 14px;
}

.form-group input {
    background: var(--darker);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-error {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid var(--secondary);
    color: var(--secondary);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}

.form-error.hidden {
    display: none;
}

.auth-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    color: var(--dark);
    padding: 14px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-btn:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: var(--glow);
}

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 14px;
}

.link-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    text-decoration: underline;
}

/* ==================== PROFILE MODAL ==================== */
.profile-modal-content {
    max-width: 500px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.profile-avatar {
    font-size: 50px;
    background: var(--card-light);
    padding: 15px;
    border-radius: 50%;
}

.profile-info h2 {
    color: var(--primary);
    font-size: 24px;
    margin-bottom: 5px;
}

.profile-email {
    color: var(--text-muted);
    font-size: 14px;
}

.profile-date {
    color: var(--text-muted);
    font-size: 12px;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--card-light);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border);
}

.stat-card .stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 5px;
}

.stat-card .stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
}

.stat-card.win .stat-value {
    color: var(--success);
}

.stat-card.loss .stat-value {
    color: var(--secondary);
}

.profile-games h3 {
    margin-bottom: 15px;
    font-size: 18px;
}

.games-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
}

.game-history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--card-light);
    border-radius: 10px;
    border-left: 3px solid var(--text-muted);
    font-size: 14px;
}

.game-history-item.win {
    border-left-color: var(--success);
}

.game-history-item.loss {
    border-left-color: var(--secondary);
}

.game-history-item.draw {
    border-left-color: var(--warning);
}

.game-history-item .result {
    font-weight: 600;
    min-width: 100px;
}

.game-history-item .opponent {
    color: var(--text-muted);
    flex: 1;
}

.game-history-item .score {
    font-weight: 600;
    color: var(--primary);
}

.game-history-item .difficulty {
    background: var(--darker);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    text-transform: uppercase;
}

.game-history-item .date {
    color: var(--text-muted);
    font-size: 12px;
}

.no-games {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
}

/* ==================== LEADERBOARD MODAL ==================== */
.leaderboard-modal-content {
    max-width: 550px;
}

.leaderboard-modal-content h2 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 24px;
}

.leaderboard-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.lb-tab {
    flex: 1;
    min-width: 80px;
    padding: 10px;
    background: var(--card-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lb-tab.active {
    background: var(--primary);
    color: var(--dark);
    border-color: var(--primary);
}

.leaderboard-container {
    max-height: 400px;
    overflow-y: auto;
}

.leaderboard-container .loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

#leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

#leaderboard-table th {
    background: var(--darker);
    padding: 12px 10px;
    text-align: left;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    position: sticky;
    top: 0;
}

#leaderboard-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

#leaderboard-table tr:hover {
    background: var(--card-light);
}

#leaderboard-table tr.current-user {
    background: rgba(0, 212, 255, 0.1);
}

#leaderboard-table .rank {
    font-weight: 700;
    width: 50px;
}

#leaderboard-table .player {
    display: flex;
    align-items: center;
    gap: 8px;
}

#leaderboard-table .player-avatar {
    font-size: 18px;
}

#leaderboard-table .player-name {
    font-weight: 600;
}

#leaderboard-table .rating {
    color: var(--primary);
    font-weight: 700;
}

#leaderboard-table .wins {
    color: var(--success);
}

#leaderboard-table .losses {
    color: var(--secondary);
}

#leaderboard-table .winrate {
    color: var(--warning);
}

/* ==================== NOTIFICATIONS ==================== */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    padding: 15px 40px 15px 20px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    animation: slideIn 0.3s ease;
    max-width: 300px;
}

.notification.success {
    border-left: 4px solid var(--success);
}

.notification.error {
    border-left: 4px solid var(--secondary);
}

.notification.info {
    border-left: 4px solid var(--primary);
}

.notification button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ==================== AUTH MODAL ==================== */
.auth-modal-content {
    max-width: 350px;
    width: 90%;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
}

.modal-close:hover {
    color: var(--text);
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
}

.modal-subtitle {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 20px;
    font-size: 14px;
}

.btn-google {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    background: white;
    color: #333;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-google:hover {
    background: #f5f5f5;
    transform: translateY(-2px);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    padding: 0 10px;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab.active {
    background: var(--primary);
    color: var(--dark);
    border-color: var(--primary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form input {
    padding: 12px;
    background: var(--dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ==================== LEADERBOARD MODAL ==================== */
.leaderboard-modal-content {
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
}

.leaderboard-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.lb-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.lb-tab.active {
    background: var(--primary);
    color: var(--dark);
    border-color: var(--primary);
}

.leaderboard-list {
    max-height: 400px;
    overflow-y: auto;
}

.leaderboard-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.lb-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.lb-item:last-child {
    border-bottom: none;
}

.lb-rank {
    font-size: 18px;
    font-weight: 700;
    min-width: 30px;
    color: var(--text-muted);
}

.lb-rank.gold { color: #FFD700; }
.lb-rank.silver { color: #C0C0C0; }
.lb-rank.bronze { color: #CD7F32; }

.lb-name {
    flex: 1;
    font-weight: 600;
}

.lb-score {
    font-weight: 700;
    color: var(--primary);
}

.lb-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* ==================== PROFILE MODAL ==================== */
.profile-modal-content {
    max-width: 400px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--card-light);
    border-radius: 12px;
    margin-bottom: 20px;
}

.profile-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
}

.profile-info h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-email {
    font-size: 12px;
    color: var(--text-muted);
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.profile-stat {
    background: var(--card-light);
    padding: 12px 8px;
    border-radius: 10px;
    text-align: center;
}

.profile-stat .stat-value {
    font-size: 22px;
    font-weight: 700;
    display: block;
    color: var(--primary);
}

.profile-stat.wins .stat-value {
    color: var(--success);
}

.profile-stat.losses .stat-value {
    color: var(--secondary);
}

.profile-stat .stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.match-history-section {
    margin-bottom: 20px;
}

.match-history-section h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--text-muted);
}

.match-history-list {
    max-height: 200px;
    overflow-y: auto;
    background: var(--card-light);
    border-radius: 10px;
}

.match-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.match-history-item:last-child {
    border-bottom: none;
}

.match-result {
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.match-result.win {
    background: rgba(78, 205, 196, 0.2);
    color: var(--success);
}

.match-result.loss {
    background: rgba(255, 107, 107, 0.2);
    color: var(--secondary);
}

.match-result.draw {
    background: rgba(255, 217, 61, 0.2);
    color: var(--warning);
}

.match-opponent {
    flex: 1;
    margin-left: 10px;
    font-size: 13px;
}

.match-score {
    font-size: 13px;
    color: var(--text-muted);
}

.match-date {
    font-size: 11px;
    color: var(--text-muted);
}

.match-history-loading,
.match-history-empty {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
}

/* First Login Modal */
.first-login-content {
    text-align: center;
    padding: 40px 30px;
}

.first-login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 25px;
}

.first-login-input {
    width: 100%;
    padding: 15px 20px;
    font-size: 18px;
    text-align: center;
    background: var(--card);
    border: 2px solid var(--primary);
    border-radius: 10px;
    color: var(--text);
    outline: none;
}

.first-login-input:focus {
    box-shadow: var(--glow);
}

.btn-large {
    padding: 15px 30px;
    font-size: 18px;
}

/* Profile Name Edit */
.profile-name-edit {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-name-input {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text);
    font-size: 18px;
    font-weight: 600;
    width: 150px;
}

.profile-name-input:focus {
    border-color: var(--primary);
    outline: none;
}

.btn-save-name {
    background: var(--primary);
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.btn-save-name:hover {
    transform: scale(1.1);
}

/* Locked name for logged-in users */
.player-name-input.locked {
    opacity: 0.7;
}

.player-name-input.locked input {
    pointer-events: none;
    background: var(--card);
}

.player-name-input.locked::after {
    content: '🔒';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}