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

:root {
    --bg-primary: #0d1329;
    --bg-secondary: #1a2140;
    --bg-card: #252b4a;
    --accent-pink: #ff3b6f;
    --accent-pink-dark: #cc2f59;
    --accent-blue: #4a6cf7;
    --accent-orange: #ff9500;
    --accent-orange-dark: #e68600;
    --text-primary: #ffffff;
    --text-secondary: #8892b0;
    --text-placeholder: #5a6380;
    --success: #4ade80;
    --error: #f87171;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(180deg, var(--bg-primary) 0%, #0a0f1f 100%);
    min-height: 100vh;
    min-height: var(--app-height, 100dvh);
    color: var(--text-primary);
    overflow-x: hidden;
}

.app {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: var(--app-height, 100dvh);
    position: relative;
}

.screen {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    min-height: var(--app-height, 100dvh);
    padding: 40px 24px;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--accent-pink), #ff6b9d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Back Button */
.btn-back {
    position: absolute;
    top: 40px;
    left: 24px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    z-index: 10;
}

/* Onboarding Screen */
.onboarding-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: center;
    align-items: center;
    padding-top: 40px;
}

.onboarding-slides {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
}

.onboarding-slide {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
    animation: fadeIn 0.4s ease;
}

.onboarding-slide.active {
    display: flex;
}

.slide-icon {
    font-size: 80px;
    margin-bottom: 30px;
    animation: floatBounce 3s ease-in-out infinite;
}

@keyframes floatBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.slide-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.slide-text {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 300px;
}

.onboarding-dots {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot.active {
    background: var(--accent-pink);
    width: 30px;
    border-radius: 5px;
}

.onboarding-buttons {
    display: flex;
    gap: 16px;
    width: 100%;
    max-width: 320px;
}

.btn-skip {
    flex: 1;
    background: transparent;
    border: 2px solid var(--text-secondary);
    color: var(--text-secondary);
    padding: 16px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

@media (hover: hover) {
    .btn-skip:hover {
        border-color: var(--text-primary);
        color: var(--text-primary);
    }
}

.btn-next-slide {
    flex: 1.5;
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-pink-dark) 100%);
    border: none;
    color: white;
    padding: 16px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(255, 59, 111, 0.3);
}

@media (hover: hover) {
    .btn-next-slide:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 25px rgba(255, 59, 111, 0.4);
    }
}

/* ============================================= */
/* DICE AREA                                     */
/* ============================================= */

.dice-area {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 20px 0 30px;
    flex: 1;
    align-items: center;
}

.dice-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.dice-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 3D Dice Scene */
.dice-scene {
    width: 110px;
    height: 110px;
    perspective: 600px;
}

.dice {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-25deg) rotateY(25deg);
    transition: transform 0.15s ease-out;
}

.dice.rolling {
    transition: none;
}

.dice.settle {
    transition: transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.dice-face {
    position: absolute;
    width: 110px;
    height: 110px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    line-height: 1.2;
    padding: 10px;
    backface-visibility: hidden;
}

/* Action dice - pink/red gradient */
#dice-action .dice-face {
    background: linear-gradient(135deg, #ff3b6f 0%, #e91e63 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.15);
}

/* Body dice - purple/blue gradient */
#dice-body .dice-face {
    background: linear-gradient(135deg, #7c4dff 0%, #536dfe 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.15);
}

.face-front  { transform: translateZ(55px); }
.face-back   { transform: rotateY(180deg) translateZ(55px); }
.face-right  { transform: rotateY(90deg) translateZ(55px); }
.face-left   { transform: rotateY(-90deg) translateZ(55px); }
.face-top    { transform: rotateX(90deg) translateZ(55px); }
.face-bottom { transform: rotateX(-90deg) translateZ(55px); }

/* Glow effect while rolling */
.dice-scene.glow-pink {
    filter: drop-shadow(0 0 20px rgba(255, 59, 111, 0.6));
}

.dice-scene.glow-purple {
    filter: drop-shadow(0 0 20px rgba(124, 77, 255, 0.6));
}

/* ============================================= */
/* RESULT CARD                                   */
/* ============================================= */

.result-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    border-radius: 24px;
    padding: 28px 24px;
    text-align: center;
    margin: 0 0 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.result-card.visible {
    opacity: 1;
    transform: scale(1);
}

.result-action {
    display: block;
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-pink), #ff6b9d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-body {
    display: block;
    font-size: 24px;
    font-weight: 600;
    color: #b388ff;
}

/* ============================================= */
/* BOTTOM SECTION                                */
/* ============================================= */

.bottom-section {
    padding: 20px 0;
    margin-top: auto;
}

