* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    background: #f8f8f8;
    color: #333;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
}

.page.hidden {
    display: none;
}

/* ===== GALACTIC HEADER ===== */
.galactic-header {
    position: relative;
    background: linear-gradient(90deg, 
        #0a0015 0%, 
        #1a0042 15%, 
        #2d0a5c 25%, 
        #00355f 40%, 
        #004e92 50%, 
        #1a0066 60%, 
        #2d0a5c 75%, 
        #1a0042 85%, 
        #0a0015 100%);
    background-size: 200% 100%;
    animation: galaxyShift 15s ease-in-out infinite, galacticGlow 4s ease-in-out infinite;
    padding: 8px 20px;
    color: white;
    text-align: center;
    overflow: hidden;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    gap: 20px;
    box-shadow: 0 0 30px rgba(0, 102, 204, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border-bottom: 2px solid rgba(0, 200, 255, 0.2);
}

@keyframes galaxyShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes galacticGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 102, 204, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05); }
    50% { box-shadow: 0 0 40px rgba(0, 200, 255, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.15); }
}

.galaxy-animation {
    position: absolute;
    inset: 0;
    opacity: 0.7;
}

.star {
    position: absolute;
    width: 3px;
    height: 3px;
    background: white;
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

.star-1 { top: 20%; left: 10%; animation-delay: 0s; }
.star-2 { top: 40%; right: 15%; animation-delay: 1s; }
.star-3 { top: 60%; left: 20%; animation-delay: 2s; }
.star-4 { top: 30%; right: 25%; animation-delay: 3s; }
.star-5 { top: 70%; left: 50%; animation-delay: 1.5s; }
.star-6 { top: 15%; left: 30%; animation-delay: 0.5s; }
.star-7 { top: 50%; right: 40%; animation-delay: 2.5s; }
.star-8 { top: 25%; right: 10%; animation-delay: 1.2s; }
.star-9 { top: 75%; right: 35%; animation-delay: 3.5s; }
.star-10 { top: 10%; left: 60%; animation-delay: 0.8s; }
.star-11 { top: 55%; left: 15%; animation-delay: 2.2s; }
.star-12 { top: 35%; left: 75%; animation-delay: 1.8s; }
.star-13 { top: 65%; right: 60%; animation-delay: 2.8s; }
.star-14 { top: 45%; right: 5%; animation-delay: 0.3s; }
.star-15 { top: 80%; left: 70%; animation-delay: 3.2s; }
.star-16 { top: 22%; left: 45%; animation-delay: 0.7s; }
.star-17 { top: 38%; left: 5%; animation-delay: 1.4s; }
.star-18 { top: 52%; left: 85%; animation-delay: 2.1s; }
.star-19 { top: 18%; right: 50%; animation-delay: 1.6s; }
.star-20 { top: 42%; right: 55%; animation-delay: 2.4s; }
.star-21 { top: 68%; left: 35%; animation-delay: 0.9s; }
.star-22 { top: 12%; right: 70%; animation-delay: 3.1s; }
.star-23 { top: 58%; right: 20%; animation-delay: 1.1s; }
.star-24 { top: 32%; left: 55%; animation-delay: 2.7s; }
.star-25 { top: 72%; right: 45%; animation-delay: 0.4s; }
.star-26 { top: 48%; left: 25%; animation-delay: 1.9s; }
.star-27 { top: 28%; right: 80%; animation-delay: 2.6s; }
.star-28 { top: 62%; left: 8%; animation-delay: 1.3s; }
.star-29 { top: 85%; right: 25%; animation-delay: 0.6s; }
.star-30 { top: 5%; left: 50%; animation-delay: 3.3s; }
.star-31 { top: 15%; left: 12%; animation-delay: 0.2s; }
.star-32 { top: 35%; right: 8%; animation-delay: 1.3s; }
.star-33 { top: 65%; left: 28%; animation-delay: 2.9s; }
.star-34 { top: 25%; right: 45%; animation-delay: 0.6s; }
.star-35 { top: 55%; right: 12%; animation-delay: 2.3s; }
.star-36 { top: 10%; right: 30%; animation-delay: 1.7s; }
.star-37 { top: 50%; left: 8%; animation-delay: 0.4s; }
.star-38 { top: 70%; right: 50%; animation-delay: 3.4s; }
.star-39 { top: 20%; left: 75%; animation-delay: 1.9s; }
.star-40 { top: 60%; left: 60%; animation-delay: 2.6s; }
.star-41 { top: 12%; left: 88%; animation-delay: 0.5s; }
.star-42 { top: 40%; left: 42%; animation-delay: 1.5s; }
.star-43 { top: 75%; left: 5%; animation-delay: 3.1s; }
.star-44 { top: 30%; left: 18%; animation-delay: 0.9s; }
.star-45 { top: 52%; right: 35%; animation-delay: 2.1s; }
.star-46 { top: 8%; right: 60%; animation-delay: 1.2s; }
.star-47 { top: 45%; left: 92%; animation-delay: 2.8s; }
.star-48 { top: 68%; right: 18%; animation-delay: 0.7s; }
.star-49 { top: 18%; right: 88%; animation-delay: 3.2s; }
.star-50 { top: 42%; right: 8%; animation-delay: 1.4s; }
.star-51 { top: 62%; left: 42%; animation-delay: 2.4s; }
.star-52 { top: 14%; left: 55%; animation-delay: 0.8s; }
.star-53 { top: 38%; left: 8%; animation-delay: 1.8s; }
.star-54 { top: 72%; right: 60%; animation-delay: 2.7s; }
.star-55 { top: 22%; right: 20%; animation-delay: 1.1s; }
.star-56 { top: 48%; left: 35%; animation-delay: 3.0s; }
.star-57 { top: 16%; left: 42%; animation-delay: 0.3s; }
.star-58 { top: 58%; right: 45%; animation-delay: 1.6s; }
.star-59 { top: 32%; right: 72%; animation-delay: 2.2s; }
.star-60 { top: 66%; left: 15%; animation-delay: 0.9s; }
.star-61 { top: 11%; right: 15%; animation-delay: 3.3s; }
.star-62 { top: 44%; left: 72%; animation-delay: 1.3s; }
.star-63 { top: 76%; left: 62%; animation-delay: 2.5s; }
.star-64 { top: 24%; left: 5%; animation-delay: 0.7s; }
.star-65 { top: 54%; left: 88%; animation-delay: 1.9s; }
.star-66 { top: 9%; left: 28%; animation-delay: 2.8s; }
.star-67 { top: 46%; right: 55%; animation-delay: 1.0s; }
.star-68 { top: 64%; right: 8%; animation-delay: 3.1s; }
.star-69 { top: 19%; left: 65%; animation-delay: 1.5s; }
.star-70 { top: 50%; right: 75%; animation-delay: 2.4s; }
.star-71 { top: 13%; right: 42%; animation-delay: 0.6s; }
.star-72 { top: 36%; left: 55%; animation-delay: 2.0s; }
.star-73 { top: 70%; left: 48%; animation-delay: 1.2s; }
.star-74 { top: 27%; right: 65%; animation-delay: 2.9s; }
.star-75 { top: 58%; left: 25%; animation-delay: 0.4s; }

@keyframes float {
    0%, 100% { transform: translateY(0px) translateX(0px); opacity: 0.7; }
    50% { transform: translateY(-20px) translateX(10px); opacity: 1; }
}

.galaxy-title {
    position: relative;
    z-index: 10;
    font-size: 26px;
    font-weight: 800;
    text-shadow: 0 0 20px rgba(0, 200, 255, 0.8), 0 0 40px rgba(100, 150, 255, 0.4);
    letter-spacing: 3px;
    animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 20px rgba(0, 200, 255, 0.6), 0 0 30px rgba(100, 150, 255, 0.3); }
    50% { text-shadow: 0 0 30px rgba(0, 255, 255, 1), 0 0 50px rgba(100, 150, 255, 0.6); }
}

