:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --secondary: #06b6d4;
  --accent: #f59e0b;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --surface-border: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --surface-border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --primary-light: #eef2ff;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

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

html, body {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background-color: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Header */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--surface-border);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0.75rem 1.5rem;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.logo-badge {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  font-weight: 800;
  font-size: 1.1rem;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-text h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

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

.btn-outline {
  background: transparent;
  border-color: var(--surface-border);
  color: var(--text-main);
}
.btn-outline:hover {
  background: var(--surface-hover);
}

.btn-success {
  background: var(--success);
  color: white;
}
.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

/* Main Container */
main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* Hero / Banner */
.hero-banner {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.15), rgba(6, 182, 212, 0.1));
  border: 1px solid rgba(79, 70, 229, 0.3);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hero-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
}

.hero-title h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.hero-title p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.hero-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.stat-chip {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-width: 100px;
}

.stat-num {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Quick Action Cards */
.quick-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.quick-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.quick-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.qc-icon {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

.qc-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.qc-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Weeks Section */
.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.weeks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.week-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.week-card:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.week-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--secondary);
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.week-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.week-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: auto;
}

.tag {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
}

/* Views & Containers */
.hidden {
  display: none !important;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--surface-border);
  flex-wrap: wrap;
  gap: 1rem;
}

.view-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
}
.view-back:hover {
  color: var(--text-main);
  background: var(--surface);
}

/* Tab Navigation */
.tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--surface-border);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

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

/* Vocabulary Review List */
.vocab-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.vocab-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.vocab-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.vocab-word {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.vocab-pos {
  font-size: 0.75rem;
  color: var(--secondary);
  font-style: italic;
}

.vocab-def {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.vocab-examples {
  background: rgba(0, 0, 0, 0.2);
  border-left: 3px solid var(--primary);
  padding: 0.6rem 0.8rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.85rem;
  color: var(--text-main);
}

.vocab-examples strong {
  color: var(--primary);
}

.audio-btn-group {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
}

.audio-btn {
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.1s ease;
}
.audio-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Quiz Box / Interaction Box */
.quiz-container {
  max-width: 760px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.quiz-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: var(--surface-border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.2s ease;
}

.quiz-question-box {
  margin-bottom: 1.5rem;
}

.quiz-instruction {
  font-size: 0.85rem;
  color: var(--secondary);
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.quiz-question-text {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.5;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.quiz-opt-btn {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  color: var(--text-main);
  text-align: left;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quiz-opt-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.quiz-opt-btn.correct {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  font-weight: 600;
}

.quiz-opt-btn.wrong {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.quiz-explanation {
  background: rgba(79, 70, 229, 0.1);
  border-left: 4px solid var(--primary);
  padding: 1rem;
  border-radius: 0 8px 8px 0;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

.quiz-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* Dictation Area */
.dictation-listen-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 0;
}

.dictation-audio-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.big-listen-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: white;
  font-size: 1.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(79, 70, 229, 0.4);
  transition: transform 0.15s ease, background 0.15s ease;
}

.big-listen-btn:hover {
  transform: scale(1.08);
  background: var(--primary-hover);
}

.dictation-input {
  width: 100%;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--surface-border);
  background: var(--bg);
  color: var(--text-main);
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.dictation-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Grammar Tables */
.grammar-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  border-radius: var(--radius);
  overflow: hidden;
}

.grammar-table th, .grammar-table td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--surface-border);
  text-align: left;
  font-size: 0.9rem;
}

.grammar-table th {
  background: rgba(79, 70, 229, 0.15);
  font-weight: 600;
  color: var(--primary);
}

.grammar-table tr:hover {
  background: var(--surface-hover);
}

/* Writing Studio */
.writing-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .writing-layout {
    grid-template-columns: 1fr;
  }
}

.writing-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.writing-textarea {
  width: 100%;
  min-height: 380px;
  background: var(--bg);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1rem;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  margin-bottom: 1rem;
}

.writing-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.word-counter-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.word-counter-badge.reached {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.phrase-pill {
  display: inline-block;
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
  border: 1px solid rgba(79, 70, 229, 0.3);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  margin: 0.2rem;
  cursor: pointer;
  transition: all 0.1s ease;
}
.phrase-pill:hover {
  background: var(--primary);
  color: white;
}

/* Reading Passage Layout */
.reading-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 850px) {
  .reading-layout {
    grid-template-columns: 1fr;
  }
}

.reading-passage-box {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-height: 520px;
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ------------------------------------------------------------- */
/* Study Coach View Styles */
/* ------------------------------------------------------------- */
.coach-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 950px) {
  .coach-layout {
    grid-template-columns: 1fr;
  }
}

.day-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: all 0.15s ease;
}

.day-card.completed {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.05);
}

