/* Web puzzle player and play pages (/play/, /de/spielen/ ...). Loaded only there.
   Board colors follow the app's default look in dark mode: Arctic Sky grid
   (cell #102535, lines #2A5575, box lines #64D2FF), system-blue selection,
   yellow row/column/box wash, gray given digits, red wrong digits, killer
   cage pastels at low strength. UI chrome uses the site's own tokens. */

.play-page {
    flex: 1;
    max-width: 760px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
    width: 100%;
    --pb-cell: #102535;
    --pb-thin: #2a5575;
    --pb-thick: #64d2ff;
    --pb-given: #a9b4c2;
    --pb-entry: #eaf5ff;
    --pb-wrong: #ff6961;
    --pb-select: rgba(10, 132, 255, 0.38);
    --pb-peer: rgba(255, 214, 10, 0.13);
    --pb-same: rgba(64, 156, 255, 0.85);
    --pb-ring: #ffffff;
}

@media (min-width: 640px) {
    .play-page {
        padding: 1.5rem 1.5rem 3rem;
    }
}

.play-page h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin-bottom: 0.5rem;
}

.play-intro {
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 1.25rem;
}

.play-h2,
.play-rules h2,
.play-other-types h2 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 2rem 0 0.75rem;
}

.play-rules p {
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.75;
    margin-bottom: 0.9rem;
}

.play-rules a,
.play-other-types a {
    color: var(--color-accent);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ===== Player shell ===== */

.play {
    margin: 0 auto;
}

.play-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
    min-height: 2.75rem;
}

.play-toolbar-start {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.play-difficulty {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.play-difficulty select {
    font: inherit;
    color: var(--color-text);
    background: var(--color-card);
    border: 1px solid var(--color-card-border);
    border-radius: 10px;
    padding: 0.45rem 0.6rem;
    min-height: 2.75rem;
}

.play-difficulty option {
    background: #17243c;
}

.play-daily-label {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
}

.play-premium-label {
    font-size: 0.92rem;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.85);
}

.play-finish-note {
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 1rem;
}

.play-premium-box strong {
    color: var(--color-text);
}

.play-timer {
    font-variant-numeric: tabular-nums;
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.85);
}

.play-board-scroll {
    position: relative;
    border-radius: 6px;
}

.play-status {
    padding: 4rem 1rem;
    text-align: center;
    color: var(--color-text-muted);
}

.play-status-error {
    color: var(--pb-wrong);
}

.play.is-zoomed .play-board-scroll {
    overflow: auto;
    max-height: calc(100svh - 15rem);
    min-height: 16rem;
    overscroll-behavior: contain;
    border: 1px solid var(--color-card-border);
}

/* ===== Board (SVG) ===== */

