/* ============================================
   leARn Card Previewer
   Mobile-app style, single-screen layout
   ============================================ */

:root {
  --orange: #FF7B00;
  --orange-light: #FFA040;
  --orange-dark: #E06800;
  --blue: #4A90D9;
  --green: #7CB342;
  --purple: #7B2D8E;
  --red: #E53935;
  --white: #FFFFFF;
  --off-white: #FFF9F2;
  --gray-50: #FAFAFA;
  --gray-100: #F5F5F5;
  --gray-200: #EEEEEE;
  --gray-300: #E0E0E0;
  --gray-600: #757575;
  --gray-800: #424242;
  --gray-900: #212121;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --header-height: 44px;
  --controls-height: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --card-bg: var(--white);
  --text: var(--gray-800);
  --text-secondary: var(--gray-600);
  --viewer-bg: var(--white);
}

/* ---- DARK MODES ---- */
body.dark-1 {
  --card-bg: #3a3a3a;
  --text: #f0f0f0;
  --text-secondary: #bbb;
  --viewer-bg: #2a2a2a;
}
body.dark-2 {
  --card-bg: #1a1a1a;
  --text: #f0f0f0;
  --text-secondary: #999;
  --viewer-bg: #000000;
}

/* ---- RESET ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  height: 100%;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: linear-gradient(145deg, #FFF9F2, #FFE8CC);
  background-attachment: fixed;
  line-height: 1.4;
  height: 100%;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
body.dark-1 { background: linear-gradient(145deg, #2a2a2a, #1a1a1a); }
body.dark-2 { background: #000; }

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: var(--safe-top);
  transition: opacity 0.12s ease;
}
#app.view-exit { opacity: 0; }

img { max-width: 100%; height: auto; -webkit-user-drag: none; user-select: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; touch-action: manipulation; }

/* ============================================
   HEADER
   ============================================ */
.header {
  z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid rgba(0,0,0,0.08);
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 12px;
  padding-left: calc(12px + var(--safe-left));
  padding-right: calc(12px + var(--safe-right));
  gap: 8px;
  flex-shrink: 0;
}
body.dark-1 .header,
body.dark-2 .header {
  background: rgba(20,20,20,0.9);
  border-bottom-color: rgba(255,255,255,0.06);
}

.header-back {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--orange);
  transition: background 0.2s ease;
}
.header-back:active { background: rgba(255,123,0,0.1); }
.header-back svg { display: block; width: 24px; height: 24px; }

.header-title {
  flex: 1; font-weight: 700; font-size: 0.9rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header-actions { display: flex; gap: 2px; }
.header-btn {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text); font-size: 1.15rem;
  transition: background 0.2s ease;
}
.header-btn:active { background: var(--gray-100); }
body.dark-1 .header-btn:active,
body.dark-2 .header-btn:active { background: rgba(255,255,255,0.08); }
.header-btn.active { color: var(--orange); }

/* ============================================
   HOME VIEW — all content fits in viewport
   ============================================ */
.home-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px;
  padding-left: calc(12px + var(--safe-left));
  padding-right: calc(12px + var(--safe-right));
  padding-bottom: calc(12px + var(--safe-bottom));
  overflow: hidden;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}

/* Hero */
.home-hero {
  text-align: center;
  padding: 6px 0 10px;
  flex-shrink: 0;
}
.home-logo {
  height: 36px;
  margin-bottom: 4px;
  filter: drop-shadow(0 2px 6px rgba(255,123,0,0.25));
}
.home-hero h1 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
body.dark-1 .home-hero h1,
body.dark-2 .home-hero h1 { color: #f0f0f0; }
.home-hero p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Module Grid — auto-fills remaining height */
.module-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
  min-height: 0;
}

/* Module Tile */
.module-tile {
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255,255,255,0.5);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  min-height: 0;
  transition: transform 0.2s var(--ease), box-shadow 0.2s ease;
  position: relative;
}
.module-tile:active,
.module-tile.tile-tap {
  transform: scale(0.95);
}
@media (hover: hover) {
  .module-tile:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: var(--shadow-lg);
  }
}
body.dark-1 .module-tile {
  background: rgba(50,50,50,0.6);
  border-color: rgba(255,255,255,0.06);
}
body.dark-2 .module-tile {
  background: rgba(30,30,30,0.8);
  border-color: rgba(255,255,255,0.04);
}

