/* Stream Lab v2 — Stardew-inspired cozy pixel UI */

/* Pixellari by Zacchary Dempsey-Plante — 100% free (credit requested by author) */
@font-face {
    font-family: 'Pixellari';
    src: url('fonts/Pixellari.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

.play-page {
    /* Readable pixel UI (Pixellari); chunky display for brand marks only */
    --pixel-font: 'Pixellari', 'Courier New', monospace;
    --pixel-display: 'Press Start 2P', monospace;
    /* Warm Stardew UI tokens (no neon / no yellow accents) */
    --sdv-cream: #f5d9a5;
    --sdv-cream-deep: #e8c48a;
    --sdv-parchment: #f0cfa0;
    --sdv-wood: #6b3a1f;
    --sdv-wood-dark: #3e1c11;
    --sdv-wood-mid: #8a552e;
    --sdv-wood-light: #a86b3c;
    --sdv-inset: #d4a86a;
    --sdv-text: #3e1c11;
    --sdv-text-muted: #6b4228;
    --sdv-green: #2f6b32;
    --sdv-green-light: #4a8f4a;
    --sdv-terracotta: #c45c38;
    --pmtv-pink: #ff2961;
    padding-top: 52px;
    overflow-x: hidden;
}

.play-header {
    position: fixed;
    z-index: 20;
}

.play-main {
    min-height: calc(100vh - 52px);
    min-height: calc(100dvh - 52px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background:
        radial-gradient(ellipse at 30% 15%, rgba(107, 58, 31, 0.35), transparent 55%),
        linear-gradient(165deg, #1a140e 0%, #0f0c0a 50%, #16110c 100%);
}

.play-layout {
    display: grid;
    grid-template-columns: minmax(0, 660px) minmax(250px, 290px);
    grid-template-rows: auto auto;
    gap: 16px 20px;
    width: min(100%, 980px);
    align-items: stretch;
}

.play-intro {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
}

.play-brand-kicker {
    display: block;
    font-family: var(--pixel-display);
    font-size: 0.825rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pmtv-pink);
    margin: 0;
}

/* Plain blurb (no board) */
.play-blurb {
    margin: 0;
    font-family: var(--pixel-font);
    font-size: 1.1rem;
    line-height: 1.55;
    color: #d4c4a8;
    max-width: min(44rem, 100%);
}

.play-tags {
    display: inline-block;
    margin-top: 0.15em;
    color: #b8a888;
    letter-spacing: 0.02em;
}

/* Stardew wooden sign — thick timber frame + cream plaque */
.play-title-sign {
    position: relative;
    display: inline-block;
    padding: 10px 12px;
    border-radius: 2px;
    image-rendering: pixelated;
    background:
        repeating-linear-gradient(
            90deg,
            #8a4e28 0 4px,
            #9a5a30 4px 7px,
            #7a4420 7px 10px
        );
    border: 4px solid #2a1408;
    box-shadow:
        inset 3px 3px 0 #c48848,
        inset 6px 6px 0 #a86838,
        inset -3px -3px 0 #3e1c11,
        inset -6px -6px 0 #5a2c14,
        0 0 0 2px #1a0c06,
        4px 4px 0 rgba(20, 12, 8, 0.55);
}

.play-title-sign::before {
    content: '';
    position: absolute;
    inset: 4px;
    border: 2px solid #5a3018;
    box-shadow:
        inset 2px 2px 0 rgba(232, 180, 100, 0.35),
        inset -2px -2px 0 rgba(40, 16, 8, 0.55);
    pointer-events: none;
}

.play-title-sign-inner {
    position: relative;
    z-index: 1;
    padding: 14px 22px 12px;
    background:
        repeating-linear-gradient(
            180deg,
            transparent 0 3px,
            rgba(180, 140, 80, 0.12) 3px 4px
        ),
        #f3e0b8;
    border: 3px solid #3e1c11;
    box-shadow:
        inset 2px 2px 0 #fff6d8,
        inset -2px -2px 0 #c8a878,
        2px 2px 0 #2a1408;
}

.play-brand-title {
    font-family: var(--pixel-display);
    font-weight: 400;
    font-size: 1.725rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9a2c28;
    margin: 0;
    text-shadow: 2px 2px 0 #3e1410;
    line-height: 1.35;
}

.play-tip {
    margin: 0;
    font-family: var(--pixel-font);
    font-size: 1.44rem;
    line-height: 1.5;
    color: #e8dcc8;
    transition: opacity 0.25s ease;
    max-width: 52rem;
}

.play-tip.is-faded {
    opacity: 0.55;
}

.play-canvas-wrap {
    position: relative;
    width: 100%;
    max-width: 660px;
    aspect-ratio: 1;
    align-self: start;
    background: #1a2818;
    border: 4px solid var(--sdv-wood-dark);
    border-radius: 6px;
    box-shadow:
        inset 2px 2px 0 var(--sdv-wood-light),
        inset -2px -2px 0 #2a1208,
        4px 4px 0 rgba(20, 12, 8, 0.65);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    image-rendering: pixelated;
}

#play-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: grab;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#play-canvas.is-grabbing {
    cursor: grabbing;
}

/* Wooden / parchment sidebar */

.play-sidebar {
    --ui-type: 0.72rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 12px;
    background:
        linear-gradient(180deg, var(--sdv-cream) 0%, var(--sdv-parchment) 55%, var(--sdv-cream-deep) 100%);
    border: 4px solid var(--sdv-wood-dark);
    border-radius: 8px;
    box-shadow:
        inset 3px 3px 0 var(--sdv-wood-light),
        inset -3px -3px 0 #4a2410,
        4px 4px 0 rgba(20, 12, 8, 0.55);
    color: var(--sdv-text);
    align-self: stretch;
    min-height: 0;
    overflow-y: auto;
    box-sizing: border-box;
}

.play-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.play-sidebar-hint {
    margin: -4px 0 0;
    font-family: var(--pixel-font);
    font-size: 1.44rem;
    line-height: 1.45;
    color: var(--sdv-text-muted);
}

.play-stat {
    font-family: var(--pixel-font);
    font-size: 1.44rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    padding: 10px 12px;
    border-radius: 4px;
    color: var(--sdv-text);
    background: var(--sdv-inset);
    border: 2px solid var(--sdv-wood-dark);
    box-shadow: inset 2px 2px 0 #b88848, inset -1px -1px 0 var(--sdv-cream);
}

.play-stat.is-shake {
    animation: play-shake 0.35s ease;
    border-color: var(--pmtv-pink);
    color: var(--pmtv-pink);
}

@keyframes play-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

.play-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.play-panel-title {
    font-family: var(--pixel-font);
    font-size: var(--ui-type);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sdv-terracotta);
    margin: 0;
}

/* --- Stardew mode dial (round face + clear ticks) --- */

.play-dial {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 12px 8px 14px;
    background: var(--sdv-inset);
    border: 3px solid var(--sdv-wood-dark);
    border-radius: 4px;
    box-shadow:
        inset 2px 2px 0 #b07a40,
        inset -2px -2px 0 var(--sdv-cream);
    user-select: none;
    image-rendering: pixelated;
}

.play-dial-labels {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    width: 100%;
}

/* Wooden board plaques — active bright, idle faded */
.play-dial-label {
    appearance: none;
    font-family: var(--pixel-font);
    font-size: var(--ui-type);
    font-weight: 600;
    line-height: 1.45;
    text-transform: uppercase;
    color: #6a4a2e;
    background:
        repeating-linear-gradient(
            90deg,
            #b88848 0 3px,
            #a87840 3px 6px
        );
    border: 2px solid #5a3418;
    border-radius: 3px;
    padding: 7px 2px;
    cursor: pointer;
    text-align: center;
    box-shadow:
        inset 1px 1px 0 #c9a060,
        inset -1px -1px 0 #7a4a22,
        2px 2px 0 rgba(62, 28, 17, 0.28);
    opacity: 0.62;
    filter: saturate(0.75);
}

.play-dial-label.is-active {
    color: var(--sdv-text);
    background: var(--sdv-cream);
    border-color: var(--sdv-wood-dark);
    box-shadow:
        inset 1px 1px 0 #fff3d0,
        inset -1px -1px 0 var(--sdv-wood-mid),
        2px 2px 0 rgba(62, 28, 17, 0.4);
    opacity: 1;
    filter: none;
}

.play-dial-label:focus-visible {
    outline: 2px solid var(--sdv-terracotta);
    outline-offset: 2px;
}

.play-dial-face {
    position: relative;
    width: 128px;
    height: 128px;
    border-radius: 50%;
    background:
        repeating-linear-gradient(
            0deg,
            transparent 0 3px,
            rgba(62, 28, 17, 0.22) 3px 4px
        ),
        repeating-linear-gradient(
            90deg,
            #7a4528 0 4px,
            #6b3a1f 4px 8px
        ),
        #6b3a1f;
    border: 4px solid var(--sdv-wood-dark);
    box-shadow:
        inset 3px 3px 0 #a86b3c,
        inset -3px -3px 0 #3e1c11,
        0 0 0 2px #2a1208,
        3px 3px 0 rgba(62, 28, 17, 0.45);
    cursor: pointer;
    image-rendering: pixelated;
}

.play-dial-face:active {
    cursor: pointer;
}

/* Inner ring */
.play-dial-face::before {
    content: '';
    position: absolute;
    inset: 8px;
    border: 3px solid #3e1c11;
    border-radius: 50%;
    box-shadow: inset 0 0 0 2px #8a552e;
    pointer-events: none;
}

/* Tick marks only — no end-cap squares */
.play-dial-tick {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 4px;
    height: 16px;
    margin: -8px 0 0 -2px;
    background: var(--sdv-cream);
    border: 2px solid var(--sdv-wood-dark);
    border-radius: 1px;
    transform: rotate(var(--tick)) translateY(-50px);
    transform-origin: center center;
    box-shadow: 1px 1px 0 rgba(62, 28, 17, 0.35);
    pointer-events: none;
    z-index: 2;
}

.play-dial[data-mode="rock"] .play-dial-tick[data-mode="rock"],
.play-dial[data-mode="remove"] .play-dial-tick[data-mode="remove"],
.play-dial[data-mode="dig"] .play-dial-tick[data-mode="dig"] {
    background: var(--sdv-terracotta);
    height: 20px;
    margin-top: -10px;
    box-shadow: 0 0 0 1px var(--sdv-cream), 1px 1px 0 rgba(62, 28, 17, 0.4);
}

/* Rotating wooden disc on the larger face — keep */
.play-dial-knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 76px;
    height: 76px;
    margin: -38px 0 0 -38px;
    border-radius: 50%;
    overflow: hidden;
    background:
        repeating-linear-gradient(
            90deg,
            #8a552e 0 3px,
            #9a6336 3px 6px
        );
    border: 3px solid var(--sdv-wood-dark);
    box-shadow:
        inset 3px 3px 0 #c89860,
        inset -3px -3px 0 #4a2410;
    transform: rotate(var(--dial-angle, -52deg));
    transition: transform 0.16s steps(4);
    pointer-events: none;
    z-index: 1;
    image-rendering: pixelated;
}