#page-chat .galactic-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    position: relative;
    padding: 6px 12px;
    min-height: 40px;
}

#page-location .galactic-header {
    width: 100%;
    margin: 0;
    padding: 16px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, 
        #0a0015 0%, 
        #1a0042 15%, 
        #2d0a5c 25%, 
        #00355f 40%, 
        #004e92 50%, 
        #1a0066 60%, 
        #2d0a5c 75%, 
        #1a0042 85%, 
        #0a0015 100%);
    background-size: 200% 100%;
    animation: galaxyShift 15s ease-in-out infinite, galacticGlow 4s ease-in-out infinite;
}

#page-location .galaxy-title {
    font-size: 36px;
    letter-spacing: 4px;
    font-weight: 900;
}

#page-chat .galactic-header h1 {
    position: relative;
    z-index: 10;
    font-size: 18px;
    text-align: center;
    flex: 1;
    margin: 0;
}

.back-btn-circle {
    position: relative;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 0;
}

.back-btn-circle:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

/* ===== PAGE 1: LOCATION ===== */
#page-location {
    background: linear-gradient(135deg, #f5f7fa 0%, #f0f4f8 100%);
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.location-content {
    width: 100%;
    max-width: 500px;
    margin: 16px auto;
    padding: 0 12px;
    flex-shrink: 0;
}

.input-section {
    margin-bottom: 20px;
}

.input-section label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.input-section input {
    width: 100%;
    padding: 14px;
    border: 1px solid #d0d0d0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.2s;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.input-section input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.optional {
    font-size: 12px;
    color: #999;
    font-weight: 400;
}

.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 12px;
}

