 :root,
[data-theme='light'] {
  --font-body: 'Noto Naskh Arabic', 'Arial', sans-serif;
  --font-latin: 'Noto Serif', Georgia, serif;

  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.82rem + 0.3vw, 1rem);
  --text-base: clamp(1rem, 0.96rem + 0.3vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.4vw, 2.35rem);

  --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;

  --color-bg: #FAF8F3;
  --color-surface: rgba(255, 255, 255, 0.88);
  --color-surface-strong: #FFFFFF;
  --color-border: #E8D9B8;
  --color-text: #2C2315;
  --color-text-muted: #6B5B3E;
  --color-primary: #B8960C;
  --color-primary-hover: #9A7D0A;
  --color-primary-soft: #FAF0D0;
  --color-secondary: #D6A92B;
  --color-secondary-soft: #FDF3D0;
  --color-success: #27AE60;
  --color-success-soft: rgba(39, 174, 96, 0.16);
  --color-error: #C0392B;
  --color-error-soft: rgba(192, 57, 43, 0.16);
  --color-verb: #FDF3D0;
  --color-verb-border: #D9BF63;
  --color-meaning: #F5EFE0;
  --color-meaning-border: #E8D9B8;
  --color-back: #F5EFE0;
  --color-back-border: #E8D9B8;
  --color-progress: linear-gradient(90deg, #B8960C 0%, #D6A92B 100%);

  --radius-sm: 0.75rem;
  --radius-md: 1rem;
  --radius-lg: 1.5rem;
  --radius-xl: 2rem;

  --shadow-sm: 0 1px 3px rgba(184, 150, 12, .08), 0 4px 16px rgba(184, 150, 12, .06);
  --shadow-md: 0 10px 30px rgba(184, 150, 12, .10);
  --shadow-lg: 0 18px 54px rgba(184, 150, 12, .16);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-interactive: 180ms var(--ease-out);
}

[data-theme='dark'] {
  --color-bg: #171512;
  --color-surface: rgba(33, 30, 26, 0.92);
  --color-surface-strong: #211e1a;
  --color-border: rgba(232, 217, 184, 0.18);
  --color-text: #F7EEDC;
  --color-text-muted: #CDBF9C;
  --color-primary: #E1BE35;
  --color-primary-hover: #F4D666;
  --color-primary-soft: rgba(225, 190, 53, 0.14);
  --color-secondary: #B8960C;
  --color-secondary-soft: rgba(184, 150, 12, 0.16);
  --color-success: #69CD94;
  --color-success-soft: rgba(105, 205, 148, 0.16);
  --color-error: #EF8F99;
  --color-error-soft: rgba(239, 143, 153, 0.16);
  --color-verb: #392F16;
  --color-verb-border: rgba(225, 190, 53, 0.26);
  --color-meaning: #2A251C;
  --color-meaning-border: rgba(232, 217, 184, 0.16);
  --color-back: #312821;
  --color-back-border: rgba(240, 231, 217, 0.08);
  --color-progress: linear-gradient(90deg, #E1BE35 0%, #F4D666 100%);
  --shadow-sm: 0 10px 20px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 20px 44px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 32px 72px rgba(0, 0, 0, 0.36);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #FAF8F3;
    --color-surface: rgba(255, 255, 255, 0.88);
    --color-surface-strong: #FFFFFF;
    --color-border: #E8D9B8;
    --color-text: #2C2315;
    --color-text-muted: #6B5B3E;
    --color-primary: #B8960C;
    --color-primary-hover: #9A7D0A;
    --color-primary-soft: #FAF0D0;
    --color-secondary: #D6A92B;
    --color-secondary-soft: #FDF3D0;
    --color-success: #27AE60;
    --color-success-soft: rgba(39, 174, 96, 0.16);
    --color-error: #C0392B;
    --color-error-soft: rgba(192, 57, 43, 0.16);
    --color-verb: #FDF3D0;
    --color-verb-border: #D9BF63;
    --color-meaning: #F5EFE0;
    --color-meaning-border: #E8D9B8;
    --color-back: #F5EFE0;
    --color-back-border: #E8D9B8;
    --color-progress: linear-gradient(90deg, #B8960C 0%, #D6A92B 100%);
    --shadow-sm: 0 1px 3px rgba(184, 150, 12, .08), 0 4px 16px rgba(184, 150, 12, .06);
    --shadow-md: 0 10px 30px rgba(184, 150, 12, .10);
    --shadow-lg: 0 18px 54px rgba(184, 150, 12, .16);
  }
}
*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cpolygon points='40,4 45.88,27.06 69.28,14.72 55.56,36.44 80,40 55.56,43.56 69.28,65.28 45.88,52.94 40,76 34.12,52.94 10.72,65.28 24.44,43.56 0,40 24.44,36.44 10.72,14.72 34.12,27.06' fill='%23B8960C' fill-opacity='.055'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: 'ذاكرة';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-body);
  font-size: clamp(9rem, 24vw, 20rem);
  font-weight: 800;
  color: var(--color-primary-hover);
  opacity: .03;
  pointer-events: none;
  user-select: none;
  line-height: 1;
}