/* Tile image */
.module-tile-img-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}
.module-tile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.module-tile:active .module-tile-img {
  transform: scale(1.05);
}
.module-tile-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 60%, rgba(0,0,0,0.04));
  pointer-events: none;
}

/* Tile info */
.module-tile-info {
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  background: var(--card-bg);
  transition: background 0.3s ease;
}
.module-tile-icon {
  width: 24px; height: 24px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.module-tile-text { flex: 1; min-width: 0; }
.module-tile-name {
  font-weight: 700; font-size: 0.75rem; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.module-tile-count {
  font-size: 0.6rem; font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

/* Favorites tile */
.favorites-tile {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(255,123,0,0.06), rgba(255,123,0,0.14));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer; border: 1.5px solid var(--orange);
  transition: transform 0.2s var(--ease);
}
.favorites-tile:active { transform: scale(0.97); }
.favorites-tile-icon { font-size: 1.1rem; }
.favorites-tile-text { flex: 1; }
.favorites-tile-name { font-weight: 700; font-size: 0.8rem; }
.favorites-tile-count { font-size: 0.65rem; color: var(--text-secondary); }
.favorites-tile-arrow { font-size: 1rem; color: var(--text-secondary); }

/* ============================================
   VIEWER — single screen, no scroll
   ============================================ */
.viewer-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viewer-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.viewer-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px;
  padding-left: calc(2px + var(--safe-left));
  padding-right: calc(2px + var(--safe-right));
  min-height: 0;
  background: var(--viewer-bg);
  transition: background 0.3s ease;
}

/* Mode 1: single card, no padding */
.viewer-area.mode-1 {
  padding: 0;
  gap: 0;
}

/* ---- CARD SLOT ---- */
.card-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border-radius: 6px;
  background: var(--viewer-bg);
  transition: background 0.3s ease;
}

.viewer-area.mode-1 .card-slot {
  flex: 1;
  border-radius: 0;
}

/* Mode 2: primary gets 60%, secondary 40% */
.viewer-area.mode-2 .card-slot.slot-primary { flex: 3; }
.viewer-area.mode-2 .card-slot.slot-secondary { flex: 2; }

/* Mode 3: primary gets remaining, bottom row has fixed-height squares */
.viewer-area.mode-3 .card-slot.slot-primary { flex: 1; }
.viewer-area.mode-3 .secondary-row {
  flex-shrink: 0;
  /* Height = half of viewport width minus safe areas minus gaps.
     This creates a square for each card in the 2-up row */
  height: calc((100vw - var(--safe-left) - var(--safe-right) - 6px) / 2);
  max-height: 40vh;
}

.secondary-row {
  display: flex;
  gap: 2px;
  min-height: 0;
}
.secondary-row .card-slot {
  flex: 1;
}
.secondary-row .card-slot.slot-square {
  aspect-ratio: 1;
}

/* Card inner */
.card-slot-inner {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
  overflow: hidden;
}

.card-image-wrapper {
  position: relative;
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s var(--ease);
  will-change: transform;
}

.card-image {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.card-slot-border {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px; z-index: 2;
  border-radius: 3px 0 0 3px;
}

/* ---- CARD CONTROLS BAR ---- */
.card-controls {
  display: flex;
  align-items: center;
  height: var(--controls-height);
  padding: 0 6px;
  flex-shrink: 0;
  background: var(--viewer-bg);
  gap: 8px;
  transition: background 0.3s ease;
}

.nav-arrow {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--gray-100);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 700;
  color: var(--gray-800);
  transition: all 0.15s ease;
  flex-shrink: 0;
  border: 1.5px solid var(--gray-200);
}
.nav-arrow:active {
  transform: scale(0.88);
  background: var(--orange);
  border-color: var(--orange);
  color: white;
}
@media (hover: hover) {
  .nav-arrow:hover {
    background: rgba(255,123,0,0.08);
    border-color: var(--orange);
    color: var(--orange);
  }
}
body.dark-1 .nav-arrow,
body.dark-2 .nav-arrow {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.12);
  color: #eee;
}
body.dark-1 .nav-arrow:active,
body.dark-2 .nav-arrow:active {
  background: var(--orange);
  border-color: var(--orange);
  color: white;
}
body.dark-1 .card-controls,
body.dark-2 .card-controls { background: var(--viewer-bg); }