.btn-detect {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.btn-detect:active {
    background: #e8e8e8;
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, #0066cc 0%, #00ccff 100%);
    color: white;
    font-weight: 700;
}

.btn-primary:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.status-message {
    font-size: 14px;
    padding: 12px;
    border-radius: 6px;
    margin-top: 12px;
    display: none;
}

.status-message.show {
    display: block;
}

.status-message.success {
    background: #d1fae5;
    color: #065f46;
}

.status-message.error {
    background: #fee2e2;
    color: #991b1b;
}

.status-message.info {
    background: #dbeafe;
    color: #0c2d6b;
}

/* ===== PAGE 2: CHAT ===== */
.chat-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: #f8f8f8;
    display: flex;
    flex-direction: column;
    padding: 0 0 80px 0;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 16px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* Chat Messages */
.chat-message {
    display: flex;
    margin-bottom: 12px;
    animation: slideIn 0.3s ease;
}

.chat-message.user {
    justify-content: flex-end;
    margin-right: 0;
}

.chat-message.assistant {
    justify-content: flex-start;
    margin-left: 0;
    padding-left: 8px;
}

.message-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
}

.chat-message.user .message-wrapper {
    align-items: flex-end;
}

.ai-avatar,
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.ai-avatar {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    border: 2px solid #a5b4fc;
}

.user-avatar {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border: 2px solid #1e40af;
}

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

.chat-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
    font-size: 15px;
    line-height: 1.6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: normal;
}

.chat-bubble strong {
    font-weight: 600;
    color: inherit;
}

/* User Message */
.chat-message.user .chat-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%);
    background-size: 200% 200%;
    color: white;
    border-bottom-right-radius: 4px;
    animation: gradientShift 5s ease infinite;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* AI Message */
.chat-message.assistant .chat-bubble {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #1f2937;
    border-bottom-left-radius: 4px;
    border: 1px solid #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chat-message.error .chat-bubble {
    background: #fee2e2;
    color: #991b1b;
}

