/* Owlypia Word Search */

.ows-root {
    --ows-orange: #ff9f1c;
    --ows-cell-bg: #f6efe3;

    max-width: none;
    margin: 0 auto;
    padding: 20px 14px 26px;
    border-radius: 24px;
    background: var(--wpg-card-gradient, linear-gradient(135deg, #5104b9 0%, #c62786 50%, #ff6428 100%));
    box-shadow: 0 12px 34px rgba(20, 8, 46, 0.45);
    font-family: 'Segoe UI', 'Comic Sans MS', system-ui, sans-serif;
    -webkit-user-select: none;
    user-select: none;
}

.ows-header {
    text-align: center;
    margin-bottom: 14px;
}

.ows-title {
    font-size: clamp(22px, 5vw, 32px);
    font-weight: 800;
    color: var(--ows-orange);
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.ows-subtitle {
    color: #e8ddff;
    font-size: clamp(13px, 3vw, 16px);
    margin-top: 2px;
}

.ows-theme {
    display: block;
    width: fit-content;
    margin: 8px auto 0;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255, 209, 102, 0.2);
    color: #ffd166;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.3px;
}

.ows-theme.ows-hidden {
    display: none;
}

.ows-levels {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.ows-level-btn {
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: #f1e9ff;
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.ows-level-btn.ows-level-active {
    background: var(--ows-orange);
    border-color: var(--ows-orange);
    color: #34145e;
}

.ows-hud {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    margin-bottom: 12px;
    color: #fff;
    font-size: 16px;
}

.ows-hud-item strong {
    color: #ffd166;
    font-variant-numeric: tabular-nums;
}

.ows-new-btn {
    border: 0;
    background: #e63946;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    padding: 7px 14px;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 3px 0 #a1242f;
}

.ows-play {
    display: flex;
    gap: 14px;
    align-items: stretch;
    justify-content: center;
}

.ows-stage {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 640px;
    overflow: hidden;
    border-radius: 18px;
}

.ows-board {
    display: grid;
    grid-template-columns: repeat(var(--ows-n), 1fr);
    gap: 4px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 18px;
    touch-action: none;
}

.ows-cell {
    aspect-ratio: 1 / 1;
    border-radius: 18%;
    background: var(--ows-cell-bg);
    color: #34145e;
    font-weight: 800;
    font-size: clamp(12px, 2.6vw, 20px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.ows-cell.ows-selecting {
    background: #ffd166;
    color: #34145e;
}

.ows-cell.ows-found {
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.ows-words {
    flex: 0 0 auto;
    min-width: 150px;
    width: max-content;
    max-width: 46%;
    background: rgba(0, 0, 0, 0.22);
    border-radius: 18px;
    padding: 12px 10px;
    box-sizing: border-box;
}

.ows-words-title {
    color: #ffd166;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
}

.ows-word-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ows-word {
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
    padding: 4px 6px;
    border-radius: 8px;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: keep-all;
    hyphens: none;
}

.ows-word-found {
    color: #cbb8ee;
    text-decoration: line-through;
    background: color-mix(in srgb, var(--ows-found, #9b5de5) 35%, transparent);
}

.ows-hint {
    min-height: 22px;
    text-align: center;
    color: #ffd166;
    font-size: 14px;
    font-weight: 600;
    margin-top: 12px;
}

.ows-help {
    margin-top: 12px;
    background: rgba(12, 6, 28, 0.34);
    border-radius: 12px;
    padding: 10px 14px;
    color: #e8ddff;
    font-size: 14px;
}

.ows-help summary {
    cursor: pointer;
    font-weight: 700;
    color: #fff;
}

.ows-help ul {
    margin: 8px 0 4px;
    padding-left: 20px;
}

.ows-overlay {
    position: absolute;
    inset: 0;
    background: rgba(24, 8, 50, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    border-radius: 18px;
}

.ows-overlay.ows-hidden {
    display: none;
}

.ows-win-card {
    text-align: center;
    padding: 22px 30px;
    background: linear-gradient(160deg, #3d1670, #5b2a92);
    border: 2px solid rgba(255, 209, 102, 0.5);
    border-radius: 20px;
    max-width: 90%;
}

.ows-win-title {
    color: var(--ows-orange);
    font-size: clamp(18px, 4.5vw, 26px);
    font-weight: 800;
}

.ows-stars {
    font-size: clamp(30px, 8vw, 46px);
    margin: 4px 0;
}

.ows-star {
    color: rgba(255, 255, 255, 0.22);
    margin: 0 3px;
}

.ows-star-on {
    color: #ffd166;
    text-shadow: 0 0 14px rgba(255, 209, 102, 0.8);
}

.ows-win-score {
    color: #fff;
    font-size: 20px;
    font-weight: 800;
}

.ows-win-meta {
    color: #cbb8ee;
    font-size: 14px;
    margin-bottom: 14px;
}

.ows-win-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.ows-win-btn {
    border: 0;
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    background: #e63946;
    color: #fff;
    box-shadow: 0 3px 0 #a1242f;
}

.ows-win-btn-next {
    background: #2a9d8f;
    box-shadow: 0 3px 0 #1c6b62;
}

.ows-confetti {
    position: absolute;
    top: -30px;
    z-index: 6;
    pointer-events: none;
    animation: ows-fall 2.6s linear forwards;
}

@keyframes ows-fall {
    to {
        transform: translateY(120vh) rotate(340deg);
        opacity: 0.7;
    }
}

@media (max-width: 768px) {
    .ows-play {
        flex-direction: column;
    }

    .ows-words {
        flex-basis: auto;
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .ows-word-list {
        display: flex;
        flex-wrap: wrap;
        gap: 4px 8px;
        justify-content: center;
    }

    .ows-word {
        flex: 0 0 auto;
    }
}