/* Multi-mode controls */
.viewer-area.mode-2 .card-controls,
.viewer-area.mode-3 .card-controls {
  height: 40px; padding: 0 4px; gap: 4px;
}
.viewer-area.mode-2 .nav-arrow,
.viewer-area.mode-3 .nav-arrow {
  width: 40px; height: 40px; font-size: 1.3rem;
  border-radius: 12px;
}

/* Card counter */
.card-counter {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(0,0,0,0.45);
  color: white;
  font-size: 0.58rem; font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  z-index: 5;
  backdrop-filter: blur(4px);
}

/* Card name */
.card-name {
  flex: 1; text-align: center;
  font-size: 0.72rem; font-weight: 600;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}

/* Multi-mode sizing */
.viewer-area.mode-2 .card-counter,
.viewer-area.mode-3 .card-counter {
  font-size: 0.5rem; padding: 1px 4px; top: 2px; right: 2px;
}
.viewer-area.mode-2 .card-name,
.viewer-area.mode-3 .card-name {
  font-size: 0.62rem;
}

/* Favorite button */
.card-fav-btn {
  position: absolute;
  top: 6px; left: 6px;
  width: 36px; height: 36px;
  border-radius: 12px;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; z-index: 10; color: white;
  transition: all 0.2s var(--ease);
  border: 1.5px solid rgba(255,255,255,0.15);
}
.card-fav-btn:active {
  transform: scale(0.85);
  background: rgba(0,0,0,0.5);
}
.card-fav-btn.active {
  color: #FFD700;
  background: rgba(0,0,0,0.55);
  border-color: rgba(255,215,0,0.4);
}
.viewer-area.mode-2 .card-fav-btn,
.viewer-area.mode-3 .card-fav-btn {
  width: 30px; height: 30px;
  font-size: 0.9rem;
  border-radius: 10px;
  top: 4px; left: 4px;
}

/* Remove button */
.card-remove-btn {
  position: absolute;
  bottom: 6px; right: 6px;
  width: 32px; height: 32px;
  border-radius: 10px;
  background: rgba(229,57,53,0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700;
  z-index: 10;
  transition: all 0.15s ease;
  border: 1.5px solid rgba(255,255,255,0.15);
}
.card-remove-btn:active {
  transform: scale(0.85);
  background: rgba(229,57,53,1);
}
.viewer-area.mode-2 .card-remove-btn,
.viewer-area.mode-3 .card-remove-btn {
  width: 26px; height: 26px; font-size: 0.7rem;
  bottom: 4px; right: 4px;
  border-radius: 8px;
}

/* ---- MODULE PICKER ---- */
.module-picker {
  background: var(--card-bg);
  border-top: 0.5px solid rgba(0,0,0,0.06);
  padding: 6px 10px;
  padding-left: calc(10px + var(--safe-left));
  padding-right: calc(10px + var(--safe-right));
  padding-bottom: calc(6px + var(--safe-bottom));
  display: flex; gap: 5px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
  transition: background 0.3s ease;
}
.module-picker::-webkit-scrollbar { display: none; }
body.dark-1 .module-picker,
body.dark-2 .module-picker {
  border-top-color: rgba(255,255,255,0.06);
}

.module-chip {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 0.72rem; font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s var(--ease);
  display: flex; align-items: center; gap: 4px;
  min-height: 36px;
}
.module-chip.inactive {
  background: transparent;
  border: 1.5px solid var(--gray-300);
  color: var(--text-secondary);
}
.module-chip.active {
  color: white;
  border: 1.5px solid transparent;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.module-chip:active { transform: scale(0.92); }

/* ---- MODALS ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}
.modal-content {
  position: relative;
  background: var(--card-bg);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px;
  padding-bottom: calc(20px + var(--safe-bottom));
  width: 100%; max-width: 500px; max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.35s var(--ease-bounce);
}
.modal-title {
  font-size: 1.05rem; font-weight: 700; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-close {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: var(--text-secondary);
  background: var(--gray-100);
}
.modal-option {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  margin-bottom: 8px; cursor: pointer;
  transition: all 0.2s ease;
  width: 100%; text-align: left; color: var(--text);
}
.modal-option:active { transform: scale(0.98); background: rgba(255,123,0,0.05); }
@media (hover: hover) { .modal-option:hover { border-color: var(--orange); } }
.modal-option-icon { font-size: 1.2rem; }
.modal-option-text { flex: 1; }
.modal-option-title { font-weight: 600; font-size: 0.85rem; }
.modal-option-desc { font-size: 0.7rem; color: var(--text-secondary); }

/* PDF Progress */
.pdf-progress { margin-top: 14px; }
.pdf-progress-bar {
  height: 4px; background: var(--gray-200);
  border-radius: 2px; overflow: hidden; margin-bottom: 6px;
}
.pdf-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--orange-light));
  border-radius: 2px;
  transition: width 0.3s ease; width: 0%;
}
.pdf-progress-text { font-size: 0.75rem; color: var(--text-secondary); text-align: center; }

