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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #ffffff;
    min-height: 100vh;
    padding: 20px;
    padding-top: 80px; /* Space for mobile header */
}

/* ==================== MOBILE STICKY HEADER ==================== */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(30, 60, 114, 0.98);
    backdrop-filter: blur(10px);
    padding: 10px 15px;
    z-index: 1000;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    align-items: center;
}

.mobile-fighter {
    text-align: center;
}

.mobile-fighter-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 3px;
    opacity: 0.9;
}

.mobile-score {
    font-size: 1.8rem;
    font-weight: 700;
}

.mobile-countdown {
    font-size: 1rem;
    font-weight: 700;
    color: #4CAF50;
    margin-top: 3px;
    animation: countdown-pulse 1s infinite;
}

.mobile-timer {
    text-align: center;
}

.mobile-round {
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0.8;
    margin-bottom: 2px;
}

.mobile-time {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

@media (max-width: 768px) {
    .mobile-header {
        display: grid;
    }
}

/* ==================== MAIN LAYOUT ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.match-status {
    font-size: 1.2rem;
    opacity: 0.9;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* ==================== FIGHTER CARDS ==================== */
.fighter-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    border: 3px solid transparent;
    transition: all 0.3s ease;
}

.fighter-card.fighter-a {
    border-color: #4CAF50;
}

.fighter-card.fighter-b {
    border-color: #FF5722;
}

.fighter-card.in-control {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.4);
    transform: scale(1.02);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-font-smoothing: subpixel-antialiased;
}

.fighter-name {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.fighter-score {
    font-size: 4rem;
    font-weight: 700;
    margin: 20px 0;
}

.fighter-countdown {
    font-size: 2rem;
    font-weight: 700;
    color: #4CAF50;
    margin: 10px 0;
    animation: countdown-pulse 1s infinite;
    min-height: 2.5rem;
}

.rounds-won {
    font-size: 1.2rem;
    margin-top: 15px;
}

.rounds-indicator {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.round-dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.round-dot.won {
    background: #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.6);
}

/* ==================== TIMER SECTION ==================== */
.timer-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 40px;
    text-align: center;
}

.round-info {
    font-size: 1.5rem;
    margin-bottom: 20px;
    opacity: 0.9;
}

.timer {
    font-size: 6rem;
    font-weight: 700;
    margin: 30px 0 10px 0;
    font-family: 'Courier New', monospace;
}

.timer.rest {
    color: #FFC107;
}

.timer.warning {
    color: #FF5722;
    animation: pulse 1s infinite;
}

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

@keyframes countdown-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* ==================== BUTTONS ==================== */
.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

button {
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-secondary {
    background: #2196F3;
    color: white;
}

.btn-warning {
    background: #FFC107;
    color: #333;
}

.btn-danger {
    background: #FF5722;
    color: white;
}

.btn-fighter-a {
    background: #4CAF50;
    color: white;
}

.btn-fighter-b {
    background: #FF5722;
    color: white;
}

.btn-neutral {
    background: #607D8B;
    color: white;
}

.btn-active {
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.key-hint {
    display: block;
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 5px;
    font-weight: normal;
}

/* ==================== CONTROLS ==================== */
.controls {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    margin-top: 20px;
}

.control-section {
    margin-bottom: 25px;
}

.control-section:last-child {
    margin-bottom: 0;
}

.control-section h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    opacity: 0.9;
}

.keyboard-hint {
    font-size: 0.9rem;
    opacity: 0.7;
    font-weight: normal;
}

.keyboard-shortcuts {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.9rem;
}

.keyboard-shortcuts strong {
    width: 100%;
    margin-bottom: 5px;
}

.keyboard-shortcuts span {
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 10px;
    border-radius: 5px;
}

/* ==================== ROUND HISTORY ==================== */
.round-history {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
}

.round-history h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.history-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item:last-child {
    margin-bottom: 0;
}

/* ==================== MATCH WINNER ==================== */
.match-winner {
    background: rgba(76, 175, 80, 0.2);
    border: 3px solid #4CAF50;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    margin-top: 20px;
}

.match-winner h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

/* ==================== MODAL ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-radius: 15px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.8rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 30px;
}

.settings-section {
    margin-bottom: 30px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    opacity: 0.9;
}

.input-group {
    margin-bottom: 15px;
}

.input-group:last-child {
    margin-bottom: 0;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    opacity: 0.9;
}

.input-group input {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transition: all 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: #4CAF50;
    background: rgba(255, 255, 255, 0.15);
}

.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.modal-footer {
    padding: 20px 30px;
    border-top: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Round Ending Modal */
.round-end-modal .modal-content {
    max-width: 400px;
}

.round-end-modal .modal-body {
    padding: 40px;
    text-align: center;
}

.round-end-modal h3 {
    font-size: 1.5rem;
    margin-bottom: 30px;
}

.round-end-modal .button-group {
    flex-direction: column;
}

.round-end-modal button {
    width: 100%;
    font-size: 1.2rem;
    padding: 20px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 968px) {
    .main-grid {
        grid-template-columns: 1fr;
    }

    .timer {
        font-size: 4rem;
    }

    .fighter-score {
        font-size: 3rem;
    }

    .header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 15px;
        padding-top: 70px;
    }

    .timer {
        font-size: 3rem;
    }

    .control-countdown {
        font-size: 2rem;
    }

    button {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    .keyboard-shortcuts {
        font-size: 0.8rem;
    }
}
