:root {
    --gold-dark: #b8860b;
    --gold-light: #ffd700;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background-color: #000;
    margin: 0;
    padding: 0;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.mobile-app-container {
    width: 100%;
    max-width: 480px;
    height: 100%;
    max-height: 900px;
    background: radial-gradient(circle at 50% 40%, #1a1a2e 0%, #000 100%);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.15);
    border-left: 1px solid #333;
    border-right: 1px solid #333;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.app-loaded {
    opacity: 1;
}

#introScreen {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: radial-gradient(circle at 50% 40%, #111122 0%, #000 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease-in-out, visibility 1s;
}

#introScreen.hidden-intro {
    opacity: 0;
    visibility: hidden;
}

.intro-text-wrapper {
    position: relative;
    text-align: center;
    padding: 20px;
    overflow: hidden;
}

.intro-title {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 40px;
    line-height: 1.2;
    color: #ffd700;
    text-shadow: 0 0 10px #ffaa00, 0 0 20px #b8860b;
    position: relative;
}

.intro-subtitle {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 24px;
    color: #e2e8f0;
    margin-top: 10px;
    opacity: 0;
    animation: fadeIn 1s 0.5s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 215, 0, 0.1);
    border-top: 5px solid #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-top: 40px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.ribbon-mini {
    background: linear-gradient(135deg, #ffd700 0%, #b8860b 100%);
    color: #000;
    font-weight: bold;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    display: inline-flex;
    align-items: center;
    font-family: 'Vazirmatn';
    white-space: nowrap;
}

/* Pointer Styles - Fixed Visibility */
.custom-pointer {
    position: absolute;
    top: -20px;
    /* Position slightly above the wheel */
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    /* Ensure it's above the wheel */
    width: 60px;
    /* Give it explicit size */
    height: 70px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.5));
    /* Shadow for the whole shape */
    pointer-events: none;
}

.custom-pointer.pulse-on-tick {
    animation: pointerPulse 0.1s ease-out;
}

@keyframes pointerPulse {
    0% {
        transform: translateX(-50%) scale(1);
    }

    50% {
        transform: translateX(-50%) scale(1.1);
    }

    100% {
        transform: translateX(-50%) scale(1);
    }
}

.pointer-body {
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #ffd700, #b8860b);
    /* Inverted Triangle / Shield Shape */
    clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8px;
}

.pointer-ball {
    width: 32px;
    height: 32px;
    background: radial-gradient(circle, #fff, #f0f0f0);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 2px solid #b8860b;
}

.pointer-ball i {
    font-size: 16px;
    color: #b8860b;
}

.header-vertical-stack {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.header-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.spin-btn-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    z-index: 50;
    border-radius: 50%;
}

.pulse-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #ffd700;
    box-shadow: 0 0 10px #ffd700;
    animation: ripple 2s linear infinite;
    z-index: -1;
    opacity: 0;
}

.pulse-ring:nth-child(2) {
    animation-delay: 0.6s;
}

.pulse-ring:nth-child(3) {
    animation-delay: 1.2s;
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0.8;
        border-width: 4px;
    }

    100% {
        transform: scale(2.2);
        opacity: 0;
        border-width: 0px;
    }
}

#spinBtn {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    background: radial-gradient(circle, #444, #000);
    border: 3px solid #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 51;
}

#spinBtn:active {
    transform: scale(0.95);
}

.spin-text {
    font-family: 'Lalezar';
    font-size: 28px;
    color: #ffd700;
    text-shadow: 0 2px 0 #000;
    line-height: 1;
}

/* Wheel Golden Borders (حاشیه طلایی گردونه) */
.relative-wheel-container>div:first-child {
    /* Golden outer ring */
    position: absolute;
    inset: -5px;
    /* Make ring slightly larger than container */
    border-radius: 50%;
    background: linear-gradient(to bottom, #e6b800, #8a6e00);
    border: 4px solid #ffd700;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
    z-index: 5;
    /* Below canvas but visible */
}

.relative-wheel-container>div:nth-child(2) {
    /* Inner dark ring */
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #3d2b00;
    z-index: 6;
}

/* Canvas */
#wheelCanvas {
    position: relative;
    z-index: 10;
    border-radius: 50%;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    width: 100% !important;
    /* Force responsive width */
    height: 100% !important;
    /* Force responsive height */
    object-fit: contain;
}

