:root {
    --bg: #faf8ef;
    --board: #e9e5dc;
    --dark: #3e3a37;
    --white: #fff;
    --accent: #4CAF50;

    --c1: #ff6b6b;
    /* قرمز */
    --c2: #ffd93d;
    /* زرد */
    --c3: #6bcB77;
    /* سبز */
    --c4: #4d96ff;
    /* آبی */
    --c5: #a066ff;
    /* بنفش */
}

* {
    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;
    /* جلوگیری از pull-to-refresh */
    user-select: none;
}

.wrap {
    max-width: min(92vw, 560px);
    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: #8f7a66;
    color: var(--white);
    padding: 8px 12px;
    border-radius: 8px;
    text-align: center;
    min-width: 84px;
}

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

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

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

.hint {
    font-size: 12px;
    opacity: .85
}

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

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

.board {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    /* مربع و رسپانسیو */
    background: var(--board);
    border-radius: 12px;
    padding: 10px;
}

.grid {
    position: absolute;
    inset: 10px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 10px;
}

.cell {
    position: relative;
    border-radius: 10px;
    background: #f5f2eb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dot {
    width: 76%;
    height: 76%;
    border-radius: 50%;
    transition: transform .08s ease, box-shadow .1s ease, opacity .15s ease;
}

.dot.c1 {
    background: var(--c1)
}

.dot.c2 {
    background: var(--c2)
}

.dot.c3 {
    background: var(--c3)
}

.dot.c4 {
    background: var(--c4)
}

.dot.c5 {
    background: var(--c5)
}

.dot.selected {
    transform: scale(0.88);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, .06) inset, 0 0 10px rgba(0, 0, 0, .12);
}

/* انیمیشن حذف */
.cell.removing .dot {
    opacity: .2;
    transform: scale(0.4);
}

/* اورلی پایان */
.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
}

/* جلوگیری از ژست‌های مرورگر داخل برد */
.board,
.grid,
.cell {
    touch-action: none;
}