/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
    background: #0e1621;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: #f5f5f5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* ===== SCREENS ===== */
.screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* ===== SCREEN 1: TELEGRAM CHAT ===== */
#chat-screen {
    background: #0e1621;
}

/* Header */
.chat-header {
    display: flex;
    align-items: center;
    padding: 10px 8px;
    background: #17212b;
    border-bottom: 1px solid #0e1621;
    gap: 10px;
    flex-shrink: 0;
    padding-top: calc(env(safe-area-inset-top, 0px) + 16px);
}

.header-back {
    display: flex;
    align-items: center;
    padding: 4px;
}

.header-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.header-info {
    flex: 1;
}

.header-name {
    font-size: 16px;
    font-weight: 600;
    color: #f5f5f5;
    line-height: 1.2;
}

.header-status {
    font-size: 13px;
    color: #6ab3f3;
    line-height: 1.2;
    transition: opacity 0.2s ease;
}

.header-icons {
    display: flex;
    gap: 16px;
    padding-right: 4px;
}

/* Chat Body */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 8px 16px;
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
    transition: padding-bottom 0.4s ease;
}

.chat-body.with-button {
    padding-bottom: 80px;
}

.chat-date {
    text-align: center;
    margin: 8px 0 12px;
}

.chat-date span {
    background: #182533;
    color: #6d7f8f;
    font-size: 13px;
    padding: 4px 12px;
    border-radius: 16px;
}

/* Messages */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.message {
    max-width: 85%;
    padding: 7px 12px 6px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.35;
    position: relative;
    word-wrap: break-word;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    opacity: 0;
    transform: translateY(8px);
    animation: messageAppear 0.25s ease forwards;
}

@keyframes messageAppear {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-incoming {
    align-self: flex-start;
    background: #182533;
    color: #f5f5f5;
    border-bottom-left-radius: 4px;
}

.message-outgoing {
    align-self: flex-end;
    background: #2b5278;
    color: #f5f5f5;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #6d7f8f;
    margin-left: auto;
    padding-left: 8px;
    line-height: 1;
    flex-shrink: 0;
}

.message-outgoing .message-time {
    color: #7eaec4;
}

/* Spacing: first in a group has more top margin */
.message-group-start {
    margin-top: 8px;
}

/* Tail on last message in group */
.message-incoming.message-group-end {
    border-bottom-left-radius: 12px;
}

.message-incoming.message-group-start {
    border-top-left-radius: 12px;
}

.message-incoming:not(.message-group-start) {
    border-top-left-radius: 4px;
}

.message-incoming:not(.message-group-end) {
    border-bottom-left-radius: 4px;
}

.message-outgoing.message-group-start {
    border-top-right-radius: 12px;
}

.message-outgoing:not(.message-group-start) {
    border-top-right-radius: 4px;
}

.message-outgoing:not(.message-group-end) {
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.typing-bubble {
    align-self: flex-start;
    background: #182533;
    padding: 10px 16px;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    display: none;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.typing-bubble.visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.typing-bubble .dot {
    width: 7px;
    height: 7px;
    background: #6d7f8f;
    border-radius: 50%;
    animation: typingDot 1.2s infinite;
}

.typing-bubble .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-bubble .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Transition button */
.chat-button-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 24px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    display: flex;
    justify-content: center;
    opacity: 0;
    transform: translateY(20px);
    visibility: hidden;
    transition: opacity 0.6s ease, transform 0.6s ease, visibility 0.6s ease;
    z-index: 10;
}

.chat-button-container.visible {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

#chat-button {
    background: #2b5278;
    color: #f5f5f5;
    border: none;
    padding: 14px 32px;
    border-radius: 24px;
    font-size: 16px;
    font-family: inherit;
    cursor: pointer;
    animation: buttonPulse 2s ease-in-out infinite;
    transition: background 0.2s ease;
}

#chat-button:active {
    background: #3a6a94;
}

@keyframes buttonPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(106, 179, 243, 0.3);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(106, 179, 243, 0);
    }
}

/* ===== SCREEN 2: CARDS ===== */
#cards-screen {
    background: #0d1117;
    justify-content: center;
    align-items: center;
}