.page-shell, .fixed-logo, .skip-link {
  position: relative;
  z-index: 1;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  background: var(--color-primary-hover);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  z-index: 60;
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transition:
    transform var(--transition-interactive),
    box-shadow var(--transition-interactive);
}

.skip-link:hover,
.skip-link:focus {
  transform: translateY(2px);
  box-shadow: var(--shadow-lg);
}

.fixed-logo {
  position: fixed;
  top: var(--space-4);
  left: var(--space-4);
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(94px, 11vw, 148px);
  min-height: 44px;
  padding: 0.45rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  transition:
    transform var(--transition-interactive),
    box-shadow var(--transition-interactive),
    background-color var(--transition-interactive);
}

[data-theme='dark'] .fixed-logo {
  background: rgba(255, 255, 255, 0.92);
}

.fixed-logo:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.fixed-logo:active {
  transform: translateY(0);
}

.fixed-logo img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.page-shell {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
  padding-block: clamp(var(--space-6), 5vw, var(--space-12));
}

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
  gap: var(--space-8);
  padding: clamp(var(--space-6), 4vw, var(--space-10));
  align-items: center;
}

.eyebrow,
.section-kicker,
.modal-kicker {
  margin: 0 0 var(--space-3);
  color: var(--color-primary-hover);
  font-size: var(--text-sm);
  font-weight: 800;
  letter-spacing: 0.02em;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2rem, 1.2rem + 3vw, 3.5rem);
  margin-bottom: var(--space-3);
}

.hero h2 {
  font-size: clamp(1.25rem, 1rem + 1vw, 1.9rem);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.lede,
.sublede,
.instruction-note,
.status-text,
.seo-section p,
.cta-section p,
.modal-copy {
  margin: 0;
  color: var(--color-text-muted);
}

.sublede,
[lang='en'] {
  font-family: var(--font-latin);
}

.legend-row,
.badge-stack,
.control-group,
.cta-actions,
.progress-label,
.modal-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.legend-row {
  margin-top: var(--space-5);
}

.legend-card,
.micro-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 700;
}

.legend-card {
  border: 1px solid var(--color-border);
  background: var(--color-surface-strong);
}

.legend-card--verb {
  background: var(--color-verb);
  border-color: var(--color-verb-border);
}

.legend-card--meaning {
  background: var(--color-meaning);
  border-color: var(--color-meaning-border);
}

.legend-dot {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
}

.legend-card--verb .legend-dot {
  background: var(--color-primary);
}

.legend-card--meaning .legend-dot {
  background: var(--color-secondary);
}

.hero-actions {
  position: relative;
  display: grid;
  gap: var(--space-4);
  align-self: stretch;
  padding: var(--space-5);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent);
  border-radius: calc(var(--radius-xl) - 0.5rem);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.hero-motif {
  position: absolute;
  left: var(--space-4);
  bottom: var(--space-4);
  width: clamp(72px, 10vw, 110px);
  height: auto;
  opacity: 0.11;
  pointer-events: none;
  filter: saturate(0.9);
}

.micro-badge {
  background: var(--color-primary-soft);
  border: 1px solid var(--color-border);
}

.action-button,
.cta-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.85rem 1.15rem;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 800;
  transition:
    transform var(--transition-interactive),
    box-shadow var(--transition-interactive),
    background-color var(--transition-interactive),
    border-color var(--transition-interactive),
    color var(--transition-interactive);
}

.action-button {
  background: var(--color-surface-strong);
  border-color: var(--color-border);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.action-button--primary,
.cta-link--primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary-hover);
}

.cta-link--secondary {
  background: #fff;
  color: var(--color-primary-hover);
  border-color: var(--color-primary);
}

.action-button--icon {
  width: 48px;
  padding-inline: 0;
}

.theme-icon {
  font-size: 1.2rem;
}

.action-button:hover,
.cta-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.action-button:active,
.cta-link:active {
  transform: translateY(0);
}

.main-layout {
  display: grid;
  gap: var(--space-8);
  margin-top: var(--space-8);
}

.game-stage {
  padding: clamp(var(--space-5), 4vw, var(--space-8));
}

.section-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-4);
  align-items: end;
  margin-bottom: var(--space-5);
}

.section-header h2 {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
}

.status-text {
  max-width: 34ch;
  font-weight: 700;
  text-align: start;
}

.status-text[data-tone='success'] {
  color: var(--color-success);
}

.status-text[data-tone='error'] {
  color: var(--color-error);
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.stat-card {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-surface-strong);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.stat-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.stat-value {
  display: block;
  font-size: clamp(1.35rem, 1.1rem + 0.9vw, 2rem);
  font-weight: 800;
}

.progress-block {
  margin-bottom: var(--space-5);
}

.progress-label {
  justify-content: space-between;
  margin-bottom: 0.65rem;
  font-size: var(--text-sm);
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 0.8rem;
  border-radius: 999px;
  background: rgba(127, 119, 104, 0.16);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--color-progress);
  transition: width 320ms var(--ease-out);
}

