/* Game Widget */
.game-widget {
    margin-top: 1rem;
    margin-bottom: 1rem;
}
.game-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.game-widget-title {
    margin: 0;
    font-size: 1.2rem;
}
.game-widget-title .badge {
    font-size: 0.7rem;
    vertical-align: middle;
    text-transform: capitalize;
}
.game-widget-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.game-help-link {
    font-size: 0.85rem;
    color: #999;
    text-decoration: none;
    white-space: nowrap;
}
.game-help-link:hover {
    color: #417690;
}
.game-fullscreen-btn {
    border: 1px solid #ccc;
    background: transparent;
    padding: 0.3rem 0.6rem;
    border-radius: 3px;
    cursor: pointer;
}
.game-fullscreen-btn:hover {
    background: #f5f5f5;
}
.game-more-link {
    text-align: center;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #eee;
    font-size: 0.85rem;
    color: #888;
}
.game-more-link a {
    color: #417690;
    text-decoration: none;
}
.game-more-link a:hover {
    text-decoration: underline;
}

/* Fullscreen overlay */
.game-widget.game-fullscreen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    background: #fff;
    margin: 0;
    border-radius: 0;
    overflow-y: auto;
    padding: 2rem;
}
.game-widget.game-fullscreen .card-body {
    max-width: 600px;
    margin: 0 auto;
}

/* Level switcher */
.game-level-switcher {
    display: inline-flex;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
}
.game-level-btn {
    border: none;
    background: #fff;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
    color: #666;
    border-right: 1px solid #ccc;
    transition: background-color 0.15s, color 0.15s;
}
.game-level-btn:last-child {
    border-right: none;
}
.game-level-btn:hover {
    background: #f0f0f0;
}
.game-level-btn.active {
    background: #417690;
    color: #fff;
}

/* Sudoku */
.sudoku-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.sudoku-timer {
    font-size: 1.1rem;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
    min-width: 50px;
}
.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0;
    max-width: 360px;
    margin: 0 auto;
    border: 2px solid #333;
}
.sudoku-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    border: 1px solid #ccc;
    cursor: pointer;
    user-select: none;
    background: #fff;
    transition: background-color 0.15s;
}
.sudoku-cell:hover {
    background: #e8f0fe;
}
.sudoku-cell.selected {
    background: #d2e3fc;
}
.sudoku-cell.given {
    font-weight: bold;
    color: #333;
    cursor: default;
    background: #f5f5f5;
}
.sudoku-cell.user-input {
    color: #1a73e8;
}
.sudoku-cell.error {
    color: #fff;
    font-weight: bold;
    background: #e74c3c;
    animation: shake 0.4s ease;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-3px); }
    40%, 80% { transform: translateX(3px); }
}
/* Thicker borders for 3x3 boxes */
.sudoku-cell:nth-child(3n) {
    border-right: 2px solid #333;
}
.sudoku-cell:nth-child(9n+1) {
    border-left: 2px solid #333;
}
.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 2px solid #333;
}
.sudoku-cell:nth-child(-n+9) {
    border-top: 2px solid #333;
}
.sudoku-cell:nth-child(n+73) {
    border-bottom: 2px solid #333;
}

.sudoku-numpad {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}
.sudoku-num-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sudoku-num-btn:hover {
    background: #e8f0fe;
}
.sudoku-erase-btn {
    font-size: 1.3rem;
    color: #e74c3c;
}
.sudoku-message {
    text-align: center;
    margin-top: 0.5rem;
    font-weight: bold;
    min-height: 1.5em;
}
.sudoku-message.success {
    color: #27ae60;
}
.sudoku-message.error {
    color: #e74c3c;
}

/* Word Scramble */
.ws-category {
    text-align: center;
    font-size: 0.85rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}
