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

/* Body styling */
body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f8ff;
    color: #333;
    line-height: 1.6;
    padding: 20px;
    margin: 0;
}

/* Container styling */
.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    position: relative;
    overflow: visible;
    box-sizing: border-box;
}

/* Header styling */
.header {
    margin-bottom: 20px;
}

#greeting {
    color: #2ecc71;
    font-size: 24px;
    margin-bottom: 10px;
    font-weight: bold;
}

.subheading {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 10px;
    font-style: italic;
}

/* Table selection styling */
.table-selection {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-bottom: 20px;
    text-align: center;
}

.table-selection .button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 120px;
    text-align: center;
    position: relative;
}

.table-selection button {
    padding: 5px;
    border: none;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 5px;
    position: relative;
    overflow: visible;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
    min-height: 40px;
    max-width: 120px;
    margin: 0;
    width: 120px;
}

.table-selection button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.table-selection .stats-box {
    background-color: #cce0ff; /* Light blue-grey color */
    color: white;
    padding: 5px;
    border-radius: 0 0 5px 5px;
    margin-top: 5px;
    width: 100%;
    display: flex;
    justify-content: flex-start;
    text-align: left;
    min-height: 40px;
    width: 120px;
    margin: 0;
}

.table-selection .stats-box .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px;
}

.table-selection .stats-box .stat-icon {
    font-size: 18px;
}

.table-selection .stats-box .stat-value {
    font-size: 14px;
    font-weight: bold;
    margin-right: 10px;
}

.table-selection .stats-box .stat-value.no-score {
    font-size: 10px;
}

.table-selection .stats-box .stat-label {
    font-size: 10px;
    color: #fff;
    opacity: 0.8;
}

.table-selection .time {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 5px;
    opacity: 0.7;
}

/* Game container styling */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.question-timer-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
}

/* Input styling */
#answer {
    width: 20%;
    padding: 10px;
    margin: 10px auto;
    font-size: 24px;
    border: 2px solid #ddd;
    border-radius: 5px;
    text-align: center;
}

/* Button styling */
button {
    width: 100%;
    padding: 15px;
    margin: 10px 0;
    background-color: #2ecc71;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 18px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #27ae60;
}

button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

/* Question styling */
#question {
    font-size: 24px;
    margin: 20px 0;
    color: #2c3e50;
    text-align: center;
}

/* Question count styling */
#question-count {
    font-size: 14px;
    color: #7f8c8d;
    pointer-events: none;
    z-index: 10;
    margin: 10px;
    padding: 5px 10px;
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}

/* Feedback styling */
#feedback {
    margin-top: 20px;
    font-size: 18px;
    font-weight: bold;
}

/* Results container styling */
.results-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 5px 5px 0 0;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: 0 auto;
}

.results-container .trophy-icon {
    font-size: 48px;
    color: gold;
    margin-bottom: 10px;
}

.results-container h2 {
    color: #2ecc71;
    margin-bottom: 20px;
    font-size: 24px;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    width: 100%;
    margin-bottom: 20px;
}

.stat {
    display: flex;
    align-items: center;
    padding: 15px;
    border-radius: 5px 5px 0 0;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    position: relative;
 }

/* Settings icon styling */
.settings-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    cursor: pointer;
    color: #7f8c8d;
    transition: color 0.3s;
    pointer-events: auto;
    overflow: visible;
    z-index: 100;
    box-sizing: content-box;
    margin: 0;
    padding: 0;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
}

.settings-icon:hover {
    color: #3498db;
}

/* Color picker modal styling */
.color-picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.color-picker-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.color-picker-content h3 {
    margin-bottom: 20px;
    font-size: 20px;
    color: #333;
}

.color-picker-content .color-option {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
    transition: transform 0.2s;
}

.color-picker-content .color-option:hover {
    transform: scale(1.05);
}

.color-picker-content .color-option .color-box {
    width: 30px;
    height: 30px;
    border-radius: 5px;
    margin-right: 10px;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.color-picker-content .color-option .color-name {
    font-size: 16px;
    color: #333;
}

.color-picker-content .color-option .color-name.selected {
    font-weight: bold;
    color: #3498db;
}

.color-picker-content button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
    margin-top: 20px;
}

.color-picker-content button:hover {
    background-color: #2980b9;
}

.stat:hover {
    transform: translateY(-5px);
}

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

.stat-value {
    font-size: 24px;
    font-weight: bold;
    margin-right: 10px;
}

.stat-label {
    font-size: 16px;
    color: #7f8c8d;
}

.stat.correct {
    background-color: #e8f5e9;
    color: #2b9b5b;
}

.new-score-text {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: #ffeb3b;
    color: #333;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transform: rotate(15deg);
    z-index: 10;
}

.stat.wrong {
    background-color: #ffebee;
    color: #e74c3c;
}

.stat.score {
    background-color: #e3f2fd;
    color: #3498db;
}

.stat.best {
    background-color: #fff8e1;
    color: #a49620;
}

.stat.time {
    background-color: #f3e5f5;
    color: #9c27b0;
}

.results-container button {
    background-color: #2ecc71;
    padding: 15px 30px;
    font-size: 18px;
    border-radius: 30px;
    transition: background-color 0.3s, transform 0.2s;
    margin-top: 20px;
}

.results-container button:hover {
    background-color: #27ae60;
    transform: translateY(-3px);
}

/* Time display styling */
#time-display {
    font-size: 14px;
    color: #7f8c8d;
    background-color: white;
    padding: 5px 10px;
    border-radius: 5px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
    z-index: 10;
    position: absolute;
    top: 10px;
    left: 10px;
}

/* Table container styling */
#table-container {
    width: 100%;
    margin-top: 10px;
    overflow-x: auto; /* Add horizontal scrolling for small screens */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

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

#table-container th, #table-container td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}

#table-container th {
    background-color: #f2f2f2;
    font-weight: bold;
}

#table-container tr:nth-child(even) {
    background-color: #f9f9f9;
}

#table-container tr:nth-child(odd) {
    background-color: #ffffff;
}

#table-container tr:hover {
    background-color: #f1f1f1;
}

/* Responsive design */
@media (max-width: 480px) {
    .table-selection {
        grid-template-columns: 1fr 1fr;
    }

    /* Make table scrollable on small screens */
    #table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #table-container table {
        min-width: 600px; /* Ensure table is wide enough to show all columns */
    }
}

    /* Make results container more responsive */
    .results-container {
        width: 90%;
        padding: 15px;
    }

    .stats-container {
        grid-template-columns: 1fr;
    }

    .stat {
        width: 100%;
        margin-bottom: 10px;
    }

    #answer {
        width: 80%;
    }
}