.day-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.day-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
}

.trap-card {
  background: var(--surface);
  border-left: 4px solid var(--accent);
  padding: 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 0.75rem;
  border-top: 1px solid var(--surface-border);
  border-right: 1px solid var(--surface-border);
  border-bottom: 1px solid var(--surface-border);
}

/* AI Chatbox */
.chat-container {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  height: 600px;
  box-shadow: var(--shadow);
}

.chat-header {
  padding: 1rem;
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.chat-msg {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.5;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 2px;
}

.chat-msg.bot {
  align-self: flex-start;
  background: var(--bg);
  border: 1px solid var(--surface-border);
  color: var(--text-main);
  border-bottom-left-radius: 2px;
  white-space: pre-line;
}

.chat-quick-actions {
  display: flex;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  overflow-x: auto;
  border-top: 1px solid var(--surface-border);
}

.chat-input-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--surface-border);
}

.chat-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  color: var(--text-main);
  font-size: 0.9rem;
}
.chat-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Footer */
footer {
  border-top: 1px solid var(--surface-border);
  background: var(--surface);
  padding: 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: auto;
}

/* Dictation Score & Suggestion Box */
.dict-result-card {
  border-radius: var(--radius);
  border: 1px solid var(--surface-border);
  padding: 1.25rem;
  margin-top: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.dict-score-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--surface-border);
}
.dict-score-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}
.dict-score-perfect {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.dict-score-high {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.35);
}
.dict-score-mid {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.dict-score-low {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.dict-suggestions-box {
  margin-top: 0.85rem;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  border-left: 4px solid var(--primary);
}
body.dark-mode .dict-suggestions-box {
  background: rgba(255, 255, 255, 0.03);
}
.dict-suggestion-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.92rem;
  margin-bottom: 0.45rem;
  line-height: 1.45;
}
.dict-suggestion-item:last-child {
  margin-bottom: 0;
}

/* Floating Word Translation Popover (0 Cost Instant Translation) */
.word-popover {
  position: fixed !important;
  z-index: 999999 !important;
  background: var(--surface);
  border: 1.5px solid var(--primary);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(79, 70, 229, 0.4);
  padding: 0.95rem 1.15rem;
  max-width: 360px;
  min-width: 260px;
  pointer-events: auto;
  transition: opacity 0.15s ease;
  animation: popoverFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popoverFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.word-popover::after {
  display: none !important;
}

.word-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.word-popover-title {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--primary);
}

.popover-speak-btn {
  background: rgba(79, 70, 229, 0.12);
  border: none;
  border-radius: 6px;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s ease;
}
.popover-speak-btn:hover {
  background: rgba(79, 70, 229, 0.25);
}

.popover-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0.2rem;
  line-height: 1;
}
.popover-close:hover {
  color: var(--danger);
}

.word-popover-pos {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.word-popover-tr {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--success);
  line-height: 1.35;
  margin-bottom: 0.25rem;
}

.word-popover-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Audio Button Download Progress & Play State */
.popover-audio-btn {
  position: relative;
  overflow: hidden;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.popover-audio-btn .btn-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--success);
  transition: width 0.15s ease;
}

