/* ============================================================
   CLIPIBORA — O‘zbek milliy iboralari va madaniyati platformasi
   Design System: Artisan Editorial & Living Cultural Archive
   ============================================================ */

:root {
  /* ---- Ipak yo‘li & Tarixiy koshinlar palitrasi (Light Mode) ---- */
  --canvas: #FAF6EE;             /* Qadimiy qo‘lyozma qog‘ozi (Canvas Parchment) */
  --surface: #FFFDF9;            /* Alabaster toza sirt (Cards & Panels) */
  --surface-2: #F2EADB;          /* Iliq qoramtir pergament (Secondary Fill) */
  --surface-card: #FFFFFF;
  --surface-float: #FFFFFF;

  /* Chuqur tabiiy siyohlar */
  --ink: #1C1917;                /* Charcoal Ink (Bosh matn, Zinc-950) */
  --ink-soft: #5C5549;           /* Qadimiy kotib rangi (Muted text) */
  --ink-faint: #8E8575;          /* Kuchizlangan yordamchi matn */

  /* 1px Nafis chegaralar */
  --line: rgba(168, 142, 102, 0.22);
  --line-strong: rgba(168, 142, 102, 0.45);

  /* Ipak yo'li asosiy aksentlari */
  --cobalt: #17457E;             /* Registon koshini (Primary Brand) */
  --cobalt-deep: #0E2E56;
  --cobalt-tint: rgba(23, 69, 126, 0.08);
  --cobalt-tint-2: rgba(23, 69, 126, 0.14);

  --turquoise: #248277;          /* Shohi Zinda feruzasi */
  --turquoise-tint: rgba(36, 130, 119, 0.09);
  --turquoise-tint-2: rgba(36, 130, 119, 0.18);

  --saffron: #D9822B;            /* Buxoro zarhali va za'faron */
  --saffron-tint: rgba(217, 130, 43, 0.10);

  --terracotta: #B45309;         /* Pishgan g'isht va qadimiy kulolchilik */
  --terracotta-tint: rgba(180, 83, 9, 0.09);

  --suzani: #B93828;             /* Nurota va Samarqand so‘zanasi qizili */
  --suzani-tint: rgba(185, 56, 40, 0.09);

  --green: #236B4E;              /* Farg‘ona vodiysi yam-yashil tabiati */
  --green-tint: rgba(35, 107, 78, 0.10);

  /* Tizimli signallar */
  --good: var(--green);
  --warn: var(--saffron);
  --crit: var(--suzani);

  /* Funksional xaritalar */
  --bg: var(--canvas);
  --text: var(--ink);
  --text-2: var(--ink-soft);
  --text-3: var(--ink-faint);
  --accent: var(--cobalt);
  --accent-ink: #FFFFFF;

  /* ---- Tipografiya arxitekturasi ---- */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-ui: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", monospace;

  /* ---- Mayin tabiiy soyalar (Diffused Warm Shadows) ---- */
  --shadow-sm: 0 1px 3px rgba(43, 38, 32, 0.05), 0 1px 2px rgba(43, 38, 32, 0.03);
  --shadow-md: 0 4px 14px -2px rgba(43, 38, 32, 0.06), 0 2px 6px rgba(43, 38, 32, 0.03);
  --shadow-lg: 0 14px 28px -4px rgba(43, 38, 32, 0.08), 0 4px 10px rgba(43, 38, 32, 0.03);
  --shadow-hover: 0 12px 24px -4px rgba(23, 69, 126, 0.12), 0 4px 8px rgba(43, 38, 32, 0.04);

  /* Burchak radiuslari */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --r-pill: 999px;

  /* O'lcham va bo'shliqlar miqyosi */
  --maxw: 1160px;
  --page-pad: clamp(1rem, 3.5vw, 2.25rem);
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Boshqaruv tugmalari geometriyasi */
  --btn-h: 46px;
  --btn-h-sm: 38px;
  --btn-h-lg: 52px;

  /* Harakat tezlanishi (Spring Physics) */
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --tr-fast: 160ms var(--ease-spring);
  --tr-norm: 260ms var(--ease-spring);
}

/* ---- Samarqand Tuni (Dark Mode) ---- */
:root[data-theme="dark"] {
  --canvas: #110F0D;
  --surface: #181512;
  --surface-2: #211D18;
  --surface-card: #1A1713;
  --surface-float: #211D18;

  --ink: #F7F1E7;
  --ink-soft: #B8AC99;
  --ink-faint: #7E7361;

  --line: rgba(220, 200, 170, 0.13);
  --line-strong: rgba(220, 200, 170, 0.24);

  --cobalt: #4686D4;
  --cobalt-deep: #2A5A96;
  --cobalt-tint: rgba(70, 134, 212, 0.15);
  --cobalt-tint-2: rgba(70, 134, 212, 0.25);

  --turquoise: #38B8A9;
  --turquoise-tint: rgba(56, 184, 169, 0.14);
  --turquoise-tint-2: rgba(56, 184, 169, 0.24);

  --saffron: #E89E3A;
  --saffron-tint: rgba(232, 158, 58, 0.15);

  --terracotta: #D47432;
  --terracotta-tint: rgba(212, 116, 50, 0.15);

  --suzani: #D95443;
  --suzani-tint: rgba(217, 84, 67, 0.16);

  --green: #41A877;
  --green-tint: rgba(65, 168, 119, 0.16);

  --bg: var(--canvas);
  --text: var(--ink);
  --text-2: var(--ink-soft);
  --text-3: var(--ink-faint);
  --accent: var(--cobalt);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.65);
  --shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.6);
}

