:root {
    color-scheme: light dark;
    --bg: #f7f8fc;
    --panel: #ffffff;
    --border: #d0d4e4;
    --accent: #4c6ef5;
    --accent-muted: #eef1ff;
    --text: #1f2333;
    --muted: #6b7087;
    font-family: 'Pretendard', 'Noto Sans KR', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.app {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) 280px;
    gap: 32px;
    width: min(960px, 100%);
}

.game-area,
.sidebar {
    background: var(--panel);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 16px 35px rgba(30, 42, 87, 0.08);
}

.sidebar {
    display: flex;
    flex-direction: column;
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
}

#new-game {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#new-game:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(76, 110, 245, 0.25);
}

.board {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    border: 3px solid var(--text);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    width: 100%;
}

.cell {
    position: relative;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--border);
    background: transparent;
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    user-select: none;
}

.cell.edge-left {
    border-left: none;
}

.cell.edge-top {
    border-top: none;
}

.cell.edge-right {
    border-right: none;
}

.cell.edge-bottom {
    border-bottom: none;
}

.cell.block-border-right {
    border-right: 2px solid var(--text);
}

.cell.block-border-bottom {
    border-bottom: 2px solid var(--text);
}

.cell::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid transparent;
    pointer-events: none;
}

.cell.selected {
    background: var(--accent-muted);
    box-shadow: inset 0 0 0 2px var(--accent);
    z-index: 1;
}

.cell.filled {
    color: var(--accent);
}

.cell.fixed {
    background: rgba(76, 110, 245, 0.12);
    color: #1b2559;
    font-weight: 700;
    cursor: default;
}

.sidebar h2 {
    margin: 0 0 12px;
    font-size: 22px;
}

.point-info {
    margin-bottom: 24px;
    padding: 16px;
    border-radius: 14px;
    background: rgba(76, 110, 245, 0.08);
    color: var(--muted);
    line-height: 1.5;
}

.point-info h2 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 20px;
}

.point-info p {
    margin: 0 0 6px;
}

.point-info p:last-child {
    margin-bottom: 0;
}

.point-info strong {
    color: var(--text);
}

.number-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.number-panel {
    display: flex;
    flex-direction: column;
}

.number-button {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 0;
    font-size: 18px;
    font-weight: 600;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.number-button:hover {
    background: var(--accent-muted);
    transform: translateY(-1px);
}

.number-button.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 8px 18px rgba(76, 110, 245, 0.3);
}

.number-button.clear {
    grid-column: span 3;
    background: #f2f4ff;
}

.instructions h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.instructions ul {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.6;
    font-size: 14px;
}

.status {
    margin-top: 16px;
    min-height: 20px;
    color: var(--muted);
    font-size: 15px;
}

.status.success {
    color: #2b8a3e;
}

@media (max-width: 900px) {
    .app {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    body {
        padding: 0;
        display: block;
    }

    .app {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 0;
    }

    .game-area,
    .sidebar {
        box-shadow: none;
        border-radius: 0;
    }

    .game-area {
        padding: 20px 16px 12px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .sidebar {
        padding: 0 16px 24px;
        order: 1;
        margin-top: 8px;
    }

    .board {
        border-radius: 0;
        margin: 0;
        width: min(100%, 520px);
    }

    .game-header,
    .status {
        width: min(100%, 520px);
        padding: 0 16px;
        box-sizing: border-box;
    }

    .number-panel {
        margin-top: auto;
    }

    .instructions {
        display: none;
    }
}