/* Loading Bubble */
.loading-bubble {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 36px 20px;
    min-height: 160px;
    background: linear-gradient(135deg, #f8f9fc 0%, #f0f4f9 100%);
    border-radius: 16px;
    border: 1px solid #e5e7eb;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.loading-title {
    font-size: 17px;
    color: #1f2937;
    margin: 0;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-align: center;
    white-space: nowrap;
}

.premium-loader {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    height: 50px;
}

.loader-bar {
    width: 8px;
    height: 20px;
    border-radius: 4px;
    background: linear-gradient(to top, #ff6b6b, #ff9c6e, #ffd666);
    background-size: 100% 200%;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    transform-origin: bottom;
    animation: barWave 1.2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

.loader-bar-1 {
    animation-delay: 0s;
    background: linear-gradient(to top, #ff6b6b, #ff9c6e);
}

.loader-bar-2 {
    animation-delay: 0.1s;
    background: linear-gradient(to top, #ff9c6e, #ffd666);
}

.loader-bar-3 {
    animation-delay: 0.2s;
    background: linear-gradient(to top, #ffd666, #95de64);
}

.loader-bar-4 {
    animation-delay: 0.1s;
    background: linear-gradient(to top, #95de64, #52c41a);
}

.loader-bar-5 {
    animation-delay: 0s;
    background: linear-gradient(to top, #52c41a, #ff6b6b);
}

@keyframes barWave {
    0% {
        height: 20px;
        opacity: 0.6;
    }
    50% {
        height: 40px;
        opacity: 1;
    }
    100% {
        height: 20px;
        opacity: 0.6;
    }
}

.chat-message.hidden {
    display: none;
}

/* ===== FRESH INPUT AREA (REBUILT FROM SCRATCH) ===== */
#inputSection {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 70px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 16px;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
    z-index: 100;
}

.fresh-input-box {
    flex: 1;
    height: 44px;
    padding: 10px 16px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 15px;
    background: #f5f5f5;
    color: #333;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.fresh-input-box:focus {
    background: white;
    border-color: #a0a0a0;
    box-shadow: 0 0 0 2px rgba(168, 139, 250, 0.1);
}

.fresh-input-box::placeholder {
    color: #999;
}

.fresh-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #a78bfa 0%, #c084fc 50%, #e879f9 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(168, 139, 250, 0.4);
    flex-shrink: 0;
}

.fresh-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 18px rgba(232, 121, 249, 0.6);
}

.fresh-send-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(168, 139, 250, 0.3);
}

.fresh-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: scale(1);
}

/* ===== MOBILE OPTIMIZATION ===== */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    .galactic-header {
        min-height: 40px;
        padding: 6px 12px;
    }

    .galaxy-title {
        font-size: 18px;
    }

    #page-location {
        padding: 12px;
    }

    .location-content {
        margin: 12px auto;
        max-width: 100%;
        padding: 0 8px;
    }

    .input-section input {
        padding: 12px;
        font-size: 16px;
        border-radius: 10px;
    }

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

    .chat-container {
        padding: 12px 8px;
        gap: 12px;
    }

    .chat-bubble {
        max-width: 90%;
        padding: 10px 14px;
        font-size: 14px;
    }

    .chat-container {
        padding: 12px 8px;
        gap: 12px;
    }

    .chat-bubble {
        max-width: 90%;
        padding: 10px 14px;
        font-size: 14px;
    }

    .ai-avatar,
    .user-avatar {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }

    .back-btn-circle {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }

    /* Fresh input area responsive */
    #inputSection {
        height: 60px;
        padding: 0 12px;
        gap: 8px;
    }

    .fresh-input-box {
        height: 40px;
        padding: 8px 12px;
        font-size: 14px;
    }

    .fresh-send-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* Scrollbar styling */
.chat-container::-webkit-scrollbar {
    width: 4px;
}

.chat-container::-webkit-scrollbar-track {
    background: transparent;
}

.chat-container::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, #4f46e5 0%, #10b981 100%);
    color: white;
    padding: 3rem 1rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 500;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ===== SECTIONS ===== */
section {
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.section-header h2 {
    margin-bottom: 0;
}

/* ===== INPUT SECTION ===== */
.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.optional {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    background-color: #f1f5f9;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.input-group input {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition);
    background-color: #f8fafc;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-group small {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ===== BUTTONS ===== */
.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    justify-content: center;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
    width: auto;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    width: 100%;
}

.btn-primary:hover {
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-detect {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #d0d0d0;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.btn-detect:hover {
    background: #eee;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.btn-detect:active {
    background: #e8e8e8;
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    flex-shrink: 0;
}

/* ===== STATUS & ERROR MESSAGES ===== */
.status-message {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-top: 1rem;
    display: none;
    animation: slideIn 0.3s ease;
}

.status-message.show {
    display: block;
}

.status-message.success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.status-message.error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.status-message.info {
    background-color: #dbeafe;
    color: #0c2d6b;
    border: 1px solid #bfdbfe;
}

.error-message {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 1rem;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--error-color);
    margin-top: 1rem;
    display: none;
    animation: slideIn 0.3s ease;
}

.error-message.show {
    display: block;
}

/* ===== LOADING SPINNER ===== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 1rem;
}

.loading.hidden {
    display: none;
}

/* ===== RESULTS CONTAINER ===== */
.result-container {
    animation: slideIn 0.4s ease;
}

.result-container.hidden {
    display: none;
}

.intro-text {
    font-size: 1.1rem;
    line-height: 1.8;
    padding: 1.5rem;
    background-color: #f0f9ff;
    border-left: 4px solid var(--primary-color);
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    color: #0c2d6b;
    font-style: italic;
}

/* ===== OBJECTS GRID ===== */
.objects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.object-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition);
    cursor: pointer;
}

