:root {
    --bg: #faf8ef;
    --panel: #fff;
    --dark: #3e3a37;
    --muted: #7a726c;
    --accent: #4CAF50;
    --accent-2: #8f7a66;
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    background: var(--bg);
    font-family: "Vazirmatn", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    color: var(--dark);
    overscroll-behavior: none;
    user-select: none;
}

.wrap {
    max-width: min(92vw, 720px);
    margin: 24px auto 40px;
    padding: 0 12px;
}

.header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

h1 {
    margin: 0;
    line-height: 1.15;
    font-size: clamp(20px, 5vw, 32px);
    font-weight: 800;
}

.scores {
    display: flex;
    gap: 10px;
    flex-wrap: wrap
}

.score-box {
    background: var(--accent-2);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    text-align: center;
    min-width: 96px;
}

.score-box .lbl {
    display: block;
    font-size: 12px;
    opacity: .9
}

.score-box span:last-child {
    display: block;
    font-weight: 700;
    font-size: 18px
}

.score-box select {
    margin-top: 2px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid #e2e2e2;
}

.controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin: 14px 0 10px;
}

.btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 700;
}

.btn:hover {
    filter: brightness(.95)
}

.hint {
    font-size: 12px;
    color: var(--muted);
}

.board {
    background: var(--panel);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .08);
}

.game {
    width: 100%;
    aspect-ratio: 9/16;
    /* عمودی و رسپانسیو */
    background: linear-gradient(180deg, #87CEEB, #E0F7FF);
    border-radius: 12px;
    display: block;
    touch-action: none;
    /* جلوگیری از ژست‌های مرورگر داخل بازی */
}

/* اورلی پایان */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.hidden {
    display: none
}

.modal {
    background: #fff;
    color: #333;
    padding: 22px 18px;
    border-radius: 12px;
    width: min(92vw, 420px);
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .2)
}

.modal h2 {
    margin: 8px 0 6px
}

.modal p {
    margin: 0 0 12px
}