/* ============================================================
   ASOSIY VA ACCESSIBILITY QOIDALARI
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Accessibility: Skip Link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 1000;
  background: var(--cobalt);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--r-sm);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  transition: top var(--tr-fast);
}
.skip-link:focus {
  top: 1rem;
  outline: 3px solid var(--turquoise);
  outline-offset: 2px;
}

/* Keyboard Focus Ring */
:focus-visible {
  outline: 2px solid var(--turquoise);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  line-height: 1.22;
  margin: 0;
  text-wrap: balance;
  letter-spacing: -0.015em;
}

h1 { font-size: clamp(1.5rem, 2.3vw, 2.15rem); font-weight: 750; }
h2 { font-size: clamp(1.2rem, 1.7vw, 1.5rem); font-weight: 700; }
h3 { font-size: 1.12rem; font-weight: 650; }

a {
  color: var(--cobalt);
  text-decoration: none;
  transition: color var(--tr-fast);
}
a:hover {
  color: var(--turquoise);
}

button {
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.uz {
  font-family: var(--font-display);
}

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.hide { display: none !important; }

.eyebrow {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cobalt);
}

/* ============================================================
   APP SHELL (TOPBAR & NAVIGATION)
   ============================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: color-mix(in srgb, var(--bg) 93%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  transition: background var(--tr-norm), border-color var(--tr-norm);
  overflow: hidden;
}

/* Navbarni orqa tomonidagi chiroyli fade (so'nish) effektli xoshiya */
.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url('../public/assets/patterns/web/moziy-border.png');
  background-repeat: repeat-x;
  background-position: bottom center;
  background-size: auto 24px;
  opacity: 0.14;
  pointer-events: none;
  z-index: 0;
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.2) 50%, rgba(0, 0, 0, 0) 90%);
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.2) 50%, rgba(0, 0, 0, 0) 90%);
}

:root[data-theme="dark"] .topbar::before {
  opacity: 0.12;
}

.topbar .in {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.45rem var(--page-pad);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 56px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  text-decoration: none;
  flex-shrink: 0;
}
.brand svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(23, 69, 126, 0.2));
  transition: transform var(--tr-fast);
}
.brand:hover svg {
  transform: scale(1.08) rotate(5deg);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.25rem;
  flex-wrap: nowrap;
}
.topnav a {
  padding: 0.38rem 0.75rem;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-2);
  transition: all var(--tr-fast);
  white-space: nowrap;
  flex-shrink: 0;
}
.topnav a:hover {
  color: var(--text);
  background: var(--surface-2);
}
.topnav a.active, .topnav a[aria-current="page"] {
  color: var(--cobalt);
  background: var(--cobalt-tint-2);
}

.spacer {
  flex: 1;
}

/* Role Switcher Pill */
.role-switch {
  display: flex;
  background: var(--surface-2);
  padding: 2px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.role-switch button {
  border: none;
  background: transparent;
  padding: 0.28rem 0.72rem;
  border-radius: var(--r-pill);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  transition: all var(--tr-fast);
  white-space: nowrap;
}
.role-switch button.on {
  background: var(--surface);
  color: var(--cobalt);
  box-shadow: var(--shadow-sm);
}

/* Icon Buttons */
.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 1.05rem;
  transition: all var(--tr-fast);
  flex-shrink: 0;
}
.iconbtn:hover {
  background: var(--surface-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.iconbtn:active {
  transform: translateY(1px) scale(0.96);
}

/* Mobile Tabbar */
.tabbar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  justify-content: space-around;
  overflow: hidden;
}
.tabbar::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url('../public/assets/patterns/web/moziy-border.png');
  background-repeat: repeat-x;
  background-position: top center;
  background-size: auto 24px;
  opacity: 0.16;
  pointer-events: none;
  z-index: 0;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 80%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 80%);
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--tr-fast);
  position: relative;
  z-index: 2;
}
.tabbar a svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
}
.tabbar a.active, .tabbar a[aria-current="page"] {
  color: var(--cobalt);
}
.tabbar a.active::after {
  content: "";
  position: absolute;
  bottom: 1px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--cobalt);
}

@media (max-width: 768px) {
  .topnav, .role-switch { display: none; }
  .tabbar { display: flex; }
  body { padding-bottom: 70px; }
}

/* ============================================================
   PAGE LAYOUT & HERO SECTION
   ============================================================ */

.page {
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 2.5rem) var(--page-pad);
  flex: 1;
}

/* Hero Section: Asymmetric Living Cultural Architecture */
.hero {
  position: relative;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: clamp(1.25rem, 2.5vw, 2.25rem);
  overflow: hidden;
  margin-bottom: var(--space-6);
}
.hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 14px;
  background: url('../public/assets/patterns/web/moziy-border.png') repeat-x center;
  background-size: auto 14px;
  opacity: 0.75;
  mask-image: linear-gradient(90deg, transparent 0%, black 5%, black 95%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 5%, black 95%, transparent 100%);
}