.board-shell {
  position: relative;
  padding: clamp(var(--space-3), 2vw, var(--space-5));
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent 24%),
    var(--color-surface-strong);
  border: 1px solid var(--color-border);
  overflow: hidden;
  isolation: isolate;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.55rem, 1.3vw, 0.8rem);
}

.memory-card {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: clamp(72px, 8vw, 98px);
  border: 0;
  padding: 0;
  background: transparent;
  perspective: 1200px;
  cursor: pointer;
}

.memory-card:hover {
  z-index: 2;
}

.memory-card:focus-visible,
.action-button:focus-visible,
.cta-link:focus-visible {
  outline: 3px solid rgba(184, 150, 12, 0.42);
  outline-offset: 3px;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 540ms var(--ease-out);
}

.memory-card.flipped .card-inner,
.memory-card.matched .card-inner {
  transform: rotateY(180deg);
}

.memory-card:hover .card-inner {
  transform: translateY(-3px);
}

.memory-card.flipped:hover .card-inner,
.memory-card.matched:hover .card-inner {
  transform: rotateY(180deg) translateY(-3px);
}

.memory-card:active .card-inner {
  transform: translateY(0) scale(0.985);
}

.memory-card.flipped:active .card-inner,
.memory-card.matched:active .card-inner {
  transform: rotateY(180deg) scale(0.985);
}

.card-face {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.35rem;
  padding: clamp(0.55rem, 1.4vw, 0.8rem);
  border-radius: var(--radius-md);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: var(--shadow-sm);
  text-align: center;
  border: 1px solid transparent;
}

.card-back {
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.5), transparent 26%),
    radial-gradient(circle at 72% 72%, rgba(255, 255, 255, 0.35), transparent 22%),
    var(--color-back);
  border-color: var(--color-back-border);
}

.card-back-symbol {
  font-size: clamp(1.35rem, 1rem + 1.3vw, 2rem);
  font-weight: 800;
  color: var(--color-primary-hover);
}

.card-back-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.card-front {
  transform: rotateY(180deg);
}

.card-front--verb {
  background: var(--color-verb);
  border-color: var(--color-verb-border);
}

.card-front--meaning {
  background: var(--color-meaning);
  border-color: var(--color-meaning-border);
}

.card-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 800;
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.card-front--verb .card-value {
  font-size: clamp(1.12rem, 0.98rem + 0.75vw, 1.48rem);
  font-weight: 800;
}

.card-front--meaning .card-value {
  font-family: var(--font-latin);
  direction: ltr;
  font-size: clamp(0.9rem, 0.82rem + 0.45vw, 1.12rem);
  font-weight: 800;
}

.card-icon {
  font-size: 1.35rem;
}

.card-hint {
  font-size: clamp(0.68rem, 0.64rem + 0.18vw, 0.8rem);
  color: var(--color-text-muted);
}

.memory-card.correct-flash .card-front {
  animation: correctFlash 520ms var(--ease-out);
}

.memory-card.wrong {
  animation: wrongShake 480ms var(--ease-in-out);
}

.memory-card.matched .card-front {
  box-shadow: 0 18px 34px rgba(45, 141, 88, 0.18);
}

.memory-card.matched .card-front::after {
  content: '✓';
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  width: 1.4rem;
  height: 1.4rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--color-success);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
}

.board-shell.complete {
  box-shadow: 0 0 0 3px var(--color-success-soft), var(--shadow-lg);
}

.board-celebration {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.board-celebration span {
  position: absolute;
  top: -10%;
  width: 0.8rem;
  height: 1.15rem;
  border-radius: 999px;
  opacity: 0;
}

.board-celebration.is-active span {
  animation: confettiDrop 1200ms linear forwards;
}

.completion-modal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--space-5);
  background: rgba(23, 21, 18, 0.28);
  z-index: 3;
}

.modal-card {
  width: min(100%, 520px);
  padding: clamp(var(--space-5), 3vw, var(--space-8));
  border-radius: var(--radius-xl);
  background: var(--color-surface-strong);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: modalIn 320ms var(--ease-out);
}

.modal-card h3 {
  font-size: clamp(1.5rem, 1.25rem + 1vw, 2.1rem);
  margin-bottom: var(--space-3);
}

.modal-copy {
  margin-bottom: var(--space-5);
}

.modal-stats {
  justify-content: center;
  margin-bottom: var(--space-5);
}

.modal-stat {
  min-width: 96px;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}

.modal-stat span {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.modal-stat strong {
  display: block;
  margin-top: 0.35rem;
  font-size: var(--text-lg);
}

.modal-button {
  min-width: 180px;
}

.support-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
}

.seo-section,
.cta-section {
  padding: clamp(var(--space-5), 4vw, var(--space-8));
  content-visibility: auto;
}

.seo-section h2,
.cta-section h2 {
  font-size: clamp(1.4rem, 1.15rem + 1vw, 2rem);
  margin-bottom: var(--space-4);
}

.seo-section p + p,
.cta-section p + .cta-actions {
  margin-top: var(--space-4);
}