.cards-stack {
    position: relative;
    width: 320px;
    height: 460px;
}

/* Kraft Packet */
.packet {
    position: absolute;
    inset: 0;
    display: none;
    cursor: pointer;
}

.packet.current {
    display: block;
}

.packet-body {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    overflow: visible;
}

.packet-top,
.packet-bottom {
    position: absolute;
    left: 0;
    right: 0;
    background: #c4a47a;
    transition: transform 0.6s ease, opacity 0.5s ease;
}

.packet-top {
    top: 0;
    height: 45%;
    clip-path: polygon(
        0% 0%, 100% 0%, 100% 85%,
        97% 75%, 94% 85%, 91% 75%, 88% 85%, 85% 75%, 82% 85%,
        79% 75%, 76% 85%, 73% 75%, 70% 85%, 67% 75%, 64% 85%,
        61% 75%, 58% 85%, 55% 75%, 52% 85%, 49% 75%, 46% 85%,
        43% 75%, 40% 85%, 37% 75%, 34% 85%, 31% 75%, 28% 85%,
        25% 75%, 22% 85%, 19% 75%, 16% 85%, 13% 75%, 10% 85%,
        7% 75%, 4% 85%, 0% 75%
    );
    border-radius: 12px 12px 0 0;
    z-index: 2;
}

.packet-bottom {
    bottom: 0;
    height: 60%;
    clip-path: polygon(
        0% 8%,
        4% 17%, 7% 8%, 10% 17%, 13% 8%, 16% 17%, 19% 8%, 22% 17%,
        25% 8%, 28% 17%, 31% 8%, 34% 17%, 37% 8%, 40% 17%, 43% 8%,
        46% 17%, 49% 8%, 52% 17%, 55% 8%, 58% 17%, 61% 8%, 64% 17%,
        67% 8%, 70% 17%, 73% 8%, 76% 17%, 79% 8%, 82% 17%, 85% 8%,
        88% 17%, 91% 8%, 94% 17%, 97% 8%, 100% 17%,
        100% 100%, 0% 100%
    );
    border-radius: 0 0 12px 12px;
    z-index: 2;
}

/* Kraft paper texture via gradients */
.packet-top,
.packet-bottom {
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 2px,
            rgba(0,0,0,0.02) 2px,
            rgba(0,0,0,0.02) 4px
        ),
        linear-gradient(
            180deg,
            #cdb08a 0%,
            #c4a47a 40%,
            #b89868 100%
        );
}

