/* ══════════════════════════════════════════════════════════
   Fortune Wheel — Crazy Cart · Design System
   Стиль: «Мягкий 3D-пластик» (Soft 3D / Claymorphism)
   ══════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties (Design Tokens) ─────────────── */
:root {
    /* Brand Colors */
    --cc-red: #E63946;
    --cc-red-light: #FF6B6B;
    --cc-red-dark: #C1121F;
    --cc-dark: #1D1D2C;
    --cc-dark-light: #2A2A3D;
    --cc-dark-medium: #232338;
    --cc-white: #F1FAEE;
    --cc-white-dim: rgba(241, 250, 238, 0.7);
    --cc-accent: #FFD166;
    --cc-accent-green: #06D6A0;

    /* Semantic */
    --color-bg: var(--cc-dark);
    --color-surface: var(--cc-dark-light);
    --color-text: var(--cc-white);
    --color-text-muted: rgba(241, 250, 238, 0.5);
    --color-primary: var(--cc-red);
    --color-primary-hover: var(--cc-red-light);
    --color-success: var(--cc-accent-green);
    --color-error: #FF4D6D;
    --color-warning: var(--cc-accent);

    /* 3D Shadows */
    --shadow-soft: 8px 8px 24px rgba(0, 0, 0, 0.35),
                   -4px -4px 12px rgba(255, 255, 255, 0.04);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3),
                   0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-inset: inset 4px 4px 8px rgba(0, 0, 0, 0.25),
                    inset -4px -4px 8px rgba(255, 255, 255, 0.04);
    --shadow-glow-red: 0 0 30px rgba(230, 57, 70, 0.4),
                       0 0 60px rgba(230, 57, 70, 0.15);
    --shadow-glow-gold: 0 0 20px rgba(255, 209, 102, 0.35);
    --shadow-btn: 0 4px 15px rgba(230, 57, 70, 0.4),
                  0 2px 4px rgba(0, 0, 0, 0.3);

    /* Radii */
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --radius-xl: 36px;
    --radius-full: 50%;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--cc-red) 0%, var(--cc-red-dark) 100%);
    --gradient-surface: linear-gradient(145deg, #2E2E45 0%, #1D1D2C 100%);
    --gradient-gold: linear-gradient(135deg, #FFD166 0%, #F4A261 100%);
    --gradient-glass: linear-gradient(135deg,
        rgba(255, 255, 255, 0.08) 0%,
        rgba(255, 255, 255, 0.02) 100%);

    /* Typography */
    --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}


/* ── Reset & Base ──────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100dvh;
    overflow-x: hidden;
    line-height: 1.6;
}

a {
    color: var(--cc-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--cc-red-light);
}

img {
    max-width: 100%;
    display: block;
}


/* ── Layout ────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    z-index: 1;
    overflow-y: auto;
    padding: var(--space-lg) 0;
}

.screen--active {
    opacity: 1;
    visibility: visible;
    z-index: 10;
}


/* ── Typography ────────────────────────────────────────── */
.text-gradient {
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


/* ══════════════════════════════════════════════════════════
   WELCOME SCREEN
   ══════════════════════════════════════════════════════════ */
.welcome {
    text-align: center;
    position: relative;
    z-index: 2;
}

.welcome__logo {
    margin-bottom: var(--space-xl);
}

.logo-placeholder {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    border-radius: var(--radius-lg);
    background: var(--gradient-primary);
    box-shadow: var(--shadow-glow-red);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.logo-placeholder::before {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: calc(var(--radius-lg) - 2px);
    background: linear-gradient(135deg,
        rgba(255,255,255,0.15) 0%,
        rgba(255,255,255,0) 60%);
    pointer-events: none;
}

.logo-placeholder--small {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
}

.logo-text {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.4rem;
    color: white;
    letter-spacing: 2px;
    line-height: 1.1;
    text-align: center;
}

.logo-text--small {
    font-size: 1.2rem;
    letter-spacing: 1px;
}

.welcome__title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2.2rem, 8vw, 3.2rem);
    line-height: 1.1;
    margin-bottom: var(--space-md);
    letter-spacing: -0.02em;
}

.welcome__subtitle {
    font-size: 1.05rem;
    color: var(--cc-white-dim);
    margin-bottom: var(--space-2xl);
    line-height: 1.5;
}

.welcome__rules {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-2xl);
}

.rule-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    background: var(--gradient-glass);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.rule-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

.rule-card__icon {
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--gradient-surface);
    box-shadow: var(--shadow-soft);
    flex-shrink: 0;
}

.rule-card__text {
    font-weight: 500;
    font-size: 0.95rem;
}


/* ── Background Orbs ───────────────────────────────────── */
.bg-orbs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
}

.orb--1 {
    width: 300px;
    height: 300px;
    background: var(--cc-red);
    top: -80px;
    right: -80px;
    animation: float 8s ease-in-out infinite;
}