.ws-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.ws-timer {
    font-size: 1.1rem;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
    min-width: 50px;
}
.ws-score {
    font-weight: bold;
    color: #417690;
}
.ws-play-area {
    text-align: center;
}
.ws-scrambled {
    font-size: 1.8rem;
    font-weight: bold;
    letter-spacing: 0.15em;
    margin: 1rem 0;
    color: #333;
    min-height: 2.5rem;
}
.ws-hint {
    color: #999;
    font-style: italic;
    margin-bottom: 0.75rem;
    min-height: 1.3em;
}
.ws-input-area {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 0.75rem;
}
.ws-input {
    max-width: 250px;
    text-align: center;
    font-size: 1.1rem;
}
.ws-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}
.ws-message {
    text-align: center;
    font-weight: bold;
    min-height: 1.5em;
    margin-top: 0.5rem;
}
.ws-message.correct {
    color: #27ae60;
}
.ws-message.wrong {
    color: #e74c3c;
}
.ws-message.skipped {
    color: #f39c12;
}
.ws-round-info {
    text-align: center;
    color: #999;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Highscores */
.game-highscores {
    margin-top: 1rem;
    text-align: center;
}
.hs-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}
.hs-table {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.hs-table th,
.hs-table td {
    padding: 0.3rem 0.5rem;
    text-align: center;
    border-bottom: 1px solid #eee;
}
.hs-table th {
    color: #888;
    font-weight: normal;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.hs-table td.hs-initials {
    font-weight: bold;
    font-family: monospace;
    letter-spacing: 0.1em;
}
.hs-table tr.hs-current {
    background: #fffde7;
    font-weight: bold;
}
.hs-empty {
    color: #999;
    font-size: 0.85rem;
    font-style: italic;
}
.hs-input-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.hs-input-label {
    font-weight: bold;
    font-size: 0.9rem;
}
.hs-initials-input {
    width: 4em;
    text-align: center;
    font-size: 1.2rem;
    font-family: monospace;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    padding: 0.3rem;
    border: 2px solid #ccc;
    border-radius: 4px;
}
.hs-initials-input:focus {
    border-color: #417690;
    outline: none;
}
.hs-initials-input.hs-shake {
    border-color: #e74c3c;
    animation: shake 0.4s ease;
}
.hs-submit-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.hs-hint {
    width: 100%;
    text-align: center;
    font-size: 0.8rem;
    color: #999;
}
.hs-error {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 0.25rem;
    width: 100%;
}
.hs-existing {
    margin-top: 0.5rem;
}

/* Reaction Time */
.rt-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
}
.rt-round-info {
    color: #666;
}
.rt-average {
    font-weight: bold;
    color: #417690;
}
.rt-best {
    color: #27ae60;
    font-weight: bold;
}
.rt-zone {
    width: 100%;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s;
    margin-bottom: 0.75rem;
    background: #f0f0f0;
    border: 2px solid #ddd;
}
.rt-zone-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: #666;
    text-align: center;
    padding: 1rem;
}
.rt-zone.rt-waiting {
    background: #e74c3c;
    border-color: #c0392b;
}
.rt-zone.rt-waiting .rt-zone-text {
    color: #fff;
    font-size: 2rem;
}
.rt-zone.rt-ready {
    background: #27ae60;
    border-color: #1e8449;
}
.rt-zone.rt-ready .rt-zone-text {
    color: #fff;
    font-size: 2.5rem;
}
.rt-zone.rt-too-early {
    background: #f39c12;
    border-color: #d68910;
}
.rt-zone.rt-too-early .rt-zone-text {
    color: #fff;
    font-size: 1.3rem;
}
.rt-zone.rt-result {
    background: #d5f5e3;
    border-color: #27ae60;
}
.rt-zone.rt-result .rt-zone-text {
    color: #333;
}
.rt-time-big {
    font-size: 3rem;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}
.rt-next-hint {
    font-size: 0.95rem;
    font-weight: normal;
    color: #888;
    margin-top: 0.5rem;
}
.rt-zone.rt-ended {
    background: #f8f9fa;
    border-color: #ccc;
    cursor: default;
}
.rt-final {
    text-align: center;
}
.rt-final-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}
.rt-final-score {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}
.rt-results {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
    min-height: 2rem;
}
.rt-dot {
    background: #d5f5e3;
    border: 1px solid #27ae60;
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    font-weight: bold;
    color: #1e8449;
}

/* Responsive */
@media (max-width: 480px) {
    .sudoku-grid {
        max-width: 100%;
    }
    .sudoku-cell {
        font-size: 0.9rem;
    }
    .sudoku-num-btn {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }
    .ws-scrambled {
        font-size: 1.4rem;
    }
}
