.games-page {
    background: #f4efe7;
    color: #1f1a12;
    min-height: 100vh;
    padding: 140px 0 70px;
}

.games-container {
    margin: 0 auto;
    max-width: 1120px;
    padding: 0 16px;
}

.games-titlebar,
.game-toolbar {
    margin-bottom: 24px;
}

.games-titlebar h1,
.game-toolbar h1 {
    color: #1f1a12;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1;
    margin: 0 0 10px;
}

.games-titlebar p,
.game-toolbar p {
    color: #635747;
    font-size: 1.05rem;
    margin: 0;
}

.games-eyebrow {
    color: #9a6a24 !important;
    font-size: 0.8rem !important;
    font-weight: 800;
    letter-spacing: 0;
    margin-bottom: 8px !important;
    text-transform: uppercase;
}

.games-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.games-intro {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 16px;
}

.games-intro div {
    background: #ffffff;
    border: 1px solid rgba(31, 26, 18, 0.1);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(31, 26, 18, 0.08);
    padding: 14px;
}

.games-intro strong,
.games-intro span {
    display: block;
}

.games-intro strong {
    color: #1f1a12;
    font-size: 1rem;
    margin-bottom: 6px;
}

.games-intro span {
    color: #635747;
    line-height: 1.4;
}

.game-tile {
    align-items: center;
    background: #ffffff;
    border: 1px solid rgba(31, 26, 18, 0.1);
    border-radius: 8px;
    box-shadow: 0 18px 40px rgba(31, 26, 18, 0.1);
    color: #1f1a12;
    display: grid;
    gap: 16px;
    grid-template-columns: 68px minmax(0, 1fr);
    min-height: 150px;
    padding: 20px;
    text-decoration: none;
}

.game-tile:hover {
    color: #1f1a12;
    transform: translateY(-2px);
}

.game-tile--featured {
    background: linear-gradient(135deg, #1f1a12 0%, #4f3421 62%, #c48b3b 100%);
    border-color: rgba(246, 242, 234, 0.32);
    box-shadow: 0 22px 48px rgba(31, 26, 18, 0.2);
    color: #fff7e6;
    grid-column: span 3;
    min-height: 170px;
}

.game-tile--featured:hover {
    color: #fff7e6;
}

.game-tile--featured .game-tile__icon {
    background: #fff7e6;
    color: #1f1a12;
}

.game-tile--featured small {
    color: rgba(255, 247, 230, 0.86);
}

.game-tile__icon {
    align-items: center;
    background: #1f1a12;
    border-radius: 8px;
    color: #f6f2ea;
    display: inline-flex;
    font-size: 2.2rem;
    font-weight: 900;
    height: 68px;
    justify-content: center;
    line-height: 1;
    width: 68px;
}

.game-tile strong {
    display: block;
    font-size: 1.35rem;
    margin-bottom: 6px;
}

.game-tile small {
    color: #635747;
    display: block;
    font-size: 0.98rem;
    line-height: 1.45;
}

.game-toolbar {
    align-items: center;
    display: grid;
    gap: 14px;
    grid-template-columns: auto minmax(0, 1fr) auto;
}

.game-back,
.game-offline-badge,
.game-controls button,
.game-controls select {
    border-radius: 999px;
    min-height: 42px;
}

.game-back {
    align-items: center;
    background: #1f1a12;
    color: #fff;
    display: inline-flex;
    font-weight: 800;
    padding: 9px 16px;
    text-decoration: none;
}

.game-back:hover {
    color: #fff;
}

.game-offline-badge {
    align-items: center;
    background: rgba(24, 119, 63, 0.12);
    color: #166534;
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    padding: 8px 14px;
}

.game-offline-badge.is-offline {
    background: rgba(154, 106, 36, 0.18);
    color: #704a18;
}

.game-controls {
    align-items: center;
    background: #ffffff;
    border: 1px solid rgba(31, 26, 18, 0.1);
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
    padding: 12px;
}

.game-controls label {
    font-weight: 800;
}

.game-controls select {
    border: 1px solid rgba(31, 26, 18, 0.16);
    color: #1f1a12;
    padding: 0 14px;
}

.game-controls button {
    background: #d0a25f;
    border: 0;
    color: #1f1a12;
    font-weight: 800;
    padding: 8px 15px;
}

.game-controls button:hover {
    background: #bd8e4b;
}

.sudoku-layout,
.crossword-layout {
    align-items: start;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(280px, 560px) minmax(240px, 1fr);
}

.sudoku-board,
.crossword-board {
    background: #1f1a12;
    border: 4px solid #1f1a12;
    border-radius: 8px;
    display: grid;
    overflow: hidden;
    touch-action: manipulation;
    width: 100%;
}

.sudoku-board {
    aspect-ratio: 1;
    grid-template-columns: repeat(9, 1fr);
}

.sudoku-cell {
    align-items: center;
    background: #fffaf2;
    border: 1px solid rgba(31, 26, 18, 0.18);
    color: #1f1a12;
    display: inline-flex;
    font-size: clamp(1.05rem, 4vw, 2rem);
    font-weight: 800;
    justify-content: center;
    min-width: 0;
    padding: 0;
    text-align: center;
}

.sudoku-cell:nth-child(3n) {
    border-right-width: 3px;
}

.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom-width: 3px;
}