@keyframes correctFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(45, 141, 88, 0.22);
    filter: saturate(1);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(45, 141, 88, 0.12);
    filter: saturate(1.08);
  }
  100% {
    box-shadow: 0 18px 34px rgba(45, 141, 88, 0.18);
    filter: saturate(1);
  }
}

@keyframes wrongShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px);
  }
  40% {
    transform: translateX(8px);
  }
  60% {
    transform: translateX(-5px);
  }
  80% {
    transform: translateX(5px);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes confettiDrop {
  0% {
    transform: translateY(-10%) rotate(0deg);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  100% {
    transform: translateY(120%) rotate(540deg);
    opacity: 0;
  }
}



.how-to-play {
  margin-top: var(--space-5);
  padding: 0;
  overflow: hidden;
}

.how-to-play summary {
  cursor: pointer;
  list-style: none;
  padding: 0.9rem 1rem;
  color: var(--color-primary-hover);
  font-size: var(--text-sm);
  font-weight: 900;
}

.how-to-play summary::-webkit-details-marker {
  display: none;
}

.instruction-body {
  border-top: 1px solid var(--color-border);
  padding: var(--space-4);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.instruction-card {
  background: var(--color-surface-strong);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--color-text-muted);
}

.instruction-card strong {
  display: block;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.modal-share-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.modal-share-row .modal-button {
  width: 100%;
  min-width: 0;
}

.share-note {
  margin: var(--space-3) 0 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.7;
}

.share-note[data-tone='success'] {
  color: var(--color-success);
  font-weight: 800;
}

.share-note[data-tone='error'] {
  color: var(--color-error);
  font-weight: 800;
}

.keyword-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: var(--space-4);
}

.keyword-cloud span {
  font-size: var(--text-xs);
  background: var(--color-primary-soft);
  border: 1px solid var(--color-border);
  color: var(--color-primary-hover);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-weight: 800;
}

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

@media (max-width: 920px) {
  .hero,
  .support-grid,
  .instruction-body {
    grid-template-columns: 1fr;
  }

  .section-header {
    grid-template-columns: 1fr;
  }

  .status-text {
    max-width: none;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 1rem, 1120px);
  }

  .stats-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .memory-card {
    height: 66px;
  }

  .card-face {
    gap: 0.2rem;
    padding: 0.38rem;
    border-radius: 0.75rem;
  }

  .card-chip,
  .card-hint,
  .card-back-label {
    display: none;
  }

  .card-front--verb .card-value {
    font-size: clamp(0.95rem, 4vw, 1.15rem);
  }

  .card-front--meaning .card-value {
    font-size: clamp(0.68rem, 3vw, 0.82rem);
    line-height: 1.15;
  }
}

@media (max-width: 520px) {
  .page-shell {
    width: calc(100% - 0.8rem);
  }

  .hero,
  .game-stage,
  .seo-section,
  .cta-section {
    padding: var(--space-4);
  }

  .control-group {
    flex-direction: column;
  }

  .modal-share-row {
    grid-template-columns: 1fr;
  }

  .action-button,
  .cta-link {
    width: 100%;
  }

  .stats-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .memory-card {
    height: 58px;
  }

  .fixed-logo {
    top: 0.55rem;
    left: 0.55rem;
    width: 86px;
    padding: 0.35rem 0.45rem;
    border-radius: 0.85rem;
  }

  .skip-link {
    top: 4.8rem;
    right: 0.55rem;
    max-width: calc(100% - 1.1rem);
    padding: 0.6rem 0.75rem;
    font-size: var(--text-sm);
  }
}

@media (hover: none) {
  .memory-card:hover .card-inner {
    transform: none;
  }

  .memory-card.flipped .card-inner,
  .memory-card.flipped:hover .card-inner,
  .memory-card.matched:hover .card-inner,
  .memory-card.matched .card-inner {
    transform: rotateY(180deg);
  }

  .action-button:hover,
  .cta-link:hover {
    transform: none;
  }
}

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

.related-games {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.related-games a {
  display: inline-flex;
  margin: .25rem .15rem 0;
  padding: .28rem .65rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-strong);
  color: var(--color-primary-hover);
  text-decoration: none;
  font-size: var(--text-xs);
  font-weight: 800;
}

.related-games a:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}

/* ===== MOBILE-FIRST RESPONSIVE PATCH =====
   Keeps the game logic unchanged while making the board easier to use on phones. */
