/* Game specific styles for Calc Training */

:root {
    --primary-color: #FF9800;
    --primary-hover: #F57C00;
    --text-main: #333;
    --cell-size: 40px;
}

@media (min-width: 600px) {
    :root {
        --cell-size: 50px;
    }
}

.game-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    padding: 20px 0;
}

.game-container h1 {
    margin-bottom: 1.5rem;
    color: #333;
}

.game-description {
    margin-bottom: 2rem;
    color: #555;
    font-size: 1.1rem;
}

.game-area-wrapper {
    position: relative;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

/* Setup Area */
.setup-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
}

.setup-group {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: bold;
}

.game-select {
    padding: 8px 16px;
    border-radius: 8px;
    border: 2px solid #ccc;
    font-size: 1rem;
}

/* Play Area */
.timer-display {
    font-family: 'Courier New', monospace;
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    background: #eee;
    padding: 5px 20px;
    border-radius: 8px;
    display: inline-block;
}

.grid-container-scroll {
    overflow-x: auto;
    width: 100%;
    margin-bottom: 20px;
    padding-bottom: 10px;
    /* scrollbar space */
    display: flex;
    justify-content: center;
    /* Center if smaller than width */
    background: #FAFAFA;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #eee;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.02);
}

/* If content wider, justify-center breaks scrolling in some browsers, but mostly flex works ok.
   Actually use grid display for centering? Or Margin auto. */

.calc-grid {
    border-collapse: separate;
    border-spacing: 2px;
    /* Slight gap looks modern */
    margin: 0 auto;
}

.calc-grid th,
.calc-grid td {
    width: var(--cell-size);
    height: var(--cell-size);
    border: 1px solid #ddd;
    text-align: center;
    vertical-align: middle;
    padding: 0;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.calc-grid th {
    background: #FFF3E0;
    /* Lighter Orange */
    font-weight: 800;
    font-size: 1.1rem;
    color: #E65100;
    border-color: #FFE0B2;
}

.calc-grid .calc-op {
    background: #FF9800;
    color: #fff;
    border-color: #F57C00;
    font-size: 1.4rem;
}

.cell-input {
    width: 100%;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    outline: none;
    background: transparent;
    padding: 0;
    margin: 0;
    border-radius: 4px;
}

.cell-input:focus {
    background: #E1F5FE;
    /* Light Blue Focus */
    box-shadow: inset 0 0 0 2px #29B6F6;
}

/* Results styles */
.cell-correct {
    background: #C8E6C9;
    /* Green tint */
    color: #2E7D32;
    font-weight: bold;
}

.cell-wrong {
    background: #FFCDD2;
    /* Red tint */
    color: #C62828;
    position: relative;
}

.correct-answer-tooltip {
    display: none;
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 10;
}

.cell-wrong:hover .correct-answer-tooltip {
    display: block;
}

.finish-btn {
    margin-top: 10px;
    min-width: 200px;
}

/* Result Overlay (Embedded in flow) */
.result-display {
    margin-top: 20px;
    padding: 20px;
    background: #E8F5E9;
    border: 2px solid #4CAF50;
    border-radius: 12px;
}

.score-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2E7D32;
    margin: 10px 0;
}

.time-text {
    font-size: 1.2rem;
    color: #555;
    margin-bottom: 10px;
}

.score-message {
    font-weight: bold;
    color: #FF9800;
    font-size: 1.2rem;
}

.hidden {
    display: none !important;
}

/* Primary Btn */
.primary-btn {
    background-color: var(--primary-color);
    color: white;
    font-size: 1rem;
    font-weight: bold;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
    transition: transform 0.1s;
}

.primary-btn:active {
    transform: translateY(4px);
    box-shadow: none;
}

.secondary-btn {
    background-color: #78909C;
    color: white;
    font-size: 1rem;
    font-weight: bold;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
    margin-left: 10px;
}

/* Instructions */
.instructions {
    background: #FAFAFA;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    text-align: left;
    margin: 3rem auto 5rem;
    color: #444;
    line-height: 1.8;
}

.instructions h3 {
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    color: var(--primary-color);
    font-size: 1.3rem;
    font-weight: 700;
}