/* ======================================================================
   شمارنده امتیاز تیمی - Shomarandeh (Team Score Counter)
   ابزار حضوری، کاملا سمت کلاینت - بدون نیاز به دیتابیس یا سرور
   ====================================================================== */

@font-face {
    font-family: KalamehWebFaNum;
    font-display: block;
    font-style: normal;
    font-weight: 500;
    src: url('../../fonts/Abi-FaNum-MediumDot3.woff2') format('woff2');
}

@font-face {
    font-family: KalamehWebFaNum;
    font-display: block;
    font-style: normal;
    font-weight: 800;
    src: url('../../fonts/Abi-FaNum-ExtraBoldDot3.woff2') format('woff2');
}

@font-face {
    font-family: KalamehWebFaNum;
    font-display: block;
    font-style: normal;
    font-weight: 900;
    src: url('../../fonts/Abi-FaNum-BlackDot3.woff2') format('woff2');
}

#scb-root, #scb-root * {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

#scb-root {
    --scb-bg: #0a0a0f;
    --scb-line: rgba(255, 255, 255, .14);
    --scb-safe-t: env(safe-area-inset-top, 0px);
    --scb-safe-b: env(safe-area-inset-bottom, 0px);
    --scb-safe-l: env(safe-area-inset-left, 0px);
    --scb-safe-r: env(safe-area-inset-right, 0px);

    --scb-c1a: #ff4d63; --scb-c1b: #7a1026;
    --scb-c2a: #12b7ea; --scb-c2b: #0b3f8f;
    --scb-c3a: #ffb648; --scb-c3b: #a5540a;
    --scb-c4a: #37c987; --scb-c4b: #0c6b4c;
    --scb-c5a: #b06bff; --scb-c5b: #4a1c8f;
    --scb-c6a: #ff6fb0; --scb-c6b: #8a1257;
    --scb-c7a: #d9e34d; --scb-c7b: #6a7a12;
    --scb-c8a: #6ea8fe; --scb-c8b: #1c3f9c;

    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    height: calc(var(--scb-vh, 1vh) * 100);
    overflow: hidden;
    background: var(--scb-bg);
    font-family: KalamehWebFaNum, Tahoma, sans-serif;
    direction: rtl;
    color: #fff;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    z-index: 20000;
}

#scb-root button, #scb-root input {
    font-family: KalamehWebFaNum, Tahoma, sans-serif;
}

#scb-root .scb-stepper__btn,
#scb-root .scb-quick-btn,
#scb-root .scb-start-btn,
#scb-root .scb-card__flip,
#scb-root .scb-toolbar__btn {
    touch-action: manipulation;
}

/* ---------------------------------------------------------------------
   صفحات کلی
   --------------------------------------------------------------------- */
.scb-screen {
    position: absolute;
    inset: 0;
    display: none;
    width: 100%;
    height: 100%;
}

.scb-screen.scb-active {
    display: block;
}

/* ---------------------------------------------------------------------
   صفحه تنظیمات
   --------------------------------------------------------------------- */