.popover-audio-btn.downloading {
  border-color: var(--warning);
  color: var(--warning);
  cursor: wait;
}
.popover-audio-btn.downloading .btn-progress-bar {
  background: var(--warning);
}

.popover-audio-btn.playing {
  border-color: var(--success);
  color: var(--success);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
  animation: pulsePlaying 1.2s infinite ease-in-out;
}

@keyframes pulsePlaying {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

.audio-status-bar {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  margin-bottom: 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.25);
  animation: fadeIn 0.15s ease;
}

.audio-status-bar.ready {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.25);
}

/* ============================================================= */
/* Comprehensive Mobile & Tablet Responsive Enhancements        */
/* ============================================================= */
@media (max-width: 768px) {
  header {
    padding: 0.5rem 0.75rem;
  }
  .header-container {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .brand {
    justify-content: space-between;
  }
  .brand-text h1 {
    font-size: 1rem;
  }
  input, textarea, select {
    font-size: 16px !important;
  }
  .nav-actions {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 6px;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    scrollbar-width: none;
  }
  .nav-actions::-webkit-scrollbar {
    display: none;
  }
  .nav-actions .btn {
    padding: 0.4rem 0.7rem;
    font-size: 0.78rem;
    flex-shrink: 0;
  }
  main {
    padding: 1rem 0.65rem;
  }
  .hero-banner {
    padding: 1.25rem 1rem;
  }
  .hero-title h2 {
    font-size: 1.35rem;
  }
  .hero-stats {
    width: 100%;
    justify-content: space-around;
  }
  .stat-chip {
    padding: 0.4rem 0.65rem;
  }
  .stat-num {
    font-size: 1.15rem;
  }
  .quick-cards {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .weeks-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar {
    display: none;
  }
  .tab-btn {
    flex-shrink: 0;
    font-size: 0.82rem;
    padding: 0.5rem 0.75rem;
  }
  .reading-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .reading-passage-box {
    max-height: 380px;
  }
  .writing-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .writing-textarea {
    min-height: 260px;
    font-size: 0.92rem;
  }
  .coach-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .word-popover {
    position: fixed !important;
    top: auto !important;
    bottom: 1.25rem !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: calc(100vw - 1.5rem) !important;
    max-width: 440px !important;
    margin: 0 !important;
    border-radius: 16px !important;
    padding: 1.15rem 1.25rem !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55), 0 0 0 2px rgba(59, 130, 246, 0.5) !important;
    z-index: 100000 !important;
    animation: mobilePopoverSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }
  .word-popover::after {
    display: none !important;
  }
  @keyframes mobilePopoverSlide {
    from {
      opacity: 0;
      transform: translate(-50%, 35px);
    }
    to {
      opacity: 1;
      transform: translate(-50%, 0);
    }
  }
  .quiz-options {
    grid-template-columns: 1fr;
  }
  .quiz-opt-btn {
    min-height: 48px;
    padding: 0.75rem;
    font-size: 0.9rem;
  }
  .vocab-grid {
    grid-template-columns: 1fr;
  }
  .dictation-listen-area {
    padding: 1rem 0;
  }
  .big-listen-btn {
    width: 58px;
    height: 58px;
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .brand-text h1 {
    font-size: 0.92rem;
  }
  .brand-text p {
    font-size: 0.68rem;
  }
  .hero-title h2 {
    font-size: 1.15rem;
  }
  .hero-title p {
    font-size: 0.8rem;
  }
  .btn {
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
  }
  .login-card {
    padding: 1.5rem 1.15rem;
    border-radius: var(--radius);
  }
  .login-header h2 {
    font-size: 1.25rem;
  }
}

/* ============================================================
   AUTHENTICATION & USER SESSION STYLES
   ============================================================ */
.login-wrapper {
  min-height: calc(80vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.4);
  padding: 2.25rem 2rem;
  position: relative;
  overflow: hidden;
  animation: fadeInLogin 0.35s ease-out;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
}

@keyframes fadeInLogin {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), #3730a3);
  color: white;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  box-shadow: 0 8px 16px -4px rgba(79, 70, 229, 0.4);
  margin-bottom: 1rem;
}

.login-header h2 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.login-header p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 0.9rem;
  font-size: 1.05rem;
  pointer-events: none;
  opacity: 0.7;
}

