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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

/* Buttons/links get a fast, delay-free tap response instead of waiting
   on the browser's double-tap-to-zoom gesture detection — without this,
   taps on a mobile PWA can feel like they "don't work" the first time. */
button, a, input, select, textarea, [onclick] {
    touch-action: manipulation;
}

button {
    -webkit-tap-highlight-color: transparent;
}

#app {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
}

/* ===== HEADER ===== */
.header {
    text-align: center;
    margin-bottom: 32px;
}

.header .logo {
    font-size: 48px;
    margin-bottom: 8px;
}

.header h1 {
    font-size: 32px;
    font-weight: 800;
    color: #1e293b;
}

.header p {
    color: #64748b;
    margin-top: 8px;
    font-size: 16px;
}

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.card h2 {
    color: #1e293b;
    margin-bottom: 16px;
    font-size: 18px;
}

.card h3 {
    margin: 0 0 16px 0;
    color: #1e293b;
    font-size: 16px;
}

/* ===== LANGUAGE SELECTOR ===== */
.lang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.lang-btn {
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
    font-weight: 600;
    color: #334155;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.lang-btn:hover {
    border-color: #1d4ed8;
    background: #eff6ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29,78,216,0.15);
}

.lang-btn .flag {
    font-size: 32px;
}

/* ===== TOP BAR ===== */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.lang-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

#current-lang {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
}

