:root {
    --bg-color: #050505;
    --panel-color: #121212;
    --text-primary: #00ff41; 
    --text-secondary: #008f11;
    --accent-cyan: #00f3ff;
    --accent-yellow: #f3ff00;
    --tile-bg: #1a1a1a;
    --tile-border: #333;
    --correct-color: #00ff41;
    --misplaced-color: #f3ff00;
    --absent-color: #444;
    --destructive: #ff3e3e;
    --font-mono: 'Fira Code', 'Courier New', monospace;
    --radius: 4px;
    --glow: 0 0 10px rgba(0, 255, 65, 0.3);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-mono);
    line-height: 1.6;
    overflow-x: hidden;
}

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

nav {
    border-bottom: 1px solid var(--text-secondary);
    padding: 1rem 0;
    background: rgba(0,0,0,0.8);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
    text-decoration: none;
    text-shadow: var(--glow);
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-left: 1.5rem;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--text-primary);
}

.ad-slot {
    border: 1px dashed var(--text-secondary);
    margin: 20px 0;
    padding: 10px;
    text-align: center;
    font-size: 10px;
    color: var(--text-secondary);
    background: var(--panel-color);
}

#home-screen {
    padding: 2rem 0;
    text-align: center;
}

.hero-text {
    margin: 2rem 0;
    font-size: 1.2rem;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.mode-toggle {
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    background: var(--panel-color);
    padding: 2rem;
    border: 1px solid var(--tile-border);
    border-radius: var(--radius);
}

/* Custom Checkbox Styling */
.switch-container {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    user-select: none;
}

.switch-container input {
    display: none;
}

.custom-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-secondary);
    border-radius: 2px;
    position: relative;
    transition: all 0.2s;
}

.switch-container input:checked + .custom-checkbox {
    border-color: var(--text-primary);
    background: var(--text-primary);
    box-shadow: var(--glow);
}

.switch-container input:checked + .custom-checkbox::after {
    content: 'X';
    color: black;
    font-size: 14px;
    font-weight: bold;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.difficulty-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    background: transparent;
    border: 1px solid var(--text-primary);
    color: var(--text-primary);
    padding: 1rem;
    cursor: pointer;
    font-family: inherit;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.btn:hover {
    background: var(--text-primary);
    color: black;
    box-shadow: var(--glow);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

#game-screen {
    padding: 1rem 0;
}

.game-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: var(--accent-cyan);
}

.board {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 2rem;
}

.row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.tile {
    width: 45px;
    height: 45px;
    border: 2px solid var(--tile-border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    background: var(--tile-bg);
    position: relative;
}

.tile .cue {
    font-size: 0.6rem;
    position: absolute;
    bottom: 2px;
    opacity: 0.6;
}

.tile.correct { background-color: var(--correct-color); border-color: var(--correct-color); color: black; }
.tile.misplaced { background-color: var(--misplaced-color); border-color: var(--misplaced-color); color: black; }
.tile.absent { background-color: var(--absent-color); border-color: var(--absent-color); color: white; }

/* Mastermind Mode Display */
.mastermind-feedback {
    display: flex;
    flex-wrap: wrap;
    width: 40px;
    gap: 4px;
    justify-content: center;
}

.dot-correct, .dot-misplaced {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-correct { background-color: var(--correct-color); box-shadow: 0 0 5px var(--correct-color); }
.dot-misplaced { background-color: var(--misplaced-color); box-shadow: 0 0 5px var(--misplaced-color); }

#input-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 2rem;
}

.digit-input {
    width: 45px;
    height: 45px;
    background: var(--panel-color);
    border: 1px solid var(--text-secondary);
    color: var(--text-primary);
    text-align: center;
    font-size: 1.2rem;
    border-radius: var(--radius);
}

.digit-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 5px var(--accent-cyan);
}

.leaderboard-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.leaderboard-modal:not(.hidden) {
    display: flex;
}

.modal-content {
    background: var(--panel-color);
    border: 1px solid var(--text-primary);
    padding: 2rem;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.leaderboard-list {
    margin: 1.5rem 0;
    max-height: 40vh;
    overflow-y: auto;
    text-align: left;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid #222;
    font-size: 0.9rem;
}

.hidden { display: none !important; }

#intro-text p {
    margin: 10px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.save-score-form {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.save-score-form input {
    background: #000;
    border: 1px solid var(--text-secondary);
    color: var(--text-primary);
    padding: 10px;
    font-family: inherit;
    text-align: center;
}

@media (max-width: 500px) {
    .tile, .digit-input { width: 35px; height: 35px; font-size: 1rem; }
    .row { gap: 6px; }
}