.orb--2 {
    width: 250px;
    height: 250px;
    background: #9B5DE5;
    bottom: -60px;
    left: -60px;
    animation: float 10s ease-in-out infinite reverse;
}

.orb--3 {
    width: 200px;
    height: 200px;
    background: var(--cc-accent);
    top: 40%;
    left: 50%;
    transform: translateX(-50%);
    animation: float 12s ease-in-out infinite 2s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(20px, -30px); }
    66% { transform: translate(-15px, 20px); }
}


/* ══════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 16px 36px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.02em;
}

.btn--primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-btn);
}

.btn--primary::before {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: calc(var(--radius-md) - 1px);
    background: linear-gradient(180deg,
        rgba(255,255,255,0.18) 0%,
        rgba(255,255,255,0) 50%);
    pointer-events: none;
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-red);
}

.btn--primary:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(230, 57, 70, 0.3);
}

.btn--glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: var(--shadow-btn); }
    50% { box-shadow: var(--shadow-glow-red); }
}

.btn--full {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    animation: none !important;
}

.btn__arrow {
    transition: transform var(--transition-fast);
}
.btn:hover .btn__arrow {
    transform: translateX(4px);
}

.btn-back {
    position: absolute;
    top: var(--space-lg);
    left: var(--space-lg);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--gradient-glass);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.06);
    color: var(--color-text);
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 20;
}

.btn-back:hover {
    background: rgba(255,255,255,0.12);
    transform: translateX(-2px);
}


/* ══════════════════════════════════════════════════════════
   AUTH SCREEN
   ══════════════════════════════════════════════════════════ */
.auth {
    position: relative;
    width: 100%;
    max-width: 440px;
}

.auth__logo {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.auth__tabs {
    display: flex;
    position: relative;
    background: var(--gradient-surface);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow-inset);
}

.auth__tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: calc(var(--radius-md) - 4px);
    transition: color var(--transition-fast);
    position: relative;
    z-index: 2;
}

.auth__tab--active {
    color: var(--color-text);
}

.auth__tab-indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: var(--cc-dark-medium);
    border-radius: calc(var(--radius-md) - 4px);
    transition: transform var(--transition-normal);
    z-index: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.auth__tab-indicator--right {
    transform: translateX(100%);
}


/* ── Forms ─────────────────────────────────────────────── */
.auth__form {
    display: none;
}

.auth__form--active {
    display: block;
    animation: fadeSlideUp 0.3s ease;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--cc-white-dim);
    margin-bottom: var(--space-xs);
    letter-spacing: 0.01em;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all var(--transition-fast);
    outline: none;
}

.form-input::placeholder {
    color: var(--color-text-muted);
}

.form-input:focus {
    border-color: var(--cc-red);
    background: rgba(230, 57, 70, 0.05);
    box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.1);
}

.form-input--error {
    border-color: var(--color-error) !important;
    box-shadow: 0 0 0 4px rgba(255, 77, 109, 0.1) !important;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-prefix {
    position: absolute;
    left: 16px;
    color: var(--cc-white-dim);
    font-weight: 600;
    font-size: 1rem;
    pointer-events: none;
    z-index: 1;
}

.form-input--phone {
    padding-left: 44px;
}

.form-error {
    display: block;
    font-size: 0.8rem;
    color: var(--color-error);
    margin-top: var(--space-xs);
    min-height: 1.2em;
}

.auth__switch {
    text-align: center;
    margin-top: var(--space-lg);
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.auth__link {
    font-weight: 600;
}


/* ── Checkbox ──────────────────────────────────────────── */
.checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    cursor: pointer;
}

.checkbox-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-custom {
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    flex-shrink: 0;
    position: relative;
    transition: all var(--transition-fast);
    margin-top: 1px;
}

.checkbox-input:checked + .checkbox-custom {
    background: var(--gradient-primary);
    border-color: var(--cc-red);
}

.checkbox-input:checked + .checkbox-custom::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 6px;
    width: 6px;
    height: 10px;
    border: 2px solid white;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

.checkbox-label {
    font-size: 0.85rem;
    color: var(--cc-white-dim);
    line-height: 1.4;
}


/* ══════════════════════════════════════════════════════════
   WHEEL SCREEN
   ══════════════════════════════════════════════════════════ */
.wheel-page {
    text-align: center;
    position: relative;
}

.wheel-page__header {
    margin-bottom: var(--space-lg);
}

.user-greeting {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    border-radius: var(--radius-lg);
    background: var(--gradient-glass);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.06);
    font-size: 1rem;
}

.user-greeting__emoji {
    font-size: 1.3rem;
}

.wheel-container {
    position: relative;
    display: inline-block;
    margin: var(--space-lg) auto;
}

