/* ==========================================================================
   Sokoban — Game Screen Layer CSS  (redesign 2026-09)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Board Grid Container
   -------------------------------------------------------------------------- */
.sk-board {
    display: grid;
    gap: 2px;
    margin: 0 auto;
    touch-action: manipulation;
}

.sk-board,
.sk-cell,
.sk-cell * {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

/* --------------------------------------------------------------------------
   Base Cell
   -------------------------------------------------------------------------- */
.sk-cell {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    padding: 0;
    margin: 0;
    background: transparent;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.07s ease;
    border-radius: 3px;
    overflow: visible;
}

.sk-cell .paper-tile-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
    border-radius: 3px;
}

/* --------------------------------------------------------------------------
   Wall — dark solid block, clearly impassable
   -------------------------------------------------------------------------- */
.sk-cell--wall {
    cursor: default;
    background: #3b4f63;
    border-radius: 2px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        inset 0 -2px 0 rgba(0, 0, 0, 0.28);
}

/* No paper texture on walls */
.sk-cell--wall .paper-tile-svg {
    display: none;
}

/* --------------------------------------------------------------------------
   Floor — shows notebook paper background through paper tile SVG
   -------------------------------------------------------------------------- */
.sk-cell--floor:hover {
    transform: translateY(-1px);
    z-index: 2;
}

.sk-cell--floor:active {
    transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Target — large red ink circle drawn on paper
   -------------------------------------------------------------------------- */
.sk-cell--target::before {
    content: '';
    position: absolute;
    inset: 14%;
    border: 2.5px solid rgba(192, 57, 43, 0.75);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}

.sk-cell--target::after {
    content: '';
    position: absolute;
    inset: 37%;
    background: rgba(192, 57, 43, 0.55);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}

/* --------------------------------------------------------------------------
   Box — cardboard crate look, clearly 3-D
   -------------------------------------------------------------------------- */
.sk-cell--box {
    cursor: pointer;
}

/* No paper SVG for boxes — custom face handles the look */
.sk-cell--box .paper-tile-svg,
.sk-cell--box-done .paper-tile-svg {
    display: none;
}

.sk-box-face {
    position: absolute;
    inset: 5%;
    background: linear-gradient(150deg, #d4924a 0%, #b97130 55%, #9a5c20 100%);
    border-radius: 5px;
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.22),
        inset 0 -1px 0 rgba(0, 0, 0, 0.15),
        0 3px 0 #6b3d10,
        0 4px 6px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

/* Cross-string lines on crate face */
.sk-box-face::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1.5px;
    background: rgba(0, 0, 0, 0.16);
    transform: translateX(-50%);
}

.sk-box-face::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1.5px;
    background: rgba(0, 0, 0, 0.16);
    transform: translateY(-50%);
}

/* --------------------------------------------------------------------------
   Box on Target — green "delivered" state
   -------------------------------------------------------------------------- */
.sk-cell--box-done .sk-box-face {
    background: linear-gradient(150deg, #5dce81 0%, #27ae60 55%, #1a8a4a 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.28),
        inset 0 -1px 0 rgba(0, 0, 0, 0.12),
        0 3px 0 #126436,
        0 4px 6px rgba(0, 0, 0, 0.18);
}

.sk-box-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #126436;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 4;
}

/* --------------------------------------------------------------------------
   Player — bright blue circle, clearly the character
   -------------------------------------------------------------------------- */
.sk-cell--player .paper-tile-svg {
    border-radius: 50% !important;
}

.sk-cell--player::after {
    content: '';
    position: absolute;
    inset: 11%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 32%, #5dade2 0%, #1a6fa8 75%);
    box-shadow:
        inset 0 2px 3px rgba(255, 255, 255, 0.4),
        0 3px 7px rgba(0, 0, 0, 0.35);
    z-index: 3;
}

/* Keep the blue player; show the target around it. */
.sk-cell--player.sk-cell--target::before { inset:4%; border:2px solid rgba(192,57,43,.75); }

/* --------------------------------------------------------------------------
   Path Trail — subtle ink dots showing possible walk route
   -------------------------------------------------------------------------- */
.sk-cell--path:not(.sk-cell--target):not(.sk-cell--player)::before {
    content: '';
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(44, 62, 80, 0.28);
    z-index: 2;
}

/* Rectangular warehouse fits inside the shared square game slot. */
#game-canvas-area { width:min(88vw,408px); aspect-ratio:1; display:flex; align-items:center; justify-content:center; margin-inline:auto; }
.sk-board { width:calc(100% * var(--sk-cols) / var(--sk-side)); height:calc(100% * var(--sk-rows) / var(--sk-side)); gap:2px; }
.sk-cell { min-width:0; min-height:0; aspect-ratio:auto; height:100%; }
.plg-play-screen .gamestat-module { width:100%;max-width:340px; }
.page-content h2,.page-content h3 { display:block; }
.page-content .content-block,.page-content .faq-block,.page-content .strategy-block { overflow:clip; }
@media (max-width:360px) { .sk-box-badge { width:12px;height:12px;font-size:8px;top:1px;right:1px; } }

@media (max-width:360px) { .gamestat-item:nth-of-type(1) > .gamestat-label { font-size:13px; letter-spacing:0; padding-inline:3px; } }

.sk-teaching-example p { white-space:pre-wrap; font-family:monospace; font-size:13px; line-height:28px; }
.page-content h2 { display:block; }

.page-content .guide-block { overflow:clip; }

.sk-cell--exterior { pointer-events:none; cursor:default; }
.sk-walk-trail { position:absolute;width:5px;height:5px;border-radius:50%;background:rgba(44,62,80,.25);z-index:2;pointer-events:none; }
.sk-cell--player .sk-walk-trail { display:none; }
@media (prefers-reduced-motion:reduce) { .sk-walk-trail { display:none; } }

.sk-confirm .message-sticker { --sticker-fill:#eadb83; --sticker-stroke:#b9a34f; --sticker-underlay:rgba(91,77,30,.26); }
.sk-confirm .msg-title { font-size:20px; }
.sk-confirm .msg-body { font-size:15px;line-height:1.45; }