.btn-roll {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-pink-dark) 100%);
    border: none;
    color: white;
    padding: 20px;
    border-radius: 30px;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 25px rgba(255, 59, 111, 0.4);
    position: relative;
    overflow: hidden;
}

@media (hover: hover) {
    .btn-roll:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 30px rgba(255, 59, 111, 0.5);
    }
}

.btn-roll:active {
    transform: translateY(0) scale(0.98);
}

.btn-roll.rolling {
    pointer-events: none;
    opacity: 0.7;
}

/* Shimmer effect on button */
.btn-roll::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.15) 50%,
        transparent 70%
    );
    transform: translateX(-100%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.hint-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 12px;
    transition: opacity 0.3s;
}

/* ============================================= */
/* PARTICLES                                     */
/* ============================================= */

.particle {
    position: fixed;
    pointer-events: none;
    border-radius: 50%;
    z-index: 100;
}

/* ============================================= */
/* RESPONSIVE                                    */
/* ============================================= */

@media (max-width: 480px) {
    .app {
        max-width: 100%;
    }

    .screen {
        padding: 20px 12px;
    }

    .title {
        font-size: 20px;
        margin-bottom: 16px;
    }

    .btn-back {
        top: 20px;
        left: 12px;
        font-size: 20px;
        padding: 6px;
    }

    .dice-area {
        gap: 20px;
        margin: 16px 0 20px;
    }

    .dice-scene {
        width: 90px;
        height: 90px;
    }

    .dice-face {
        width: 90px;
        height: 90px;
        border-radius: 14px;
        font-size: 15px;
        padding: 8px;
    }

    .face-front  { transform: translateZ(45px); }
    .face-back   { transform: rotateY(180deg) translateZ(45px); }
    .face-right  { transform: rotateY(90deg) translateZ(45px); }
    .face-left   { transform: rotateY(-90deg) translateZ(45px); }
    .face-top    { transform: rotateX(90deg) translateZ(45px); }
    .face-bottom { transform: rotateX(-90deg) translateZ(45px); }

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

    .result-card {
        padding: 20px 16px;
        border-radius: 20px;
        min-height: 80px;
    }

    .result-action {
        font-size: 22px;
    }

    .result-body {
        font-size: 20px;
    }

    .btn-roll {
        padding: 18px;
        font-size: 18px;
    }

    .slide-icon {
        font-size: 60px;
        margin-bottom: 20px;
    }

    .slide-title {
        font-size: 20px;
        margin-bottom: 16px;
    }

    .slide-text {
        font-size: 14px;
        max-width: 280px;
    }

    .onboarding-buttons {
        gap: 12px;
    }

    .btn-skip, .btn-next-slide {
        padding: 14px;
        font-size: 14px;
    }
}

@media (max-height: 600px) {
    .screen {
        padding: 16px 12px;
    }

    .title {
        font-size: 18px;
        margin-bottom: 12px;
    }

    .dice-area {
        gap: 16px;
        margin: 10px 0 16px;
    }

    .dice-scene {
        width: 80px;
        height: 80px;
    }

    .dice-face {
        width: 80px;
        height: 80px;
        font-size: 13px;
        padding: 6px;
    }

    .face-front  { transform: translateZ(40px); }
    .face-back   { transform: rotateY(180deg) translateZ(40px); }
    .face-right  { transform: rotateY(90deg) translateZ(40px); }
    .face-left   { transform: rotateY(-90deg) translateZ(40px); }
    .face-top    { transform: rotateX(90deg) translateZ(40px); }
    .face-bottom { transform: rotateX(-90deg) translateZ(40px); }

    .result-card {
        padding: 16px;
        min-height: 70px;
    }

    .result-action {
        font-size: 20px;
    }

    .result-body {
        font-size: 18px;
    }

    .btn-roll {
        padding: 14px;
        font-size: 16px;
    }
}

@media (min-width: 768px) {
    .dice-scene {
        width: 130px;
        height: 130px;
    }

    .dice-face {
        width: 130px;
        height: 130px;
        font-size: 20px;
        border-radius: 18px;
    }

    .face-front  { transform: translateZ(65px); }
    .face-back   { transform: rotateY(180deg) translateZ(65px); }
    .face-right  { transform: rotateY(90deg) translateZ(65px); }
    .face-left   { transform: rotateY(-90deg) translateZ(65px); }
    .face-top    { transform: rotateX(90deg) translateZ(65px); }
    .face-bottom { transform: rotateX(-90deg) translateZ(65px); }

    .result-action {
        font-size: 32px;
    }

    .result-body {
        font-size: 28px;
    }

    .btn-roll {
        padding: 22px;
        font-size: 22px;
    }
}