.sudoku-cell.is-fixed {
    background: #ead8be;
}

.sudoku-cell.is-selected {
    outline: 3px solid #d0a25f;
    outline-offset: -3px;
}

.sudoku-cell.is-error {
    background: #fee2e2;
    color: #991b1b;
}

.game-side,
.crossword-clues {
    background: #ffffff;
    border: 1px solid rgba(31, 26, 18, 0.1);
    border-radius: 8px;
    padding: 16px;
}

.number-pad {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, 1fr);
}

.number-pad button {
    aspect-ratio: 1;
    background: #1f1a12;
    border: 0;
    border-radius: 8px;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 900;
}

.number-pad button:last-child {
    background: #6b5c4a;
    font-size: 0.95rem;
}

.game-message {
    color: #635747;
    font-weight: 700;
    margin: 16px 0 0;
}

.game-result-banner {
    align-items: center;
    background: #166534;
    border-radius: 8px;
    bottom: 22px;
    box-shadow: 0 18px 40px rgba(31, 26, 18, 0.24);
    color: #ffffff;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    left: 50%;
    max-width: min(92vw, 620px);
    padding: 14px 16px;
    position: fixed;
    transform: translateX(-50%);
    width: 100%;
    z-index: 1100;
}

.game-result-banner[hidden] {
    display: none;
}

.game-result-banner.is-lose {
    background: #991b1b;
}

.game-result-banner strong,
.game-result-banner span {
    display: block;
}

.game-result-banner strong {
    font-size: 1.1rem;
    font-weight: 900;
    margin-bottom: 2px;
}

.game-result-banner span {
    line-height: 1.35;
}

.game-result-banner button {
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    color: #ffffff;
    font-weight: 900;
    min-height: 38px;
    padding: 8px 12px;
}

.sudoku-subscribe {
    background: #fff7e6;
    border: 1px solid rgba(208, 162, 95, 0.45);
    border-radius: 8px;
    margin-top: 14px;
    padding: 14px;
}

.sudoku-subscribe label {
    color: #1f1a12;
    display: block;
    font-weight: 900;
    margin-bottom: 4px;
}

.sudoku-subscribe p {
    color: #635747;
    margin: 0 0 10px;
}