.hero-split {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: clamp(1.25rem, 2.5vw, 2.25rem);
  align-items: center;
  position: relative;
  z-index: 2;
}
@media (max-width: 880px) {
  .hero-split {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero h1 {
  margin: 0.65rem 0 0.85rem;
  font-size: clamp(1.45rem, 2.2vw, 2.15rem);
  color: var(--text);
  line-height: 1.22;
}

.hero p.lead {
  font-size: 0.95rem;
  color: var(--text-2);
  margin-bottom: 1.25rem;
  line-height: 1.6;
  max-width: 54ch;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* Hero San'atkorona tasvir ramkasi (Artwork frame) */
.hero-art-frame {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  background: var(--surface);
  transition: transform var(--tr-norm), box-shadow var(--tr-norm);
}
.hero-art-frame:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}
.hero-art {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}
.hero-art-caption {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
}
.shamsa-icon img {
  border-radius: 50%;
  display: block;
  border: 1px solid rgba(217, 130, 43, 0.35);
  box-shadow: 0 1px 4px rgba(217, 130, 43, 0.15);
}

/* Section Header */
.section-header {
  margin: 2.25rem 0 1.25rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.75rem;
}
.section-header h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-header p {
  margin: 0.3rem 0 0;
  color: var(--text-2);
  font-size: 0.95rem;
}

/* ============================================================
   BUTTONS & CONTROLS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: var(--btn-h);
  padding: 0 1.5rem;
  border-radius: var(--r-pill);
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--tr-fast);
  white-space: nowrap;
}
.btn:active {
  transform: translateY(1px) scale(0.985);
}

.btn-primary {
  background: var(--cobalt);
  color: #FFFFFF;
  border-color: var(--cobalt-deep);
  box-shadow: 0 2px 8px rgba(23, 69, 126, 0.25);
}
.btn-primary:hover {
  background: #1e5294;
  color: #FFFFFF;
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}
.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.btn-learn {
  background: var(--turquoise-tint-2);
  color: var(--turquoise);
  border-color: color-mix(in srgb, var(--turquoise) 30%, transparent);
}
.btn-learn:hover {
  background: var(--turquoise);
  color: #FFFFFF;
  transform: translateY(-1px);
}

.btn-success {
  background: var(--green);
  color: #FFFFFF;
  border-color: color-mix(in srgb, var(--green) 30%, transparent);
}
.btn-success:hover {
  background: #1b533d;
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--suzani);
  color: #FFFFFF;
  border-color: color-mix(in srgb, var(--suzani) 30%, transparent);
}
.btn-danger:hover {
  background: #962c1f;
}

.btn-sm {
  height: var(--btn-h-sm);
  padding: 0 1.1rem;
  font-size: 0.85rem;
}
.btn-lg {
  height: var(--btn-h-lg);
  padding: 0 2rem;
  font-size: 1.05rem;
}
.btn-block {
  width: 100%;
}

/* ============================================================
   CHIPS & BADGES
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.75rem;
  border-radius: var(--r-pill);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  border: 1px solid transparent;
}
.b-cobalt { background: var(--cobalt-tint); color: var(--cobalt); border-color: var(--cobalt-tint-2); }
.b-turq   { background: var(--turquoise-tint); color: var(--turquoise); border-color: var(--turquoise-tint-2); }
.b-terra  { background: var(--terracotta-tint); color: var(--terracotta); border-color: rgba(180, 83, 9, 0.2); }
.b-saffron{ background: var(--saffron-tint); color: var(--saffron); border-color: rgba(217, 130, 43, 0.2); }
.b-green  { background: var(--green-tint); color: var(--green); border-color: rgba(35, 107, 78, 0.2); }
.b-suzani { background: var(--suzani-tint); color: var(--suzani); border-color: rgba(185, 56, 40, 0.2); }
.b-muted  { background: var(--surface-2); color: var(--text-2); border-color: var(--line); }

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

/* ============================================================
   CARDS & GRIDS
   ============================================================ */

.grid {
  display: grid;
  gap: 1.25rem;
}
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.autofit { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

@media (max-width: 900px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .g4, .g3, .g2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--tr-fast);
  overflow: hidden;
  position: relative;
}
.card.pad {
  padding: 1.5rem;
}
.card:hover {
  border-color: var(--line-strong);
}

/* Topic & Word Card (tcard) */
.tcard {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--tr-fast), box-shadow var(--tr-fast), border-color var(--tr-fast);
  text-decoration: none;
  color: inherit;
}
.tcard:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: color-mix(in srgb, var(--cobalt) 40%, var(--line));
}
.tcard .cover {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  font-size: 3rem;
}
.tcard .cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 320ms var(--ease-spring);
}
.tcard:hover .cover img {
  transform: scale(1.04);
}
.tcard .body {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Card Cover Image & Heritage Overlays */
.card-img-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(14, 46, 86, 0.05) 0%, rgba(14, 46, 86, 0.55) 100%);
  pointer-events: none;
  transition: opacity var(--tr-fast);
}
.tcard:hover .card-cover-overlay {
  opacity: 0.75;
}
.card-cultural-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: rgba(14, 46, 86, 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  z-index: 2;
}
.card-cultural-badge img {
  width: 13px !important;
  height: 13px !important;
  border-radius: 50%;
  object-fit: cover;
  display: inline-block;
}