.bulb {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #555;
    position: absolute;
    z-index: 15;
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.bulb.on {
    background: #ffff00;
    box-shadow: 0 0 10px #ffff00, 0 0 20px #ffaa00;
}

#emojiPickerModal {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 300;
    display: none;
    flex-direction: column;
    padding: 20px;
    align-items: center;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 300px;
    max-height: 400px;
    overflow-y: auto;
    padding-bottom: 20px;
    border: 1px solid #444;
    border-radius: 12px;
    padding: 10px;
    margin-top: 10px;
}

.emoji-item {
    font-size: 28px;
    background: #222;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s;
}

.emoji-item:active {
    transform: scale(0.9);
    background: #444;
}

.dashboard-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 25%;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 1rem;
    background: radial-gradient(circle at center top, #2d2d44, #111 70%);
    border-top: 2px solid #b8860b;
    border-radius: 40px 40px 0 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.8);
    transition: transform 0.5s ease-out;
}

.dashboard-slide-down {
    transform: translateY(100%);
}

.dashboard-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    color: white;
    transition: all 0.2s;
}

.dashboard-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.titles-container {
    position: absolute;
    top: 100px;
    left: 0;
    right: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    text-align: center;
    padding: 0 15px;
}

.wheel-container-wrapper {
    position: absolute;
    top: 280px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.relative-wheel-container {
    position: relative;
    width: 400px;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    scale: 0.95;
}

/* ==================== RESPONSIVE DESIGN ==================== */

@media (max-width: 374px) {
    .intro-title {
        font-size: 28px;
    }

    .intro-subtitle {
        font-size: 16px;
    }

    .titles-container {
        top: 60px;
    }

    .titles-container h1 {
        font-size: 2rem !important;
    }

    .wheel-container-wrapper {
        top: 180px;
    }

    .relative-wheel-container {
        width: 280px;
        height: 280px;
        scale: 1;
    }

    .dashboard-container {
        height: 22%;
    }

    .header-btn {
        width: 35px;
        height: 35px;
    }

    .ribbon-mini {
        font-size: 10px;
        padding: 4px 8px;
    }
}

@media (min-width: 375px) and (max-width: 479px) {
    .intro-title {
        font-size: 32px;
    }

    .intro-subtitle {
        font-size: 18px;
    }

    .titles-container {
        top: 70px;
    }

    .titles-container h1 {
        font-size: 2.5rem !important;
    }

    .wheel-container-wrapper {
        top: 200px;
    }

    .relative-wheel-container {
        width: 320px;
        height: 320px;
        scale: 1;
    }

    .dashboard-container {
        height: 24%;
    }
}

@media (min-width: 480px) and (max-width: 639px) {
    .relative-wheel-container {
        width: 360px;
        height: 360px;
        scale: 1;
    }

    .titles-container {
        top: 80px;
    }

    .wheel-container-wrapper {
        top: 240px;
    }
}

@media (min-width: 640px) {
    .relative-wheel-container {
        scale: 1;
    }
}

@media (orientation: portrait) and (max-height: 700px) {
    .titles-container {
        top: 50px;
    }

    .titles-container h1 {
        font-size: 2.25rem !important;
        line-height: 1.1;
    }

    .wheel-container-wrapper {
        top: 160px;
    }

    .relative-wheel-container {
        width: min(320px, 85vw);
        height: min(320px, 85vw);
    }

    .dashboard-container {
        height: 20%;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .mobile-app-container {
        max-height: none;
        height: 100vh;
    }

    .titles-container {
        top: 30px;
    }

    .titles-container h1 {
        font-size: 2rem !important;
    }

    .wheel-container-wrapper {
        top: 120px;
    }

    .relative-wheel-container {
        width: 280px;
        height: 280px;
    }

    .dashboard-container {
        height: 25%;
    }

    .header-vertical-stack {
        top: 10px;
    }
}

@media (max-width: 480px) {
    body {
        overflow-x: hidden;
    }

    .mobile-app-container {
        width: 100vw;
        max-width: 100vw;
        border: none;
    }

    #winModal .bg-gradient-to-b {
        max-width: 85vw;
    }

    .dashboard-btn {
        font-size: 11px;
    }

    .header-btn {
        width: 40px;
        height: 40px;
    }
}