/* =========================================================
   Games arcade + Sudoku styles
   ========================================================= */
.btn {
    font-family: inherit;
    background: #2c313a;
    color: var(--text);
    border: 1px solid #3a414d;
    border-radius: 6px;
    padding: 0.4em 0.9em;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: #353b45; border-color: var(--accent); }
.btn.primary { border-color: var(--accent); color: var(--accent); }
.btn.active { border-color: var(--folder); color: var(--folder); }
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.8em;
    margin: 1em 0;
}
.game-tile {
    background: #2c313a;
    border: 1px solid #3a414d;
    border-radius: 8px;
    padding: 1em;
    cursor: pointer;
    text-align: center;
    transition: transform 0.15s, border-color 0.15s;
}
.game-tile:hover { transform: translateY(-3px); border-color: var(--accent); }
.game-tile.soon { opacity: 0.5; cursor: default; }
.game-tile.soon:hover { transform: none; border-color: #3a414d; }
.game-tile .icon { font-size: 1.8em; display: block; margin-bottom: 0.2em; }
.game-tile .name { color: var(--folder); font-weight: bold; }
.game-tile .meta { color: var(--comment); font-size: 0.8em; display: block; margin-top: 0.3em; }
.name-form { display: flex; gap: 0.5em; flex-wrap: wrap; margin: 0.6em 0; }
.name-form input {
    font-family: inherit;
    background: #181c20;
    color: var(--text);
    border: 1px solid #3a414d;
    border-radius: 6px;
    padding: 0.4em 0.6em;
}
/* ---- Sudoku ---- */
.sudoku-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.8em;
    margin: 0.8em 0;
}
.sudoku-bar .timer { color: var(--accent); }
.difficulty-row { display: flex; gap: 0.5em; flex-wrap: wrap; margin: 0.6em 0; }
.sudoku-board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    box-sizing: border-box;
    width: 100%;
    max-width: 338px;            /* 3 boxes × ~112px = 338px total */
    margin: 0.8em 0;
    background: #fff;
    border: 2px solid #1a1a1a;
}
.sudoku-cell {
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    min-width: 0;
    border: none;
    border-right: 1px solid #c8c8c8;
    border-bottom: 1px solid #c8c8c8;
    background: #fff;
    color: #1d4ed8;               /* your "pencil" entries */
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 0.95em;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    padding: 0;
    border-radius: 0;
    -moz-appearance: textfield;
}
.sudoku-cell:focus { outline: none; background: #fff6c2; }
.sudoku-cell.given { color: #111; font-weight: 700; }
.sudoku-cell.conflict { color: #c0392b; background: #ffdede; }
.sudoku-cell.hint { color: #0a7d2c; font-weight: 700; background: #eafbe7; }
/* green splash when a row/column is completed correctly */
@keyframes cellComplete {
    0%   { background: #28c93f; box-shadow: inset 0 0 0 2px #1f9e31; }
    60%  { background: #b9f6c1; }
    100% { background: #fff; box-shadow: none; }
}
.sudoku-cell.flash-complete { animation: cellComplete 0.98s ease-out; }
/* trim inner edges so they don't double up with the outer frame */
.sudoku-cell:nth-child(9n) { border-right: none; }
.sudoku-cell:nth-child(n+73) { border-bottom: none; }
/* thick 3x3 separators for the printed-grid look */
.sudoku-cell.box-edge-right { border-right: 2px solid #1a1a1a; }
.sudoku-cell.box-edge-bottom { border-bottom: 2px solid #1a1a1a; }
.num-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.3em; max-width: 383px; margin: 0.6em 0; }
.num-pad .btn { padding: 0.5em 0; }
.win-banner { color: var(--folder); font-weight: bold; margin: 0.6em 0; }
.stats-line { color: var(--comment); margin: 0.4em 0; }

/* ---- Tic Tac Toe ---- */
.ttt-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    box-sizing: border-box;
    width: 100%;
    max-width: 270px;
    margin: 0.8em 0;
    background: #fff;
    border: 2px solid #1a1a1a;
}
.ttt-cell {
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    min-width: 0;
    padding: 0;
    border: none;
    border-right: 1px solid #c8c8c8;
    border-bottom: 1px solid #c8c8c8;
    background: #fff;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 2.4em;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
}
.ttt-cell:nth-child(3n) { border-right: none; }
.ttt-cell:nth-child(n+7) { border-bottom: none; }
.ttt-cell.x { color: #1d4ed8; }
.ttt-cell.o { color: #c0392b; }
.ttt-cell:not(.x):not(.o):hover { background: #fff6c2; }
.ttt-cell.ttt-win { background: #b9f6c1; }

/* ---- Win celebration ---- */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 9999; }
.confetti {
    position: absolute;
    top: -12px;
    width: 8px;
    height: 14px;
    opacity: 0.9;
    will-change: transform;
    animation-name: confettiFall;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}
@keyframes confettiFall {
    0%   { transform: translateY(-12vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0.9; }
}
.win-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.55);
    z-index: 10000;
    animation: fadeIn 0.3s;
}
.win-modal .card {
    background: var(--panel);
    border: 1px solid #3a414d;
    border-radius: 12px;
    padding: 1.6em 1.8em;
    text-align: center;
    box-shadow: var(--shadow);
    max-width: 320px;
    margin: 1em;
}
.win-modal h3 { color: var(--folder); margin: 0 0 0.4em; font-size: 1.4em; }
.win-modal .sub { color: var(--text); margin-bottom: 1.2em; }
.win-modal .difficulty-row { justify-content: center; margin: 0; }
@media (max-width: 600px) {
    .sudoku-board { max-width: 338px; }
    .num-pad { max-width: 383px; }
}