.form-input {
  width: 100%;
  padding: 0.75rem 2.8rem 0.75rem 2.6rem;
  background: var(--bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  color: var(--text-main);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

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

.pwd-toggle-btn {
  position: absolute;
  right: 0.6rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  font-size: 1.1rem;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.pwd-toggle-btn:hover {
  opacity: 1;
}

.btn-login {
  width: 100%;
  padding: 0.85rem;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  border-radius: var(--radius);
}

.login-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: var(--danger);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.86rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.login-footer-notice {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--surface-border);
  text-align: center;
}

.notice-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  margin-bottom: 0.45rem;
}

.login-footer-notice p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

/* User Session Badge in Header */
.user-session-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(79, 70, 229, 0.12);
  border: 1px solid rgba(79, 70, 229, 0.3);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.user-name-tag {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-logout {
  background: rgba(239, 68, 68, 0.15) !important;
  color: var(--danger) !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
  padding: 0.2rem 0.5rem !important;
  font-size: 0.75rem !important;
}

.btn-logout:hover {
  background: var(--danger) !important;
  color: white !important;
}

/* Spinner */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   A1 TO B2 JOURNEY & COMPASS STYLES
   ============================================================ */
.compass-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.compass-card {
  background: var(--bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.compass-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
}

.compass-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.compass-icon-badge {
  font-size: 1.6rem;
}

.compass-time-tag {
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(79, 70, 229, 0.12);
  color: var(--primary);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(79, 70, 229, 0.25);
}

.compass-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.compass-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Level Hub Tabs */
.level-tabs-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.level-tab-btn {
  background: var(--bg);
  border: 2px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 0.85rem 0.5rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.level-tab-btn .ltb-code {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.level-tab-btn .ltb-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.level-tab-btn.active {
  background: var(--surface);
  box-shadow: var(--shadow);
}

.level-tab-btn[data-level="a1"].active {
  border-color: #10b981;
  color: #10b981;
}
.level-tab-btn[data-level="a2"].active {
  border-color: #3b82f6;
  color: #3b82f6;
}
.level-tab-btn[data-level="b1"].active {
  border-color: #8b5cf6;
  color: #8b5cf6;
}
.level-tab-btn[data-level="b2"].active {
  border-color: #ec4899;
  color: #ec4899;
}

/* Checklist Items */
.checklist-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.checklist-item:hover {
  background: var(--surface);
}

.checklist-item.checked {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.08);
}

.checklist-item.checked .checklist-text {
  text-decoration: line-through;
  opacity: 0.75;
}

.checklist-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  font-size: 0.75rem;
  color: white;
}

.checklist-item.checked .checklist-check {
  background: var(--success);
  border-color: var(--success);
}

.checklist-text {
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.4;
}

@media (max-width: 600px) {
  .level-tabs-bar {
    grid-template-columns: repeat(2, 1fr);
  }
}



/* ==========================================================================
   A2 INTERACTIVE CAMPUS STYLES (PELIN ÖZEL ÇALIŞMA PLATFORMU)
   ========================================================================== */

.a2-welcome-card {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(139, 92, 246, 0.15) 100%);
  border: 2px solid rgba(59, 130, 246, 0.35);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.a2-welcome-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.a2-welcome-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.a2-welcome-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.a2-wstep {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.a2-wstep-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.a2-wstep-text h5 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.a2-wstep-text p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Units Carousel / Selector Bar */
.a2-units-selector {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  scrollbar-width: thin;
}

.a2-unit-btn {
  background: var(--surface);
  border: 2px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 0.85rem 1.25rem;
  min-width: 190px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
}

.a2-unit-btn:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.a2-unit-btn.active {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.a2-unit-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #3b82f6;
  letter-spacing: 0.05em;
}

.a2-unit-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
}

.a2-unit-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface-border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.a2-unit-progress-fill {
  height: 100%;
  background: #10b981;
  transition: width 0.3s ease;
}

/* Station Nav Tabs */
.a2-station-nav {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 0.35rem;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.a2-station-tab {
  flex: 1;
  min-width: 140px;
  padding: 0.75rem 0.6rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.a2-station-tab:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.04);
}

body.dark-mode .a2-station-tab:hover {
  background: rgba(255, 255, 255, 0.04);
}

.a2-station-tab.active {
  background: var(--surface);
  color: #3b82f6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Station 1: Sentence Shadowing */
.a2-sentences-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.a2-sentence-row {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.a2-sentence-row:hover {
  border-color: rgba(59, 130, 246, 0.5);
}

.a2-sentence-row.shadowed {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.04);
}

.a2-sent-content {
  flex: 1;
}

.a2-sent-en {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.45;
  margin-bottom: 0.4rem;
}

.a2-sent-tr {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 0.35rem;
  padding-left: 0.5rem;
  border-left: 3px solid #3b82f6;
}

.a2-sent-tr.hidden {
  display: none;
}

.a2-sent-note {
  font-size: 0.78rem;
  color: #8b5cf6;
  margin-top: 0.3rem;
  font-style: italic;
}

.a2-sent-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-end;
  flex-shrink: 0;
}

.a2-btn-group {
  display: flex;
  gap: 0.35rem;
}

/* Translation Practice & AI Checking */
.a2-tr-practice-wrap {
  margin-top: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: var(--bg);
  border: 1px dashed var(--surface-border);
  border-radius: 8px;
}

.a2-tr-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.a2-tr-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  font-size: 0.88rem;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.a2-tr-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.a2-tr-feedback {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.84rem;
  line-height: 1.45;
  animation: fadeIn 0.2s ease;
}

.a2-tr-feedback.score-high {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #10b981;
}

.a2-tr-feedback.score-mid {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #f59e0b;
}

.a2-tr-feedback.score-low {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #ef4444;
}

.a2-tr-feedback strong {
  font-weight: 700;
}

.a2-tr-actions-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

/* Station 2: Vocab Cards */
.a2-vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.a2-vocab-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  transition: all 0.2s ease;
}

.a2-vocab-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}

.a2-vocab-card.learned {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.05);
}