.object-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.object-card h3 {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.object-card .info-grid {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.info-value {
    color: var(--text-primary);
    font-weight: 600;
}

.object-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    background-color: rgba(79, 70, 229, 0.05);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-top: 1rem;
}

.card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
    opacity: 0.7;
    transition: var(--transition);
}

.object-card:hover .card-footer {
    opacity: 1;
    color: #4338ca;
}

.stats {
    background-color: #f0f9ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    color: #0c2d6b;
    font-weight: 500;
}

/* ===== CHAT SECTION ===== */
.chat-container {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    height: 400px;
    overflow-y: auto;
    padding: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
}

.chat-welcome p {
    margin-bottom: 1rem;
}

.chat-message {
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease;
}

.chat-message.user {
    text-align: right;
}

.chat-bubble {
    display: inline-block;
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    word-wrap: break-word;
}

.chat-message.user .chat-bubble {
    background-color: var(--primary-color);
    color: white;
    border-bottom-right-radius: var(--radius-sm);
}

.chat-message.assistant .chat-bubble {
    background-color: #e2e8f0;
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-sm);
}

.chat-timestamp {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.chat-input-area {
    display: flex;
    gap: 1rem;
}

/* ===== CONFIG SECTION ===== */
.config-section {
    background-color: #f8fafc;
}

details {
    cursor: pointer;
}

summary {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 1rem;
    cursor: pointer;
    user-select: none;
    color: var(--primary-color);
}

summary:hover {
    background-color: #f1f5f9;
    border-radius: var(--radius-md);
}

.config-content {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    margin-top: 1rem;
}

/* ===== FOOTER ===== */
.footer {
    background-color: var(--text-primary);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
}

.footer p {
    margin-bottom: 0.5rem;
}

.footer a {
    color: var(--secondary-color);
}

.footer a:hover {
    color: #059669;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .input-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .section-header .btn {
        width: 100%;
    }

    .objects-grid {
        grid-template-columns: 1fr;
    }

    .object-card .info-grid {
        grid-template-columns: 1fr;
    }

    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .chat-bubble {
        max-width: 90%;
    }

    .chat-input-area {
        flex-direction: column;
    }

    .chat-input-area .btn {
        width: 100%;
    }

    section {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 0.95rem;
    }

    section {
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    .objects-grid {
        gap: 1rem;
    }

    .object-card {
        padding: 1rem;
    }

    .intro-text {
        font-size: 1rem;
        padding: 1rem;
    }
}

/* ===== MODAL RESPONSIVE ===== */
@media (max-width: 768px) {
    .modal-content {
        max-width: 90vw;
        max-height: 95vh;
    }

    .position-grid {
        grid-template-columns: 1fr;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        flex: 1;
        width: 100%;
    }
}

/* ===== MODAL ===== */
.modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none !important;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    z-index: 1001;
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, #f0f9ff 0%, #f1f5f9 100%);
}

.modal-header h2 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.8rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--primary-color);
    transform: scale(1.2);
}

.star-detail-content {
    padding: 1.5rem;
    animation: slideIn 0.3s ease 0.1s both;
}

