:root {
    --primary: #6d73ff;
    --primary-dark: #484ed7;
    --accent: #facc15;
    --accent-soft: #fde68a;
    --white: #ffffff;
    --glass: rgba(255, 255, 255, 0.09);
    --glass-strong: rgba(255, 255, 255, 0.14);
    --glass-border: rgba(255, 255, 255, 0.16);
    --text-soft: rgba(255, 255, 255, 0.72);
    --bg: linear-gradient(140deg, #0f1d47 0%, #172554 35%, #4c1d95 100%);
    --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.42);
    --shadow-md: 0 16px 36px rgba(15, 23, 42, 0.22);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-family: 'Inter', sans-serif; }

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    min-height: 100dvh;
    background:
        radial-gradient(circle at top left, rgba(125, 211, 252, 0.12), transparent 22%),
        radial-gradient(circle at 85% 20%, rgba(250, 204, 21, 0.08), transparent 18%),
        var(--bg);
    color: var(--white);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.welcome-wrapper,
.welcome-main,
.selection-side,
.ticket-side,
.ticket-stage,
.ticket-preview {
    max-width: 100%;
}

.welcome-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100dvh;
    height: auto;
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
    overflow-x: clip;
}

.welcome-main {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

@media (min-width: 1024px) {
    .welcome-main {
        display: grid;
        grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.75fr);
        flex: 1 1 auto;
        align-items: stretch;
        gap: 0;
    }

    .selection-side {
        min-width: 0;
        padding: 40px 30px;
        border-right: 1px solid var(--glass-border);
        display: flex;
        flex-direction: column;
    }

    .ticket-side {
        min-width: 0;
        padding: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
    overflow: clip;
    }
}

.selection-side { padding: 20px; overflow: visible; }

@media (max-width: 1023px) {
    .selection-side {
        position: relative;
        z-index: 2;
        flex: 0 0 auto;
        padding: max(12px, env(safe-area-inset-top, 0px)) 14px 10px;
        overflow: visible;
    }

    .ticket-side {
        position: relative;
        z-index: 1;
        flex: 0 0 auto;
        padding: 6px 12px max(28px, env(safe-area-inset-bottom, 0px));
    }

    .welcome-header {
        margin-bottom: 14px;
    }

    .logo {
        font-size: clamp(1.75rem, 6.5vw, 2.1rem);
    }

    .subtitle {
        font-size: clamp(0.82rem, 2.8vw, 0.9rem);
    }

    .route-hint {
        font-size: 0.7rem;
        max-width: none;
    }

    .selection-container {
        margin-top: 10px;
        gap: 10px;
        min-height: 0;
    }

    .country-list {
        max-height: min(38dvh, 300px);
        -webkit-overflow-scrolling: touch;
    }

    .country-item {
        padding: 11px 8px;
        min-height: 48px;
    }

    .country-info strong {
        font-size: 0.84rem;
    }

    .ticket-body {
        padding: clamp(16px, 4vw, 24px) clamp(10px, 3vw, 14px);
        flex-wrap: nowrap;
        gap: 4px;
    }

    .info {
        flex: 1 1 0;
        min-width: 0;
    }

    .info h2 {
        font-size: clamp(1.45rem, 9vw, 1.85rem);
        word-break: break-word;
    }

    .info small {
        font-size: 0.72rem;
    }

    .plane-divider {
        width: auto;
        flex: 0 0 auto;
        min-width: 36px;
    }

    .plane-divider i {
        font-size: 1.2rem;
        padding: 0 6px;
    }

    .ticket-header {
        padding: 12px 14px;
        font-size: clamp(0.72rem, 2.5vw, 0.9rem);
    }

    .ticket-stub {
        padding: 20px 16px;
    }

    .barcode {
        height: 48px;
    }

    .tear-zone {
        height: auto;
        min-height: 56px;
        padding: 10px 0;
    }

    .tear-hint-wrap {
        left: 12px;
        max-width: calc(100% - 88px);
    }

    .tear-label {
        font-size: 0.7rem;
    }

    .tear-guide-inline {
        font-size: clamp(0.68rem, 2.4vw, 0.8rem);
        line-height: 1.3;
    }

    .tear-arrow {
        right: 56px;
        font-size: 0.9rem;
    }

    .ticket-preview.ready {
        transform: none;
        filter: drop-shadow(0 16px 36px rgba(15, 23, 42, 0.26));
    }

    .ticket-preview.ready .tear-zone {
        cursor: grab;
        touch-action: none;
    }

    .ticket-preview.dragging .tear-zone {
        touch-action: none;
    }
}

@media (max-width: 1200px) {
    .welcome-main {
        display: flex;
        flex-direction: column;
    }
}

@media (max-width: 360px) {
    .selection-container {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .country-list {
        max-height: min(28dvh, 220px);
    }
}
.welcome-header { margin-bottom: 25px; }
.logo {
    font-size: 2.8rem;
    font-weight: 900;
    letter-spacing: -2px;
    margin: 0;
    color: var(--white);
}
.logo span { color: var(--accent); }
.subtitle { font-size: 0.9rem; opacity: 0.8; margin-top: 5px; }

.route-hint {
    margin: 12px 0 0;
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--text-soft);
    opacity: 0.88;
    max-width: 52ch;
}