.a2-vocab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.a2-vocab-word {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
}

.a2-vocab-pos {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--surface-border);
}

.a2-vocab-tr-box {
  margin: 0.35rem 0;
}

.a2-vocab-tr-toggle {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #3b82f6;
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.a2-vocab-tr-toggle:hover {
  background: rgba(59, 130, 246, 0.16);
  border-color: #3b82f6;
}

.a2-vocab-tr {
  font-size: 0.95rem;
  font-weight: 700;
  color: #10b981;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  margin-top: 0.35rem;
  display: inline-block;
  animation: fadeIn 0.2s ease;
}

.a2-vocab-tr.hidden {
  display: none !important;
}

.a2-vocab-example {
  background: var(--bg);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  font-size: 0.86rem;
  line-height: 1.4;
  border-left: 3px solid #3b82f6;
}

.a2-vocab-example-en {
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.a2-example-tr-btn {
  background: transparent;
  border: 1px dashed rgba(59, 130, 246, 0.4);
  color: #3b82f6;
  border-radius: 5px;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.2s ease;
}

.a2-example-tr-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: #3b82f6;
}

.a2-vocab-example-tr {
  color: #10b981;
  font-size: 0.85rem;
  font-weight: 600;
  animation: fadeIn 0.2s ease;
}

.a2-vocab-example-tr.hidden {
  display: none !important;
}

/* Station 3: Grammar Workshop */
.a2-grammar-hero {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(59, 130, 246, 0.1) 100%);
  border: 1px solid rgba(79, 70, 229, 0.2);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.a2-formula-box {
  background: var(--surface);
  border: 2px dashed rgba(59, 130, 246, 0.4);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  font-family: monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-main);
  white-space: pre-line;
}