.star-detail-content.hidden {
    display: none;
}

.detail-section {
    margin-bottom: 2rem;
}

.detail-section h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Position Grid */
.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.position-item {
    background: linear-gradient(135deg, #f0f9ff 0%, #f1f5f9 100%);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    transition: var(--transition);
}

.position-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.position-item .label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.position-item .value {
    display: block;
    font-size: 1.6rem;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.position-item .unit {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Direction Text */
.direction-text {
    background-color: #f0f9ff;
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    border-radius: var(--radius-md);
    color: #0c2d6b;
    line-height: 1.8;
    font-size: 1.05rem;
}

/* Details List */
.details-list {
    display: grid;
    gap: 1rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.detail-item .label {
    font-weight: 600;
    color: var(--text-secondary);
}

.detail-item .value {
    color: var(--primary-color);
    font-weight: 700;
}

/* Description Text */
.description-text {
    background-color: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 1rem;
    border-radius: var(--radius-md);
    color: #78350f;
    line-height: 1.8;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.modal-actions .btn {
    flex: 1;
    justify-content: center;
    min-width: 140px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* ===== UTILITIES ===== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

/* ===== UTILITIES ===== */
.hidden {
    display: none !important;
}

/* ===== PAGE 2 CHAT HARD OVERRIDES ===== */
#page-chat .chat-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    background: #f8f8f8;
    padding: 0 0 84px 0;
}

#page-chat .chat-container {
    flex: 1;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 16px 10px 10px;
    border: none;
    border-radius: 0;
    background: transparent;
    height: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#page-chat .chat-message {
    display: flex;
    margin-bottom: 0;
}

#page-chat .chat-message.user {
    justify-content: flex-end;
    text-align: left;
    margin-left: auto;
}

#page-chat .chat-message.assistant {
    justify-content: flex-start;
    padding-left: 0;
    margin-right: auto;
}

#page-chat .message-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: min(88%, 720px);
}

#page-chat .chat-message.user .message-wrapper {
    flex-direction: row-reverse;
}

#page-chat .chat-bubble {
    display: block;
    width: auto;
    max-width: 100%;
    min-width: fit-content;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: normal;
    overflow-wrap: anywhere;
}

#page-chat .chat-message.user .chat-bubble,
#page-chat .chat-message.assistant .chat-bubble,
#page-chat .chat-message.error .chat-bubble {
    max-width: min(75vw, 640px);
}

#page-chat .loading-bubble {
    min-height: 90px;
    padding: 18px 16px;
}

@media (max-width: 480px) {
    #page-chat .chat-wrapper {
        padding-bottom: 70px;
    }

    #page-chat .chat-container {
        padding: 12px 8px 8px;
        gap: 10px;
    }

    #page-chat .message-wrapper {
        max-width: 94%;
        gap: 6px;
    }

    #page-chat .chat-bubble {
        max-width: 100%;
        padding: 10px 12px;
        font-size: 14px;
        line-height: 1.4;
    }

    #page-chat .loading-bubble {
        min-height: 78px;
        padding: 14px 12px;
    }
}

#page-chat .inline-thinking {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

#page-chat .inline-thinking-label {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
}

#page-chat .inline-loader {
    display: inline-flex;
    align-items: flex-end;
    gap: 4px;
    height: 16px;
}

#page-chat .inline-loader-bar {
    width: 3px;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(180deg, #06b6d4 0%, #8b5cf6 50%, #ec4899 100%);
    box-shadow: 0 0 6px rgba(139, 92, 246, 0.35);
    animation: inlinePulse 0.9s ease-in-out infinite;
}

#page-chat .inline-loader-bar:nth-child(2) {
    animation-delay: 0.12s;
}

#page-chat .inline-loader-bar:nth-child(3) {
    animation-delay: 0.24s;
}

#page-chat .inline-loader-bar:nth-child(4) {
    animation-delay: 0.36s;
}

@keyframes inlinePulse {
    0%,
    100% {
        transform: scaleY(0.6);
        opacity: 0.65;
    }
    50% {
        transform: scaleY(1.2);
        opacity: 1;
    }
}
