:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #f472b6;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-color: #ffffff;
    --chat-bg: #ffffff;
    --chat-text: #1f2937;
    --bot-msg-bg: #f3f4f6;
    --user-msg-bg: #6366f1;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

svg.lucide,
i[data-lucide] {
    width: 48px !important;
    height: 48px !important;
    flex-shrink: 0;
}

body {
    background: var(--bg-gradient);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: self-start;
    margin-top: 100px;
    color: var(--text-color);
}

#app {
    width: 100%;
    max-width: 900px;
    height: 80vh;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

header {
    padding: 24px;
    border-bottom: 1px solid var(--glass-border);
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.home-btn {
    position: absolute;
    left: 40px;
    background: transparent !important;
    border: 1px solid var(--glass-border) !important;
    display: flex;
    align-items: center;
    justify-content: center;
}


.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    max-width: 90%;
    padding: 24px 32px;
    border-radius: 24px;
    font-size: 1.9rem;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease-out;
}

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

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

.message.bot {
    align-self: flex-start;
    background: var(--bot-msg-bg);
    color: var(--chat-text);
    border-bottom-left-radius: 4px;
}

.message.user {
    align-self: flex-end;
    background: var(--user-msg-bg);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.controls {
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-group {
    display: flex;
    gap: 16px;
    align-items: center;
}

.input-group .btn {
    padding: 24px 32px;
}

.input-group input {
    flex: 1;
    padding: 24px 32px;
    border-radius: 16px;
    border: none;
    outline: none;
    font-size: 2rem;
}

.btn {
    padding: 24px 48px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-size: 1.9rem;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-primary {
    background: var(--primary-color);
    color: white;

}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-icon {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    width: 88px;
    height: 88px;
}

.btn-icon i,
.btn-icon svg {
    width: 48px !important;
    height: 48px !important;
    flex-shrink: 0;
}

.btn-icon.active {
    background: var(--secondary-color);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: white;
    margin-top: 12px;
    width: 100%;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* MBTI Option Buttons */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
    width: 100%;
}

.option-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 28px;
    border-radius: 16px;
    border: none;
    font-size: 2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    color: white;
}

.option-btn i {
    width: 20px;
    height: 20px;
}

.option-btn.yes {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
}

.option-btn.no {
    background: linear-gradient(135deg, #db2777 0%, #f472b6 100%);
}

.option-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    filter: brightness(1.1);
}

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

/* Progress Bar */
.progress-container {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    width: 100%;
}

.progress-bar {
    height: 100%;
    background: var(--secondary-color);
    width: 0%;
    transition: width 0.3s ease;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 16px !important;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: bounce 1s infinite ease-in-out;
}

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

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

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

/* Result Screen */
.result-screen {
    position: absolute;
    inset: 0;
    background: var(--bg-gradient);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    z-index: 10;
    text-align: center;
    padding: 40px 24px;
    overflow-y: auto;
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.result-content {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.result-label {
    font-size: 2rem;
    opacity: 0.9;
}

.result-mbti {
    font-size: 10rem;
    font-weight: 900;
    line-height: 1;
    margin: 16px 0;
    background: linear-gradient(to bottom, #fff, #e0e7ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.2));
}

.result-title {
    font-size: 3rem;
    font-weight: 700;
}

.result-description {
    font-size: 1.9rem;
    line-height: 1.6;
    opacity: 0.9;
    padding: 0 20px;
}

.result-traits {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 12px 0;
}

.trait-tag {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.result-percentages {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.percentage-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
}

.result-actions {
    margin-top: 24px;
}

/* Menu Screen */
.menu-screen {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 24px;
    background: var(--bg-gradient);
    z-index: 5;
    animation: fadeIn 0.5s ease-out;
    overflow-y: auto;
}

.menu-content {
    width: 100%;
    text-align: center;
}

.menu-content h2 {
    font-size: 2.5rem;
    margin-bottom: 64px;
    font-weight: 600;
}

.menu-options {
    display: flex;
    flex-direction: column;
    gap: 32px;
    width: 100%;
}


.menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 30px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: white;
    font-size: 2.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.menu-btn i,
.menu-btn svg {
    width: 48px !important;
    height: 48px !important;
    flex-shrink: 0;
}

.menu-btn:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.menu-btn.mbti:hover {
    border-color: var(--primary-color);
}

.menu-btn.math:hover {
    border-color: var(--secondary-color);
}

.menu-btn.stress:hover {
    border-color: #22c55e;
}

.menu-btn.ai-chat:hover {
    border-color: #8b5cf6;
}

.menu-btn.cafe-order:hover {
    border-color: #f59e0b;
}

/* STT Microphone Button */
.mic-btn {
    transition: all 0.3s ease;
}

.mic-btn.scanning {
    background: #ef4444 !important;
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Custom Scrollbar */
.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Stress Test Styles */
.stress-options-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
    width: 100%;
}

.stress-option-btn {
    padding: 28px 36px;
    border-radius: 14px;
    border: none;
    font-size: 1.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    color: white;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.stress-option-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.3s ease;
}

.stress-option-btn:hover::before {
    left: 100%;
}

.stress-option-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.stress-option-btn:active {
    transform: translateY(-1px) scale(0.98);
}

.stress-option-btn.stress-level-0 {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.stress-option-btn.stress-level-0:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.stress-option-btn.stress-level-1 {
    background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
}

.stress-option-btn.stress-level-1:hover {
    background: linear-gradient(135deg, #ca8a04 0%, #a16207 100%);
}

.stress-option-btn.stress-level-2 {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.stress-option-btn.stress-level-2:hover {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
}

.stress-option-btn.stress-level-3 {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.stress-option-btn.stress-level-3:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

/* Traffic Light */
.traffic-light {
    display: flex;
    flex-direction: row;
    gap: 16px;
    align-items: center;
    margin: 24px 0;
    padding: 24px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.traffic-light .light {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0.3;
    transition: all 0.5s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.traffic-light .light.active {
    opacity: 1;
    box-shadow: 0 0 30px currentColor, 0 0 60px currentColor;
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.3);
    }
}

.stress-level-text {
    font-size: 2.2rem;
    font-weight: 600;
    line-height: 1.6;
    margin: 32px 0;
}

.stress-score {
    font-size: 1.9rem;
    opacity: 0.9;
    background: rgba(0, 0, 0, 0.1);
    padding: 24px;
    border-radius: 12px;
}