/* Phrase Mini Card Heritage Header */
.phrase-mini-card .phrase-mini-cover {
  height: 54px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--cobalt-deep) 0%, var(--cobalt) 60%, var(--turquoise) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.9rem;
}
.phrase-mini-bg {
  position: absolute;
  inset: 0;
  background: url('../public/assets/patterns/web/moziy-border.png') repeat-x center;
  background-size: auto 30px;
  opacity: 0.22;
  pointer-events: none;
}
.phrase-mini-badge {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.phrase-mini-rosette {
  width: 14px !important;
  height: 14px !important;
  border-radius: 50%;
  object-fit: cover;
}
.phrase-mini-id {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #fff;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}
.phrase-mini-tag {
  position: relative;
  z-index: 2;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
}

/* Vcard Heritage Cover */
.vcard-cover {
  height: 84px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--cobalt-deep) 0%, var(--cobalt) 65%, var(--turquoise) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.vcard-cover-bg {
  position: absolute;
  inset: 0;
  background: url('../public/assets/patterns/web/moziy-border.png') repeat-x center;
  background-size: auto 36px;
  opacity: 0.25;
  pointer-events: none;
}
.vcard-cover-badge {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 4px 14px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.vcard-cover-rosette {
  width: 18px !important;
  height: 18px !important;
  border-radius: 50%;
  object-fit: cover;
}

/* Big Vocabulary Study Card (vcard) */
.vcard {
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  margin: 1rem auto 2rem;
  max-width: 680px;
  overflow: hidden;
  position: relative;
}
.vcard::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 16px;
  background: url('../public/assets/patterns/web/moziy-border.png') repeat-x center;
  background-size: auto 16px;
  opacity: 0.9;
  z-index: 5;
  mask-image: linear-gradient(90deg, transparent 0%, black 5%, black 95%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 5%, black 95%, transparent 100%);
}
.vcard-shamsa {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(217, 130, 43, 0.4);
  box-shadow: 0 2px 8px rgba(217, 130, 43, 0.2);
  flex-shrink: 0;
}
.vcard .cover {
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.vcard .word-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.5vw, 2.6rem);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}
.vcard .defn {
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 1rem 0;
  color: var(--text);
}
.vcard .example {
  background: var(--surface-2);
  border-left: 3px solid var(--saffron);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-style: italic;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text);
  margin: 1.25rem 0;
}
.vcard .context-box {
  background: var(--turquoise-tint);
  border: 1px solid var(--turquoise-tint-2);
  border-radius: var(--r-md);
  padding: 1.1rem 1.25rem;
  margin: 1rem 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ============================================================
   AUDIO WAVE VISUALIZER BUTTON
   ============================================================ */

.audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  height: 42px;
  padding: 0 1.15rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--turquoise-tint-2);
  background: var(--turquoise-tint);
  color: var(--turquoise);
  font-weight: 700;
  font-size: 0.88rem;
  transition: all var(--tr-fast);
}
.audio-btn:hover {
  background: var(--turquoise);
  color: #FFFFFF;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(36, 130, 119, 0.25);
}
.audio-btn:active {
  transform: translateY(1px) scale(0.97);
}

.wave {
  display: inline-flex;
  align-items: center;
  gap: 2.5px;
  height: 18px;
}
.wave i {
  display: block;
  width: 3px;
  height: 8px;
  background: currentColor;
  border-radius: 2px;
  transition: height 120ms ease;
}
.audio-btn.playing .wave i:nth-child(1) { animation: wavePulse 0.5s ease infinite alternate; }
.audio-btn.playing .wave i:nth-child(2) { animation: wavePulse 0.7s ease infinite alternate 0.1s; }
.audio-btn.playing .wave i:nth-child(3) { animation: wavePulse 0.4s ease infinite alternate 0.2s; }
.audio-btn.playing .wave i:nth-child(4) { animation: wavePulse 0.6s ease infinite alternate 0.15s; }
.audio-btn.playing .wave i:nth-child(5) { animation: wavePulse 0.5s ease infinite alternate 0.25s; }

@keyframes wavePulse {
  0%   { height: 4px; }
  100% { height: 18px; }
}

/* ============================================================
   PROGRESS BAR & METRIC STATS
   ============================================================ */

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.85rem 1rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform var(--tr-fast);
}
.stat:hover {
  transform: translateY(-2px);
}
.stat .v {
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 0.2rem;
}
.stat .k {
  font-size: 0.72rem;
  color: var(--text-2);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.progbar {
  background: var(--surface-2);
  height: 8px;
  border-radius: var(--r-pill);
  overflow: hidden;
  position: relative;
  margin: 0.5rem 0;
}
.progbar-fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--turquoise), var(--cobalt));
  transition: width 400ms var(--ease-spring);
}

/* ============================================================
   INTERACTIVE GAME LAYOUTS (MATCH, LISTEN, BUILD)
   ============================================================ */

.activity {
  max-width: 720px;
  margin: 1rem auto 2.5rem;
}

.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 580px) {
  .match-grid { grid-template-columns: 1fr; }
}

.match-item {
  background: var(--surface-card);
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 84px;
  box-shadow: var(--shadow-sm);
  transition: all var(--tr-fast);
  text-align: center;
  user-select: none;
}
.match-item:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}
.match-item.sel {
  border-color: var(--cobalt);
  background: var(--cobalt-tint);
  box-shadow: 0 0 0 3px var(--cobalt-tint-2);
}
.match-item.ok {
  border-color: var(--green) !important;
  background: var(--green-tint) !important;
  color: var(--green) !important;
  pointer-events: none;
}
.match-item.bad {
  border-color: var(--suzani) !important;
  background: var(--suzani-tint) !important;
  animation: shake 0.35s ease;
}

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

/* Dots Progress */
.progress-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 1rem 0;
}
.progress-dots i {
  display: block;
  width: 24px;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  transition: all var(--tr-fast);
}
.progress-dots i.cur {
  background: var(--cobalt);
  width: 38px;
}
.progress-dots i.done {
  background: var(--green);
}

/* Sentence Builder */
.sentence-slot {
  min-height: 72px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: var(--surface);
  margin-top: 1.25rem;
}
.tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 1.25rem 0;
}
.token {
  background: var(--surface-card);
  border: 1px solid var(--line);
  padding: 0.5rem 1rem;
  border-radius: var(--r-pill);
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--tr-fast);
  user-select: none;
}
.token:hover {
  border-color: var(--cobalt);
  transform: translateY(-2px);
}
.token.used {
  opacity: 0.3;
  pointer-events: none;
  border-style: dashed;
}