.a2-mistake-card {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
}

.a2-mistake-wrong {
  color: var(--danger);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.a2-mistake-correct {
  color: var(--success);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.a2-irregulars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  margin-top: 1rem;
}

.a2-irreg-item {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
}

/* Station 4: Practice & Word Scramble */
.a2-scramble-wrapper {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
  text-align: center;
}

.a2-scramble-target-area {
  min-height: 54px;
  background: var(--bg);
  border: 2px dashed #3b82f6;
  border-radius: 12px;
  padding: 0.6rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 1rem 0;
}

.a2-scramble-pool {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.a2-word-chip {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.a2-word-chip:hover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
}

.a2-word-chip.picked {
  opacity: 0.3;
  pointer-events: none;
  border-style: dashed;
}

.a2-word-chip.in-target {
  background: #3b82f6;
  color: white;
  border-color: #2563eb;
}

.a2-writing-box {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.a2-writing-textarea {
  width: 100%;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-main);
  padding: 0.85rem;
  font-size: 0.95rem;
  line-height: 1.45;
  resize: vertical;
  min-height: 85px;
  margin: 0.75rem 0;
  font-family: inherit;
}

.a2-writing-textarea:focus {
  outline: none;
  border-color: #3b82f6;
}


/* --------------------------------------------------------------------------
   Interactive Tap-Word & Touch Lookup Enhancements
   -------------------------------------------------------------------------- */
.tap-word {
  cursor: pointer;
  border-bottom: 1.5px dotted rgba(59, 130, 246, 0.45);
  border-radius: 3px;
  padding: 0 1px;
  transition: all 0.15s ease;
  user-select: text;
  -webkit-user-select: text;
  display: inline;
}

.tap-word:hover, .tap-word:active {
  background: rgba(59, 130, 246, 0.18);
  color: #3b82f6;
  border-bottom-color: #3b82f6;
}

.a2-wstep {
  cursor: pointer !important;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease !important;
  user-select: none;
}

.a2-wstep:hover {
  transform: translateY(-2px);
  border-color: #3b82f6 !important;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.18) !important;
}

.a2-wstep:active {
  transform: scale(0.98);
  background: rgba(59, 130, 246, 0.08) !important;
}

/* --------------------------------------------------------------------------
   Mobile Responsive Rules for A2 Campus (Tablets & Phones <= 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .a2-welcome-card {
    padding: 1.15rem 1rem !important;
    margin-bottom: 1.25rem !important;
  }

  .a2-welcome-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.65rem !important;
  }

  .a2-welcome-title {
    font-size: 1.15rem !important;
    line-height: 1.35 !important;
  }

  .a2-welcome-steps {
    grid-template-columns: 1fr !important;
    gap: 0.6rem !important;
    margin-top: 0.75rem !important;
  }

  .a2-wstep {
    padding: 0.75rem 0.85rem !important;
  }

  .a2-units-selector {
    gap: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    -webkit-overflow-scrolling: touch;
  }

  .a2-unit-btn {
    min-width: 155px !important;
    padding: 0.75rem 0.9rem !important;
  }

  .a2-unit-title {
    font-size: 0.88rem !important;
  }

  .a2-station-nav {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.35rem !important;
    padding: 0.3rem !important;
  }

  .a2-station-tab {
    min-width: 0 !important;
    padding: 0.65rem 0.4rem !important;
    font-size: 0.82rem !important;
    justify-content: center !important;
    white-space: normal !important;
    text-align: center !important;
  }

  /* Sentence Row on Mobile: Vertical Stack & Full-Width Buttons */
  .a2-sentence-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.85rem !important;
    padding: 1rem 0.95rem !important;
  }

  .a2-sent-content {
    width: 100% !important;
  }

  .a2-sent-en {
    font-size: 1.12rem !important;
    line-height: 1.65 !important;
    margin-bottom: 0.4rem !important;
  }

  .a2-sent-tr {
    font-size: 0.92rem !important;
    line-height: 1.45 !important;
    margin-top: 0.4rem !important;
  }

  .a2-sent-actions {
    width: 100% !important;
    align-items: stretch !important;
    border-top: 1px solid var(--surface-border) !important;
    padding-top: 0.75rem !important;
    margin-top: 0.25rem !important;
    gap: 0.45rem !important;
  }

  .a2-btn-group {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.45rem !important;
    width: 100% !important;
  }

  .a2-btn-group .btn,
  .a2-btn-group .audio-btn {
    width: 100% !important;
    min-height: 42px !important;
    justify-content: center !important;
    font-size: 0.84rem !important;
    padding: 0.45rem 0.6rem !important;
  }

  /* Vocab Cards */
  .a2-vocab-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
  }

  .a2-vocab-card {
    padding: 1.1rem 1rem !important;
  }

  /* Scramble & Writing */
  .a2-scramble-wrapper {
    padding: 1.15rem 0.85rem !important;
  }

  .a2-scramble-target-area {
    min-height: 52px !important;
    padding: 0.5rem !important;
    gap: 0.35rem !important;
  }

  .a2-scramble-pool {
    gap: 0.4rem !important;
  }

  .a2-word-chip {
    padding: 0.5rem 0.8rem !important;
    min-height: 40px !important;
    font-size: 0.92rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .a2-writing-box {
    padding: 1.1rem 0.9rem !important;
  }

  .a2-writing-box > div {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }

  .a2-writing-box > div > div {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    gap: 0.4rem !important;
  }

  .a2-writing-box .btn {
    width: 100% !important;
    min-height: 40px !important;
    justify-content: center !important;
  }
}

