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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    overflow: hidden;
}

#root {
    width: 100%;
    max-width: 600px;
    height: 100vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
#header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

#header h1 {
    font-size: 1.7em;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

/* Main Body Styles */
.body {
    flex: 1;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
}

/* Score Display */
.score {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 10px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.score h1 {
    font-size: 3.8em;
    color: #667eea;
    font-weight: 700;
    margin-bottom: 5px;
}

.score h3 {
    font-size: 1.9em;
    color: #764ba2;
    font-weight: 500;
}

.require-Box {
    display: none;
}

.require-box-content {
    background: #dbeafe;  /* light blue */
    padding: 10px 15px;
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.9em;
    color: #1e3a8a;
    position: relative;
    margin-top: auto;
    flex-wrap: wrap;
    min-height: 50px;
}

#requireBox {
    background: #dbeafe;  /* light blue */
    padding: 10px 15px;
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.9em;
    color: #1e3a8a;
    position: relative;
    margin-top: auto;
    flex-wrap: wrap;
    min-height: 50px;
}

.require-value {
    background: #6b7280; /* gray */
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95em;
}

#requiredRuns,
#requiredBalls {
    background: #6b7280; /* gray */
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95em;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #4b5563;
    cursor: pointer;
    padding: 0;
    position: absolute;
    right: 10px;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

#closeRequireBox {
    background: none;
    border: none;
    font-size: 20px;
    color: #4b5563;
    cursor: pointer;
    padding: 0;
    position: absolute;
    right: 10px;
    flex-shrink: 0;
}

#closeRequireBox:hover,
.close-btn:hover {
    color: #1f2937;
}

#resultMessage.show{
    background: #dbeafe;  /* light blue */
    padding: 10px 15px;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 1.1em;
    font-family: Georgia, 'Times New Roman', Times, serif;
    color: #1e3a8a;
    position: relative;
    margin-top: auto;
    flex-wrap: wrap;
}


/* Popup Styles */
.popupTarget {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.popupTarget.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

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

@keyframes slideIn {
    from {
        transform: scale(0.85) translateY(-30px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.popup-content {
    background: white;
    padding: 40px 30px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: slideIn 0.4s ease;
    z-index: 1001;
}

.popup-content h3 {
    font-size: 1.8em;
    color: #667eea;
    font-weight: 700;
    text-align: center;
    margin-bottom: 10px;
}

.popup-input {
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1em;
    transition: all 0.3s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
}

.popup-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: #f0f4ff;
}

.popup-input::placeholder {
    color: #a0aec0;
}

.popup-content input {
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1em;
    transition: all 0.3s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
}

.popup-content input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: #f0f4ff;
}

.popup-content input::placeholder {
    color: #a0aec0;
}

.popup-btn {
    padding: 14px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.popup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.popup-btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

#submitTarget {
    padding: 14px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

#submitTarget:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

#submitTarget:active {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

/* Live Status Buttons */
.liveStatus {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 11px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 15px;
    align-items: stretch;
    flex-shrink: 0;
}

.liveStatusButtons {
    padding: 13px 8px;
    border: none;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: 600;
    cursor: default;
    background: #e8eef7;
    color: #667eea;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    pointer-events: none;
}

/* Operation Buttons */
.operations {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 11px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 15px;
    flex-shrink: 0;
}

.operationButtons {
    padding: 13px 8px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 10px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.operationButtons:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.operationButtons:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(102, 126, 234, 0.4);
}

/* Special button styling for specific operations */
#DOT_Button {
    background: #f0f0f0;
    border-color: #999;
    color: #333;
}

#DOT_Button:hover {
    background: #999;
    color: white;
}

#WIDE_Button {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

#WIDE_Button:hover {
    background: #ffc107;
    color: white;
}

#NO_BALL_Button {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

#NO_BALL_Button:hover {
    background: #dc3545;
    color: white;
}

#WICKET_Button {
    background: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

#WICKET_Button:hover {
    background: #17a2b8;
    color: white;
}

#UNDO_Button {
    background: #e2e3e5;
    border-color: #6c757d;
    color: #383d41;
}

#UNDO_Button:hover {
    background: #6c757d;
    color: white;
}

#Scoreboard_Button, #Target_Mode_Button {
    grid-column: span 1.5;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

#Scoreboard_Button:hover, #Target_Mode_Button:hover {
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.6);
}

/* CSS of ScoreBoard Popup  */
#popupScoreBoard {
    display: none;
}

#popupScoreBoard.active {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
    padding: 0; /* Override previous padding */
}

#popupScoreBoard .popup-content {
    width: 90%;
    max-width: 800px; /* Increased max-width for scoreboard */
    max-height: 80vh;
    overflow-y: auto;
}

#popupScoreBoard table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

#popupScoreBoard th,
#popupScoreBoard td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
}

#popupScoreBoard th {
    background-color: #f8f9fa;
    color: #667eea;
    font-weight: 600;
}

#popupScoreBoard tr:last-child td {
    border-bottom: none;
}

/* Footer Styles */
#footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 13px;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

#footer h6 {
    font-size: 0.75em;
    font-weight: 500;
    letter-spacing: 1px;
}

/* Responsive Design */
@media (max-width: 480px) {
    #header h1 {
        font-size: 1.8em;
    }

    .score h1 {
        font-size: 2.5em;
    }

    .score h3 {
        font-size: 1.1em;
    }

    .operations {
        grid-template-columns: repeat(2, 1fr);
    }

    #Scoreboard_Button, #Target_Mode_Button {
        grid-column: span 1;
    }
}