/* Feedback alert */
.feedback {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--r-md);
  margin: 1rem 0;
  font-weight: 600;
  animation: fadeIn 200ms ease;
}
.feedback .ic {
  font-size: 1.15rem;
  line-height: 1.4;
  flex-shrink: 0;
}
.feedback .txt {
  flex: 1;
  line-height: 1.5;
}
.feedback .txt strong {
  color: inherit;
  font-weight: 750;
}
.feedback .txt small {
  display: block;
  margin-top: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  opacity: 0.92;
  line-height: 1.45;
}
.feedback.good {
  background: var(--green-tint);
  border: 1px solid color-mix(in srgb, var(--green) 30%, transparent);
  color: var(--green);
}
.feedback.bad {
  background: var(--suzani-tint);
  border: 1px solid color-mix(in srgb, var(--suzani) 30%, transparent);
  color: var(--suzani);
}
.feedback.think {
  background: var(--saffron-tint);
  border: 1px solid color-mix(in srgb, var(--saffron) 30%, transparent);
  color: var(--saffron);
}

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

/* ============================================================
   FORMS & INPUTS
   ============================================================ */

.fl {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-2);
  margin: 0.75rem 0 0.35rem;
}

input[type="text"], input[type="search"], select, textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  box-sizing: border-box;
  transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--turquoise);
  box-shadow: 0 0 0 3px var(--turquoise-tint-2);
}
textarea {
  resize: vertical;
  min-height: 100px;
}

/* ============================================================
   TABLES & DATA ANALYTICS
   ============================================================ */

.tbl-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin: 1rem 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.925rem;
}
th {
  background: var(--surface-2);
  padding: 0.85rem 1.15rem;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  border-bottom: 1px solid var(--line);
}
td {
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--line);
}
tr:last-child td {
  border-bottom: none;
}
td.n, th.n {
  text-align: right;
  font-family: var(--font-mono);
}

/* ============================================================
   TOASTS & MODALS
   ============================================================ */

.toast-wrap {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
@media (max-width: 640px) {
  .toast-wrap {
    bottom: 5rem;
    left: 1rem;
    right: 1rem;
  }
}

.toast {
  background: var(--ink);
  color: var(--canvas);
  padding: 0.75rem 1.25rem;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideUp 240ms var(--ease-spring);
}

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

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(18, 16, 14, 0.55);
  backdrop-filter: blur(8px);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 200ms ease;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  max-width: 540px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 280ms var(--ease-spring);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal .mh {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal .mb {
  padding: 1.5rem;
  max-height: 80vh;
  overflow-y: auto;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   VIEWS & COMPONENTS EXTENSIONS
   ============================================================ */

/* Breadcrumb button */
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: none;
  color: var(--cobalt);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--r-pill);
  cursor: pointer;
  margin-bottom: 1rem;
  transition: all var(--tr-fast);
}
.crumb:hover {
  background: var(--cobalt-tint);
  transform: translateX(-3px);
}

/* Rowhead */
.rowhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 2.25rem 0 1rem;
}
.rowhead h2 {
  font-size: 1.35rem;
  margin: 0;
}

/* Circular Progress Ring */
.ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: conic-gradient(var(--turquoise) calc(var(--p, 0) * 1%), var(--surface-2) 0);
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
}
.ring::before {
  content: "";
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
}
.ring::after {
  content: attr(data-label);
  position: absolute;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
}
.ring.lg {
  width: 78px;
  height: 78px;
}
.ring.lg::before {
  width: 62px;
  height: 62px;
}
.ring.lg::after {
  font-size: 0.88rem;
}

/* Progress Bar */
.bar {
  background: var(--surface-2);
  height: 8px;
  border-radius: var(--r-pill);
  overflow: hidden;
  position: relative;
  margin: 0.5rem 0;
}
.bar i {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--turquoise), var(--cobalt));
  transition: width 400ms var(--ease-spring);
}

/* Achievements */
.ach {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.35rem 1.15rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--tr-fast);
}
.ach:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}
.ach.locked {
  opacity: 0.5;
  filter: grayscale(0.85);
  border-style: dashed;
}
.ach .medal {
  font-size: 2.25rem;
  width: 58px;
  height: 58px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  margin-bottom: 0.25rem;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-xl);
  margin: 1.5rem 0;
}
.empty .big {
  font-size: 3.2rem;
  margin-bottom: 0.75rem;
}
.empty-illo {
  width: 80px;
  height: 80px;
  margin: 0 auto 1rem;
  opacity: 0.75;
}

/* Cultural Fact Card */
.fact {
  position: relative;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 1.85rem 2rem;
  margin: 2.25rem 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.fact::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 16px;
  background: url('../public/assets/patterns/web/moziy-border.png') repeat-x center;
  background-size: auto 16px;
  opacity: 0.88;
  mask-image: linear-gradient(90deg, transparent 0%, black 5%, black 95%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 5%, black 95%, transparent 100%);
}
.fact-illo {
  position: absolute;
  right: -15px;
  bottom: -15px;
  width: 140px;
  opacity: 0.18;
  pointer-events: none;
}

/* Girih / Ornate Divider with Clipibora Tezhib Ribbon */
.girih, .ornate-divider {
  margin: 2.75rem 0;
  width: 100%;
  height: 28px;
  background: url('../public/assets/patterns/web/moziy-border.png') repeat-x center;
  background-size: auto 28px;
  opacity: 0.92;
  mask-image: linear-gradient(90deg, transparent 0%, black 5%, black 95%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 5%, black 95%, transparent 100%);
}

/* External resource cards */
.res-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}
.res-card {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--tr-fast), border-color var(--tr-fast);
}
.res-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}
.res-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.res-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-3);
}
.res-card h3 {
  font-size: 1.05rem;
  margin: 0;
  font-family: var(--font-ui);
}