/* ---- TOAST ---- */
.toast {
  position: fixed;
  bottom: calc(70px + var(--safe-bottom));
  left: 50%; transform: translateX(-50%);
  background: var(--gray-900); color: white;
  padding: 8px 18px; border-radius: 50px;
  font-size: 0.78rem; font-weight: 500;
  z-index: 2000;
  animation: toastIn 0.3s var(--ease-bounce), toastOut 0.3s ease 2.5s forwards;
  box-shadow: var(--shadow-lg);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(100%); } to { transform: translateY(0); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(16px) scale(0.9); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to { opacity: 0; transform: translateX(-50%) translateY(16px); }
}
@keyframes slotIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
.slot-enter { animation: slotIn 0.25s var(--ease-bounce); }

/* Staggered tile entrance */
.tile-enter {
  animation: tileIn 0.4s var(--ease-bounce) both;
}
@keyframes tileIn {
  from { opacity: 0; transform: translateY(20px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Card swipe animations */
.card-slide-left { animation: cardSlideLeft 0.22s var(--ease) forwards; }
.card-slide-right { animation: cardSlideRight 0.22s var(--ease) forwards; }
@keyframes cardSlideLeft {
  from { transform: translateX(60%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes cardSlideRight {
  from { transform: translateX(-60%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (min-width: 480px) {
  .home-view { padding: 16px; }
  .module-grid { gap: 10px; }
}

@media (min-width: 600px) {
  .module-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
  }
}

@media (min-width: 768px) {
  .module-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
  }
  .home-view { max-width: 800px; }
}

/* Landscape */
@media (orientation: landscape) and (max-height: 500px) {
  :root {
    --header-height: 36px;
    --controls-height: 26px;
  }
  .header-back, .header-btn { width: 28px; height: 28px; font-size: 0.85rem; }
  .header-title { font-size: 0.8rem; }
  .viewer-area.mode-2,
  .viewer-area.mode-3 { flex-direction: row; }
  .viewer-area.mode-3 .secondary-row {
    flex-direction: column;
    height: auto;
    max-height: none;
    flex: 1;
  }
  .module-picker { padding: 2px 6px; }
  .module-chip { padding: 2px 6px; font-size: 0.55rem; }
  .home-hero { padding: 2px 0 4px; }
  .home-logo { height: 24px; }
  .home-hero h1 { font-size: 0.9rem; }
  .home-hero p { font-size: 0.65rem; }
  .module-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
  }
}

/* Fullscreen */
:fullscreen .header { display: none; }
:fullscreen .module-picker { display: none; }
:fullscreen .viewer-area { padding: 0; }
:-webkit-full-screen .header { display: none; }
:-webkit-full-screen .module-picker { display: none; }
:-webkit-full-screen .viewer-area { padding: 0; }

/* Loading */
.card-loading {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  animation: pulse 1.5s ease infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

/* ============================================
   HOME ACTIONS (lang + share buttons)
   ============================================ */
.home-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}
.home-action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(0,0,0,0.05);
  color: var(--text-secondary);
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}
.home-action-btn span {
  font-size: 0.68rem;
}
.home-action-btn:active {
  transform: scale(0.93);
  background: rgba(255,123,0,0.12);
  color: var(--orange);
}
@media (hover: hover) {
  .home-action-btn:hover {
    background: rgba(255,123,0,0.08);
    color: var(--orange);
  }
}
body.dark-1 .home-action-btn,
body.dark-2 .home-action-btn {
  background: rgba(255,255,255,0.08);
  color: #aaa;
}
body.dark-1 .home-action-btn:active,
body.dark-2 .home-action-btn:active {
  background: rgba(255,123,0,0.15);
  color: var(--orange);
}

/* ============================================
   LANGUAGE MODAL
   ============================================ */
.lang-modal {
  max-height: 70vh;
}
.lang-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 55vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}
.lang-list::-webkit-scrollbar {
  width: 3px;
}
.lang-list::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}
.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  text-align: left;
  color: var(--text);
  border: 1px solid transparent;
}
.lang-option:hover {
  background: rgba(255,123,0,0.05);
}
.lang-option:active {
  transform: scale(0.98);
}
.lang-option.active {
  background: rgba(255,123,0,0.08);
  border-color: var(--orange);
}
.lang-native {
  font-weight: 600;
  font-size: 0.88rem;
  flex: 1;
}
.lang-name {
  font-size: 0.72rem;
  color: var(--text-secondary);
}
.lang-check {
  color: var(--orange);
  font-weight: 700;
  font-size: 1rem;
}
body.dark-1 .lang-option:hover,
body.dark-2 .lang-option:hover {
  background: rgba(255,255,255,0.05);
}
body.dark-1 .lang-option.active,
body.dark-2 .lang-option.active {
  background: rgba(255,123,0,0.12);
}

/* ============================================
   PROMO MODAL
   ============================================ */
.promo-modal {
  text-align: center;
  padding-top: 24px;
}
.promo-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; font-weight: 700;
  color: white;
  background: var(--gray-800);
  z-index: 2;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  border: 2px solid var(--card-bg);
  transition: all 0.15s ease;
}
.promo-close:active {
  transform: scale(0.85);
  background: var(--red);
}
body.dark-1 .promo-close,
body.dark-2 .promo-close {
  background: var(--gray-600);
  border-color: var(--card-bg);
}
.promo-logo {
  margin-bottom: 12px;
}
.promo-logo img {
  height: 44px;
  filter: drop-shadow(0 2px 8px rgba(255,123,0,0.3));
}
.promo-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}
.promo-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

