@import url('https://fonts.googleapis.com/css2?family=Changa:wght@400;500;600;700;800&display=swap');

/* 1. إعدادات عامة */
:root {
    --gold: #ffd34e;
    --navy: #04142d;
    --blue: #079eff;
    --ink: #061126;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    padding: 8px;
    background: radial-gradient(ellipse at 50% 8%, #542b87 0, #18255d 36%, #020d23 78%);
    color: #fff;
    font-family: 'Changa', sans-serif;
}

button {
    font: inherit;
    color: inherit;
    cursor: pointer;
    border: 0;
}

/* 2. الحاوية الرئيسية */
#game {
    max-width: 940px;
    margin: auto;
    padding: 10px;
    border: 3px solid #eebc39;
    border-radius: 26px;
    background: linear-gradient(180deg, #09234a, #031632 64%, #04142b);
    box-shadow: 0 0 22px #ffbe37, 0 0 40px #075bce;
    overflow: hidden;
}

/* 3. شريط اللاعب والمحفظة */
.player-bar {
    height: 124px;
    margin: 2px 12px 8px;
    padding: 8px 18px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 3px solid #e8b438;
    border-radius: 28px;
    background: linear-gradient(100deg, #06182f, #123362, #06142d);
    box-shadow: 0 0 12px #f6b426;
}

.player-info,
.social-avatars,
.balance {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar,
.social-avatars b {
    display: grid;
    place-items: center;
    border: 3px solid #eab944;
    border-radius: 50%;
    background: linear-gradient(145deg, #8541ad, #122958);
    width: 82px;
    height: 82px;
    font-size: 48px;
}

.player-details {
    display: grid;
    font-size: 19px;
}

.score {
    font-size: 38px;
    color: #ffcf45;
    text-shadow: 0 2px #743900;
}

.social-avatars b {
    width: 69px;
    height: 69px;
    font-size: 40px;
}

.social-avatars .info {
    font: bold 42px Georgia;
    background: linear-gradient(#eee, #75879a);
    color: #fff;
}

.balance {
    height: 54px;
    padding: 4px 8px 4px 14px;
    border: 2px solid #c18b28;
    border-radius: 30px;
    background: #05152b;
    font-size: 24px;
}

.coin-icon {
    font-size: 30px;
}

.add-coins {
    width: 43px;
    height: 43px;
    border-radius: 50%;
    background: linear-gradient(#46ed69, #058c29);
    border: 3px solid #b8ffbe;
    font-size: 32px;
    font-weight: bold;
}

/* 4. آلة السلوت والبكرات — قيم شاشة الدوران محفوظة كما هي */
.machine-section {
    position: relative;
    padding: 8px 20px 4px;
    border: 3px solid #dba632;
    border-radius: 34px;
    background: linear-gradient(115deg, #071a37, #0b2b58 50%, #07162f);
    box-shadow: inset 0 0 22px #0676c755, 0 0 16px #ffb934;
}

.machine {
    position: relative;
    padding: 10px;
    border: 8px ridge #e3a92d;
    border-radius: 28px;
    background: linear-gradient(130deg, #ffdf75, #843b0b 22%, #ffca48 48%, #763500 73%, #ffdd70);
    box-shadow: 0 0 16px #ffbb2d;
}

.reel-window {
    position: relative;
    isolation: isolate;
    height: clamp(360px, 50vw, 450px);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    padding: 6px;
    overflow: hidden;
    border: 5px solid #72410f;
    border-radius: 17px;
    background: #f8e4b7;
    box-shadow: inset 0 0 20px #5e390d;
}

.reel {
    position: relative;
    display: block;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    background: #fff0cf;
    border-inline: 5px solid #d99816;
    box-shadow: inset 0 0 8px #9b6319;
}

.reel-strip {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    will-change: transform;
}

.reel-strip .symbol {
    flex: 0 0 auto;
    width: 100%;
}

.symbol {
    display: grid;
    place-items: center;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    border-bottom: 1px solid #b68943;
    background: linear-gradient(140deg, #fff6df, #f2d9a9);
}

.symbol:nth-child(2) {
    background: linear-gradient(140deg, #fff3d4, #f7e4bd);
}

.symbol img {
    width: 65%;
    height: 65%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 2px #713e3555);
}

/* خطوط الفوز */
.pay-lines {
    position: absolute;
    z-index: 2;
    inset: 0;
    pointer-events: none;
}

.pay-lines i {
    position: absolute;
    left: -3%;
    width: 106%;
    height: 1px;
    background: #4e412e9c;
    transform-origin: center;
}

/* الخط الأفقي العلوي */
.pay-lines i:nth-child(1) {
    top: 16.67%;
}

/* الخط الأفقي الأوسط */
.pay-lines i:nth-child(2) {
    top: 50%;
}

/* الخط الأفقي السفلي */
.pay-lines i:nth-child(3) {
    top: 83.33%;
}

/* القطر من أعلى اليسار إلى أسفل اليمين */
.pay-lines i:nth-child(4) {
    top: 50%;
    left: -10%;
    width: 120%;
    transform: rotate(29deg);
}

/* القطر من أعلى اليمين إلى أسفل اليسار */
.pay-lines i:nth-child(5) {
    top: 50%;
    left: -10%;
    width: 120%;
    transform: rotate(-29deg);
}

/* أسهم خطوط الفوز */
.line-arrow {
    position: absolute;
    z-index: 3;
    top: 45%;
    width: 58px;
    height: 76px;
    background: linear-gradient(90deg, #078ed7, #072c71);
    border: 4px ridge #f8c642;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
    color: #fff;
    font-size: 27px;
}

.line-arrow.left {
    left: -8px;
}

.line-arrow.right {
    right: -8px;
    transform: rotate(180deg);
}

/* 5. إحصائيات اللعبة */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding: 7px 3px 4px;
}

.stats > div {
    display: grid;
    justify-items: center;
    align-content: center;
    min-height: 66px;
    border: 2px solid #0a4b7e;
    border-radius: 13px;
    background: #020811;
}

.stats label {
    font-size: 17px;
    color: #eef4ff;
}

.stats strong {
    font-size: 31px;
    color: #ffd94f;
    line-height: 1.2;
}

.stats small {
    font-size: 20px;
}

/* 6. أزرار التحكم والرهان */
.control-panel {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1.8fr;
    gap: 16px;
    padding: 12px 4px 4px;
}

.control-panel button {
    height: 82px;
    border-radius: 22px;
    border: 4px solid #ffc83f;
    box-shadow: 0 8px 0 #4a2b13, 0 10px 15px #0008, inset 0 3px 8px #fff8;
    font-weight: 800;
    font-size: 29px;
    line-height: 1;
    background: linear-gradient(#ff6670, #b40028 68%, #71031c);
    text-shadow: 0 2px 3px #511;
}

.control-panel .bet-blue {
    background: linear-gradient(#39d8ff, #0675d9 68%, #074386);
}

.control-panel .auto-button {
    background: linear-gradient(#d84cff, #7009c7 70%, #3f0878);
}

.control-panel .play-button {
    height: 88px;
    border-radius: 35px;
    background: linear-gradient(#4cff91, #06b94b 65%, #057230);
    font-size: 44px;
    color: white;
}

/* 7. صناديق الجوائز */
.prize-section {
    margin-top: 10px;
    padding: 10px 16px;
    border: 2px solid #12517e;
    border-radius: 23px;
    background: linear-gradient(100deg, #05172e, #06244b, #05152d);
    box-shadow: inset 0 0 20px #0074bd33;
}

.prize-chests {
    direction: rtl;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-auto-flow: row;
    gap: 6px;
}

/* صور صناديق الجوائز */
.chest img {
    display: block;
    width: 100%;
    max-width: 130px;
    height: 100px;
    object-fit: contain;
}

.chest b {
    font-size: 24px;
    line-height: 1.1;
}

/* 8. نافذة المعلومات وجدول الأرباح */
.info-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    padding: 20px;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.82);
}

.info-modal.show {
    display: flex;
}

.info-content {
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 12px;
    border: 3px solid #eab539;
    border-radius: 24px;
    background: linear-gradient(135deg, #061b37, #03142b);
    box-shadow: 0 0 25px rgba(234, 181, 57, 0.5);
}

.paytable-head {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    color: #80a6c3;
}

.paytable-head h1 {
    font-size: 34px;
    color: #ffd04d;
}

.paytable-head span {
    font-size: 22px;
}

.close-pay {
    width: 60px;
    height: 60px;
    border: 3px solid #12618d;
    border-radius: 50%;
    background: #06172d;
    font-size: 44px;
    line-height: 1;
}

.line-icon {
    width: 74px;
    height: 54px;
    display: grid;
    place-items: center;
    color: #ffca39;
    background: #05152b;
    border-radius: 12px;
    font-size: 58px;
}

.paytable-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px 16px;
}

.pay-item {
    min-height: 69px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 10px;
    padding: 4px 10px;
    border: 1px solid #16527d;
    border-radius: 13px;
    background: linear-gradient(100deg, #06162d, #071c36);
}

.pay-item strong {
    font-size: 26px;
    color: #ffd54f;
    white-space: nowrap;
}

.pay-item img {
    width: 48%;
    height: 60px;
    object-fit: contain;
    filter: drop-shadow(0 3px 3px #0007);
}

/* 9. تنسيقات الشاشات الصغيرة */
@media (max-width: 700px) {
    body {
        padding: 3px;
    }

    #game {
        padding: 5px;
        border-radius: 18px;
    }

    .player-bar {
        height: 93px;
        margin: 3px 2px 6px;
        padding: 5px;
        gap: 5px;
        border-radius: 18px;
    }

    .avatar {
        width: 49px;
        height: 49px;
        font-size: 29px;
    }

    .player-info,
    .social-avatars,
    .balance {
        gap: 4px;
    }

    .score {
        font-size: 23px;
    }

    .player-details {
        font-size: 12px;
    }

    .social-avatars b {
        width: 39px;
        height: 39px;
        font-size: 24px;
    }

    .social-avatars .info {
        font-size: 25px;
    }

    .balance {
        height: 38px;
        padding: 2px 4px;
        font-size: 14px;
    }

    .coin-icon {
        font-size: 18px;
    }

    .add-coins {
        width: 29px;
        height: 29px;
        font-size: 21px;
    }

    .machine-section {
        padding: 6px 6px 3px;
        border-radius: 21px;
    }

    .machine {
        padding: 5px;
        border-width: 5px;
        border-radius: 17px;
    }

    .reel-window {
        height: clamp(280px, 83vw, 390px);
        padding: 3px;
        gap: 2px;
        border-width: 3px;
    }

    .reel {
        border-width: 3px;
    }

    .symbol {
        padding: 2px;
    }

    .line-arrow {
        width: 34px;
        height: 51px;
        font-size: 19px;
    }

    .stats {
        gap: 5px;
        padding-top: 5px;
    }

    .stats > div {
        min-height: 50px;
    }

    .stats label {
        font-size: 12px;
    }

    .stats strong {
        font-size: 21px;
    }

    .stats small {
        font-size: 13px;
    }

    .control-panel {
        gap: 6px;
        padding: 8px 1px 3px;
    }

    .control-panel button {
        height: 58px;
        border-width: 2px;
        border-radius: 13px;
        font-size: 17px;
        box-shadow: 0 5px 0 #4a2b13, 0 7px 9px #0008;
    }

    .control-panel .play-button {
        height: 62px;
        border-radius: 20px;
        font-size: 28px;
    }

    .prize-section {
        padding: 7px 4px;
        margin-top: 7px;
    }

.chest img {
    display: block;
    width: 100%;
    max-width: 130px;
    height: 100px;
    object-fit: contain;
}

.chest b {
    font-size: 16px;
}

    .info-content {
        padding: 5px 7px 9px;
        border-radius: 19px;
    }

    .paytable-head {
        height: 55px;
    }

    .paytable-head h1 {
        font-size: 21px;
    }

    .paytable-head span {
        font-size: 14px;
    }

    .close-pay {
        width: 42px;
        height: 42px;
        font-size: 31px;
    }

    .line-icon {
        width: 45px;
        height: 40px;
        font-size: 39px;
    }

    .paytable-grid {
        gap: 5px;
    }

    .pay-item {
        min-height: 55px;
        padding: 2px 4px;
        gap: 2px;
        border-radius: 9px;
    }

    .pay-item strong {
        font-size: clamp(12px, 3.4vw, 18px);
    }

    .pay-item img {
        height: 46px;
        width: 43%;
    }
}

@media (max-width: 390px) {
    .social-avatars b:nth-child(2) {
        display: none;
    }

    .balance {
        font-size: 12px;
    }

    .paytable-head h1 {
        font-size: 18px;
    }
}