/* Chart Legend & dots */
.legend {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-2);
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Callout Notes */
.note {
  background: var(--surface-2);
  border-left: 3px solid var(--cobalt);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  margin: 1.25rem 0;
  font-size: 0.95rem;
  color: var(--text);
}
.note.warn {
  border-left-color: var(--saffron);
  background: var(--saffron-tint);
}

/* Images inside card covers */
.cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-illo {
  position: absolute;
  right: -20px;
  bottom: -20px;
  width: 320px;
  height: 320px;
  opacity: 0.15;
  pointer-events: none;
}

/* ============================================================
   GOOGLE SHEETS REAL-TIME SYNC CHIP & PHRASE CATALOG UI
   ============================================================ */

.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--tr-fast);
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.sync-chip:hover {
  background: var(--surface-card);
  border-color: var(--cobalt);
  color: var(--ink);
  transform: translateY(-1px);
}
.sync-chip .sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2px var(--green-tint);
  flex-shrink: 0;
}
.sync-chip.syncing .sync-dot {
  background: var(--saffron);
  animation: pulseSync 1s infinite alternate ease-in-out;
}
.sync-chip.offline .sync-dot {
  background: var(--ink-faint);
  box-shadow: none;
}
@keyframes pulseSync {
  0% { transform: scale(0.85); opacity: 0.6; }
  100% { transform: scale(1.25); opacity: 1; }
}

/* Catalog Filter Tabs */
.catalog-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin: 1.25rem 0;
  scrollbar-width: thin;
}
.tab-pill {
  padding: 0.45rem 1rem;
  border-radius: var(--r-pill);
  font-size: 0.86rem;
  font-weight: 700;
  background: var(--surface-card);
  border: 1px solid var(--line);
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--tr-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.tab-pill:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}
.tab-pill.active {
  background: var(--cobalt);
  color: #fff;
  border-color: var(--cobalt);
  box-shadow: 0 2px 8px var(--cobalt-tint-2);
}
.tab-pill .tab-count {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  opacity: 0.8;
  padding: 0.1rem 0.35rem;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 99px;
}
.tab-pill.active .tab-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Search Input inside Catalog */
.search-bar-wrap {
  position: relative;
  max-width: 520px;
  margin: 0.75rem 0 1.25rem;
}
.search-bar-wrap input {
  padding-left: 2.75rem;
  height: 48px;
  border-radius: var(--r-pill);
  font-size: 0.95rem;
  background: var(--surface-card);
}
.search-bar-wrap .search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 1.1rem;
  pointer-events: none;
}

/* Phrase Cards (pcard) */
.pcard {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform var(--tr-fast), box-shadow var(--tr-fast), border-color var(--tr-fast);
  position: relative;
  overflow: hidden;
}
.pcard::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cobalt), var(--turquoise));
  opacity: 0;
  transition: opacity var(--tr-fast);
}
.pcard:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-hover);
}
.pcard:hover::before {
  opacity: 1;
}
.pcard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.pcard-id {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-3);
  font-weight: 700;
}
.pcard-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.pcard-meaning {
  font-size: 0.92rem;
  color: var(--text-2);
  line-height: 1.5;
  margin: 0;
  flex: 1;
}
.pcard-meaning.draft {
  font-style: italic;
  color: var(--text-3);
}
.pcard-example {
  font-size: 0.85rem;
  color: var(--text-3);
  background: var(--surface-2);
  padding: 0.5rem 0.75rem;
  border-radius: var(--r-sm);
  font-style: italic;
  border-left: 2px solid var(--turquoise);
}