.scb-setup {
    background:
        radial-gradient(circle at 18% 14%, rgba(255, 77, 99, .28), transparent 32%),
        radial-gradient(circle at 84% 20%, rgba(18, 183, 234, .26), transparent 34%),
        radial-gradient(circle at 50% 92%, rgba(255, 182, 72, .18), transparent 38%),
        linear-gradient(160deg, #0a0a12 0%, #14101a 45%, #0a1614 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(20px, var(--scb-safe-t)) max(18px, var(--scb-safe-r)) max(20px, var(--scb-safe-b)) max(18px, var(--scb-safe-l));
    overflow-y: auto;
    touch-action: pan-y;
}

.scb-setup__inner {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.scb-setup__logo {
/*    width: 76px;
    height: 76px;*/
    border-radius: 22px;
    overflow: hidden;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .14);
    box-shadow: 0 14px 30px rgba(0, 0, 0, .35);
    margin-bottom: 4px;
}

.scb-setup__logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.scb-setup__title {
    font-size: clamp(1.7rem, 7.5vw, 2.3rem);
    font-weight: 900;
    margin: 0;
    background: linear-gradient(90deg, #ffb648, #fff 45%, #ff4d63);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: .3px;
}

.scb-setup__desc {
    font-size: .92rem;
    line-height: 1.9;
    color: rgba(255, 255, 255, .78);
    margin: 0 0 4px;
}

.scb-setup__block {
    width: 100%;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 18px;
    padding: 16px;
}

.scb-setup__label {
    display: block;
    font-size: .82rem;
    font-weight: 700;
    color: rgba(255, 255, 255, .68);
    margin-bottom: 12px;
}

.scb-stepper {
    display: grid;
    grid-template-columns: 52px 1fr 52px;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.scb-stepper__btn {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, .18);
    background: rgba(255, 255, 255, .07);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, transform .1s ease;
}

.scb-stepper__btn:active {
    transform: scale(.92);
    background: rgba(255, 255, 255, .16);
}

.scb-stepper__value {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    background: rgba(0, 0, 0, .25);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 14px;
    padding: 6px 8px;
}

.scb-stepper__input {
    width: 3.2ch;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 1.9rem;
    font-weight: 900;
    text-align: center;
    -moz-appearance: textfield;
}

.scb-stepper__input::-webkit-outer-spin-button,
.scb-stepper__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.scb-stepper__value small {
    color: rgba(255, 255, 255, .55);
    font-size: .78rem;
    font-weight: 700;
}

.scb-quick-options {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.scb-quick-btn {
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .16);
    background: rgba(255, 255, 255, .04);
    color: #fff;
    font-size: .92rem;
    font-weight: 800;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .1s ease;
}

.scb-quick-btn:active {
    transform: scale(.92);
}

.scb-quick-btn.scb-active {
    background: linear-gradient(135deg, #ff4d63, #a5540a);
    border-color: transparent;
    box-shadow: 0 6px 16px rgba(255, 77, 99, .35);
}

.scb-start-btn {
    width: 100%;
    margin-top: 6px;
    padding: 16px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, #ff5468, #d7193f);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: .3px;
    cursor: pointer;
    box-shadow: 0 14px 30px rgba(215, 25, 63, .38);
    transition: transform .12s ease;
}

.scb-start-btn:active {
    transform: scale(.97);
}

.scb-access-note {
    font-size: .74rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, .5);
    margin-top: 2px;
}

/* ---------------------------------------------------------------------
   صفحه شمارش امتیاز
   --------------------------------------------------------------------- */
.scb-board {
    background: #050507;
}

.scb-cards {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(var(--scb-cols, 1), 1fr);
    grid-template-rows: repeat(var(--scb-rows, 1), 1fr);
    gap: 3px;
    background: var(--scb-line);
}

.scb-card {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    transition: transform .35s ease;
}

.scb-card--wide {
    grid-column: 1 / -1;
}

.scb-card--flipped .scb-card__inner {
    transform: rotate(180deg);
}

.scb-card--c1 { background: linear-gradient(150deg, var(--scb-c1a), var(--scb-c1b)); }
.scb-card--c2 { background: linear-gradient(150deg, var(--scb-c2a), var(--scb-c2b)); }
.scb-card--c3 { background: linear-gradient(150deg, var(--scb-c3a), var(--scb-c3b)); }
.scb-card--c4 { background: linear-gradient(150deg, var(--scb-c4a), var(--scb-c4b)); }
.scb-card--c5 { background: linear-gradient(150deg, var(--scb-c5a), var(--scb-c5b)); }
.scb-card--c6 { background: linear-gradient(150deg, var(--scb-c6a), var(--scb-c6b)); }
.scb-card--c7 { background: linear-gradient(150deg, var(--scb-c7a), var(--scb-c7b)); }
.scb-card--c8 { background: linear-gradient(150deg, var(--scb-c8a), var(--scb-c8b)); }

.scb-card__inner {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(6px, 1.6vh, 16px);
    padding: 10px;
    transition: transform .35s ease;
}

.scb-card__label {
    font-size: clamp(.78rem, 2.4vh, 1.05rem);
    font-weight: 800;
    color: rgba(255, 255, 255, .88);
    background: rgba(0, 0, 0, .2);
    padding: 4px 14px;
    border-radius: 999px;
    letter-spacing: .3px;
}

.scb-card__score {
    font-size: clamp(2.6rem, 12vh, 6.5rem);
    font-weight: 900;
    line-height: 1;
    color: #fff;
    text-shadow: 0 6px 18px rgba(0, 0, 0, .3);
    min-width: 1.4ch;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.scb-card__controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(14px, 4vw, 34px);
}

.scb-card__btn {
    width: clamp(46px, 11vh, 66px);
    height: clamp(46px, 11vh, 66px);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .55);
    background: rgba(0, 0, 0, .22);
    color: #fff;
    font-size: clamp(1.4rem, 4vh, 2rem);
    font-weight: 900;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: none;
    transition: background .12s ease, transform .1s ease;
}

.scb-card__btn:active,
.scb-card__btn.scb-active {
    background: rgba(255, 255, 255, .38);
    transform: scale(.9);
}

.scb-card__flip {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .4);
    background: rgba(0, 0, 0, .28);
    color: #fff;
    font-size: .92rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.scb-card--flipped .scb-card__flip {
    top: auto;
    bottom: 8px;
    right: 8px;
    left: auto;
    transform: rotate(180deg);
}

/* نوار ابزار شناور (بازگشت / صفر کردن) */
.scb-toolbar {
    position: absolute;
    top: max(10px, var(--scb-safe-t));
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    display: flex;
    gap: 8px;
    padding: 6px;
    border-radius: 999px;
    background: rgba(5, 5, 8, .55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, .14);
}

.scb-toolbar__btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.scb-toolbar__btn:active {
    transform: scale(.9);
}

#scb-reset-btn.scb-confirming {
    background: #d7193f;
    color: #fff;
    animation: scb-pulse 1s ease-in-out infinite;
}

@keyframes scb-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(215, 25, 63, .55); }
    50% { box-shadow: 0 0 0 7px rgba(215, 25, 63, 0); }
}

/* ---------------------------------------------------------------------
   واکنش‌گرا
   --------------------------------------------------------------------- */
@media (max-width: 360px) {
    .scb-quick-options {
        gap: 4px;
    }

    .scb-quick-btn {
        height: 36px;
        font-size: .82rem;
    }
}

@media (max-height: 560px) {
    .scb-setup__logo {
        width: 54px;
        height: 54px;
        border-radius: 16px;
        margin-bottom: 0;
    }

    .scb-setup__desc {
        display: none;
    }

    .scb-setup__block {
        padding: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .scb-card,
    .scb-card__inner,
    #scb-reset-btn.scb-confirming {
        transition: none !important;
        animation: none !important;
    }
}