.wheel-wrapper {
    position: relative;
    width: 340px;
    height: 340px;
    margin: 0 auto;
    border-radius: 50%;
    box-shadow:
        0 0 0 12px var(--cc-dark-light),
        0 0 0 16px rgba(230, 57, 70, 0.3),
        0 0 40px rgba(230, 57, 70, 0.15),
        0 10px 40px rgba(0,0,0,0.4);
}

#wheel-canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.wheel-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
    animation: pointer-bounce 1.5s ease-in-out infinite;
}

@keyframes pointer-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(4px); }
}

.wheel-spin-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.2);
    background: var(--gradient-primary);
    box-shadow:
        0 0 20px rgba(230, 57, 70, 0.5),
        inset 0 2px 4px rgba(255,255,255,0.3);
    cursor: pointer;
    z-index: 20;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wheel-spin-btn:hover {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow:
        0 0 30px rgba(230, 57, 70, 0.7),
        inset 0 2px 4px rgba(255,255,255,0.3);
}

.wheel-spin-btn:active {
    transform: translate(-50%, -50%) scale(0.95);
}

.wheel-spin-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: translate(-50%, -50%) !important;
    box-shadow: none !important;
}

.wheel-spin-btn__text {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 0.7rem;
    color: white;
    letter-spacing: 1px;
    text-transform: uppercase;
}


/* ── Cooldown Timer ────────────────────────────────────── */
.cooldown-timer {
    margin-top: var(--space-xl);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    background: var(--gradient-glass);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.06);
    display: inline-flex;
    align-items: center;
    gap: var(--space-md);
}

.cooldown-timer__icon {
    font-size: 1.5rem;
}

.cooldown-timer__text {
    font-size: 0.95rem;
    color: var(--cc-white-dim);
}

.cooldown-timer__text strong {
    color: var(--cc-accent);
    font-family: var(--font-display);
    font-size: 1.1rem;
    letter-spacing: 1px;
}


/* ══════════════════════════════════════════════════════════
   MODAL — RESULT
   ══════════════════════════════════════════════════════════ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s ease;
}

.modal--active {
    opacity: 1;
    visibility: visible;
}

.modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.modal__content {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: var(--space-2xl) var(--space-xl);
    border-radius: var(--radius-xl);
    background: var(--gradient-surface);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: var(--shadow-card);
    text-align: center;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.modal--active .modal__content {
    transform: scale(1) translateY(0);
}

.modal__confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.modal__icon {
    font-size: 3.5rem;
    margin-bottom: var(--space-md);
    animation: bounce-in 0.6s ease 0.2s both;
}

.modal__title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.8rem;
    margin-bottom: var(--space-lg);
}

.modal__prize {
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    background: rgba(255, 209, 102, 0.08);
    border: 1px solid rgba(255, 209, 102, 0.15);
    margin-bottom: var(--space-lg);
}

.modal__prize-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--cc-accent);
    margin-bottom: var(--space-xs);
}

.modal__prize-desc {
    font-size: 0.9rem;
    color: var(--cc-white-dim);
}

.modal__expires {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-xl);
}


/* ══════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
    box-shadow: var(--shadow-card);
    animation: toast-in 0.3s ease, toast-out 0.3s ease 3.7s forwards;
    max-width: 360px;
    backdrop-filter: blur(12px);
}

.toast--error {
    background: linear-gradient(135deg, #FF4D6D 0%, #C9184A 100%);
}

.toast--success {
    background: linear-gradient(135deg, #06D6A0 0%, #0A9B6B 100%);
}

.toast--info {
    background: linear-gradient(135deg, #457B9D 0%, #2A5478 100%);
}


/* ══════════════════════════════════════════════════════════
   GLOBAL LOADER
   ══════════════════════════════════════════════════════════ */
.global-loader {
    position: fixed;
    inset: 0;
    background: rgba(29, 29, 44, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top-color: var(--cc-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .container {
        padding: 0 var(--space-md);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .wheel-wrapper {
        width: 290px;
        height: 290px;
    }

    .wheel-spin-btn {
        width: 66px;
        height: 66px;
    }

    .wheel-spin-btn__text {
        font-size: 0.6rem;
    }

    .welcome__title {
        font-size: 2rem;
    }

    .btn-back {
        top: var(--space-md);
        left: var(--space-md);
    }

    .toast-container {
        left: var(--space-md);
        right: var(--space-md);
    }

    .toast {
        max-width: 100%;
    }
}

@media (max-width: 360px) {
    .wheel-wrapper {
        width: 260px;
        height: 260px;
    }
}

@media (min-width: 768px) {
    .wheel-wrapper {
        width: 400px;
        height: 400px;
    }

    .wheel-spin-btn {
        width: 90px;
        height: 90px;
    }

    .wheel-spin-btn__text {
        font-size: 0.8rem;
    }
}
