/* Owlypia Smart Friends */

.sf-root {
    --sf-orange: #ff9f1c;
    position: relative;
    overflow: hidden;
    max-width: none;
    margin: 0 auto;
    padding: 20px 14px 26px;
    border-radius: 24px;
    background: var(--wpg-card-gradient, linear-gradient(135deg, #0a4cef 0%, #5b22d6 46%, #d23a96 100%));
    box-shadow: 0 12px 34px rgba(20, 8, 46, 0.45);
    font-family: 'Segoe UI', system-ui, sans-serif;
    -webkit-user-select: none;
    user-select: none;
}

.sf-header { text-align: center; margin-bottom: 12px; }
.sf-title { font-size: clamp(22px, 5vw, 32px); font-weight: 800; color: var(--sf-orange); text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.sf-subtitle { color: #e8ddff; font-size: 14px; }

.sf-levels { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.sf-level-btn {
    appearance: none; -webkit-appearance: none;
    border: 2px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08);
    color: #f1e9ff; padding: 7px 16px; border-radius: 999px; font-weight: 700;
    cursor: pointer;
}
.sf-level-btn small { font-size: 11px; opacity: .8; }
.sf-level-btn.sf-level-active { background: var(--sf-orange); border-color: var(--sf-orange); color: #34145e; }

.sf-hud { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; color: #fff; }
.sf-hud-item strong { color: #ffd166; font-variant-numeric: tabular-nums; }
.sf-new-btn {
    appearance: none; border: 0; background: #e63946; color: #fff;
    font-weight: 700; padding: 7px 14px; border-radius: 999px; cursor: pointer;
}
.sf-reset-btn {
    appearance: none; border: 0; background: #ffd166; color: #34145e;
    font-weight: 700; padding: 7px 14px; border-radius: 999px; cursor: pointer;
}
.sf-reset-btn:disabled {
    opacity: .4;
    cursor: default;
}

.sf-body {
    display: flex;
    gap: 14px;
    align-items: stretch;
    flex-wrap: wrap;
}
.sf-board-wrap {
    flex: 1 1 220px;
    background: rgba(0,0,0,.22);
    border-radius: 16px;
    padding: 16px 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}
.sf-board {
    display: grid;
    grid-template-rows: repeat(var(--sf-rows, 2), 76px);
    grid-template-columns: repeat(var(--sf-cols, 2), 76px);
    gap: 8px;
}
.sf-cell {
    position: relative;
    width: 76px; height: 76px;
    border-radius: 14px;
    background: #eadbc8;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sf-cell-empty {
    background: #f6efe3;
    border: 2px dashed #cbb8a0;
    cursor: pointer;
}

.sf-board-wrap.sf-solved {
    box-shadow: inset 0 0 0 3px #7bd389;
}
.sf-board-wrap.sf-solved .sf-friend {
    cursor: default;
    box-shadow: 0 0 0 2px #2a9d8f;
}

.sf-friend {
    appearance: none; -webkit-appearance: none;
    width: 68px; height: 68px;
    border: 3px solid #eadbc8 !important;
    background: #fffdf8 !important;
    border-radius: 12px;
    cursor: pointer;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 0; padding: 0; line-height: 1;
    color: #34145e;
    box-shadow: 0 2px 0 #cbb8a0;
}
.sf-friend-on {
    background: #ffd166 !important;
    border-color: #ff9f1c !important;
    box-shadow: 0 0 0 3px rgba(255,159,28,.5);
    transform: scale(0.96);
}
.sf-glyph { font-size: 28px; line-height: 1; }
.sf-fname { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; }

.sf-clues {
    flex: 1 1 240px;
    background: rgba(255,255,255,.07);
    border-radius: 14px;
    padding: 12px 14px;
}
.sf-clues-title, .sf-tray-title {
    color: #ffd166; font-size: 12px; font-weight: 800;
    letter-spacing: .4px; text-transform: uppercase; margin-bottom: 8px;
}
.sf-clue-list { margin: 0; padding-left: 18px; color: #e8ddff; font-size: 14px; }
.sf-clue { margin: 6px 0; }
.sf-clue-wait { color: #e8ddff; }
.sf-clue-ok { color: #7bd389; }
.sf-clue-no { color: #ff8a80; }

.sf-tray {
    margin-top: 12px;
    padding: 12px 10px 14px;
    background: rgba(0,0,0,.22);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.sf-tray-title { width: 100%; text-align: center; }
.sf-tray-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.sf-home {
    width: 68px;
    height: 68px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    box-sizing: content-box;
    border: 2px dashed transparent;
}
.sf-home-filled {
    background: transparent;
    border-style: solid;
    border-color: rgba(255,255,255,.16);
}
.sf-home-filled .sf-friend {
    width: 68px;
    height: 68px;
}
.sf-home-empty {
    background: rgba(255,255,255,.06);
    border: 2px dashed rgba(255,255,255,.38);
    cursor: pointer;
}
.sf-home-empty:hover {
    border-color: #ffd166;
    background: rgba(255,209,102,.12);
}
.sf-home-ghost {
    font-size: 26px;
    line-height: 1;
    opacity: .38;
    filter: grayscale(1);
}
.sf-home-ghost-name {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: #e8ddff;
    opacity: .55;
}

.sf-hint { min-height: 22px; text-align: center; color: #ffd166; font-weight: 600; margin-top: 10px; font-size: 14px; }
.sf-help { margin-top: 12px; background: rgba(12, 6, 28, 0.34); border-radius: 12px; padding: 10px 14px; color: #e8ddff; font-size: 14px; }
.sf-help summary { cursor: pointer; font-weight: 700; color: #fff; }
.sf-help ul { margin: 8px 0 4px; padding-left: 20px; }

.sf-overlay {
    position: absolute;
    inset: 0;
    background: rgba(24, 8, 50, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 24px;
    padding: 16px;
}
.sf-overlay.sf-hidden { display: none; }
.sf-result {
    text-align: center;
    width: min(100%, 340px);
    padding: 22px 28px;
    background: linear-gradient(160deg, #3d1670, #5b2a92);
    border: 2px solid rgba(255, 209, 102, 0.5);
    border-radius: 20px;
}
.sf-result-title { color: var(--sf-orange); font-size: 22px; font-weight: 800; }
.sf-stars { font-size: 36px; margin: 4px 0; }
.sf-star-icon { color: rgba(255,255,255,.22); }
.sf-star-on { color: #ffd166; }
.sf-win-score { color: #fff; font-size: 20px; font-weight: 800; }
.sf-win-meta { color: #cbb8ee; margin-bottom: 12px; }
.sf-win-buttons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.sf-win-btn {
    appearance: none; border: 0; padding: 10px 20px; border-radius: 999px;
    font-weight: 800; cursor: pointer; background: #e63946; color: #fff;
}

.sf-confetti {
    position: absolute;
    top: -28px;
    z-index: 20;
    pointer-events: none;
    animation-name: sf-fall;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}
@keyframes sf-fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(110vh) rotate(420deg); opacity: 0.65; }
}

@media (max-width: 560px) {
    .sf-board {
        grid-template-rows: repeat(var(--sf-rows, 2), 64px);
        grid-template-columns: repeat(var(--sf-cols, 2), 64px);
    }
    .sf-cell, .sf-friend, .sf-home { width: 56px; height: 56px; }
    .sf-cell { width: 64px; height: 64px; }
    .sf-glyph, .sf-home-ghost { font-size: 22px; }
}