/* ========================================================
   FLOATING SELECTION PILL & MULTI-WORD PHRASE LOOKUP
   ======================================================== */
.selection-lookup-pill {
  position: fixed;
  z-index: 100001;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #ffffff;
  padding: 0.5rem 0.95rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  user-select: none;
  animation: pillBounce 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.selection-lookup-pill:active {
  transform: scale(0.96);
}
@keyframes pillBounce {
  from { opacity: 0; transform: translateY(8px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.popover-phrase-box {
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--surface-border);
}
.popover-phrase-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #3b82f6;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.4rem;
}
.popover-phrase-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.phrase-chip {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.phrase-chip:hover, .phrase-chip:active {
  background: #3b82f6;
  color: #ffffff;
  border-color: #3b82f6;
}
.popover-search-row {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px dashed var(--surface-border);
}
.popover-custom-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--surface-border);
  color: var(--text-main);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  outline: none;
  min-width: 0;
}
.popover-custom-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Multi-Word Range Selection in Sentences */
.tap-word.phrase-start {
  background: rgba(59, 130, 246, 0.35) !important;
  outline: 2px solid #3b82f6 !important;
  border-radius: 4px;
}
.tap-word.phrase-in-range {
  background: rgba(59, 130, 246, 0.2) !important;
  border-radius: 2px;
}
.a2-phrase-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(99, 102, 241, 0.12);
  color: #6366f1;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}
.a2-phrase-mode-badge.active {
  background: #6366f1;
  color: #ffffff;
}

/* AI Feedback Mistakes Alert Box */
.a2-feedback-mistakes {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #f87171;
  background: rgba(239, 68, 68, 0.12);
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  border-left: 3px solid #ef4444;
}
.a2-feedback-correction {
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: #10b981;
  font-weight: 600;
}

.a2-feedback-correct {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  border-left: 3px solid #10b981;
}

.a2-ai-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: a2Spin 0.75s linear infinite;
  flex-shrink: 0;
}
@keyframes a2Spin {
  to { transform: rotate(360deg); }
}

/* Floating Toast Notification */
.lb-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 999999;
  color: #ffffff;
  padding: 0.65rem 1.25rem;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.2);
  pointer-events: none;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 90vw;
  text-align: center;
}
.lb-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.lb-toast.fade-out {
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
}