button,
.memory-card,
.action-button,
.cta-link,
summary {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.board-shell,
.grid,
.memory-card,
.card-inner,
.card-face {
  min-width: 0;
}

.card-value {
  overflow-wrap: anywhere;
  word-break: normal;
}

@media (max-width: 760px) {
  body::after {
    font-size: clamp(7rem, 30vw, 12rem);
  }

  .page-shell {
    padding-block: 0.75rem 1.5rem;
  }

  .fixed-logo {
    position: static;
    display: flex;
    width: fit-content;
    max-width: 145px;
    margin: 0 auto 0.65rem;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
  }

  .skip-link {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    transform: translateY(-140%);
  }

  .skip-link:focus {
    transform: translateY(0);
  }

  .hero {
    gap: 0.9rem;
    padding: 0.95rem;
    text-align: center;
  }

  .eyebrow {
    font-size: 0.78rem;
    margin-bottom: 0.35rem;
  }

  .hero h1 {
    font-size: clamp(1.45rem, 8vw, 2.1rem);
    margin-bottom: 0.25rem;
  }

  .hero h2 {
    font-size: clamp(1rem, 4.8vw, 1.25rem);
    margin-bottom: 0.55rem;
  }

  .lede,
  .sublede,
  .instruction-note {
    font-size: 0.84rem;
    line-height: 1.55;
  }

  .legend-row,
  .badge-stack {
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.65rem;
  }

  .legend-card,
  .micro-badge {
    min-height: 34px;
    padding: 0.35rem 0.55rem;
    font-size: 0.76rem;
  }

  .hero-actions {
    padding: 0.75rem;
    gap: 0.7rem;
  }

  .hero-motif,
  .badge-stack {
    display: none;
  }

  .control-group {
    display: grid;
    grid-template-columns: 1fr 1fr 44px;
    gap: 0.45rem;
    width: 100%;
  }

  .action-button,
  .cta-link {
    min-height: 42px;
    padding: 0.58rem 0.7rem;
    font-size: 0.82rem;
  }

  .action-button--icon {
    width: 44px;
  }

  .how-to-play {
    margin-top: 0.65rem;
  }

  .how-to-play summary {
    padding: 0.62rem 0.72rem;
    font-size: 0.86rem;
  }

  .instruction-body {
    gap: 0.5rem;
    padding: 0.55rem;
  }

  .instruction-card {
    padding: 0.55rem;
    font-size: 0.78rem;
    line-height: 1.6;
  }

  .main-layout {
    margin-top: 0.75rem;
    gap: 0.9rem;
  }

  .game-stage {
    padding: 0.75rem;
  }

  .section-header {
    gap: 0.45rem;
    margin-bottom: 0.7rem;
  }

  .section-kicker {
    display: none;
  }

  .section-header h2 {
    font-size: 1.18rem;
  }

  .status-text {
    font-size: 0.8rem;
    line-height: 1.45;
  }

  .stats-panel {
    gap: 0.45rem;
    margin-bottom: 0.7rem;
  }

  .stat-card {
    padding: 0.5rem;
    border-radius: 0.85rem;
  }

  .stat-label {
    margin-bottom: 0.1rem;
    font-size: 0.72rem;
  }

  .stat-value {
    font-size: clamp(1rem, 4.5vw, 1.25rem);
  }

  .progress-block {
    margin-bottom: 0.7rem;
  }

  .progress-label {
    font-size: 0.78rem;
    margin-bottom: 0.35rem;
  }

  .progress-track {
    height: 0.55rem;
  }

  .board-shell {
    padding: 0.45rem;
    border-radius: 1rem;
  }

  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(0.28rem, 1.3vw, 0.5rem);
  }

  .memory-card {
    height: clamp(68px, 18.5vw, 84px);
  }

  .card-face {
    padding: 0.34rem 0.24rem;
    gap: 0.14rem;
    border-radius: 0.75rem;
  }

  .card-back-symbol {
    font-size: clamp(1rem, 5vw, 1.35rem);
  }

  .card-front--verb .card-value {
    font-size: clamp(1rem, 4.7vw, 1.22rem);
    line-height: 1.1;
  }

  .card-front--meaning .card-value {
    font-size: clamp(0.72rem, 3.2vw, 0.92rem);
    line-height: 1.08;
  }

  .completion-modal {
    align-items: flex-start;
    padding: 0.65rem;
    overflow-y: auto;
  }

  .modal-card {
    width: min(100%, 420px);
    padding: 0.9rem;
    border-radius: 1rem;
  }

  .modal-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .modal-share-row {
    gap: 0.45rem;
  }

  .support-grid {
    gap: 0.75rem;
  }

  .seo-section,
  .cta-section {
    padding: 0.85rem;
  }

  .seo-section h2,
  .cta-section h2 {
    font-size: 1.05rem;
  }

  .seo-section p,
  .cta-section p {
    font-size: 0.83rem;
    line-height: 1.7;
  }
}

@media (max-width: 380px) {
  .page-shell {
    width: calc(100% - 0.5rem);
  }

  .hero,
  .game-stage,
  .seo-section,
  .cta-section {
    padding: 0.62rem;
  }

  .control-group {
    grid-template-columns: 1fr;
  }

  .action-button--icon {
    width: 100%;
  }

  .memory-card {
    height: clamp(62px, 18vw, 72px);
  }

  .card-front--verb .card-value {
    font-size: clamp(0.9rem, 4.5vw, 1.05rem);
  }

  .card-front--meaning .card-value {
    font-size: clamp(0.64rem, 3vw, 0.76rem);
  }
}

