:root {
  --bg: #FFFBF5;
  --surface: #FFFFFF;
  --surface-soft: #FAF5EE;
  --border: #E7E5E4;
  --border-strong: #D6D3D1;
  --text: #1C1917;
  --text-muted: #57534E;
  --primary: #0F766E;
  --primary-hover: #0D655E;
  --primary-light: #CCFBF1;
  --primary-soft: #F0FDFA;
  --accent: #D97706;
  --accent-light: #FEF3C7;
  --success: #059669;
  --success-bg: #ECFDF5;
  --success-border: #6EE7B7;
  --error: #E11D48;
  --error-bg: #FFF1F2;
  --error-border: #FDA4AF;
  --shadow-sm: 0 2px 8px rgba(28, 25, 23, 0.05);
  --shadow-md: 0 8px 24px rgba(28, 25, 23, 0.08);
  --shadow-lg: 0 16px 40px rgba(28, 25, 23, 0.14);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --level-color: #0F766E;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

html.large-text {
  font-size: 19px;
}

*, *::before, *::after {
  box-sizing: border-box;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  overscroll-behavior-y: contain;
}

body.large-text {
  font-size: 1rem;
}

button, input {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* App Shell */
.app-shell {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
}

/* Update Banner */
.update-banner {
  position: sticky;
  top: 0;
  z-index: 60;
  background: linear-gradient(135deg, #0F766E, #0D9488);
  color: #FFFFFF;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-md);
}

.update-banner-text {
  font-weight: 700;
  font-size: 0.95rem;
}

.update-banner-btn {
  background: #FFFBF5;
  color: var(--primary);
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  min-height: 44px;
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
  flex-shrink: 0;
}

/* Top Bar */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 251, 245, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.brand-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.stat-pill.streak {
  background: #FFF7ED;
  border-color: #FED7AA;
  color: #C2410C;
}

.stat-pill.xp {
  background: #FEFCE8;
  border-color: #FDE68A;
  color: #B45309;
}

.icon-toggle-btn {
  min-width: 48px;
  min-height: 48px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.icon-toggle-btn.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

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

/* Main Content */
.main-content {
  flex: 1;
  padding: 16px 16px calc(92px + env(safe-area-inset-bottom));
}

.tab-panel {
  display: none;
  animation: fadeSlideIn 0.2s ease;
}

.tab-panel.active {
  display: block;
}

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

/* Cards & Banners */
.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.welcome-card {
  background: linear-gradient(135deg, #F0FDFA 0%, #FFFBEB 100%);
  border: 1.5px solid #99F6E4;
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.welcome-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.welcome-title {
  margin: 0 0 4px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
}

.welcome-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
  font-weight: 600;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.mini-stat {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
  text-align: center;
}

.mini-stat-value {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
  display: block;
}

.mini-stat-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* iOS Install Hint Banner */
.ios-banner {
  background: #FFFBEB;
  border: 1.5px solid #FDE68A;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.ios-banner p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 600;
}

.ios-banner-close {
  min-width: 40px;
  min-height: 40px;
  border: none;
  background: rgba(217, 119, 6, 0.12);
  color: #92400E;
  border-radius: 10px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}

/* Review CTA */
.review-cta-btn {
  width: 100%;
  min-height: 54px;
  border: 1.5px solid #FDE68A;
  background: linear-gradient(135deg, #FEF3C7, #FFFBEB);
  color: #92400E;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.98rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease;
}

.review-cta-btn:active {
  transform: scale(0.985);
}

.review-badge {
  background: #D97706;
  color: #FFFFFF;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 800;
}

/* Level Selector Pills */
.section-label {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.level-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 14px;
  scrollbar-width: none;
}

.level-pills::-webkit-scrollbar {
  display: none;
}

.level-pill {
  flex-shrink: 0;
  min-height: 48px;
  padding: 8px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.level-pill.active {
  background: var(--level-color, var(--primary));
  border-color: var(--level-color, var(--primary));
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.25);
}

.level-pill-cefr {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(28, 25, 23, 0.07);
}

.level-pill.active .level-pill-cefr {
  background: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
}

/* Level Header Card */
.level-banner {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-left: 6px solid var(--level-color, var(--primary));
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.level-banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.level-banner-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.level-badge {
  font-size: 0.76rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  color: #FFFFFF;
  background: var(--level-color, var(--primary));
  white-space: nowrap;
}

.level-banner-desc {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Unit Grid & Cards */
.unit-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.unit-card {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.unit-card:active {
  transform: scale(0.985);
}

.unit-emoji-box {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
}

.unit-info {
  flex: 1;
  min-width: 0;
}

.unit-title {
  margin: 0 0 2px;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}

.unit-sub {
  margin: 0 0 8px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
}

.unit-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.unit-stars {
  font-size: 0.95rem;
  letter-spacing: 2px;
}

.unit-mastered {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 9px;
  border-radius: 999px;
}

.unit-arrow {
  font-size: 1.2rem;
  color: var(--text-muted);
  font-weight: 800;
}

/* Primary & Secondary Buttons */
.btn {
  min-height: 50px;
  padding: 12px 18px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.24);
}

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

.btn-secondary {
  background: var(--surface-soft);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-outline {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--primary);
}

.btn-danger {
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error-border);
}

.btn-audio {
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1.5px solid #99F6E4;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
  font-size: 0.94rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-audio.slow {
  border-color: #FDE68A;
  background: #FFFBEB;
  color: #B45309;
}

.btn-audio:active {
  transform: scale(0.96);
}

/* Review Tab */
.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mode-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.mode-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.mode-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.mode-card h3 {
  margin: 0 0 2px;
  font-size: 1.08rem;
  font-weight: 800;
}

.mode-card p {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-chip {
  min-height: 42px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
}

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
}

/* Phrasebook / Dictionary */
.search-box {
  position: relative;
  margin-bottom: 12px;
}

.search-input {
  width: 100%;
  min-height: 50px;
  padding: 12px 44px 12px 16px;
  border-radius: 14px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  outline: none;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  background: var(--surface-soft);
  color: var(--text-muted);
  font-weight: 800;
  cursor: pointer;
}

.phrase-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.phrase-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.phrase-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.phrase-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.phrase-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.phrase-emoji {
  font-size: 1.5rem;
  line-height: 1.2;
}

.phrase-en {
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 2px;
}

.phrase-phonetic {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 4px;
}

.phrase-tr {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0;
}

.phrase-example {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 0.86rem;
  color: var(--text-muted);
  font-weight: 600;
}

.phrase-example strong {
  color: var(--text);
}

.phrase-audio-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.phrase-audio-row .btn-audio {
  min-height: 42px;
  padding: 6px 12px;
  font-size: 0.86rem;
}

/* Settings */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.setting-row:first-child {
  padding-top: 0;
}

.setting-title {
  margin: 0 0 2px;
  font-size: 1rem;
  font-weight: 800;
}

.setting-desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Accessible Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 56px;
  height: 32px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background-color: #D6D3D1;
  border-radius: 999px;
  transition: background-color 0.2s ease;
}

.slider::before {
  content: '';
  position: absolute;
  height: 24px;
  width: 24px;
  left: 4px;
  bottom: 4px;
  background-color: #FFFFFF;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.switch input:checked + .slider {
  background-color: var(--primary);
}

.switch input:checked + .slider::before {
  transform: translateX(24px);
}

.install-steps {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.92rem;
}

.install-steps li {
  margin-bottom: 6px;
}

.version-status {
  margin: 8px 0 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
}

.bottom-nav-inner {
  width: 100%;
  max-width: 640px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.nav-btn {
  min-height: 52px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 14px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.nav-btn-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.nav-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
}

/* Modals & Sheets */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(28, 25, 23, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

@media (min-width: 540px) {
  .modal-backdrop {
    align-items: center;
  }
}

.sheet-card {
  width: 100%;
  max-width: 540px;
  background: var(--surface);
  border-radius: 24px;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  max-height: 90dvh;
  overflow-y: auto;
  animation: popUp 0.2s ease;
}

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

.sheet-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sheet-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sheet-emoji {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  flex-shrink: 0;
}

.sheet-title {
  margin: 0 0 2px;
  font-size: 1.25rem;
  font-weight: 800;
}

.sheet-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.close-circle-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}

.tip-box {
  background: #FFFBEB;
  border: 1.5px solid #FDE68A;
  border-radius: 16px;
  padding: 14px 16px;
  margin: 14px 0 18px;
}

.tip-box-title {
  margin: 0 0 4px;
  font-size: 0.9rem;
  font-weight: 800;
  color: #92400E;
}

.tip-box p {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 600;
  color: #451A03;
}

.sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Flashcard Walkthrough Overlay */
.overlay-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.overlay-inner {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 16px 20px;
  overflow-y: auto;
}

.game-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.progress-track {
  flex: 1;
  height: 14px;
  background: #E7E5E4;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0F766E, #14B8A6);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress-count {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-muted);
  min-width: 48px;
  text-align: right;
}

/* Flashcard */
.flashcard-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

.flashcard-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 24px;
  padding: 26px 20px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.flashcard-emoji {
  font-size: 3rem;
  margin-bottom: 8px;
}

.flashcard-en {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 6px;
}

.flashcard-phonetic {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 12px;
}

.flashcard-tr {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent);
  margin: 0 0 14px;
}

.flashcard-example {
  background: var(--surface-soft);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.94rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 16px;
}

.flashcard-example strong {
  display: block;
  color: var(--text);
  margin-bottom: 2px;
}

.audio-controls {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.flashcard-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

/* Game Stage */
.game-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.exercise-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid #99F6E4;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.84rem;
  font-weight: 800;
}

.prompt-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.prompt-emoji {
  font-size: 2.2rem;
  margin-bottom: 6px;
}

.prompt-main {
  margin: 0 0 6px;
  font-size: 1.38rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.35;
}

.prompt-phonetic {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
}

.prompt-sub {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
}

.prompt-audio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

/* Options Grid */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1.04rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.option-btn:active:not(:disabled) {
  transform: scale(0.985);
}

.option-btn.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.option-btn.correct {
  border-color: var(--success);
  background: var(--success-bg);
  color: #065F46;
}

.option-btn.wrong {
  border-color: var(--error);
  background: var(--error-bg);
  color: #9F1239;
}

/* Sentence Builder */
.builder-answer-box {
  min-height: 82px;
  background: var(--surface);
  border: 2px dashed var(--border-strong);
  border-radius: 18px;
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
}

.builder-placeholder {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  margin: auto 0;
}

.builder-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 6px 0;
}

.word-tile {
  min-height: 48px;
  padding: 10px 15px;
  border-radius: 14px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--border-strong);
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.word-tile:active:not(:disabled) {
  transform: translateY(1px);
}

.word-tile.placed {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: none;
}

.word-tile.used {
  opacity: 0.25;
  pointer-events: none;
  box-shadow: none;
}

/* Match Pairs */
.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.match-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.match-btn {
  min-height: 62px;
  padding: 10px 12px;
  border-radius: 15px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.match-btn.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.match-btn.matched {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: #065F46;
  opacity: 0.72;
  cursor: default;
}

.match-btn.shake {
  border-color: var(--error);
  background: var(--error-bg);
  animation: shake 0.35s ease;
}

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

/* Blank Highlight */
.blank-gap {
  display: inline-block;
  min-width: 72px;
  padding: 2px 10px;
  border-bottom: 3px solid var(--primary);
  color: var(--primary);
  text-align: center;
}

/* Feedback Drawer */
.feedback-drawer {
  margin-top: auto;
  border-radius: 20px;
  padding: 16px;
  border: 2px solid transparent;
  animation: fadeSlideIn 0.2s ease;
}

.feedback-drawer.correct {
  background: var(--success-bg);
  border-color: var(--success-border);
}

.feedback-drawer.wrong {
  background: var(--error-bg);
  border-color: var(--error-border);
}

.feedback-title {
  margin: 0 0 6px;
  font-size: 1.08rem;
  font-weight: 800;
}

.feedback-drawer.correct .feedback-title {
  color: #065F46;
}

.feedback-drawer.wrong .feedback-title {
  color: #9F1239;
}

.feedback-detail {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.feedback-note {
  margin: 0 0 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.7);
  padding: 8px 10px;
  border-radius: 10px;
}

.feedback-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Summary View */
.summary-card {
  margin: auto 0;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 26px;
  padding: 28px 20px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.summary-stars {
  font-size: 2.8rem;
  letter-spacing: 6px;
  margin-bottom: 8px;
}

.summary-title {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 800;
}

.summary-sub {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 0.98rem;
  font-weight: 600;
}

.summary-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.summary-metric {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
}

.summary-metric strong {
  display: block;
  font-size: 1.25rem;
  color: var(--primary);
}

.summary-metric span {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
}

.summary-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Feedback Modal & WhatsApp */
#feedback-modal {
  z-index: 90;
}

.btn-whatsapp {
  background: #15803D;
  color: #FFFFFF;
  min-height: 50px;
  box-shadow: 0 4px 12px rgba(21, 128, 61, 0.22);
}

.btn-whatsapp:hover:not(:disabled) {
  background: #166534;
}

.feedback-field-label {
  display: block;
  margin: 12px 0 6px;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
}

.feedback-input,
.feedback-textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  outline: none;
}

.feedback-input {
  min-height: 48px;
}

.feedback-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.45;
}

.feedback-input:focus,
.feedback-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.feedback-char-count {
  text-align: right;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 4px 0 12px;
}

.feedback-status-box {
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.94rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.feedback-status-box.success {
  background: var(--success-bg);
  border: 1.5px solid var(--success-border);
  color: #065F46;
}

.feedback-status-box.error {
  background: var(--error-bg);
  border: 1.5px solid var(--error-border);
  color: #9F1239;
}

.feedback-saved-id {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.85);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  color: var(--text);
  user-select: all;
  -webkit-user-select: all;
}
