/* Word Search — Game Worlds (dark slate + cyan, matches Mine Finder family) */

@media screen and (max-height: 640px) {
    .container.container-single {
        padding-top: 3px !important;
    }
}

.ws-gw#gamebox,
#gamebox.ws-gw {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    min-height: 420px;
    margin: 0;
    padding: 0;
    position: relative;
    overflow: hidden;

    font-family:
        ui-sans-serif,
        system-ui,
        -apple-system,
        'Segoe UI',
        Roboto,
        'Helvetica Neue',
        Arial,
        sans-serif;

    color: #e2e8f0;
    background:
        radial-gradient(ellipse 100% 65% at 50% 0%, rgba(34, 211, 238, 0.08) 0%, transparent 52%),
        linear-gradient(165deg, #0b0f14 0%, #111827 48%, #0a0d12 100%);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 14px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 18px 44px rgba(0, 0, 0, 0.5);
}

.ws-layout {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: 16px 20px;
    padding: 16px 16px 20px;
}

.ws-word-panel#wordListContainer,
#wordListContainer.ws-word-panel {
    float: none;
    width: auto;
    min-width: 160px;
    max-width: 220px;
    height: auto;
    padding: 14px 16px;
    margin: 0;

    background: rgba(30, 41, 59, 0.65);
    border: 1px solid rgba(34, 211, 238, 0.22);
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.ws-word-list#wordList,
#wordList.ws-word-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ws-word-list#wordList li,
#wordList.ws-word-list li {
    float: none;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #a5f3fc;
    text-transform: uppercase;
}

.ws-word-list#wordList li.label,
#wordList li.label {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    color: #7dd3fc;
    opacity: 0.9;
    margin-bottom: 2px;
}

.ws-gw .ws-word-found {
    text-decoration: line-through;
    text-decoration-color: #f87171;
    text-decoration-thickness: 2px;
    color: #64748b !important;
    opacity: 0.85;
}

.ws-grid-panel#wordSearchContainer,
#wordSearchContainer.ws-grid-panel {
    float: none;
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px;
    text-align: center;
}

.ws-wordsearch-grid.wordsearch,
.wordsearch.ws-wordsearch-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(28px, 3.25rem));
    gap: 4px;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    padding: 12px;

    align-content: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(51, 65, 85, 0.7);
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ws-gw .cell {
    box-sizing: border-box;
    width: 100%;
    aspect-ratio: 1;
    height: auto;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;

    margin: 0;
    padding: 0;
    border: 1px solid rgba(15, 23, 42, 0.5);
    border-radius: 8px;

    font-size: clamp(1rem, 2.8vw, 1.45rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #f1f5f9;

    cursor: pointer;
    user-select: none;

    background: linear-gradient(165deg, #475569 0%, #334155 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 2px 6px rgba(0, 0, 0, 0.25);

    transition:
        transform 0.12s ease,
        filter 0.12s ease,
        background 0.15s ease;
}

.ws-gw .cell:hover {
    filter: brightness(1.08);
}

.ws-gw .cell:active {
    transform: scale(0.96);
}

/* Legacy edge classes — grid uses gap; harmless if present */
.ws-gw .cell.rbd,
.ws-gw .cell.bbd {
    border-right-color: rgba(15, 23, 42, 0.5);
    border-bottom-color: rgba(15, 23, 42, 0.5);
}

/* Found-word highlights (class names unchanged for JS) */
.ws-gw .cell.highlighted-orange {
    background: linear-gradient(165deg, #fbbf24 0%, #d97706 100%);
    color: #0f172a;
    border-color: rgba(245, 158, 11, 0.5);
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.35);
}

.ws-gw .cell.highlighted-brown {
    background: linear-gradient(165deg, #f472b6 0%, #db2777 100%);
    color: #fff;
    border-color: rgba(244, 114, 182, 0.45);
    box-shadow: 0 0 0 1px rgba(244, 114, 182, 0.3);
}

.ws-gw .cell.highlighted-green {
    background: linear-gradient(165deg, #34d399 0%, #059669 100%);
    color: #0f172a;
    border-color: rgba(16, 185, 129, 0.45);
    box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.35);
}

.ws-gw .cell.highlighted-blue {
    background: linear-gradient(165deg, #38bdf8 0%, #0284c7 100%);
    color: #0f172a;
    border-color: rgba(14, 165, 233, 0.45);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35);
}

/* Win overlay */
.ws-msg#msg,
#msg.ws-msg {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 10;

    margin: 0;
    padding: 0 24px;
    box-sizing: border-box;

    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;

    text-align: center;
    font-style: normal;
    font-size: clamp(1.35rem, 3.5vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.35;
    color: #f8fafc;

    background: rgba(8, 10, 14, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.ws-msg#msg.full,
#msg.ws-msg.full {
    display: flex;
    opacity: 1;
}

@media (max-width: 640px) {
    .ws-layout {
        flex-direction: column;
        align-items: stretch;
    }

    .ws-word-panel#wordListContainer {
        max-width: none;
    }

    .ws-wordsearch-grid.wordsearch {
        grid-template-columns: repeat(8, minmax(24px, 1fr));
        padding: 10px;
    }
}

/* Game Worlds: same play column height as sky-shooter.css #gamebox */
.game-worlds-play-shell #gamebox.ws-gw {
    flex: 0 0 auto;
    height: calc(768px * 5 / 7);
    max-height: calc(768px * 5 / 7);
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.game-worlds-play-shell #gamebox.ws-gw .ws-layout {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}
