:root {
    --cell-size: 7vmin; 
    --max-cell-size: 50px;
    --min-cell-size: 30px;
    --border-color: #444;
    --bg-dark: #121212;
    --bg-panel: #1e1e1e;
    --text-main: #e0e0e0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 5px;
    box-sizing: border-box;
}

h1 { 
    margin: 5px 0; 
    color: #fff; 
    font-size: 1.8rem;
    text-align: center;
}

.game-subtitle {
    margin-top: 0;
    margin-bottom: 4px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
}

.game-instructions {
    margin-top: 0;
    margin-bottom: 20px;
    color: #aaaaaa;
    font-size: 0.85rem;
    text-align: center;
    max-width: 90vw;
    line-height: 1.4;
}

.controls-panel {
    background-color: var(--bg-panel);
    padding: 16px 24px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    width: auto;
    max-width: 95vw;
}

.difficulty-row {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
}

.difficulty-row label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.buttons-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    width: 100%;
    border-top: 1px solid #333;
    padding-top: 10px;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

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

#game-board-container {
    position: relative;
    max-width: 100%;
}

#game-board {
    display: grid;
    grid-template-columns: repeat(10, clamp(var(--min-cell-size), var(--cell-size), var(--max-cell-size)));
    grid-template-rows: repeat(10, clamp(var(--min-cell-size), var(--cell-size), var(--max-cell-size)));
    gap: 2px;
    background-color: var(--border-color);
    padding: 2px;
    border-radius: 6px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.5);
}

.cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85rem;
    user-select: none;
    transition: background-color 0.1s ease;
}

.border-cell {
    background-color: #2c3e50;
    cursor: pointer;
    color: #95a5a6;
}

.border-cell:hover:not(.corner) {
    background-color: #34495e;
    color: #fff;
}

.corner { 
    background-color: #1a252f; 
    cursor: default; 
}

.play-cell { 
    background-color: #ffffff; /* Crisp white cells */
    color: #333; 
    cursor: pointer; 
}

/* FIXED: Applies a clear, subtle silver-gray tint to the white squares on hover */
.cell-highlighted {
    background-color: #e0e0e0 !important; 
}

/* Hit Markers: Bright Red */
.marker-hit { 
    background-color: #e74c3c !important; 
    color: #ffffff !important; 
}

/* Reflection / Reverse Markers: Neon Yellow with dark text */
.marker-reflect { 
    background-color: #f1c40f !important; 
    color: #121212 !important; 
}

/* Detour Markers */
.marker-detour { 
    color: #ffffff !important; 
}

/* Style for player guesses (?) */
.cell-guessed {
    background-color: #dfe6e9 !important; 
}
.cell-guessed::before {
    content: "?";
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: bold;
}

/* Highlights correct final guesses */
.guess-correct {
    background-color: #2ecc71 !important;
    color: white !important;
}
.guess-correct::before { 
    content: "✓" !important; 
    font-size: 1.3rem;
}

/* WRONG GUESS: Stylized handwriting multiplication sign "×" */
.guess-wrong-x {
    background-color: #fab1a0 !important;
    color: #c0392b !important;
}
.guess-wrong-x::before { 
    content: "×" !important; 
    font-size: 1.7rem; 
    font-weight: 300; 
    font-family: 'Comic Sans MS', cursive, sans-serif; 
    line-height: 1;
}

/* MISSED BALL: Revealed with the actual ball icon where it should be */
.ball-revealed {
    background-color: #ffeaa7 !important;
}
.ball-revealed::after {
    content: "●" !important;
    color: #e67e22 !important;
    font-size: 24px;
}

.credit-text {
    margin-top: 15px;
    font-size: 0.8rem;
    color: #555;
    text-align: center;
}

/* ========================================================
    DYNAMIC DISPLAY OVERLAY DESIGN
======================================================== */
#score-overlay, #warning-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(30, 30, 30, 0.95); 
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    cursor: pointer;
    transition: opacity 0.2s ease-in-out;
}

.overlay-hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 4px;
    color: #ffffff; 
    margin-bottom: 5px;
}

.overlay-score-digits {
    font-size: 5rem; 
    font-weight: 900;
    color: #f1c40f; 
    line-height: 1;
    margin-bottom: 15px;
}

.warning-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: #e74c3c; 
    margin-bottom: 15px;
}

.warning-message-text {
    font-size: 1rem;
    color: #ffffff;
    text-align: center;
    max-width: 80%;
    line-height: 1.4;
    margin-bottom: 30px;
}

.overlay-dismiss {
    font-size: 0.75rem;
    color: #ffffff; 
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    padding: 0 10px;
}

@media (max-width: 600px) {
	h1 {font-size:1.4rem;}
	.difficulty-row {font-size:0.8rem; gap:12px;}
	.cell {font-size:0.75rem;}
	.cell-guessed::before {font-size:1.0rem;}
	.guess-correct::before {font-size:1.0rem;}
	.guess-wrong-x::before {font-size:1.6rem;}
}

@media (max-width: 300px) {
    :root {--cell-size:8.5vmin;}
    p {font-size:0.75rem;}
	button {padding:6px 12px; font-size:0.8rem;}
    .controls-panel {padding:12px 16px; width:90vw;}
    .overlay-title, .warning-title {font-size:1.2rem;}
    .overlay-score-digits {font-size:3.5rem;}
    .warning-message-text {font-size:0.85rem;}
    .overlay-dismiss {font-size:0.65rem;}
    .credit-text {font-size:0.75rem; margin-top:12px;}
}

a {color:inherit; text-decoration:none;}