@font-face {
    font-family: "ADJMN Press Start";
    src: url("/games/fonts/PressStart2P-Regular.ttf") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

.arcade-site.casual-puzzle-site {
    min-height: 100vh;
    margin: 0;
    color: #f5f0ff;
    background:
        radial-gradient(ellipse at 50% 5%, rgba(91,48,137,.28), transparent 56%),
        linear-gradient(180deg, #130d2b 0%, #100b21 48%, #190b23 100%);
    font: 400 16px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

.casual-puzzle-page {
    position: relative;
    z-index: 1;
    width: min(100% - 36px, 940px);
    margin: 0 auto;
    padding: 34px 0 52px;
}

.casual-puzzle-page *,
.casual-puzzle-page *::before,
.casual-puzzle-page *::after { box-sizing: border-box; }

.puzzle-intro { margin: 0 auto 23px; }
.puzzle-eyebrow {
    margin: 0 0 9px;
    color: #4ce8ff;
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.puzzle-intro h1,
.puzzle-machine > h2,
.puzzle-win h3 {
    font-family: "ADJMN Press Start", "Courier New", monospace;
    font-weight: 400;
    line-height: 1.55;
}
.puzzle-intro h1 {
    margin: 0;
    color: #fff2c4;
    font-size: clamp(1.1rem, 4vw, 1.8rem);
    text-shadow: 3px 3px 0 #5c318b;
}
.puzzle-intro h1 span { color: #ffe17b; }
.puzzle-intro > p:last-child {
    max-width: 68ch;
    margin: 10px 0 0;
    color: #e2dced;
    font-size: 1rem;
    line-height: 1.6;
}

.puzzle-machine {
    --puzzle-accent: #4ce8ff;
    position: relative;
    overflow: hidden;
    padding: clamp(15px, 3.5vw, 30px);
    border: 2px solid color-mix(in srgb, var(--puzzle-accent), #251938 32%);
    background:
        repeating-linear-gradient(0deg, rgba(76,232,255,.025) 0, rgba(76,232,255,.025) 1px, transparent 1px, transparent 4px),
        radial-gradient(ellipse at 50% 12%, color-mix(in srgb, var(--puzzle-accent), transparent 91%), transparent 66%),
        #100d20;
    box-shadow: 0 8px 0 #090615, 0 0 24px color-mix(in srgb, var(--puzzle-accent), transparent 83%), inset 0 0 0 4px rgba(15,11,31,.82);
}
.maze-machine { --puzzle-accent: #4ce8ff; }
.sudoku-machine { --puzzle-accent: #ffe17b; }
.word-find-machine { --puzzle-accent: #d776ff; }
.maze-scoreboards {
    --scores-mint: #4ce8ff;
    --scores-mint-dim: #b7a0ef;
    --scores-black: #080817;
    --scores-line: rgba(76, 232, 255, .4);
    border-color: #4c9ab0;
    background:
        repeating-linear-gradient(0deg, rgba(76, 232, 255, .018) 0, rgba(76, 232, 255, .018) 1px, transparent 1px, transparent 4px),
        #10121b;
}
.sudoku-scoreboards {
    --scores-mint: #ffe17b;
    --scores-mint-dim: #d776ff;
    --scores-black: #17100b;
    --scores-line: rgba(255, 225, 123, .42);
    border-color: #c79c4d;
    background:
        repeating-linear-gradient(0deg, rgba(255, 225, 123, .018) 0, rgba(255, 225, 123, .018) 1px, transparent 1px, transparent 4px),
        #17120e;
}
.word-find-scoreboards {
    --scores-mint: #e4a0ff;
    --scores-mint-dim: #b7a0ef;
    --scores-black: #100d20;
    --scores-line: rgba(215, 118, 255, .42);
    border-color: #9d64c2;
    background:
        repeating-linear-gradient(0deg, rgba(215, 118, 255, .018) 0, rgba(215, 118, 255, .018) 1px, transparent 1px, transparent 4px),
        #15101f;
}

.puzzle-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #4ce8ff;
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .08em;
}
.puzzle-machine > h2 {
    margin: 17px 0 2px;
    color: #ffe17b;
    font-size: clamp(.85rem, 2.7vw, 1.15rem);
    text-align: center;
    text-shadow: 2px 2px #5c318b;
}
.puzzle-tagline {
    margin: 3px 0 20px;
    color: #4ce8ff;
    font-size: .8rem;
    font-weight: 750;
    letter-spacing: .08em;
    text-align: center;
}
.puzzle-hud {
    display: grid;
    grid-template-columns: minmax(90px, 145px) minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-height: 58px;
    margin: 0 auto 17px;
    padding: 10px 14px;
    border: 1px solid #51436f;
    border-radius: 7px;
    background: rgba(5,5,14,.88);
}
.puzzle-hud > div { display: grid; gap: 3px; }
.puzzle-hud > div span {
    color: #bcb3d2;
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.puzzle-hud > div strong {
    color: #4ce8ff;
    font-size: 1.2rem;
    font-variant-numeric: tabular-nums;
}
.puzzle-hud > p {
    margin: 0;
    color: #f5f0ff;
    font-size: 1rem;
    line-height: 1.45;
}
.timed-puzzle-hud {
    grid-template-columns: minmax(82px, 120px) minmax(104px, 142px) minmax(0, 1fr);
}
.timed-puzzle-hud > div strong {
    white-space: nowrap;
    font-size: 1.05rem;
}
.puzzle-instructions {
    max-width: 68ch;
    margin: 14px auto 18px;
    color: #ddd6ea;
    font-size: 1rem;
    line-height: 1.55;
    text-align: center;
}
.puzzle-button,
.puzzle-key {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid #b9304b;
    border-radius: 7px;
    color: #fff;
    background: linear-gradient(180deg, #f0445e, #c91f3c);
    box-shadow: 0 4px 0 #70152a, 0 0 14px rgba(239,48,73,.2);
    font: 700 1rem/1.2 Inter, ui-sans-serif, system-ui, sans-serif;
    cursor: pointer;
    touch-action: manipulation;
    transition: filter .16s ease, transform .16s ease, box-shadow .16s ease;
}
.puzzle-button { padding: 10px 18px; }
.puzzle-button:hover,
.puzzle-key:hover { filter: brightness(1.12); }
.puzzle-button:active,
.puzzle-key:active { transform: translateY(2px); box-shadow: 0 2px 0 #70152a; }
.puzzle-button:focus-visible,
.puzzle-key:focus-visible,
.sudoku-cell:focus-visible,
.word-cell:focus-visible,
.puzzle-back-link:focus-visible {
    outline: 3px solid #ffe17b;
    outline-offset: 3px;
}
.puzzle-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.puzzle-back-link {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 9px 15px;
    border: 1px solid #7653ad;
    border-radius: 7px;
    color: #e4d6ff;
    background: #211735;
    font-weight: 700;
    text-decoration: none;
}
.puzzle-back-link:hover { border-color: #4ce8ff; color: #fff; }
.puzzle-win {
    margin: 18px auto 0;
    padding: 15px;
    border: 1px solid var(--puzzle-accent);
    border-radius: 8px;
    background: rgba(17,12,32,.96);
    text-align: center;
    box-shadow: 0 0 20px color-mix(in srgb, var(--puzzle-accent), transparent 78%);
}
.puzzle-win[hidden] { display: none; }
.puzzle-win h3 { margin: 0 0 8px; color: #ffe17b; font-size: .9rem; }
.puzzle-win p { margin: 0 0 12px; color: #e2dced; }
.puzzle-machine.is-complete > :not(.puzzle-topline):not(#game-title):not(.puzzle-tagline):not(.puzzle-win) {
    display: none !important;
}
.puzzle-machine.is-complete .puzzle-win { display: block; }
.puzzle-disclaimer {
    margin: 17px 0 0;
    color: #bcb3d2;
    font-size: .875rem;
    text-align: center;
}

.puzzle-start-card[hidden],
.puzzle-play-area[hidden] { display: none !important; }
.puzzle-start-card {
    display: grid;
    justify-items: center;
    gap: 13px;
    width: min(100%, 600px);
    min-height: 245px;
    margin: 18px auto;
    padding: clamp(22px, 5vw, 38px);
    border: 1px solid color-mix(in srgb, var(--puzzle-accent), #251938 32%);
    border-radius: 9px;
    background:
        repeating-linear-gradient(0deg, color-mix(in srgb, var(--puzzle-accent), transparent 96%) 0, color-mix(in srgb, var(--puzzle-accent), transparent 96%) 1px, transparent 1px, transparent 4px),
        radial-gradient(ellipse at 50% 45%, color-mix(in srgb, var(--puzzle-accent), transparent 84%), transparent 72%),
        #100d20;
    box-shadow: 0 0 22px color-mix(in srgb, var(--puzzle-accent), transparent 84%), inset 0 0 0 3px rgba(15,11,31,.72);
    text-align: center;
}
.puzzle-start-kicker {
    margin: 0;
    color: #a3f5ff;
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.puzzle-start-card h3 {
    margin: 0;
    color: #ffe17b;
    font-family: "ADJMN Press Start", "Courier New", monospace;
    font-size: clamp(.9rem, 3.2vw, 1.15rem);
    font-weight: 400;
    line-height: 1.7;
}
.puzzle-start-card > p:not(.puzzle-start-kicker) {
    max-width: 42ch;
    margin: 0;
    color: #e2dced;
    font-size: 1rem;
}
.puzzle-start-card .puzzle-button { min-width: 180px; margin-top: 3px; }
.sudoku-mode-picker {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: min(100%, 520px);
}
.sudoku-mode-choice {
    display: grid;
    min-width: 0;
    min-height: 58px;
    align-content: center;
    justify-items: center;
    gap: 3px;
    padding: 7px 5px;
    border: 1px solid #5d4a8c;
    border-radius: 7px;
    color: #e2dced;
    background: #211735;
    font: 700 .95rem/1.2 Inter, ui-sans-serif, system-ui, sans-serif;
    cursor: pointer;
    touch-action: manipulation;
}
.sudoku-mode-choice strong { color: #a3f5ff; font-size: 1rem; }
.sudoku-mode-choice[aria-pressed="true"] {
    border-color: #ffe17b;
    color: #fff2c4;
    background: #3b2c4a;
    box-shadow: 0 0 12px rgba(255,225,123,.2), inset 0 0 0 1px rgba(255,225,123,.2);
}
.sudoku-mode-choice[aria-pressed="true"] strong { color: #ffe17b; }
.sudoku-mode-choice:focus-visible { outline: 3px solid #ffe17b; outline-offset: 3px; }

/* Cable Maze */
.maze-board-wrap { width: min(100%, 420px); margin: 0 auto; }
.maze-canvas {
    display: block;
    width: 100%;
    height: auto;
    border: 2px solid #4c3f76;
    background: #080812;
    box-shadow: inset 0 0 18px rgba(0,0,0,.75), 0 0 15px rgba(76,232,255,.13);
    image-rendering: pixelated;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.maze-marker-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 10px auto 0;
    color: #d8d1e7;
    font-size: .9rem;
}
.maze-marker-legend strong {
    margin-right: 5px;
    color: #4ce8ff;
    font-size: .75rem;
    letter-spacing: .08em;
}
.maze-marker-legend span:last-child strong { color: #ffe17b; }
.maze-control-hint {
    margin: 9px auto 0;
    color: #c4bfd6;
    font-size: .84rem;
    text-align: center;
}

/* Wedding Sudoku */
.sudoku-board {
    display: grid;
    grid-template-columns: repeat(var(--sudoku-size, 9), minmax(0, 1fr));
    width: min(100%, 414px);
    margin: 0 auto 14px;
    overflow: hidden;
    border: 2px solid #9b7e49;
    border-radius: 5px;
    background: #6a5b46;
}
.sudoku-cell {
    display: grid;
    min-width: 0;
    aspect-ratio: 1;
    place-items: center;
    padding: 0;
    border: 0;
    border-right: 1px solid #4f4662;
    border-bottom: 1px solid #4f4662;
    color: #4ce8ff;
    background: #151328;
    font: 600 clamp(.92rem, 4vw, 1.25rem)/1 Inter, ui-sans-serif, system-ui, sans-serif;
    cursor: pointer;
}
.sudoku-cell.box-right { border-right: 3px solid #82704f; }
.sudoku-cell.box-bottom { border-bottom: 3px solid #82704f; }
.sudoku-cell.last-column { border-right: 0; }
.sudoku-cell.last-row { border-bottom: 0; }
.sudoku-cell.given { color: #ffe17b; font-weight: 800; }
.sudoku-cell.selected { color: #fff; background: #bf2548; }
.sudoku-cell.related:not(.selected) { background: #24203b; }
.sudoku-cell.same-value:not(.selected) { background: #3c315c; }
#sudoku-play-area {
    display: grid;
    grid-template-columns: minmax(0, 414px) minmax(190px, 260px);
    grid-template-areas:
        "hud hud"
        "board pad"
        "actions actions";
    align-items: center;
    justify-content: center;
    gap: 14px 22px;
}
#sudoku-play-area .timed-puzzle-hud { grid-area: hud; width: 100%; }
#sudoku-play-area .sudoku-board {
    grid-area: board;
    width: min(100%, 414px);
    margin: 0 auto;
}
#sudoku-play-area .sudoku-number-pad {
    grid-area: pad;
    width: 100%;
    margin: 0;
}
#sudoku-play-area .puzzle-actions { grid-area: actions; }
.sudoku-machine #sudoku-status {
    min-height: 4.35em;
}
.sudoku-number-pad {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: min(100%, 300px);
    margin: 0 auto 12px;
}
.puzzle-key {
    width: 100%;
    min-height: 46px;
    border-color: #5d4a8c;
    background: #281d47;
    box-shadow: 0 3px 0 #160e2c;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}
.puzzle-key:hover { border-color: #ffe17b; }
.sudoku-clear { min-width: 104px; }

/* DJ Word Find */
.word-find-start[hidden],
.word-find-play-area[hidden] { display: none !important; }
.word-find-start {
    display: grid;
    justify-items: center;
    gap: 13px;
    width: min(100%, 600px);
    min-height: 245px;
    margin: 18px auto;
    padding: clamp(22px, 5vw, 38px);
    border: 1px solid #a85bd0;
    border-radius: 9px;
    background:
        repeating-linear-gradient(0deg, rgba(215,118,255,.035) 0, rgba(215,118,255,.035) 1px, transparent 1px, transparent 4px),
        radial-gradient(ellipse at 50% 45%, rgba(116,53,151,.28), transparent 72%),
        #100d20;
    box-shadow: 0 0 22px rgba(215,118,255,.16), inset 0 0 0 3px rgba(15,11,31,.72);
    text-align: center;
}
.word-find-start .word-start-kicker {
    margin: 0;
    color: #a3f5ff;
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.word-find-start h3 {
    margin: 0;
    color: #ffe17b;
    font-family: "ADJMN Press Start", "Courier New", monospace;
    font-size: clamp(.9rem, 3.2vw, 1.15rem);
    font-weight: 400;
    line-height: 1.7;
}
.word-find-start > p:not(.word-start-kicker) {
    max-width: 42ch;
    margin: 0;
    color: #e2dced;
    font-size: 1rem;
}
.word-find-start .word-start-button { min-width: 180px; margin-top: 3px; }
.word-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    margin: 0 auto 13px;
    padding: 10px;
    border: 1px solid #51436f;
    border-radius: 7px;
    background: rgba(5,5,14,.88);
}
.word-item {
    padding: 4px 8px;
    border: 1px solid #51436f;
    border-radius: 5px;
    color: #a3f5ff;
    background: #211735;
    font-size: .95rem;
    font-weight: 750;
    letter-spacing: .04em;
}
.word-item.found { border-color: #4ce8ff; color: #baf7ce; text-decoration: line-through; opacity: .78; }
.word-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: clamp(2px, .7vw, 5px);
    width: min(100%, 420px);
    margin: 0 auto;
    padding: clamp(6px, 1.4vw, 10px);
    border: 2px solid #65508e;
    border-radius: 8px;
    background: #080812;
}
.word-cell {
    display: grid;
    min-width: 0;
    aspect-ratio: 1;
    place-items: center;
    padding: 0;
    border: 1px solid #51436f;
    border-radius: 4px;
    color: #f7f3ff;
    background: #201a38;
    font: 700 clamp(.9rem, 4.2vw, 1.2rem)/1 Inter, ui-sans-serif, system-ui, sans-serif;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}
.word-cell:hover { border-color: #d776ff; background: #32204d; }
.word-cell.selected { border-color: #ffe17b; color: #fff; background: #b72e5b; }
.word-cell.found { border-color: #65ecc2; color: #baf7ce; background: #17443d; }
.word-cell.found.selected {
    border-color: #ffe17b;
    color: #fff;
    background: #684218;
    box-shadow: inset 0 0 0 2px #ffe17b;
}
.word-hint { margin: 11px auto 17px; color: #d8d1e7; font-size: 1rem; text-align: center; }

@media (max-width: 600px) {
    .casual-puzzle-page { width: min(100% - 28px, 480px); padding: 28px 0 42px; }
    .puzzle-intro { margin-bottom: 18px; }
    .puzzle-intro > p:last-child { font-size: 1rem; }
    .puzzle-machine { padding: 13px 10px 17px; }
    .puzzle-topline { font-size: .75rem; }
    .puzzle-hud { grid-template-columns: 86px minmax(0,1fr); gap: 8px; padding: 9px; }
    .timed-puzzle-hud {
        grid-template-columns: minmax(66px, .7fr) minmax(104px, 1fr);
        align-items: start;
    }
    .timed-puzzle-hud > p { grid-column: 1 / -1; }
    .timed-puzzle-hud > div strong { font-size: 1rem; }
    .puzzle-hud > p { font-size: .95rem; }
    .puzzle-instructions { margin: 12px auto 15px; }
    .puzzle-actions { gap: 9px; }
    .puzzle-button, .puzzle-back-link { min-height: 46px; }
    .puzzle-tagline { font-size: .72rem; }
    .puzzle-start-card { min-height: 220px; padding: 21px 15px; }
    .puzzle-start-card > p:not(.puzzle-start-kicker) { font-size: .96rem; }
    .word-grid { width: min(100%, 380px); }
}

@media (max-width: 760px) {
    #sudoku-play-area {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "hud"
            "board"
            "pad"
            "actions";
        gap: 14px;
    }
    #sudoku-play-area .sudoku-number-pad {
        width: min(100%, 300px);
        margin: 0 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .puzzle-button, .puzzle-key { transition: none; }
}