.selection-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    flex-grow: 1;
    overflow: visible;
    margin-top: 15px;
}

.selection-group { display: flex; flex-direction: column; overflow: visible; height: auto; min-width: 0; }
.selection-group h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    color: var(--accent-soft);
}

.country-list {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--glass-border);
    flex-grow: 1;
}

.country-list::-webkit-scrollbar { width: 4px; }
.country-list::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 10px; }

.country-item {
    padding: 12px 10px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 5px;
}

.country-item:hover { background: rgba(255, 255, 255, 0.05); }
.country-item.active {
    background: var(--white);
    color: var(--primary-dark);
    font-weight: 800;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transform: scale(1.02);
}
.country-item.active small { color: #64748b; }

.country-item--soon {
    opacity: 0.84;
    cursor: default;
    filter: none;
    position: relative;
    background: rgba(255, 255, 255, 0.035);
}

.country-item--soon::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    pointer-events: none;
    border: 1px solid rgba(129, 140, 248, 0.2);
    background: linear-gradient(135deg, rgba(129, 140, 248, 0.06), transparent 58%);
}

.country-item--soon:hover {
    background: rgba(255, 255, 255, 0.055);
    transform: none;
}

.country-item--soon .flag-icon { opacity: 0.92; }

.flag-icon { font-size: 1.3rem; }
.country-info strong { font-size: 0.9rem; display: block; }
.country-info small { font-size: 0.7rem; opacity: 0.7; }

.ticket-stage {
    width: min(920px, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    overflow: clip;
}

.ticket-preview {
    --tear-progress: 0;
    --tear-fall: 0;
    --tear-velocity: 0;
    --tear-jitter: 0;
    --tear-rot-vel-gain: 1.8;
    --tear-drop-x: 0px;
    --tear-drop-y: 0px;
    --tear-rotate: 0deg;
    --tear-seam-pull: 0px;
    --tear-edge-drop: 0px;
    --tear-body-drop: 0px;
    --tear-torsion: 0px;
    width: min(840px, 100%);
    transition: transform 0.32s ease, filter 0.32s ease;
    filter: drop-shadow(0 30px 60px rgba(15, 23, 42, 0.28));
    overflow: clip;
}

.ticket-preview.ready {
    transform: scale(1.012);
    filter: drop-shadow(0 34px 70px rgba(15, 23, 42, 0.34));
}

.ticket-main,
.ticket-stub {
    background: white;
    color: #1e293b;
    transition: transform 0.42s cubic-bezier(0.22, 0.82, 0.2, 1), opacity 0.48s ease, filter 0.42s ease, box-shadow 0.42s ease;
}

.ticket-main {
    border-radius: 26px 26px 0 0;
    overflow: hidden;
    position: relative;
}

.ticket-main::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, rgba(255,255,255,0.0) 30%, rgba(255,255,255,0.38) 46%, rgba(255,255,255,0.0) 62%);
    transform: translateX(calc(-120% + 140% * var(--tear-progress)));
    pointer-events: none;
    opacity: calc(0.25 + 0.35 * var(--tear-progress));
}

.ticket-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 16px;
    text-align: center;
    border-radius: 26px 26px 0 0;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.ticket-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 56px 52px;
}