/* Promo CTA buttons */
.promo-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  width: 100%;
  text-align: left;
  margin-bottom: 10px;
}
.promo-cta-primary {
  background: var(--orange);
  color: white;
  border: none;
  box-shadow: 0 4px 16px rgba(255,123,0,0.3);
}
.promo-cta-primary:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(255,123,0,0.2);
}
.promo-cta-secondary {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--orange);
}
.promo-cta-secondary:active {
  transform: scale(0.97);
  background: rgba(255,123,0,0.05);
}
.promo-cta-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}
.promo-cta-text {
  flex: 1;
}
.promo-cta-title {
  font-weight: 700;
  font-size: 0.88rem;
}
.promo-cta-desc {
  font-size: 0.7rem;
  opacity: 0.8;
}
.promo-cta-primary .promo-cta-desc {
  color: rgba(255,255,255,0.85);
}

/* Promo badges */
.promo-badges {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--gray-200);
}
body.dark-1 .promo-badges,
body.dark-2 .promo-badges {
  border-top-color: rgba(255,255,255,0.08);
}

/* ============================================
   STORE BADGES (home footer + promo)
   ============================================ */
.store-badges {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 10px 0 4px;
  flex-shrink: 0;
}
.store-badge {
  display: block;
  transition: transform 0.2s var(--ease), opacity 0.2s ease;
  opacity: 0.75;
}
.store-badge:active {
  transform: scale(0.93);
}
.store-badge:hover {
  opacity: 1;
}
.store-badge img {
  height: 34px;
  width: auto;
}
body.dark-1 .store-badge img,
body.dark-2 .store-badge img {
  filter: brightness(0.9);
}

/* ============================================
   RTL SUPPORT
   ============================================ */
[dir="rtl"] .header-back svg {
  transform: scaleX(-1);
}
[dir="rtl"] .card-slot-border {
  left: auto;
  right: 0;
  border-radius: 0 3px 3px 0;
}
[dir="rtl"] .card-fav-btn {
  left: auto;
  right: 4px;
}
[dir="rtl"] .card-remove-btn {
  right: auto;
  left: 30px;
}
[dir="rtl"] .card-counter {
  right: auto;
  left: 4px;
}
[dir="rtl"] .favorites-tile-arrow {
  transform: scaleX(-1);
}
[dir="rtl"] .modal-option {
  text-align: right;
}
[dir="rtl"] .promo-cta {
  text-align: right;
}
[dir="rtl"] .lang-option {
  text-align: right;
}