/* Tear indicator line */
.packet-tear-line {
    position: absolute;
    top: 38%;
    left: 10%;
    right: 10%;
    border-top: 2px dashed rgba(0,0,0,0.15);
    z-index: 3;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Quote label on packet */
.packet-quote {
    position: absolute;
    top: 62%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    text-align: center;
    width: 85%;
    pointer-events: none;
}

.packet-quote span {
    font-family: 'Caveat', cursive;
    font-size: 22px;
    color: #3d2e1a;
    line-height: 1.3;
    font-weight: 700;
}

/* Special label for last packet */
.packet-special-label {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    background: rgba(61, 46, 26, 0.15);
    color: #3d2e1a;
    font-family: 'Caveat', cursive;
    font-size: 20px;
    padding: 2px 10px;
    border-radius: 8px;
    pointer-events: none;
}

/* Torn state */
.packet.torn .packet-top {
    transform: translateY(-110%);
    opacity: 0;
}

.packet.torn .packet-bottom {
    transform: translateY(110%);
    opacity: 0;
}

.packet.torn .packet-tear-line {
    opacity: 0;
}

.packet.torn .packet-quote {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.packet.torn .packet-special-label {
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* Polaroid */
.polaroid {
    position: absolute;
    inset: -30px -30px -60px -30px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 4px;
    padding: 12px 12px 12px 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.5s ease 0.2s, transform 0.5s ease 0.2s;
    pointer-events: none;
}

.packet.torn .polaroid {
    opacity: 1;
    transform: scale(1) rotate(var(--rotation, -2deg));
    pointer-events: auto;
}

.polaroid-image {
    border-radius: 2px;
    overflow: hidden;
    background: #e0e0e0;
    aspect-ratio: 1 / 1;
}

.polaroid-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.polaroid-caption {
    padding: 12px 4px 16px;
    text-align: center;
    font-family: 'Caveat', cursive;
    font-size: 20px;
    color: #2a2a2a;
    line-height: 1.2;
    flex-shrink: 0;
}

/* Polaroid swipe animation */
.polaroid.swiping-left {
    transition: transform 0.35s ease, opacity 0.35s ease;
    opacity: 0;
    transform: translateX(-120vw) rotate(-15deg) !important;
}

.polaroid.swiping-right {
    transition: transform 0.35s ease, opacity 0.35s ease;
    opacity: 0;
    transform: translateX(120vw) rotate(15deg) !important;
}

/* Tap hint */
.tap-hint {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, 80px);
    color: rgba(0, 0, 0, 1);
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 10;
}

.tap-hint.visible {
    opacity: 1;
    animation: tapPulse 1.5s ease-in-out infinite;
}

@keyframes tapPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Counter */
.cards-counter {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.dot-indicator {
    font-size: 8px;
    color: rgba(255,255,255,0.25);
    transition: color 0.3s ease;
}

.dot-indicator.active {
    color: rgba(255,255,255,0.8);
}

/* Swipe hint */
.swipe-hint {
    position: fixed;
    bottom: 52px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.35);
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.5s ease;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    pointer-events: none;
}

.swipe-hint.visible {
    opacity: 1;
    animation: hintSlide 1.5s ease-in-out infinite;
}

@keyframes hintSlide {
    0%, 100% { transform: translateX(-50%) scaleX(1); }
    25% { transform: translateX(calc(-50% - 8px)) scaleX(1.03); }
    75% { transform: translateX(calc(-50% + 8px)) scaleX(1.03); }
}

/* ===== SCREEN 3: FINAL ===== */
#final-screen {
    background: #0a0a0f;
    justify-content: center;
    align-items: center;
}

.final-content {
    text-align: center;
    padding: 24px;
}

.final-line {
    font-size: 28px;
    font-weight: 300;
    color: #f5f5f5;
    margin-bottom: 12px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    letter-spacing: 0.5px;
}

.final-line.visible {
    opacity: 1;
    transform: translateY(0);
}

.final-signature {
    font-size: 18px;
    color: rgba(255,255,255,0.4);
    margin-top: 32px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.final-signature.visible {
    opacity: 1;
    transform: translateY(0);
}

.final-footnote {
    font-size: 12px;
    color: rgba(255,255,255,0.2);
    margin-top: 24px;
    font-style: italic;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.final-footnote.visible {
    opacity: 1;
}

/* Final screen button */
.final-button-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 24px;
    padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px));
    display: flex;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
    z-index: 10;
}

.final-button-container.visible {
    opacity: 1;
    pointer-events: auto;
}

#final-button {
    background: rgba(255,255,255,0.1);
    color: #f5f5f5;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 14px 32px;
    border-radius: 24px;
    font-size: 16px;
    font-family: inherit;
    cursor: pointer;
    animation: buttonPulse 2s ease-in-out infinite;
    transition: background 0.2s ease;
}

#final-button:active {
    background: rgba(255,255,255,0.2);
}

/* ===== SCREEN 4a: PILLOW ===== */
#pillow-screen {
    background: #0a0a0f;
    justify-content: center;
    align-items: center;
}

.pillow-content {
    text-align: center;
    padding: 24px;
}

