/* Owlypia Sudoku */

.sud-root {
    --sud-orange: #ff9f1c;
    max-width: none;
    margin: 0 auto;
    padding: 20px 14px 26px;
    border-radius: 24px;
    background: var(--wpg-card-gradient, linear-gradient(135deg, #0054d2 0%, #018edc 48%, #3ad4ea 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;
}

.sud-header { text-align: center; margin-bottom: 14px; }
.sud-title {
    font-size: clamp(22px, 5vw, 32px);
    font-weight: 800;
    color: var(--sud-orange);
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}
.sud-subtitle { color: #e8ddff; font-size: clamp(13px, 3vw, 16px); margin-top: 2px; }

.sud-levels {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.sud-level-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: #f1e9ff;
    padding: 6px 16px 5px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1.15;
}
.sud-level-btn small { font-size: 11px; opacity: 0.78; font-weight: 600; }
.sud-level-btn.sud-level-active {
    background: var(--sud-orange);
    border-color: var(--sud-orange);
    color: #34145e;
}

.sud-hud {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    color: #fff;
}
.sud-hud-item strong { color: #ffd166; font-variant-numeric: tabular-nums; }
.sud-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;
}

.sud-stage { position: relative; display: flex; justify-content: center; }

.sud-board {
    display: grid;
    grid-template-columns: repeat(var(--sud-n), 1fr);
    gap: 0;
    background: #1a0a33;
    padding: 4px;
    border-radius: 12px;
    touch-action: manipulation;
}

.sud-cell {
    appearance: none;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
    width: clamp(28px, 8vw, 48px);
    aspect-ratio: 1;
    border: 1px solid #6b4c9a;
    background: #f6efe3;
    color: #34145e;
    font-size: clamp(16px, 4vw, 22px);
    font-weight: 800;
    cursor: pointer;
    padding: 0;
}
.sud-cell:focus,
.sud-cell:focus-visible {
    outline: none;
}
.sud-board-4 .sud-cell {
    width: clamp(52px, 16vw, 80px);
    font-size: clamp(22px, 6vw, 34px);
}
.sud-board-6 .sud-cell {
    width: clamp(36px, 11vw, 58px);
    font-size: clamp(18px, 4.5vw, 26px);
}

.sud-cell.sud-left { border-left: 3px solid #1a0a33; }
.sud-cell.sud-top { border-top: 3px solid #1a0a33; }

/* Checkerboard boxes: warm cream vs cool mint, so regions read at a glance. */
.sud-cell.sud-box-alt { background: #cfe8d6; }

.sud-cell:not(.sud-given):hover {
    background: #e4d6bc;
}
.sud-cell.sud-box-alt:not(.sud-given):hover {
    background: #b3d6c0;
}

.sud-given,
.sud-cell.sud-given:disabled {
    background: #ddd0f0;
    color: #34145e;
    cursor: default;
    pointer-events: none;
    opacity: 1;
}
.sud-cell.sud-box-alt.sud-given,
.sud-cell.sud-box-alt.sud-given:disabled {
    background: #b7d4c2;
}

.sud-cell.sud-selected,
.sud-cell.sud-box-alt.sud-selected,
.sud-cell.sud-selected:hover,
.sud-cell.sud-box-alt.sud-selected:hover {
    background: #3d5afe;
    color: #fff;
    z-index: 1;
}

.sud-conflict { background: #f4c1c6; color: #a1242f; }
.sud-cell.sud-box-alt.sud-conflict { background: #f4c1c6; }
.sud-cell.sud-selected.sud-conflict,
.sud-cell.sud-box-alt.sud-selected.sud-conflict {
    background: #f4c1c6;
    color: #a1242f;
    box-shadow: inset 0 0 0 3px #3d5afe;
}

.sud-same { background: #ffe08a; }
.sud-cell.sud-box-alt.sud-same { background: #ffe08a; }

.sud-pad {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}
.sud-num {
    appearance: none;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
    min-width: 42px;
    height: 42px;
    border: 0;
    border-radius: 10px;
    background: #f6efe3;
    color: #34145e;
    font-weight: 800;
    font-size: 18px;
    cursor: pointer;
}
.sud-num:focus,
.sud-num:focus-visible {
    outline: 3px solid #ff9f1c;
    outline-offset: 2px;
}
.sud-num:disabled,
.sud-num.sud-num-done {
    opacity: 0.38;
    background: rgba(246, 239, 227, 0.35);
    color: rgba(52, 20, 94, 0.55);
    cursor: default;
    pointer-events: none;
    text-decoration: line-through;
    box-shadow: none;
}
.sud-erase { min-width: 72px; background: #e63946; color: #fff; }

.sud-hint {
    min-height: 22px;
    text-align: center;
    color: #ffd166;
    font-size: 14px;
    font-weight: 600;
    margin-top: 12px;
}
.sud-help {
    margin-top: 12px;
    background: rgba(12, 6, 28, 0.34);
    border-radius: 12px;
    padding: 10px 14px;
    color: #e8ddff;
    font-size: 14px;
}
.sud-help summary { cursor: pointer; font-weight: 700; color: #fff; }
.sud-help ul { margin: 8px 0 4px; padding-left: 20px; }

.sud-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: 12px;
}
.sud-overlay.sud-hidden { display: none; }
.sud-win-card {
    text-align: center;
    padding: 22px 28px;
    background: linear-gradient(160deg, #3d1670, #5b2a92);
    border: 2px solid rgba(255, 209, 102, 0.5);
    border-radius: 20px;
}
.sud-win-title { color: var(--sud-orange); font-size: 22px; font-weight: 800; }
.sud-stars { font-size: 40px; margin: 4px 0; }
.sud-star { color: rgba(255, 255, 255, 0.22); }
.sud-star-on { color: #ffd166; }
.sud-win-score { color: #fff; font-size: 20px; font-weight: 800; }
.sud-win-meta { color: #cbb8ee; margin-bottom: 12px; }
.sud-win-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.sud-win-btn {
    border: 0;
    padding: 10px 20px;
    border-radius: 999px;
    font-weight: 800;
    cursor: pointer;
    background: #e63946;
    color: #fff;
}
.sud-win-btn-next { background: #2a9d8f; }