/* Interactive Quiz Game (Ma'nosini top & Omonimlar) */
.quiz-box {
  max-width: 680px;
  margin: 1.5rem auto;
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: clamp(1.25rem, 4vw, 2rem);
  box-shadow: var(--shadow-md);
  position: relative;
}
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
}
.quiz-prompt-phrase {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 2.3rem);
  font-weight: 800;
  text-align: center;
  margin: 1rem 0 0.5rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.quiz-options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.75rem;
}
@media (max-width: 640px) {
  .quiz-options-grid {
    grid-template-columns: 1fr;
  }
}
.quiz-opt-btn {
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-lg);
  padding: 1.15rem 1.25rem;
  text-align: left;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: all var(--tr-fast);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  position: relative;
}
.quiz-opt-btn:hover:not(:disabled) {
  border-color: var(--cobalt);
  background: var(--surface-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.quiz-opt-btn:active:not(:disabled) {
  transform: translateY(0);
}
.quiz-opt-btn .opt-key {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-2);
  flex-shrink: 0;
}
.quiz-opt-btn.ok {
  background: var(--green-tint) !important;
  border-color: var(--green) !important;
  color: var(--green) !important;
}
.quiz-opt-btn.bad {
  background: var(--suzani-tint) !important;
  border-color: var(--suzani) !important;
  color: var(--suzani) !important;
  animation: shake 0.35s ease;
}

/* Pair Matching Board (Antonimlar & Sinonimlar) */
.pair-board {
  max-width: 800px;
  margin: 1.5rem auto;
}
.pair-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}
@media (max-width: 640px) {
  .pair-cols {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}
.pair-col-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  margin-bottom: 0.75rem;
  text-align: center;
}
.pair-item-btn {
  width: 100%;
  background: var(--surface-card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1rem 1.15rem;
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: all var(--tr-fast);
  text-align: center;
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.75rem;
  user-select: none;
}
.pair-item-btn:hover:not(:disabled) {
  border-color: var(--cobalt);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.pair-item-btn.sel {
  border-color: var(--cobalt) !important;
  background: var(--cobalt-tint) !important;
  color: var(--cobalt) !important;
  box-shadow: 0 0 0 3px var(--cobalt-tint-2) !important;
  transform: translateY(-2px);
}
.pair-item-btn.matched {
  border-color: var(--green) !important;
  background: var(--green-tint) !important;
  color: var(--green) !important;
  cursor: default;
  opacity: 0.7;
}
.pair-item-btn.bad {
  border-color: var(--suzani) !important;
  background: var(--suzani-tint) !important;
  animation: shake 0.35s ease;
}

/* ============================================================
   Clean Sentence Builder ("Gap ustasi" - Minimal va Toza)
   ============================================================ */
.clean-builder-card {
  max-width: 660px;
  margin: 1.5rem auto;
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: clamp(1.25rem, 4vw, 2.25rem);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.clean-builder-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3.5vw, 1.85rem);
  font-weight: 700;
  color: var(--ink);
  margin: 0.75rem 0 1.25rem;
}

/* Placed Sentence Slot Area */
.clean-slot-box {
  min-height: 72px;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 0.5rem;
  transition: all var(--tr-fast);
}
.clean-slot-box.active {
  border-color: var(--cobalt);
  background: var(--surface-card);
}
.clean-slot-box.ok {
  border-color: var(--green);
  background: var(--green-tint);
}
.clean-slot-box.bad {
  border-color: var(--suzani);
  animation: shake 0.35s ease;
}

.clean-slot-placeholder {
  color: var(--text-3);
  font-size: 0.95rem;
  user-select: none;
  pointer-events: none;
}

/* Word Pills placed in slot */
.clean-placed-pill {
  background: #ffffff;
  border: 1.5px solid var(--cobalt);
  color: var(--cobalt-deep);
  border-radius: var(--r-pill);
  padding: 8px 18px;
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--tr-fast);
  user-select: none;
}
.clean-placed-pill:hover {
  background: var(--suzani-tint);
  border-color: var(--suzani);
  color: var(--suzani);
  transform: translateY(-2px);
}
.clean-placed-pill.ok {
  border-color: var(--green);
  color: var(--green);
  background: #ffffff;
  cursor: default;
}

/* Sub-slot reset link */
.clean-slot-sub {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.25rem;
  min-height: 22px;
}
.clean-reset-btn {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0 4px;
  transition: color var(--tr-fast);
}
.clean-reset-btn:hover {
  color: var(--suzani);
}

/* Word Pool below */
.clean-word-pool {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 1.25rem 0;
  padding: 0.5rem 0;
}

/* Word Pill in Pool */
.clean-pool-pill {
  background: var(--surface-card);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-pill);
  padding: 10px 22px;
  font-family: var(--font-ui);
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--tr-fast);
  user-select: none;
}
.clean-pool-pill:hover:not(:disabled) {
  border-color: var(--cobalt);
  color: var(--cobalt);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.clean-pool-pill:active:not(:disabled) {
  transform: translateY(0);
}
.clean-pool-pill:disabled {
  opacity: 0.2;
  border-color: var(--line);
  cursor: default;
  pointer-events: none;
  box-shadow: none;
}

/* Success Card */
.clean-success-box {
  background: var(--surface-card);
  border: 1.5px solid var(--green);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  margin-top: 1.5rem;
  text-align: center;
  animation: popIn 0.25s var(--ease-spring);
}
.clean-success-sentence {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0.5rem 0 0.75rem;
}
.clean-success-sentence mark {
  background: var(--cobalt-tint-2);
  color: var(--cobalt-deep);
  padding: 2px 6px;
  border-radius: 4px;
}

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

/* ============================================================
   PROGRESS BARS & TEACHER DASHBOARD ENHANCEMENTS
   ============================================================ */

/* Standard Grid Utilities */
.grid {
  display: grid;
  gap: 1rem;
}
.grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

@media (max-width: 960px) {
  .grid.g4, .grid.g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .grid.g2, .grid.g3, .grid.g4, .grid.g5 { grid-template-columns: 1fr; }
}

.bar {
  position: relative;
  width: 100%;
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--turquoise), var(--cobalt));
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.bar.lg {
  height: 10px;
}
.bar.success > i {
  background: linear-gradient(90deg, var(--green), var(--turquoise));
}
.bar.warning > i {
  background: linear-gradient(90deg, var(--saffron), var(--terracotta));
}

/* ============================================================
   TEACHER DASHBOARD — POLISHED & COMPACT DESIGN
   ============================================================ */

/* Top audio sync card */
.teacher-audio-card {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 1.15rem 1.35rem;
  box-shadow: var(--shadow-sm);
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.teacher-audio-main {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 280px;
}

.teacher-audio-badge {
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  background: var(--cobalt-tint);
  color: var(--cobalt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.teacher-audio-content {
  flex: 1;
  min-width: 0;
}

.teacher-audio-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 6px;
}

.teacher-audio-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
}

.teacher-audio-stat {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--cobalt);
  white-space: nowrap;
}

.teacher-audio-track {
  width: 100%;
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.teacher-audio-track > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--turquoise), var(--cobalt));
  border-radius: 999px;
  transition: width 0.35s ease;
}

.teacher-audio-track.warning > i {
  background: linear-gradient(90deg, var(--saffron), var(--terracotta));
}

.teacher-audio-note {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-top: 5px;
  line-height: 1.3;
}

.teacher-audio-btn {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 9px 16px;
}

/* 4 Core KPI mini-cards */
.teacher-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

@media (max-width: 900px) {
  .teacher-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 520px) {
  .teacher-kpi-row {
    grid-template-columns: 1fr;
  }
}