.play-dial[data-pos="0"] { --dial-angle: -52deg; }
.play-dial[data-pos="1"] { --dial-angle: 0deg; }
.play-dial[data-pos="2"] { --dial-angle: 52deg; }

/* Full-diameter light wood arrow — stays inside the rotating disc */
.play-dial-pointer {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 28px;
    height: 64px;
    margin: -32px 0 0 -14px;
    background:
        repeating-linear-gradient(
            180deg,
            #f8e4b8 0 3px,
            #ecd29a 3px 5px,
            #f0cfa0 5px 8px
        );
    clip-path: polygon(
        50% 2%,
        100% 28%,
        68% 28%,
        68% 98%,
        32% 98%,
        32% 28%,
        0% 28%
    );
    filter:
        drop-shadow(0 0 0 #2a1208)
        drop-shadow(2px 0 0 #2a1208)
        drop-shadow(-2px 0 0 #2a1208)
        drop-shadow(0 2px 0 #2a1208)
        drop-shadow(0 -2px 0 #2a1208);
    z-index: 2;
    image-rendering: pixelated;
}

.play-dial-pointer::before,
.play-dial-pointer::after {
    content: none;
}

/* Rock size tray — two standard rocks */

.play-rock-tray {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 12px;
}

.play-rock-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border: 3px solid var(--sdv-wood-dark);
    border-radius: 6px;
    background: #3d7a38;
    box-shadow:
        inset 2px 2px 0 #5a9a48,
        inset -2px -2px 0 #2a5020,
        3px 3px 0 rgba(62, 28, 17, 0.4);
    cursor: grab;
    touch-action: none;
    user-select: none;
    flex-shrink: 0;
    padding: 0;
    image-rendering: pixelated;
}

.play-rock-chip.is-selected {
    border-color: var(--sdv-terracotta);
    box-shadow:
        inset 2px 2px 0 #5a9a48,
        inset -2px -2px 0 #2a5020,
        0 0 0 2px var(--sdv-cream),
        3px 3px 0 rgba(62, 28, 17, 0.4);
}

.play-rock-chip:active {
    cursor: grabbing;
}

.play-rock-chip.is-disabled {
    cursor: default;
    opacity: 0.72;
    filter: saturate(0.85);
}

.play-rock-chip-canvas {
    display: block;
    width: 56px;
    height: 56px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    pointer-events: none;
}

#play-canvas.is-dig {
    cursor: crosshair;
}

#play-canvas.is-remove {
    cursor: pointer;
}

.play-reset-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 2px;
}

.play-reset-btn {
    width: 100%;
    padding: 14px 12px;
    font-family: var(--pixel-font);
    font-size: 1.44rem;
    font-weight: 700;
    line-height: 1.35;
    text-transform: uppercase;
    color: var(--sdv-text);
    background: var(--sdv-cream);
    border: 3px solid var(--sdv-wood-dark);
    border-radius: 6px;
    box-shadow:
        inset 2px 2px 0 #fff3d0,
        inset -2px -2px 0 var(--sdv-wood-mid),
        3px 3px 0 rgba(62, 28, 17, 0.35);
    cursor: pointer;
}

.play-reset-btn:hover {
    background: #ffe4b0;
}

.play-reset-btn:active {
    transform: translate(2px, 2px);
    box-shadow:
        inset 2px 2px 0 var(--sdv-wood-mid),
        1px 1px 0 rgba(62, 28, 17, 0.35);
}

.play-reset-btn--hot {
    color: #fff8f0;
    background: var(--sdv-green);
    border-color: var(--sdv-wood-dark);
    box-shadow:
        inset 2px 2px 0 var(--sdv-green-light),
        inset -2px -2px 0 #1e4a20,
        3px 3px 0 rgba(62, 28, 17, 0.35);
}

.play-reset-btn--hot:hover {
    background: #357a38;
}

.play-toast {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 12px 14px;
    border-radius: 6px;
    font-family: var(--pixel-font);
    font-size: 0.48rem;
    line-height: 1.5;
    background: var(--sdv-cream);
    color: var(--sdv-text);
    border: 3px solid var(--sdv-wood-dark);
    box-shadow: 3px 3px 0 rgba(62, 28, 17, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 5;
    white-space: nowrap;
}

.play-toast.is-visible {
    opacity: 1;
}

@media (max-width: 680px) {
    .play-layout {
        grid-template-columns: 1fr;
        max-width: 660px;
    }

    .play-sidebar {
        order: 3;
        align-self: stretch;
        height: auto;
        max-height: none;
        overflow-y: visible;
    }
}
