:root {
    --primary: #0A192F;
    --accent: #D4AF37;
    --accent-glow: rgba(212, 175, 55, 0.4);
    --text-main: #333333;
    --text-light: #666666;
    --bg-main: #F8F9FA;
    --white: #FFFFFF;
    --border: #EAEAEA;
    --radius-lg: 24px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --safe-area-bottom: env(safe-area-inset-bottom, 20px);
}

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

body, html {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100%;
    width: 100%;
    overflow: hidden;
    overscroll-behavior-y: none;
}

#app {
    height: 100dvh;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease;
    background-color: var(--bg-main);
}

#promo-view {
    z-index: 1;
    transform: translateX(0);
}

#promo-view.hidden-left {
    transform: translateX(-30%);
    opacity: 0;
    pointer-events: none;
}

#webapp-view {
    z-index: 2;
    transform: translateX(100%);
    box-shadow: -10px 0 30px rgba(0,0,0,0.1);
}

#webapp-view.active {
    transform: translateX(0);
}

/* --- Hero Screen --- */
.hero-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    padding-bottom: max(20px, var(--safe-area-bottom));
    position: relative;
    z-index: 1;
    height: 100%;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.brand-name {
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--primary);
    letter-spacing: 0.5px;
}

.menu-icon {
    font-size: 1.8rem;
    color: var(--primary);
    cursor: pointer;
}

.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
}

.text-content {
    text-align: center;
    margin-bottom: 20px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(212, 175, 55, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #B89000;
    margin-bottom: 16px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #B89000;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

h1 {
    font-size: clamp(2.5rem, 8vw, 3.5rem);
    line-height: 1.1;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--primary);
}

.highlight {
    color: var(--accent);
}

.text-content p {
    font-size: 1.1rem;
    color: var(--text-light);
    line-height: 1.5;
    max-width: 90%;
    margin: 0 auto;
}

.hero-image-container {
    position: relative;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
}

.glow-bg {
    position: absolute;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
}

.hero-image {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    animation: float 6s ease-in-out infinite;
}

/* --- Action Area --- */
.action-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.btn {
    width: 100%;
    height: 56px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn:active {
    transform: scale(0.98);
}

.btn.primary {
    background-color: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(10, 25, 47, 0.2);
}

.btn.secondary {
    background-color: var(--bg-main);
    color: var(--primary);
    border: 1px solid var(--border);
}

.btn.text {
    background-color: transparent;
    color: var(--primary);
    height: 48px;
}

/* --- Bottom Sheet --- */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--white);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 100;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    flex-direction: column;
    max-height: 85dvh;
}

.bottom-sheet.active {
    transform: translateY(0);
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background-color: #E0E0E0;
    border-radius: 2px;
    margin: 16px auto;
}

.sheet-content {
    padding: 0 24px 24px 24px;
    padding-bottom: max(24px, var(--safe-area-bottom));
    overflow-y: auto;
}

.bottom-sheet h2 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    color: var(--primary);
    text-align: center;
}

.feature-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.feature-list li {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.icon-box {
    width: 48px;
    height: 48px;
    background: rgba(10, 25, 47, 0.05);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    color: var(--primary);
    flex-shrink: 0;
}

.feature-text h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--primary);
}

.feature-text p {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.4;
}

/* --- Overlay --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 25, 47, 0.4);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333333;
    color: #FFFFFF;
    padding: 14px 24px;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 500;
    z-index: 200;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* --- Animations --- */
@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(184, 144, 0, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(184, 144, 0, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(184, 144, 0, 0); }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* --- Web App Mockup --- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    z-index: 10;
    padding-top: max(16px, env(safe-area-inset-top, 20px));
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

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

.app-title h2 {
    font-size: 1.1rem;
    margin: 0;
    color: var(--primary);
}

.app-title .subtitle {
    font-size: 0.8rem;
    color: var(--text-light);
}

.user-stats {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(212, 175, 55, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.app-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #F0F4F8;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 90%;
    animation: slideUpFade 0.4s ease forwards;
}

.message.tutor {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--white);
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    object-fit: contain;
}

.avatar-placeholder {
    width: 32px;
    flex-shrink: 0;
}

.bubble {
    background: var(--white);
    padding: 12px 16px;
    border-radius: 16px;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1.4;
}

.message.user .bubble {
    background: var(--primary);
    color: var(--white);
    border-radius: 16px;
    border-top-right-radius: 4px;
}

.math-problem {
    background: #F8F9FA;
    border: 1px solid var(--border);
    padding: 10px;
    margin-top: 8px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    color: var(--primary);
    letter-spacing: 2px;
}

.app-footer {
    background: var(--white);
    padding: 16px 20px;
    padding-bottom: max(16px, var(--safe-area-bottom));
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 10;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-btn {
    background: var(--bg-main);
    border: 1px solid var(--border);
    padding: 14px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.option-btn:hover, .option-btn:active {
    border-color: var(--primary);
    background: rgba(10, 25, 47, 0.02);
}

.option-btn.correct {
    background: #E8F5E9;
    border-color: #4CAF50;
    color: #2E7D32;
}

.option-btn.incorrect {
    background: #FFEBEE;
    border-color: #F44336;
    color: #C62828;
}

.delay-1 { animation-delay: 0.5s; opacity: 0; }
.delay-2 { animation-delay: 1.5s; opacity: 0; }

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