.info small { color: #64748b; font-size: 0.84rem; }
.info h2 { margin: 6px 0 0; font-size: 3rem; color: #1f2937; }
.info-right { text-align: right; }

.plane-divider {
    position: relative;
    width: 30%;
    display: flex;
    justify-content: center;
}

.plane-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    border-top: 1px dashed rgba(148, 163, 184, 0.5);
    transform: translateY(-50%);
}

.plane-divider i {
    position: relative;
    z-index: 1;
    font-size: 1.5rem;
    color: #94a3b8;
    background: #fff;
    padding: 0 12px;
}

.tear-zone {
    position: relative;
    height: 58px;
    background: linear-gradient(180deg, #f8fafc, #eef2f7);
    border-top: 1px dashed rgba(148, 163, 184, 0.45);
    border-bottom: 1px dashed rgba(148, 163, 184, 0.45);
    user-select: none;
    overflow: hidden;
    transition: opacity 0.24s ease, transform 0.24s ease;
}

.tear-zone::before,
.tear-zone::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 6px;
    background-size: 14px 6px;
    background-repeat: repeat-x;
    opacity: 0.32;
}

.ticket-preview.dragging .tear-zone::before,
.ticket-preview.dragging .tear-zone::after {
    opacity: calc(0.32 + (var(--tear-velocity) * 0.36));
}

.ticket-preview.dragging .tear-zone::before {
    transform: translateX(calc(var(--tear-jitter) * -1.1px));
}

.ticket-preview.dragging .tear-zone::after {
    transform: translateX(calc(var(--tear-jitter) * 1.1px));
}

.tear-zone::before {
    top: -1px;
    background-image: linear-gradient(-45deg, transparent 0 6px, #e2e8f0 6px 8px);
}

.tear-zone::after {
    bottom: -1px;
    background-image: linear-gradient(45deg, transparent 0 6px, #e2e8f0 6px 8px);
}

.tear-hint-wrap {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: calc(100% - 132px);
}

.tear-label {
    font-size: 0.78rem;
    letter-spacing: 1px;
    color: #64748b;
    font-weight: 800;
}

.tear-guide-inline {
    font-size: 0.8rem;
    line-height: 1.35;
    color: rgba(71, 85, 105, 0.92);
    font-weight: 600;
}

.tear-arrow {
    position: absolute;
    right: 74px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(100, 116, 139, 0.55);
    font-size: 1rem;
    animation: arrowHint 0.9s ease-in-out infinite alternate;
}

@keyframes arrowHint {
    from { transform: translate(-2px, -50%); opacity: 0.35; }
    to { transform: translate(2px, -50%); opacity: 0.72; }
}

@keyframes tearHintBlink {
    0%, 100% { opacity: 0.42; }
    50% { opacity: 1; }
}

.tear-knob {
    position: absolute;
    top: 50%;
    left: calc(14px + (100% - 62px) * var(--tear-progress));
    transform: translateY(-50%);
    width: 48px;
    height: 28px;
    border: none;
    border-radius: 999px;
    background: transparent;
    box-shadow: none;
    opacity: 0;
    cursor: grab;
    pointer-events: none;
}

.tear-knob:active { cursor: grabbing; }

@media (max-width: 1023px) {
    .tear-zone {
        cursor: grab;
    }

    .tear-knob {
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        transform: none;
        pointer-events: none;
    }
}

.ticket-stub {
    border-radius: 0 0 26px 26px;
    padding: 30px;
    background: linear-gradient(180deg, #f8fafc, #eef2f7);
}

.barcode {
    height: 56px;
    background: repeating-linear-gradient(90deg, #333, #333 3px, transparent 3px, transparent 6px);
}

.ticket-preview.ready .tear-label,
.ticket-preview.ready .tear-guide-inline { animation: tearHintBlink 1.15s ease-in-out infinite; }

.ticket-preview .ticket-main { transform: none; }

.ticket-preview .ticket-stub {
    transform: translate(0, 0) rotate(0deg);
    transform-origin: center top;
    filter: drop-shadow(0 6px 12px rgba(30, 41, 59, 0.08));
}

.ticket-preview .tear-zone {
    clip-path: inset(0 0 0 0 round 0);
}

.ticket-preview.dragging .ticket-main,
.ticket-preview.dragging .ticket-stub {
    transition: none;
}

.ticket-preview.dragging .ticket-main {
    box-shadow:
        inset 0 calc(-1 * var(--tear-seam-pull)) 0 rgba(255, 255, 255, 0.34),
        inset 0 -4px 14px rgba(15, 23, 42, 0.1),
        0 24px 48px rgba(15, 23, 42, 0.17);
}

.ticket-preview.dragging .tear-zone {
    transform: translateY(calc(var(--tear-seam-pull) * 0.3 + (var(--tear-jitter) * 2px)));
}

.ticket-preview.dragging .ticket-stub {
    transform: translate(
        calc((2px * var(--tear-progress)) + (var(--tear-jitter) * 1.2px)),
        calc(var(--tear-edge-drop) + var(--tear-body-drop) + var(--tear-torsion))
    ) rotate(calc((0.95deg * var(--tear-fall)) + (var(--tear-velocity) * var(--tear-rot-vel-gain) * 1deg)));
    filter: drop-shadow(
        calc(2px * var(--tear-fall))
        calc(26px * var(--tear-fall))
        calc(30px * var(--tear-fall))
        rgba(30, 41, 59, 0.32)
    );
}

.ticket-preview.dragging .tear-zone {
    clip-path: inset(0 0 0 0 round 0);
}

.ticket-preview.torn .ticket-main {
    opacity: 1;
    transform: translateY(-4px) scale(1.003);
}

.ticket-preview.torn .ticket-stub {
    opacity: 0;
    transform: translate(var(--tear-drop-x), calc(var(--tear-seam-pull) + var(--tear-edge-drop) + var(--tear-body-drop) + var(--tear-drop-y))) rotate(var(--tear-rotate));
    transform-origin: center top;
    filter: drop-shadow(0 28px 28px rgba(30, 41, 59, 0.28));
    transition:
        transform 0.82s cubic-bezier(0.16, 0.78, 0.22, 1),
        opacity 0.52s ease 0.1s,
        filter 0.75s ease;
}

.ticket-preview.torn .tear-zone {
    opacity: 0;
}

.welcome-footer {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    padding: 16px 16px max(20px, env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.12);
}

.welcome-footer .btn-contact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 22px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    color: #1e1b4b;
    background: linear-gradient(135deg, #e0e7ff, #c4b5fd);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 10px 24px rgba(109, 115, 255, 0.22);
    transition: transform 0.18s ease, filter 0.18s ease;
}

.welcome-footer .btn-contact:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}