.pillow-icon {
    font-size: 64px;
    margin-bottom: 32px;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.pillow-icon.visible {
    opacity: 1;
    transform: scale(1);
}

.pillow-text {
    font-size: 24px;
    font-weight: 300;
    color: #f5f5f5;
    margin-bottom: 12px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.pillow-text.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== SCREEN 4b: DATE PICKER ===== */
#date-screen {
    background: #0d1117;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.date-content {
    padding: 24px 16px;
    width: 100%;
    max-width: 400px;
}

.date-title {
    font-size: 22px;
    font-weight: 300;
    color: #f5f5f5;
    text-align: center;
    margin-bottom: 8px;
    line-height: 1.4;
}

.date-location {
    display: block;
    font-size: 13px;
    color: rgba(255,255,255,0.45);
    text-align: center;
    text-decoration: none;
    margin-bottom: 28px;
}

.date-location:active {
    color: rgba(255,255,255,0.7);
}

.date-subtitle {
    font-size: 14px;
    color: rgba(255,255,255,0.4);
    text-align: center;
    margin-bottom: 20px;
}

/* Date cards */
.date-picker {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.date-picker::-webkit-scrollbar {
    display: none;
}

.date-card {
    flex-shrink: 0;
    width: 72px;
    padding: 14px 8px;
    border-radius: 16px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.date-card:active {
    transform: scale(0.95);
}

.date-card.selected {
    background: #c4a47a;
    border-color: #c4a47a;
}

.date-card-day {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.date-card.selected .date-card-day {
    color: rgba(61, 46, 26, 0.7);
}

.date-card-num {
    font-size: 24px;
    font-weight: 600;
    color: #f5f5f5;
    margin-bottom: 4px;
}

.date-card.selected .date-card-num {
    color: #3d2e1a;
}

.date-card-month {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}

.date-card.selected .date-card-month {
    color: rgba(61, 46, 26, 0.6);
}

/* Time picker */
.time-subtitle {
    font-size: 14px;
    color: rgba(255,255,255,0.4);
    text-align: center;
    margin-bottom: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.time-subtitle.visible {
    opacity: 1;
}

.time-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 24px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.time-picker.visible {
    opacity: 1;
}

.time-slot {
    padding: 10px 4px;
    border-radius: 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #f5f5f5;
    font-size: 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.time-slot:active {
    transform: scale(0.95);
}

.time-slot.selected {
    background: #c4a47a;
    border-color: #c4a47a;
    color: #3d2e1a;
}

/* Confirm button */
.confirm-button {
    display: block;
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    background: #c4a47a;
    color: #3d2e1a;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
    opacity: 0.4;
}

.confirm-button:disabled {
    opacity: 0.4;
    cursor: default;
}

.confirm-button:not(:disabled) {
    opacity: 1;
}

.confirm-button:not(:disabled):active {
    transform: scale(0.98);
}

/* ===== SCREEN 5: TICKET ===== */
#ticket-screen {
    background: #0d1117;
    justify-content: center;
    align-items: center;
    padding: 24px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.ticket {
    width: 100%;
    max-width: 360px;
    background: #1a1a2e;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.ticket.visible {
    opacity: 1;
    transform: translateY(0);
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #c4a47a, #b89868);
}

.ticket-airline {
    font-size: 11px;
    font-weight: 700;
    color: #3d2e1a;
    letter-spacing: 1px;
}

.ticket-class {
    font-size: 10px;
    font-weight: 600;
    color: rgba(61, 46, 26, 0.6);
    letter-spacing: 1px;
}

.ticket-route {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 20px;
}

.ticket-from,
.ticket-to {
    text-align: center;
}

.ticket-code {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: #f5f5f5;
    letter-spacing: 2px;
}

.ticket-city {
    display: block;
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    margin-top: 4px;
}

.ticket-plane {
    opacity: 0.6;
}

.ticket-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 0 20px 20px;
}

.ticket-detail {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
    width: 100%;
}

.ticket-label {
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    letter-spacing: 1px;
    font-weight: 600;
}

.ticket-value {
    font-size: 16px;
    color: #f5f5f5;
    font-weight: 500;
}

.ticket-address {
    padding: 12px 20px;
    border-top: 1px dashed rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
    text-align: center;
}

.ticket-address span {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}

.ticket-photos {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
    border-top: 1px dashed rgba(255,255,255,0.1);
}

.ticket-photos img {
    flex: 1;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    min-width: 0;
    transition: opacity 0.15s ease;
}

.ticket-photos img[style*="cursor: pointer"]:active {
    opacity: 0.7;
}

/* Photo lightbox */
#photo-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

#photo-lightbox.visible {
    opacity: 1;
    pointer-events: all;
}

#photo-lightbox-img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    transform: scale(0.95);
    transition: transform 0.25s ease, opacity 0.15s ease;
}

#photo-lightbox.visible #photo-lightbox-img {
    transform: scale(1);
}

.ticket-barcode {
    padding: 16px 20px;
    border-top: 1px dashed rgba(255,255,255,0.1);
    text-align: center;
}

.barcode-lines {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-bottom: 8px;
    height: 40px;
    align-items: end;
}

.barcode-lines span {
    display: block;
    width: 2px;
    background: rgba(255,255,255,0.3);
    border-radius: 1px;
}

.ticket-barcode > span {
    font-size: 9px;
    color: rgba(255,255,255,0.25);
    letter-spacing: 2px;
}

/* Ticket actions */
.ticket-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
    width: 100%;
    max-width: 360px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease 0.3s, transform 0.5s ease 0.3s;
}

.ticket-actions.visible {
    opacity: 1;
    transform: translateY(0);
}

.ticket-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: #f5f5f5;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease;
}