/* ===== V4 ArabicLearningGames.com adaptation ===== */
html[dir="ltr"] body { direction: ltr; }
html[dir="rtl"] body { direction: rtl; }
.memory-v4-shell { max-width: 1180px; margin: 0 auto; }
.memory-v4-main { display: block; }
.memory-v4-hero { margin-top: 0; }
.memory-v4-source-note { margin: 0.8rem 0 0; text-align: center; color: var(--color-text-muted); font-size: 0.78rem; }
#language-toggle { min-width: 52px; font-family: var(--font-latin); font-weight: 800; }
.card-front--verb .card-value { direction: rtl; font-family: var(--font-body); }
html[dir="ltr"] .card-front--verb,
html[dir="ltr"] .card-front--meaning { direction: ltr; }
html[dir="rtl"] .card-front--verb,
html[dir="rtl"] .card-front--meaning { direction: rtl; }
.completion-modal { touch-action: pan-y; }
.modal-card { max-height: min(88vh, 680px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
@media (max-width: 760px) {
  .memory-v4-hero { grid-template-columns: 1fr; }
  .control-group { justify-content: flex-start; }
  html[dir="rtl"] .control-group { justify-content: flex-start; }
}


/* =========================================================
   V5 CORPORATE IDENTITY ALIGNMENT — Hangman shell language
   ========================================================= */
:root,
[data-theme='light'] {
  --font-body: 'Cairo', 'Segoe UI', sans-serif;
  --font-latin: 'Cairo', 'Segoe UI', sans-serif;
  --color-bg: #FBFAF6;
  --color-surface: #FFFFFF;
  --color-surface-strong: #FFFFFF;
  --color-border: #EAE7E1;
  --color-text: #2B2B2B;
  --color-text-muted: #8A867F;
  --color-primary: #C9A96A;
  --color-primary-hover: #A88E52;
  --color-primary-soft: #FBF6ED;
  --color-secondary: #D8BC84;
  --color-secondary-soft: #FBF6ED;
  --color-verb: #FBF6ED;
  --color-verb-border: #D8BC84;
  --color-meaning: #F7F5EF;
  --color-meaning-border: #EAE7E1;
  --color-back: #F3EFE7;
  --color-back-border: #EAE7E1;
  --color-progress: linear-gradient(90deg, #C9A96A 0%, #D8BC84 100%);
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 4px 20px rgba(0,0,0,.06);
  --shadow-md: 0 8px 28px rgba(0,0,0,.08);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.22);
}

[data-theme='dark'] {
  --font-body: 'Cairo', 'Segoe UI', sans-serif;
  --font-latin: 'Cairo', 'Segoe UI', sans-serif;
  --color-bg: #181714;
  --color-surface: #25231F;
  --color-surface-strong: #2B2924;
  --color-border: #49443B;
  --color-text: #F4F0E8;
  --color-text-muted: #C0B8A9;
  --color-primary: #D8BC84;
  --color-primary-hover: #E6CBA8;
  --color-primary-soft: #373126;
  --color-secondary: #C9A96A;
  --color-secondary-soft: #332D23;
  --color-verb: #393126;
  --color-verb-border: #8B754B;
  --color-meaning: #302D28;
  --color-meaning-border: #4A453D;
  --color-back: #302C26;
  --color-back-border: #4A453D;
  --color-progress: linear-gradient(90deg, #C9A96A 0%, #E6CBA8 100%);
}

body {
  background: linear-gradient(135deg, var(--color-bg) 0%, #F3EFE7 50%, #EAE7E1 100%);
  font-size: 1rem;
  line-height: 1.55;
}
[data-theme='dark'] body { background: var(--color-bg); }
body::before, body::after { display:none; }

.page-shell {
  width: min(100%, 932px);
  margin: 0 auto;
  padding: 14px 16px 18px;
}

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.hero {
  padding: 16px 18px;
  gap: 14px;
  align-items: center;
}
.hero-copy { gap: 4px; }
.eyebrow {
  color: var(--color-primary-hover);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .02em;
}
.hero h1 {
  color: var(--color-primary-hover);
  font-size: clamp(1.55rem, 3.2vw, 2rem);
  line-height: 1.25;
  font-weight: 900;
}
.hero h2 {
  font-size: clamp(.98rem, 1.8vw, 1.1rem);
  color: var(--color-text);
  font-weight: 700;
}
.lede, .instruction-note { font-size: .86rem; line-height: 1.55; }
.hero-motif { display:none; }
.hero-actions { min-width: 0; align-items: flex-end; }
.control-group { gap: 7px; justify-content: flex-end; }
.action-button {
  min-height: 38px;
  padding: 7px 13px;
  border-radius: 20px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-strong);
  color: var(--color-primary-hover);
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 700;
}
.action-button:hover { background: var(--color-primary); border-color: var(--color-primary); color:#fff; }
.action-button--primary { background:var(--color-primary); border-color:var(--color-primary); color:#fff; }
.action-button--primary:hover { background:var(--color-primary-hover); border-color:var(--color-primary-hover); }
.action-button--icon { width:38px; min-width:38px; padding:0; }
.legend-row { margin-top: 7px; gap: 6px; }
.legend-card { padding: 4px 9px; border-radius: 999px; font-size:.72rem; }

.how-to-play { margin-top: 10px; }
.how-to-play summary { padding: 10px 14px; font-size:.83rem; color:var(--color-primary-hover); }
.instruction-body { padding: 0 14px 12px; gap:8px; }
.instruction-card { border-radius:10px; padding:9px 11px; font-size:.78rem; }

.main-layout { margin-top: 10px; display:block; }
.game-stage { padding: 14px; }
.section-header { margin-bottom: 10px; gap:10px; }
.section-kicker { font-size:.72rem; color:var(--color-primary-hover); }
.section-header h2 { font-size:1.15rem; color:var(--color-primary-hover); }
.status-text { font-size:.78rem; max-width:420px; }

.stats-panel { gap:8px; margin-bottom:10px; }
.stat-card {
  padding: 8px 10px;
  min-height: 64px;
  border-radius:12px;
  background:#F7F5EF;
  border:1px solid var(--color-border);
  box-shadow:none;
}
[data-theme='dark'] .stat-card { background:var(--color-surface-strong); }
.stat-label { font-size:.7rem; color:var(--color-text-muted); font-weight:700; }
.stat-value { font-size:1.25rem; color:var(--color-primary-hover); font-weight:900; }

.progress-block { margin-bottom:12px; }
.progress-label { font-size:.76rem; font-weight:700; }
.progress-track { height:8px; background:#EAE7E1; }
[data-theme='dark'] .progress-track { background:#3A3731; }

.board-shell {
  padding: 12px;
  border-radius:16px;
  background:var(--color-surface-strong);
  border:1px solid var(--color-border);
}
.grid {
  gap:8px;
  grid-template-columns:repeat(4,minmax(0,1fr));
}
.memory-card { min-height:108px; border-radius:12px; }
.card-face { border-radius:12px; padding:10px 8px; }
.card-back { background:var(--color-back); border:1px solid var(--color-back-border); }
.card-back .question-mark { color:var(--color-primary-hover); font-size:1.55rem; }
.card-back .reveal-label { font-size:.72rem; }
.card-front { border:1px solid var(--color-border); }
.card-value { font-size:clamp(1rem,2vw,1.28rem); line-height:1.45; }
.card-chip { font-size:.62rem; padding:2px 7px; }

.completion-modal { background:rgba(0,0,0,.6); padding:16px; }
.modal-card {
  max-width:420px;
  border-radius:24px;
  padding:24px 20px;
  background:var(--color-surface-strong);
  border:0;
  box-shadow:var(--shadow-lg);
}
.modal-kicker { color:var(--color-primary); }
.modal-card h3 { color:var(--color-primary-hover); font-size:1.6rem; }
.modal-stats { gap:7px; }
.modal-stat { background:var(--color-primary-soft); border:1px solid var(--color-secondary); border-radius:12px; }
.modal-stat strong { color:var(--color-primary-hover); }

#language-toggle { min-width:48px; font-family:var(--font-body); }

@media (max-width: 680px) {
  .page-shell { padding:10px; }
  .hero { padding:14px; align-items:stretch; }
  .hero-actions { align-items:stretch; }
  .control-group { justify-content:flex-start; }
  .instruction-note { margin-top:3px; }
  .stats-panel { grid-template-columns:repeat(2,1fr); }
  .grid { grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px; }
  .memory-card { min-height:88px; }
  .card-value { font-size:clamp(.82rem,3.7vw,1.02rem); }
  .card-back .reveal-label { display:none; }
  .section-header { align-items:flex-start; }
}

@media (max-width: 430px) {
  .game-stage { padding:10px; }
  .board-shell { padding:7px; }
  .grid { gap:5px; }
  .memory-card { min-height:78px; }
  .card-face { padding:7px 5px; }
  .card-chip { font-size:.55rem; }
}

/* ===== V6 COMPACT PLATFORM SHELL ===== */
.memory-v6-shell{max-width:1180px;margin:0 auto;padding:10px 12px 18px;}
.competition-bar{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;align-items:center;padding:8px 10px;background:var(--color-surface);border:1px solid var(--color-border);border-radius:14px;box-shadow:var(--shadow-sm);margin-bottom:10px;}
.competition-item{display:flex;align-items:center;justify-content:center;gap:6px;min-width:0;color:var(--color-primary-hover);font-size:.82rem;font-weight:800;white-space:nowrap;}
.competition-item strong{display:inline-flex;align-items:center;justify-content:center;min-width:34px;height:34px;padding:0 9px;border-radius:999px;background:var(--color-primary);color:#fff;font-size:.95rem;font-variant-numeric:tabular-nums;}
.competition-icon{font-size:.95rem;line-height:1;}
.game-toolbar{display:flex;align-items:end;justify-content:space-between;gap:12px;padding:12px 14px;margin-bottom:10px;}
.selector-group{display:flex;align-items:end;gap:10px;flex:1;min-width:0;}
.selector-field{display:grid;gap:5px;min-width:190px;color:var(--color-text-muted);font-size:.78rem;font-weight:800;}
.selector-field select{width:100%;min-height:44px;padding:7px 36px 7px 12px;border:1px solid var(--color-border);border-radius:12px;background:var(--color-surface-strong);color:var(--color-text);font:700 .92rem var(--font-body);outline:none;}
.selector-field select:focus{border-color:var(--color-primary);box-shadow:0 0 0 3px rgba(201,169,106,.18);}
.compact-controls{justify-content:flex-end;flex-wrap:wrap;}
.compact-controls .action-button{min-height:44px;}
.memory-v6-main{display:block;padding:0;margin:0;}
.memory-v6-main .game-stage{padding:12px 14px 14px;}
.round-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px;}
.round-head .status-text{margin:0;font-size:.84rem;min-height:1.5em;}
.round-head .progress-label{display:flex;gap:8px;font-size:.78rem;color:var(--color-text-muted);font-weight:800;white-space:nowrap;}
.compact-stats{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin-bottom:8px;}
.compact-stats .stat-card{padding:8px 10px;min-height:auto;border-radius:11px;}
.compact-stats .stat-label{font-size:.68rem;}
.compact-stats .stat-value{font-size:1.15rem;}
.memory-v6-main .progress-track{height:7px;margin:0 0 10px;}
.memory-v6-main .board-shell{padding:10px;}
.modal-total{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:10px 0;padding:11px 13px;border-radius:12px;background:var(--color-primary-soft);border:1px solid var(--color-secondary);font-weight:800;color:var(--color-primary-hover);}
.modal-total strong{font-size:1.45rem;color:var(--color-primary);}
[data-theme='dark'] .competition-bar,[data-theme='dark'] .game-toolbar{background:var(--color-surface);}
[data-theme='dark'] .selector-field select{background:var(--color-surface-strong);color:var(--color-text);}

@media(max-width:820px){
  .competition-bar{grid-template-columns:repeat(5,1fr);gap:5px;padding:7px;}
  .competition-item{flex-direction:column;gap:3px;font-size:.68rem;}
  .competition-item strong{height:29px;min-width:29px;font-size:.82rem;}
  .competition-icon{display:none;}
  .game-toolbar{align-items:stretch;flex-direction:column;}
  .selector-group{display:grid;grid-template-columns:1fr 1fr;}
  .selector-field{min-width:0;}
  .compact-controls{justify-content:stretch;display:grid;grid-template-columns:1.4fr 1.4fr .8fr .8fr;}
  .compact-controls .action-button{width:100%;padding-inline:8px;}
}
@media(max-width:560px){
  .memory-v6-shell{padding:7px;}
  .competition-bar{border-radius:11px;margin-bottom:7px;}
  .competition-item{font-size:.61rem;}
  .competition-item strong{height:27px;min-width:27px;padding:0 7px;font-size:.76rem;}
  .game-toolbar{padding:9px;margin-bottom:7px;gap:8px;}
  .selector-group{gap:7px;}
  .selector-field{font-size:.68rem;}
  .selector-field select{min-height:40px;font-size:.8rem;padding-inline:9px;}
  .compact-controls{grid-template-columns:1.25fr 1.25fr .7fr .7fr;gap:6px;}
  .compact-controls .action-button{min-height:40px;font-size:.72rem;border-radius:10px;}
  .memory-v6-main .game-stage{padding:8px;}
  .round-head{align-items:flex-start;}
  .round-head .status-text{font-size:.72rem;}
  .round-head .progress-label{font-size:.68rem;}
  .compact-stats{gap:5px;}
  .compact-stats .stat-card{padding:6px 5px;}
  .compact-stats .stat-label{font-size:.58rem;}
  .compact-stats .stat-value{font-size:.95rem;}
  .memory-v6-main .board-shell{padding:6px;}
}


/* =========================================================
   V8 — single-scroll-owner result modal
   The document is locked while the completion modal is open.
   The overlay fills the viewport; only .modal-card may scroll.
   ========================================================= */
html.memory-modal-open,
body.memory-modal-open {
  overflow: hidden !important;
  overscroll-behavior: none;
}

.completion-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px !important;
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: none;
  background: rgba(0,0,0,.60);
}

.completion-modal[hidden] {
  display: none !important;
}

.completion-modal .modal-card {
  width: min(100%, 420px);
  max-height: calc(100dvh - 32px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-gutter: stable;
}

@supports not (height: 100dvh) {
  .completion-modal .modal-card {
    max-height: calc(100vh - 32px) !important;
  }
}

@media (max-width: 680px) {
  .completion-modal {
    align-items: center !important;
    padding: 10px !important;
    overflow: hidden !important;
  }
  .completion-modal .modal-card {
    width: min(100%, 430px);
    max-height: calc(100dvh - 20px) !important;
    padding: 20px 16px;
  }
}

/* V12: keep revealed card values readable in Night Mode. */
[data-theme='dark'] .card-front--verb .card-value,
[data-theme='dark'] .card-front--meaning .card-value { color: var(--color-text); }