.sudoku-subscribe div {
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.sudoku-subscribe input {
    border: 1px solid rgba(31, 26, 18, 0.16);
    border-radius: 999px;
    min-height: 42px;
    padding: 0 14px;
}

.sudoku-subscribe button {
    background: #1f1a12;
    border: 0;
    border-radius: 999px;
    color: #ffffff;
    font-weight: 900;
    min-height: 42px;
    padding: 8px 14px;
}

.crossword-board {
    grid-template-columns: repeat(var(--crossword-size), 1fr);
}

.crossword-cell {
    aspect-ratio: 1;
    background: #fffaf2;
    border: 1px solid rgba(31, 26, 18, 0.18);
    position: relative;
}

.crossword-cell.is-blocked {
    background: #1f1a12;
}

.crossword-cell input {
    background: transparent;
    border: 0;
    color: #1f1a12;
    font-size: clamp(1rem, 4vw, 1.7rem);
    font-weight: 900;
    height: 100%;
    padding: 0;
    text-align: center;
    text-transform: uppercase;
    width: 100%;
}

.crossword-cell input:focus {
    outline: 3px solid #d0a25f;
    outline-offset: -3px;
}

.crossword-cell.is-error input {
    background: #fee2e2;
    color: #991b1b;
}

.crossword-number {
    color: #704a18;
    font-size: 0.68rem;
    font-weight: 900;
    left: 3px;
    position: absolute;
    top: 1px;
}

.crossword-clues h2 {
    color: #1f1a12;
    font-size: 1.25rem;
    font-weight: 900;
    margin: 0 0 10px;
}

.crossword-clues ol {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-left: 20px;
}

.crossword-clues button {
    background: transparent;
    border: 0;
    color: #1f1a12;
    font-weight: 700;
    padding: 0;
    text-align: left;
}

.crossword-clues button:hover {
    text-decoration: underline;
}

.joke-layout {
    align-items: start;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(280px, 1fr) minmax(260px, 360px);
}

.joke-stage,
.joke-write {
    background: #ffffff;
    border: 1px solid rgba(31, 26, 18, 0.1);
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(31, 26, 18, 0.08);
    padding: 18px;
}

.joke-progress {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 16px;
}

.joke-progress span {
    background: #f4efe7;
    border-radius: 8px;
    color: #635747;
    font-weight: 800;
    padding: 10px;
}

.joke-progress strong {
    color: #1f1a12;
    display: block;
    font-size: 1.3rem;
}

.joke-setup {
    color: #1f1a12;
    font-size: 1.45rem;
    font-weight: 900;
    line-height: 1.25;
    margin: 0 0 16px;
}

.joke-options {
    display: grid;
    gap: 10px;
}

.joke-options button {
    background: #fffaf2;
    border: 2px solid rgba(31, 26, 18, 0.12);
    border-radius: 8px;
    color: #1f1a12;
    font-weight: 800;
    line-height: 1.35;
    min-height: 56px;
    padding: 12px 14px;
    text-align: left;
}

.joke-options button:hover:not(:disabled) {
    border-color: #d0a25f;
}

.joke-options button.is-correct {
    background: #dcfce7;
    border-color: #16a34a;
}

.joke-options button.is-wrong {
    background: #fee2e2;
    border-color: #dc2626;
}

.joke-write h2 {
    color: #1f1a12;
    font-size: 1.25rem;
    font-weight: 900;
    margin: 0 0 10px;
}

.joke-write p,
.joke-write small {
    color: #635747;
    display: block;
    line-height: 1.4;
}

.joke-write textarea {
    border: 1px solid rgba(31, 26, 18, 0.16);
    border-radius: 8px;
    color: #1f1a12;
    margin: 10px 0;
    padding: 12px;
    resize: vertical;
    width: 100%;
}

.joke-write button {
    background: #1f1a12;
    border: 0;
    border-radius: 999px;
    color: #ffffff;
    font-weight: 900;
    min-height: 42px;
    padding: 8px 15px;
}

@media (max-width: 900px) {
    .games-page {
        padding-top: 125px;
    }

    .games-grid,
    .games-intro,
    .sudoku-layout,
    .crossword-layout,
    .joke-layout,
    .tetris-layout,
    .game-toolbar {
        grid-template-columns: 1fr;
    }

    .game-tile--featured {
        grid-column: auto;
    }

    .game-offline-badge {
        justify-self: start;
    }
}

.game-profile,
.game-tabs,
.score-panel {
    background: #ffffff;
    border: 1px solid rgba(31, 26, 18, 0.1);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(31, 26, 18, 0.08);
    margin-bottom: 16px;
    padding: 12px;
}

.game-profile {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.game-profile label {
    font-weight: 900;
}

.game-profile input,
.game-controls input {
    border: 1px solid rgba(31, 26, 18, 0.16);
    border-radius: 999px;
    color: #1f1a12;
    min-height: 42px;
    padding: 0 14px;
}

.game-profile button,
.score-clear {
    background: #1f1a12;
    border: 0;
    border-radius: 999px;
    color: #ffffff;
    font-weight: 800;
    min-height: 42px;
    padding: 8px 15px;
}

.game-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.game-tabs button {
    background: #f4efe7;
    border: 0;
    border-radius: 999px;
    color: #1f1a12;
    font-weight: 900;
    min-height: 40px;
    padding: 8px 16px;
}

.game-tabs button.is-active {
    background: #1f1a12;
    color: #ffffff;
}

.game-stats {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 14px;
}

.game-stats span {
    background: #f4efe7;
    border-radius: 8px;
    color: #1f1a12;
    font-weight: 800;
    padding: 10px;
}

.game-stats strong {
    display: block;
    font-size: 1.2rem;
}

.score-panel h2 {
    color: #1f1a12;
    font-size: 1.35rem;
    font-weight: 900;
    margin: 0 0 12px;
}

.score-list {
    display: grid;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.score-row {
    align-items: center;
    background: #f8f4ee;
    border-radius: 8px;
    display: grid;
    gap: 10px;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    padding: 10px;
}

.score-rank {
    align-items: center;
    background: #1f1a12;
    border-radius: 50%;
    color: #ffffff;
    display: inline-flex;
    font-weight: 900;
    height: 32px;
    justify-content: center;
    width: 32px;
}

.score-row strong,
.score-row small {
    display: block;
}

.score-row small,
.score-empty {
    color: #635747;
}

.score-points {
    color: #704a18;
    font-size: 1.2rem;
    font-weight: 900;
}

.score-clear {
    margin-top: 12px;
}

.tetris-layout {
    align-items: start;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(220px, 360px) minmax(240px, 1fr);
}

.tetris-board {
    aspect-ratio: 10 / 18;
    background: linear-gradient(145deg, #342c20, #17130e);
    border: 8px solid #2a2118;
    border-bottom-color: #0f0c09;
    border-left-color: #5b4934;
    border-radius: 10px;
    box-shadow:
        inset 0 0 0 2px rgba(246, 242, 234, 0.08),
        inset 10px 0 18px rgba(255, 255, 255, 0.06),
        inset -10px 0 18px rgba(0, 0, 0, 0.35),
        0 18px 0 #0f0c09,
        0 28px 40px rgba(31, 26, 18, 0.28);
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    width: min(100%, 360px);
}

.tetris-cell {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(246, 242, 234, 0.07);
    pointer-events: none;
}

.tetris-cell.piece-i,
.tetris-cell.piece-o,
.tetris-cell.piece-t,
.tetris-cell.piece-l,
.tetris-cell.piece-j,
.tetris-cell.piece-s,
.tetris-cell.piece-z {
    border-color: rgba(17, 24, 39, 0.42);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.42),
        inset 2px 0 0 rgba(255, 255, 255, 0.18),
        inset -2px -2px 0 rgba(0, 0, 0, 0.26),
        0 1px 0 rgba(0, 0, 0, 0.28);
}

.piece-i {
    background: linear-gradient(145deg, #7dd3fc, #0284c7);
}

.piece-o {
    background: linear-gradient(145deg, #fde68a, #ca8a04);
}

.piece-t {
    background: linear-gradient(145deg, #ddd6fe, #9333ea);
}

.piece-l {
    background: linear-gradient(145deg, #fdba74, #ea580c);
}

.piece-j {
    background: linear-gradient(145deg, #93c5fd, #2563eb);
}

.piece-s {
    background: linear-gradient(145deg, #86efac, #16a34a);
}

.piece-z {
    background: linear-gradient(145deg, #fca5a5, #dc2626);
}

.tetris-pad {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, 1fr);
    margin-top: 14px;
}

.tetris-pad button {
    background: #1f1a12;
    border: 0;
    border-radius: 8px;
    color: #ffffff;
    font-weight: 900;
    min-height: 48px;
}

.tetris-pad button[data-tetris-drop] {
    grid-column: 1 / -1;
}

@media (max-width: 900px) {
    .games-grid,
    .sudoku-layout,
    .crossword-layout,
    .joke-layout,
    .tetris-layout,
    .game-toolbar {
        grid-template-columns: 1fr;
    }

    .game-tile--featured {
        grid-column: auto;
    }

    .game-profile input,
    .game-controls input,
    .game-controls select,
    .game-controls button {
        width: 100%;
    }

    .joke-progress {
        grid-template-columns: 1fr;
    }

    .game-result-banner {
        align-items: stretch;
        flex-direction: column;
    }

    .sudoku-subscribe div {
        grid-template-columns: 1fr;
    }

    .tetris-board {
        aspect-ratio: 10 / 17;
        margin: 0 auto;
        width: min(88vw, 320px);
    }
}