.ticket-action-btn:active {
    background: rgba(255,255,255,0.15);
}

/* ===== RETURN SHEET (bottom sheet) ===== */
.return-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1e2c3a;
    border-radius: 20px 20px 0 0;
    padding: 12px 20px 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    z-index: 100;
    transform: translateY(100%);
    transition: transform 0.7s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -4px 32px rgba(0,0,0,0.5);
}

.return-sheet.visible {
    transform: translateY(0);
}

.return-sheet-handle {
    width: 36px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin: 0 auto 16px;
}

.return-sheet-info {
    font-size: 16px;
    color: #6ab3f3;
    text-align: center;
    margin-bottom: 16px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.return-sheet-actions {
    display: flex;
    gap: 12px;
}

.return-sheet-btn {
    flex: 1;
    padding: 14px;
    border-radius: 14px;
    background: rgba(106, 179, 243, 0.1);
    border: 1px solid rgba(106, 179, 243, 0.22);
    color: #f5f5f5;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}

.return-sheet-btn:active {
    background: rgba(106, 179, 243, 0.25);
}

/* ===== SCREEN 6: GALLERY (Instagram style) ===== */
#gallery-screen {
    background: #fafafa;
    color: #262626;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    align-items: stretch;
}

.ig-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 12px);
    border-bottom: 1px solid #dbdbdb;
    background: #fafafa;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}

.ig-back {
    font-size: 22px;
    background: none;
    border: none;
    color: #262626;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    font-family: inherit;
}

.ig-username {
    font-size: 16px;
    font-weight: 600;
    color: #262626;
}

.ig-more {
    font-size: 20px;
    color: #262626;
    min-width: 24px;
    text-align: right;
}

.ig-profile {
    display: flex;
    align-items: center;
    padding: 20px 16px 12px;
    gap: 24px;
    flex-shrink: 0;
}

.ig-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 3px solid transparent;
    background: linear-gradient(#fafafa, #fafafa) padding-box,
                linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888) border-box;
}

.ig-stats {
    display: flex;
    flex: 1;
    justify-content: space-around;
}

.ig-stats > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.ig-stats strong {
    font-size: 16px;
    font-weight: 700;
    color: #262626;
}

.ig-stats span {
    font-size: 12px;
    color: #262626;
}

.ig-bio {
    padding: 0 16px 12px;
    flex-shrink: 0;
}

.ig-bio strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #262626;
    margin-bottom: 4px;
}

.ig-bio p {
    font-size: 14px;
    color: #262626;
    line-height: 1.4;
}

.ig-actions {
    display: flex;
    gap: 8px;
    padding: 0 16px 16px;
    flex-shrink: 0;
}

.ig-btn {
    flex: 1;
    padding: 7px 0;
    border-radius: 8px;
    background: #efefef;
    border: 1px solid #dbdbdb;
    color: #262626;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: default;
    opacity: 0.6;
}

.ig-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
}

.ig-tile {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

.ig-tile:active {
    opacity: 0.85;
}

/* Highlights */
.ig-highlights {
    display: flex;
    gap: 16px;
    padding: 12px 16px 16px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid #dbdbdb;
}

.ig-highlights::-webkit-scrollbar {
    display: none;
}

.ig-highlight {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    cursor: default;
}

.ig-highlight-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    padding: 2px;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
}

.ig-highlight-flag {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #fafafa;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}

.ig-highlight span {
    font-size: 11px;
    color: #262626;
    text-align: center;
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