.teacher-kpi-item {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 0.95rem 1.15rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.teacher-kpi-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.teacher-kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}

.teacher-kpi-tag {
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.teacher-kpi-symbol {
  font-size: 1.15rem;
}

.teacher-kpi-value {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 3px;
}

.teacher-kpi-desc {
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.3;
}

/* Trophy Games Strip */
.teacher-games-panel {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 1.1rem 1.25rem;
  margin-top: 1rem;
  box-shadow: var(--shadow-sm);
}

.teacher-games-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.teacher-games-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.teacher-games-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (max-width: 860px) {
  .teacher-games-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 480px) {
  .teacher-games-strip {
    grid-template-columns: 1fr;
  }
}

.teacher-game-cell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.65rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.teacher-game-cell:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.teacher-game-cell-name {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--ink);
  white-space: nowrap;
}

.teacher-game-cell-badge {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--cobalt-tint);
  color: var(--cobalt);
}

/* Difficult phrases table & clean state */
.teacher-attention-box {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 1.15rem 1.25rem;
  margin-top: 1rem;
  box-shadow: var(--shadow-sm);
}

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

.teacher-attention-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.teacher-table-clean {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.86rem;
}

.teacher-table-clean th {
  background: var(--surface);
  color: var(--ink-soft);
  font-weight: 650;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.teacher-table-clean td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
}

.teacher-table-clean tr:last-child td {
  border-bottom: none;
}

@media (prefers-reduced-motion: reduce) {
  .teacher-audio-track > i,
  .teacher-kpi-item,
  .teacher-game-cell {
    transition: none !important;
  }
}

/* ============================================================
   VISUAL GAMES STYLES (Nigoh va Ibora, Clipibora Juftliklari, Kontekst Detektivi)
   ============================================================ */
.visual-game-frame {
  position: relative;
  width: 100%;
  max-width: 680px;
  margin: 0 auto 1.25rem;
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  background: var(--surface-card);
  cursor: pointer;
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 300ms ease, border-color 250ms ease;
}

.visual-game-frame:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(18, 20, 24, 0.16);
  border-color: rgba(217, 130, 43, 0.35);
}

.visual-game-img {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: cover;
  display: block;
  transform: scale(1);
  transition: transform 450ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Cursor yaqinlashganda (hover) rasm silliq va chiroyli kattalashadi */
.visual-game-frame:hover .visual-game-img {
  transform: scale(1.07);
}

.visual-game-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(18, 20, 24, 0.75);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  letter-spacing: 0.03em;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  pointer-events: none;
  z-index: 2;
}

.visual-zoom-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(18, 20, 24, 0.75);
  backdrop-filter: blur(8px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: transform 200ms ease, background 200ms ease;
  z-index: 2;
}

.visual-zoom-btn:hover {
  transform: scale(1.12);
  background: rgba(217, 130, 43, 0.9);
}

/* Matching Game Columns */
.visual-match-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 1.25rem 0;
}

@media (max-width: 680px) {
  .visual-match-container {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

.visual-match-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.visual-match-header {
  font-size: 0.85rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Large Poster Cards for Visual Matching */
.visual-poster-btn {
  background: var(--surface-card);
  border: 2px solid var(--line);
  border-radius: var(--r-xl);
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: all 250ms var(--ease-spring);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.visual-poster-btn:hover:not(:disabled) {
  border-color: var(--cobalt);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.visual-poster-btn:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
}

.visual-poster-btn.selected {
  border-color: var(--cobalt);
  background: var(--cobalt-tint);
  box-shadow: 0 0 0 4px rgba(34, 102, 221, 0.35);
  transform: scale(1.02);
}

.visual-poster-btn.matched {
  border-color: var(--green);
  background: var(--green-tint);
  opacity: 0.82;
  cursor: default;
  pointer-events: none;
}

.visual-poster-btn.bad {
  border-color: var(--terracotta);
  background: var(--terracotta-tint);
  animation: shake 400ms ease;
}

.visual-poster-img-wrap {
  width: 100%;
  height: 165px;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.visual-poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 300ms ease;
}

.visual-poster-btn:hover .visual-poster-img {
  transform: scale(1.03);
}

.visual-poster-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(18, 20, 24, 0.78);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(255, 255, 255, 0.2);
  pointer-events: none;
}

.visual-zoom-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(18, 20, 24, 0.78);
  backdrop-filter: blur(6px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
  z-index: 2;
}

.visual-zoom-btn:hover {
  transform: scale(1.15);
  background: var(--cobalt);
}

/* Matching Phrase Cards */
.visual-phrase-card {
  background: var(--surface-card);
  border: 2px solid var(--line);
  border-radius: var(--r-xl);
  padding: 1.25rem 1.15rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 185px;
  transition: all 250ms var(--ease-spring);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.visual-phrase-card:hover:not(:disabled) {
  border-color: var(--cobalt);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.visual-phrase-card:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
}

.visual-phrase-card.selected {
  border-color: var(--cobalt);
  background: var(--cobalt-tint);
  box-shadow: 0 0 0 4px rgba(34, 102, 221, 0.35);
  transform: scale(1.02);
}

.visual-phrase-card.matched {
  border-color: var(--green);
  background: var(--green-tint);
  opacity: 0.82;
  cursor: default;
  pointer-events: none;
}

.visual-phrase-card.bad {
  border-color: var(--terracotta);
  background: var(--terracotta-tint);
  animation: shake 400ms ease;
}

.visual-phrase-card .title {
  font-family: var(--font-display, serif);
  font-size: 1.32rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  margin-bottom: 6px;
}

.visual-phrase-card .meaning {
  font-size: 0.86rem;
  color: var(--ink-soft);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