.level-badge {
    padding: 4px 12px;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

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

.stat {
    font-size: 14px;
    color: #64748b;
}

/* ===== PROGRESS ===== */
.progress-card {
    padding: 16px 20px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.progress-label {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.progress-value {
    font-size: 13px;
    color: #1d4ed8;
    font-weight: 600;
}

.progress-track {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.tab-btn {
    padding: 12px 20px;
    min-height: 44px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    background: #e2e8f0;
    color: #64748b;
    transition: all 0.2s;
    font-size: 14px;
}

.tab-btn.active {
    background: #1d4ed8;
    color: white;
}

.tab-btn:hover:not(.active) {
    background: #cbd5e1;
}

.tab-btn:active:not(.active) {
    background: #cbd5e1;
}

/* ===== PANELS ===== */
.panel {
    display: none;
}

.panel.active {
    display: block;
}

/* ===== SCENARIOS ===== */
.scenario-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.scenario-btn {
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #334155;
    transition: all 0.2s;
}

.scenario-btn:hover,
.scenario-btn.active {
    border-color: #1d4ed8;
    background: #eff6ff;
    color: #1d4ed8;
}

/* ===== CHAT ===== */
.chat-card {
    min-height: 300px;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    margin-bottom: 12px;
    font-size: 15px;
    line-height: 1.5;
}

.message-bot {
    background: #f1f5f9;
    color: #1e293b;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message-bot .bot-text {
    font-weight: 600;
    margin-bottom: 4px;
}

/* ===== SPEAK BUTTON (shared: chat, flashcards, onboarding demo) ===== */
.speak-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 10px;
    margin: -8px;
    line-height: 1;
    vertical-align: middle;
    opacity: 0.75;
    transition: opacity 0.15s, transform 0.15s;
}

.speak-btn:hover {
    opacity: 1;
    transform: scale(1.15);
}

.message-bot .translation {
    font-size: 13px;
    color: #64748b;
}

.message-user {
    background: #1d4ed8;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    margin-left: auto;
}

.response-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-btn {
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    text-align: left;
    font-size: 15px;
    color: #334155;
    transition: all 0.2s;
    font-weight: 500;
    font-family: inherit;
}

.option-btn:hover {
    border-color: #1d4ed8;
    background: #eff6ff;
}

.option-btn .opt-text {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.option-btn .opt-trans {
    font-size: 13px;
    color: #64748b;
}

/* ===== FLASHCARDS ===== */
.flashcard-container {
    perspective: 1000px;
    max-width: 400px;
    margin: 0 auto;
}

.flashcard {
    width: 100%;
    height: 240px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.6s, background 0.3s;
    position: relative;
    color: white;
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(102,126,234,0.3);
    user-select: none;
}

.flashcard:hover {
    transform: scale(1.02);
}

.flashcard .card-word {
    font-size: 32px;
}

.flashcard .card-translation {
    font-size: 22px;
}

.flashcard .card-example {
    font-size: 14px;
    margin-top: 12px;
    opacity: 0.9;
}

.flashcard-speak-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 18px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.flashcard-speak-btn:hover {
    background: rgba(255,255,255,0.35);
}

.flashcard-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.btn-hard {
    padding: 10px 24px;
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-hard:hover {
    background: #fecaca;
}

.btn-easy {
    padding: 10px 24px;
    background: #dcfce7;
    color: #16a34a;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-easy:hover {
    background: #bbf7d0;
}

.card-counter {
    text-align: center;
    margin-top: 16px;
    color: #64748b;
    font-size: 14px;
}

/* ===== GRAMMAR ===== */
.grammar-question {
    font-size: 18px;
    color: #1e293b;
    margin-bottom: 20px;
    padding: 16px;
    background: #f1f5f9;
    border-radius: 12px;
}

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

.grammar-feedback {
    margin-top: 16px;
    padding: 12px;
    border-radius: 10px;
    display: none;
    font-weight: 600;
}

.grammar-feedback.correct {
    background: #dcfce7;
    color: #16a34a;
    display: block;
}

.grammar-feedback.incorrect {
    background: #fee2e2;
    color: #dc2626;
    display: block;
}

/* ===== LISTENING ===== */
.audio-player {
    text-align: center;
    padding: 40px;
}

.play-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #1d4ed8;
    color: white;
    border: none;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(29,78,216,0.3);
    margin-bottom: 20px;
    transition: all 0.2s;
}

.play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(29,78,216,0.4);
}

.play-btn:active {
    transform: scale(0.95);
}

.audio-player p {
    color: #64748b;
    margin: 0;
}

.listening-question {
    font-size: 16px;
    color: #1e293b;
    margin: 20px 0;
    text-align: center;
    font-weight: 500;
}

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

.listening-feedback {
    margin-top: 16px;
    padding: 12px;
    border-radius: 10px;
    display: none;
    font-weight: 600;
}

.listening-feedback.correct {
    background: #dcfce7;
    color: #16a34a;
    display: block;
}

.listening-feedback.incorrect {
    background: #fee2e2;
    color: #dc2626;
    display: block;
}

/* ===== SPEAKING (voice input) ===== */
.speaking-instruction {
    text-align: center;
    color: #64748b;
    font-size: 14px;
    margin-bottom: 16px;
}

.speaking-phrase-card {
    background: #f8fafc;
    border-radius: 16px;
    padding: 24px 20px;
    text-align: center;
    margin-bottom: 24px;
}

.speaking-phrase {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 6px;
}

.speaking-translation {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 14px;
}

.speaking-listen-btn {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    color: #1d4ed8;
    background: #eff6ff;
    padding: 8px 16px;
    border-radius: 20px;
    opacity: 1;
}

.speaking-listen-btn:hover {
    background: #dbeafe;
    transform: none;
}

.speaking-mic-wrap {
    text-align: center;
    padding: 8px 0 24px;
}

.speaking-mic-btn {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: #1d4ed8;
    color: white;
    border: none;
    font-size: 32px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    box-shadow: 0 6px 20px rgba(29,78,216,0.35);
}

.speaking-mic-btn:hover {
    transform: scale(1.05);
}

.speaking-mic-btn.listening {
    background: #dc2626;
    animation: micPulse 1.4s ease-out infinite;
}

@keyframes micPulse {
    0% { box-shadow: 0 0 0 0 rgba(220,38,38,0.5); }
    70% { box-shadow: 0 0 0 20px rgba(220,38,38,0); }
    100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
}

.speaking-mic-hint {
    margin-top: 14px;
    color: #64748b;
    font-size: 14px;
}

.speaking-feedback {
    margin-top: 8px;
    padding: 14px;
    border-radius: 10px;
    display: none;
    font-weight: 600;
    text-align: center;
}

.speaking-feedback.correct {
    background: #dcfce7;
    color: #16a34a;
    display: block;
}

.speaking-feedback.partial {
    background: #fef3c7;
    color: #b45309;
    display: block;
}

.speaking-feedback.incorrect {
    background: #fee2e2;
    color: #dc2626;
    display: block;
}

.speaking-tip {
    margin-top: 20px;
    background: #eff6ff;
    color: #1d4ed8;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    text-align: center;
}

/* ===== BUTTONS ===== */
.btn-primary {
    padding: 14px 32px;
    background: #1d4ed8;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #1e40af;
    transform: translateY(-1px);
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 24px;
    padding: 40px;
    max-width: 400px;
    text-align: center;
    animation: popIn 0.3s ease;
    width: 100%;
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-emoji {
    font-size: 64px;
    margin-bottom: 16px;
}

.modal-content h2 {
    color: #1e293b;
    margin: 0 0 8px 0;
    font-size: 24px;
}

.modal-content p {
    color: #64748b;
    margin-bottom: 24px;
}

.whats-new-list {
    list-style: none;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
}

.whats-new-list li {
    font-size: 14px;
    color: #334155;
    line-height: 1.5;
}

.whats-new-list li strong {
    color: #1e293b;
}

.modal-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 24px;
}

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

.modal-stat-value {
    font-size: 28px;
    font-weight: 800;
    color: #1d4ed8;
}

.modal-stat-label {
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    #app {
        padding: 16px;
    }

    .header h1 {
        font-size: 24px;
    }

    .top-bar {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .tabs {
        gap: 6px;
    }

    .tab-btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .flashcard {
        height: 200px;
        font-size: 22px;
    }

    .message-bubble {
        max-width: 90%;
        font-size: 14px;
    }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}


/* ===== AI COMPANION ===== */
.companion-message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%);
  border-radius: 16px;
  border-left: 4px solid #3b82f6;
  animation: slideIn 0.4s ease;
  transition: opacity 0.3s ease;
}

.companion-message.companion-tip {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-left-color: #f59e0b;
  margin: 12px 0;
}

@keyframes slideIn {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.companion-avatar {
  font-size: 32px;
  flex-shrink: 0;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.companion-bubble {
  flex: 1;
}

.companion-name {
  font-size: 13px;
  font-weight: 700;
  color: #1d4ed8;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.companion-tip .companion-name {
  color: #d97706;
}

.companion-text {
  font-size: 14px;
  color: #334155;
  line-height: 1.5;
}

/* ===== SCENARIO COMPLETION CELEBRATION ===== */
.celebration {
  animation: celebrate 0.6s ease;
}

@keyframes celebrate {
  0% { transform: scale(1); }
  25% { transform: scale(1.05); }
  50% { transform: scale(0.98); }
  75% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* ===== STREAK ANIMATION ===== */
@keyframes flame {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.streak-stat {
  animation: flame 1s ease infinite;
}

/* ===== XP GAIN ANIMATION ===== */
.xp-gain {
  animation: xpPop 0.5s ease;
}

@keyframes xpPop {
  0% { transform: scale(1); color: #1d4ed8; }
  50% { transform: scale(1.3); color: #fbbf24; }
  100% { transform: scale(1); color: #1d4ed8; }
}

/* ===== ACCOUNT BAR ===== */
.account-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 14px;
  color: #64748b;
  flex-wrap: wrap;
}

.account-email {
  font-weight: 600;
  color: #334155;
}

.account-link {
  background: none;
  border: none;
  color: #1d4ed8;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  padding: 0;
}

.account-link:hover {
  text-decoration: underline;
}

.account-upgrade {
  color: #d97706;
}

/* ===== AUTH SCREEN ===== */
.auth-card {
  max-width: 420px;
  margin: 0 auto 20px;
}

.auth-subtitle {
  color: #64748b;
  font-size: 14px;
  margin-bottom: 20px;
}

#auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#auth-form input {
  padding: 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}

#auth-form input:focus {
  border-color: #1d4ed8;
}

.ob-account-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.ob-account-form input {
  padding: 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}

.ob-account-form input:focus {
  border-color: #1d4ed8;
}

.auth-error {
  padding: 10px 12px;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
}

.auth-toggle {
  text-align: center;
  margin-top: 16px;
  font-size: 14px;
  color: #64748b;
}

.auth-toggle-btn {
  background: none;
  border: none;
  color: #1d4ed8;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  margin-left: 4px;
}

/* ===== SECONDARY BUTTON ===== */
.btn-secondary {
  padding: 14px 32px;
  background: #f1f5f9;
  color: #334155;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  transition: all 0.2s;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

/* ===== ONBOARDING ===== */
.onboarding-card {
  max-width: 560px;
  margin: 0 auto 20px;
}

.onboarding-progress {
  font-size: 13px;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#onboarding-step-content h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.onboarding-sub {
  color: #64748b;
  font-size: 14px;
  margin-bottom: 16px;
}

.onboarding-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.onboarding-option-btn {
  padding: 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: white;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.onboarding-option-btn:hover {
  border-color: #1d4ed8;
  background: #eff6ff;
}

.onboarding-option-btn.active {
  border-color: #1d4ed8;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(29,78,216,0.15);
}

.onboarding-option-btn .opt-label {
  font-weight: 700;
  color: #1e293b;
}

.onboarding-option-btn .opt-desc {
  font-size: 13px;
  color: #64748b;
}

.onboarding-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.onboarding-nav .btn-secondary,
.onboarding-nav .btn-primary {
  width: auto;
  flex: 1;
}

.opt-tag {
  align-self: flex-start;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 8px;
  border-radius: 20px;
  margin-bottom: 2px;
}

/* ===== ONBOARDING: PROGRESS BAR ===== */
.ob-progress-track {
  height: 6px;
  background: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
}

.ob-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #1d4ed8, #667eea);
  border-radius: 6px;
  transition: width 0.35s ease;
}

.ob-progress-label {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== ONBOARDING: HERO PANELS ===== */
.ob-hero {
  background: linear-gradient(160deg, #0b1957 0%, #1d3a8a 55%, #1d4ed8 100%);
  color: white;
  border-radius: 20px;
  padding: 32px 24px;
  text-align: center;
  margin-bottom: 20px;
}

.ob-hero-emoji {
  font-size: 40px;
  margin-bottom: 12px;
}

.ob-hero h2 {
  color: white;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 4px;
}

.ob-hero-welcome h2 {
  font-size: 26px;
  line-height: 1.3;
  margin-bottom: 12px;
}

.ob-hero-sub {
  color: #dbeafe;
  font-size: 15px;
  max-width: 420px;
  margin: 0 auto;
}

.ob-trust-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  font-size: 13px;
  font-weight: 600;
}

.ob-trust-row span {
  background: rgba(255,255,255,0.12);
  padding: 6px 12px;
  border-radius: 20px;
}

/* ===== ONBOARDING: PRIMARY CTA ===== */
.ob-cta-primary {
  display: block;
  width: 100%;
  padding: 16px;
  margin-top: 8px;
  background: linear-gradient(90deg, #16a34a, #22c55e);
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 6px 20px rgba(22,163,74,0.3);
}

.ob-cta-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(22,163,74,0.4);
}

.ob-cta-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.ob-cta-outline {
  display: block;
  width: 100%;
  padding: 15px;
  margin-top: 10px;
  background: transparent;
  color: white;
  border: 2px solid rgba(255,255,255,0.6);
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.ob-cta-outline:hover {
  background: rgba(255,255,255,0.1);
  border-color: white;
}

/* ===== HOME / SPLASH SCREEN ===== */
.home-hero {
  max-width: 420px;
  padding: 48px 28px 36px;
}

.home-hero-icon {
  width: 88px;
  height: 88px;
  margin: 0 auto 24px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.home-hero-tagline {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 32px;
}

.home-demo-link {
  display: block;
  text-align: center;
  margin-top: 16px;
  color: #dbeafe;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.home-demo-link:hover {
  color: white;
  text-decoration: underline;
}

.ob-skip-link {
  display: block;
  text-align: center;
  margin-top: 14px;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.ob-skip-link:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

.ob-risk-reversal {
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
  margin-top: 10px;
}

/* ===== ONBOARDING: LANGUAGE + CHIP PICKERS ===== */
.ob-lang-grid {
  margin-bottom: 20px;
}

.ob-subheading {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 10px;
}

.ob-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ob-chip {
  padding: 8px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 20px;
  background: white;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s;
}

.ob-chip:hover {
  border-color: #1d4ed8;
}

.ob-chip.active {
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: white;
}

/* ===== ONBOARDING: SOCIAL PROOF ===== */
.ob-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.ob-stat-card {
  background: #eff6ff;
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
}

.ob-stat-value {
  font-size: 24px;
  font-weight: 800;
  color: #1d4ed8;
}

.ob-stat-label {
  font-size: 12px;
  color: #475569;
  margin-top: 4px;
}

.ob-testimonial {
  background: #f8fafc;
  border-left: 4px solid #1d4ed8;
  border-radius: 8px;
  padding: 14px 16px;
}

.ob-testimonial-text {
  font-size: 14px;
  font-style: italic;
  color: #1e293b;
}

.ob-testimonial-author {
  font-size: 12px;
  color: #64748b;
  margin-top: 6px;
  font-weight: 600;
}

/* ===== ONBOARDING: MICRO-LESSON DEMO ===== */
.ob-demo-wrap {
  text-align: center;
}

.ob-demo-loading {
  color: #64748b;
  font-size: 14px;
  padding: 24px 0;
}

.ob-flashcard {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 2px solid #bfdbfe;
  border-radius: 18px;
  padding: 40px 20px;
  margin: 12px 0 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s;
  position: relative;
}

.ob-flashcard-speak-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 18px;
  background: rgba(255,255,255,0.6);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  opacity: 1;
}

.ob-flashcard-speak-btn:hover {
  background: white;
}

.ob-flashcard:hover {
  transform: translateY(-2px);
}

.ob-flashcard-word {
  font-size: 26px;
  font-weight: 800;
  color: #1e293b;
}

.ob-flashcard-hint {
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ob-flashcard-example {
  font-size: 13px;
  color: #475569;
  font-style: italic;
}

.ob-phrase-prompt {
  background: #f8fafc;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  text-align: left;
}

.ob-phrase-title {
  font-size: 12px;
  font-weight: 700;
  color: #1d4ed8;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

.ob-phrase-text {
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
}

.ob-phrase-translation {
  font-size: 13px;
  color: #64748b;
  margin-top: 2px;
}

.ob-phrase-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ob-phrase-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: white;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.2s;
}

.ob-phrase-option:hover:not(:disabled) {
  border-color: #1d4ed8;
  background: #eff6ff;
}

.ob-phrase-option-tr {
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
}

.ob-phrase-option.correct {
  border-color: #16a34a;
  background: #f0fdf4;
}

.ob-phrase-option.incorrect {
  border-color: #dc2626;
  background: #fef2f2;
}

.ob-demo-celebration {
  font-size: 18px;
  font-weight: 700;
  color: #16a34a;
  padding: 32px 0;
}

/* ===== ONBOARDING: GENERATING SCREEN ===== */
.ob-generating {
  text-align: center;
  padding: 12px 0 4px;
}

.ob-generating h2 {
  margin-bottom: 20px;
}

.ob-gen-track {
  margin-bottom: 20px;
}

.ob-gen-steps {
  list-style: none;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ob-gen-steps li {
  position: relative;
  padding-left: 28px;
  font-size: 14px;
  color: #94a3b8;
  transition: color 0.3s;
}

.ob-gen-steps li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  transition: all 0.3s;
}

.ob-gen-steps li.done {
  color: #1e293b;
  font-weight: 600;
}

.ob-gen-steps li.done::before {
  background: #16a34a;
  border-color: #16a34a;
}

.ob-gen-steps li.done::after {
  content: '✓';
  position: absolute;
  left: 3px;
  top: 0px;
  color: white;
  font-size: 11px;
  font-weight: 700;
}

/* ===== ONBOARDING: ROADMAP ===== */
.ob-roadmap-timeline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
}

.ob-roadmap-node {
  display: flex;
  gap: 14px;
  padding: 10px 0;
  position: relative;
}

.ob-roadmap-node:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 28px;
  bottom: -6px;
  width: 2px;
  background: #e2e8f0;
}

.ob-roadmap-dot {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid #cbd5e1;
  background: white;
  margin-top: 4px;
}

.ob-roadmap-dot.done {
  border-color: #1d4ed8;
  background: #1d4ed8;
}

.ob-roadmap-title {
  font-weight: 700;
  color: #1e293b;
  font-size: 14px;
}

.ob-roadmap-desc {
  font-size: 13px;
  color: #64748b;
  margin-top: 2px;
}

/* ===== ONBOARDING: PAYWALL ===== */
.ob-paywall-toggle {
  display: flex;
  gap: 8px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 14px;
  margin-bottom: 18px;
}

.ob-toggle-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
}

.ob-toggle-btn.active {
  background: white;
  color: #1d4ed8;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.ob-toggle-badge {
  background: #16a34a;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 4px;
}

.ob-paywall-price {
  text-align: center;
}

.ob-paywall-price-amount {
  font-size: 36px;
  font-weight: 800;
  color: #1e293b;
}

.ob-paywall-price-period {
  font-size: 15px;
  color: #64748b;
  font-weight: 500;
}

.ob-paywall-note {
  text-align: center;
  color: #16a34a;
  font-size: 13px;
  font-weight: 600;
  margin-top: 4px;
}

.ob-paywall-features {
  margin: 20px 0 8px;
}

/* ===== LANGUAGE SWITCHER ===== */
.lang-select-note {
  margin-top: 16px;
  font-size: 14px;
  color: #64748b;
  text-align: center;
}

.lang-select-note a {
  color: #1d4ed8;
  font-weight: 600;
}

.lang-btn.locked {
  opacity: 0.6;
  position: relative;
}

.lang-btn .lock-icon {
  font-size: 14px;
}

.lang-explore {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}

.lang-explore-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 10px;
}

.lang-explore-select {
  width: 100%;
  max-width: 320px;
  padding: 12px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: white;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: border-color 0.2s;
}

.lang-explore-select:hover,
.lang-explore-select:focus {
  border-color: #1d4ed8;
  outline: none;
}

.lang-explore-prompt {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.lang-explore-prompt.active {
  display: flex;
}

.lang-explore-cta {
  width: auto;
  padding: 10px 24px;
}

.lang-switch-btn {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 4px 12px;
  min-height: 40px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  font-family: inherit;
}

.lang-switch-btn:hover {
  background: #f1f5f9;
}

.lang-switch-btn:active {
  background: #e2e8f0;
}

/* ===== ACHIEVEMENTS ===== */
.achievements-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.achievement-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 20px;
  background: #f1f5f9;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
  filter: grayscale(1);
  opacity: 0.6;
}

.achievement-badge.earned {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  filter: none;
  opacity: 1;
}

.achievement-emoji {
  font-size: 16px;
}

/* ===== FREE-RESPONSE COMPANION PRACTICE ===== */
.companion-upsell {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  font-size: 13px;
  color: #64748b;
  text-align: center;
}

.companion-upsell a {
  color: #1d4ed8;
  font-weight: 600;
}

.free-response {
  margin-top: 12px;
}

.free-response-label {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 8px;
}

.free-response-input-row {
  display: flex;
  gap: 8px;
}

.free-response-input-row input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  font-family: inherit;
}

.free-response-input-row input:focus {
  border-color: #1d4ed8;
}

.free-response-input-row button {
  padding: 12px 20px;
  background: #1d4ed8;
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  width: auto;
}

/* ===== RTL LANGUAGE SUPPORT (e.g. Arabic) ===== */
#main-app.rtl {
  direction: rtl;
}

#main-app.rtl .message-bot {
  align-self: flex-end;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 4px;
}

#main-app.rtl .message-user {
  align-self: flex-start;
  margin-left: 0;
  margin-right: auto;
  border-bottom-right-radius: 16px;
  border-bottom-left-radius: 4px;
}

#main-app.rtl .option-btn,
#main-app.rtl .grammar-question,
#main-app.rtl .listening-question {
  text-align: right;
}

/* ===== PRICING PAGE ===== */
#pricing-app {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}

.logo-link {
  text-decoration: none;
}

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

.pricing-intro h2 {
  font-size: 24px;
}

.pricing-intro p {
  color: #64748b;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.pricing-card {
  background: white;
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  position: relative;
}

.pricing-card-featured {
  border: 2px solid #1d4ed8;
  box-shadow: 0 10px 40px rgba(29,78,216,0.15);
}

.pricing-badge {
  position: absolute;
  top: -12px;
  right: 24px;
  background: #1d4ed8;
  color: white;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.pricing-card h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.pricing-price {
  font-size: 36px;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 4px;
}

.pricing-period {
  font-size: 15px;
  font-weight: 500;
  color: #64748b;
}

.pricing-annual-note {
  font-size: 13px;
  color: #16a34a;
  font-weight: 600;
  margin-bottom: 16px;
}

.pricing-features {
  list-style: none;
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pricing-features li {
  font-size: 14px;
  color: #334155;
}

.pricing-features li.locked {
  color: #94a3b8;
}

.pricing-cta {
  margin-top: 8px;
}

.pricing-card-featured .btn-secondary {
  margin-top: 8px;
  background: transparent;
  border: 2px solid #1d4ed8;
  color: #1d4ed8;
}

.pricing-faq h2 {
  font-size: 20px;
  margin-bottom: 16px;
}

.faq-item {
  margin-bottom: 16px;
}

.faq-item h3 {
  font-size: 15px;
  color: #1e293b;
  margin-bottom: 4px;
}

.faq-item p {
  font-size: 14px;
  color: #64748b;
}

.pricing-footer-link {
  text-align: center;
  margin: 20px 0;
}

.pricing-footer-link a {
  color: #1d4ed8;
  font-weight: 600;
  text-decoration: none;
}