.play-board {
    display: block;
    width: 100%;
    max-width: min(100%, calc(var(--cols) * 58px), 74svh);
    height: auto;
    margin: 0 auto;
    font-family: var(--font-family);
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.play.is-zoomed .play-board {
    max-width: none;
}

.pb-cell {
    cursor: pointer;
    touch-action: manipulation;
    outline: none;
}

.pb-bg {
    fill: var(--pb-cell);
}

.pb-hl {
    fill: transparent;
}

.is-peer .pb-hl {
    fill: var(--pb-peer);
}

.is-selected .pb-hl {
    fill: var(--pb-select);
}

.pb-same {
    fill: none;
    stroke: none;
}

.is-same .pb-same {
    stroke: var(--pb-same);
    stroke-width: 2px;
    vector-effect: non-scaling-stroke;
}

.pb-ring {
    fill: none;
    stroke: none;
}

.pb-cell:focus-visible .pb-ring {
    stroke: var(--pb-ring);
    stroke-width: 2.5px;
    vector-effect: non-scaling-stroke;
}

.pb-digit {
    font-size: 60px;
    font-weight: 500;
    fill: var(--pb-entry);
    text-anchor: middle;
    dominant-baseline: central;
}

.is-given .pb-digit {
    fill: var(--pb-given);
    font-weight: 600;
}

.is-wrong .pb-digit {
    fill: var(--pb-wrong);
    text-decoration: underline;
}

.is-16 .pb-digit {
    font-size: 56px;
}

.pb-notes text {
    font-size: 25px;
    font-weight: 500;
    fill: #9fc4e0;
    text-anchor: middle;
    dominant-baseline: central;
}

.is-16 .pb-notes text {
    font-size: 19px;
}

.is-killer .is-anchor .pb-notes text {
    font-size: 21px;
}

.pb-thin,
.pb-thick,
.pb-cage {
    fill: none;
    pointer-events: none;
    vector-effect: non-scaling-stroke;
}

.pb-thin {
    stroke: var(--pb-thin);
    stroke-width: 1px;
}

.pb-thick {
    stroke: var(--pb-thick);
    stroke-width: 2.5px;
    stroke-linecap: square;
}

.pb-cage {
    stroke: rgba(234, 245, 255, 0.7);
    stroke-width: 1px;
    stroke-dasharray: 3 3;
}

.pb-sums text {
    font-size: 27px;
    font-weight: 600;
    fill: #eaf5ff;
    paint-order: stroke;
    stroke: var(--pb-cell);
    stroke-width: 7px;
    pointer-events: none;
}

/* Killer cage tints: the app's five pastels, mixed in lightly on the dark cell. */
.tint-0 .pb-bg { fill: color-mix(in srgb, #f2d9d9 16%, var(--pb-cell)); }
.tint-1 .pb-bg { fill: color-mix(in srgb, #d9ebf2 16%, var(--pb-cell)); }
.tint-2 .pb-bg { fill: color-mix(in srgb, #e0f2d9 16%, var(--pb-cell)); }
.tint-3 .pb-bg { fill: color-mix(in srgb, #f2ebd1 16%, var(--pb-cell)); }
.tint-4 .pb-bg { fill: color-mix(in srgb, #ebd9f2 16%, var(--pb-cell)); }

/* ===== Controls and number pad ===== */

.play-controls {
    display: flex;
    gap: 0.4rem;
    max-width: 520px;
    margin: 0.9rem auto 0.6rem;
}

/* Undo, Erase, Notes (and Zoom) share one row in equal parts. */
.play-controls .play-btn {
    flex: 1 1 0;
    min-width: 0;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
}

.play-btn {
    font: inherit;
    font-size: 0.92rem;
    color: var(--color-text);
    background: var(--color-card);
    border: 1px solid var(--color-card-border);
    border-radius: 10px;
    padding: 0.5rem 0.95rem;
    min-height: 2.75rem;
    cursor: pointer;
    touch-action: manipulation;
}

.play-btn:hover:not(:disabled) {
    border-color: rgba(255, 255, 255, 0.35);
}

.play-btn[aria-pressed="true"] {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.play-btn-primary {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}

.play-btn:disabled,
.play-key:disabled {
    opacity: 0.45;
    cursor: default;
}

.play-btn:focus-visible,
.play-key:focus-visible,
.play-difficulty select:focus-visible,
.play-type-card:focus-visible {
    outline: 2px solid var(--pb-thick);
    outline-offset: 2px;
}

.play-pad {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0.35rem;
    max-width: 520px;
    margin: 0 auto;
}

.play-pad.is-16 {
    grid-template-columns: repeat(8, 1fr);
}

.play-key {
    font: inherit;
    font-size: 1.35rem;
    font-weight: 500;
    color: var(--color-text);
    background: var(--color-card);
    border: 1px solid var(--color-card-border);
    border-radius: 10px;
    min-height: 3rem;
    cursor: pointer;
    touch-action: manipulation;
}

.play-key:active:not(:disabled) {
    background: rgba(10, 132, 255, 0.35);
}

.play-key.is-done {
    color: var(--color-text-muted);
}

.play.is-notes .play-key {
    font-size: 1rem;
    color: #9fc4e0;
    border-style: dashed;
}

/* While zoomed, the pad stays on screen below the scrollable board. */
.play.is-zoomed .play-pad {
    position: sticky;
    bottom: 0;
    z-index: 1;
    padding: 0.4rem 0;
    background: var(--color-bg);
}

/* Phones: the select shows the level by itself, the "Difficulty" word stays for screen readers. */
@media (max-width: 480px) {
    .play-difficulty-text {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .play-btn {
        font-size: 0.88rem;
    }
}

/* The keyboard line is noise on touch-only devices. */
@media (hover: none) and (pointer: coarse) {
    .play-keys {
        display: none;
    }
}

.play-keys {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-align: center;
}

/* ===== Finish dialog ===== */

.play-finish {
    margin: auto;
    width: min(92vw, 440px);
    color: var(--color-text);
    background: #17243c;
    border: 1px solid var(--color-card-border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
}

.play-finish::backdrop {
    background: rgba(5, 10, 20, 0.7);
}

.play-finish h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.play-finish-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
}

.play-finish-stats dt {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.play-finish-stats dd {
    font-size: 1.3rem;
    font-variant-numeric: tabular-nums;
}

.play-finish .play-app-box {
    margin: 0 0 1rem;
    padding: 1rem;
}

.play-finish-actions {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

/* ===== App box ===== */

.play-app-box {
    background: var(--color-card);
    border: 1px solid var(--color-card-border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    margin-top: 2rem;
}

.play-app-box h2,
.play-app-box h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.play-app-box p {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.92rem;
    margin-bottom: 1rem;
}

/* ===== Hub cards and other-type links ===== */

.play-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    list-style: none;
    padding: 0;
}

.play-type-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    height: 100%;
    background: var(--color-card);
    border: 1px solid var(--color-card-border);
    border-radius: 14px;
    padding: 1rem;
    color: var(--color-text);
}

.play-type-card:hover {
    border-color: var(--color-accent);
    color: var(--color-text);
}

.play-card-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 0.25rem;
}

.play-card-icon rect {
    fill: rgba(100, 210, 255, 0.1);
    stroke: var(--pb-thick);
    stroke-width: 1.5px;
    vector-effect: non-scaling-stroke;
}

.play-type-name {
    font-weight: 600;
    line-height: 1.3;
}

.play-type-blurb {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.45;
}

.play-other-types ul {
    list-style: none;
    padding: 0;
    columns: 2;
    column-gap: 1.5rem;
}

.play-other-types li {
    margin-bottom: 0.5rem;
    break-inside: avoid;
}
