.memory-games-stats-outer {
  width: 100%;
}

.memory-games-stats {
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  background: linear-gradient(180deg, hsl(var(--card)), hsl(var(--muted) / 0.1));
  padding: 1.2rem 1.35rem;
  margin: 0 auto;
  max-width: 1200px;
  box-shadow: 0 6px 20px hsl(var(--foreground) / 0.03);
}

.memory-games-dashboard {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.memory-games-stats__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.memory-games-stats__title {
  font-family: var(--font-serif, serif);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}

.memory-games-stats__subtitle {
  margin: 0.25rem 0 0;
  font-size: 1rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.4;
}

.memory-games-streak {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: hsl(32 95% 55% / 0.14);
  color: hsl(24 80% 35%);
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
}

.memory-games-stats__grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 768px) {
  .memory-games-stats__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.memory-games-dashboard__charts {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: 1fr;
}

@media (min-width: 1100px) {
  .memory-games-dashboard__charts {
    grid-template-columns: minmax(0, 2fr) minmax(220px, 260px);
    align-items: stretch;
  }
}

.memory-games-dashboard__side {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) and (max-width: 1099px) {
  .memory-games-dashboard__side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.memory-games-dashboard__detail {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
  .memory-games-dashboard__detail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.memory-games-panel {
  border: 1px solid hsl(var(--border));
  border-radius: 0.65rem;
  background: hsl(var(--background) / 0.72);
  padding: 0.8rem 0.9rem 0.85rem;
  min-width: 0;
}

.memory-games-panel--main {
  display: flex;
  flex-direction: column;
}

.memory-games-panel--gauge {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
}

.memory-games-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 0.65rem;
  margin-bottom: 0.45rem;
}

.memory-games-panel__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.memory-games-panel__hint {
  width: 100%;
  margin: 0;
  font-size: 0.95rem;
  color: hsl(var(--muted-foreground));
}

.memory-games-panel__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.memory-games-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.92rem;
  color: hsl(var(--muted-foreground));
}

.memory-games-legend::before {
  content: '';
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 0.2rem;
}

.memory-games-legend--bars::before {
  background: hsl(var(--primary) / 0.75);
}

.memory-games-legend--line::before {
  width: 1rem;
  height: 0;
  border-top: 2px solid hsl(32 85% 52%);
  border-radius: 0;
}

.memory-games-panel__chart {
  width: 100%;
  overflow: hidden;
}

.memory-games-panel__donut {
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.memory-games-panel__chart > svg,
.memory-games-combo-chart,
.memory-games-hbar-chart {
  display: block;
  width: 100%;
  height: auto;
}

.memory-games-panel__donut > svg,
.memory-games-donut-chart {
  display: block;
  width: 132px;
  height: 132px;
  max-width: 132px;
  max-height: 132px;
  margin: 0 auto;
}

.memory-games-kpi__icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 0.5rem;
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  flex-shrink: 0;
  overflow: hidden;
}

.memory-games-kpi__icon-wrap svg,
.memory-games-kpi__icon {
  width: 20px !important;
  height: 20px !important;
  max-width: 20px !important;
  max-height: 20px !important;
  flex-shrink: 0;
  display: block;
}

.memory-games-combo-chart {
  max-height: 180px;
}

.memory-games-hbar-chart {
  max-height: 150px;
}

.mg-combo__axis {
  fill: hsl(var(--muted-foreground));
  font-size: 14px;
}

.mg-combo__axis--right {
  text-anchor: start;
}

.mg-combo__grid {
  stroke: hsl(var(--border));
  stroke-width: 1;
}

.mg-combo__bar {
  fill: hsl(var(--muted));
}

.mg-combo__bar.has-value {
  fill: hsl(var(--primary) / 0.78);
}

.mg-combo__count,
.mg-combo__label {
  fill: hsl(var(--muted-foreground));
  font-size: 14px;
}

.mg-combo__count {
  fill: hsl(var(--primary));
  font-size: 15px;
  font-weight: 700;
}

.mg-combo__line {
  fill: none;
  stroke: hsl(32 85% 52%);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mg-combo__dot {
  fill: hsl(32 85% 52%);
  stroke: hsl(var(--background));
  stroke-width: 1.5;
}

.mg-hbar__label {
  fill: hsl(var(--foreground));
  font-size: 15px;
  font-weight: 600;
}

.mg-hbar__meta {
  fill: hsl(var(--muted-foreground));
  font-size: 14px;
}

.mg-hbar__track {
  fill: hsl(var(--muted));
}

.mg-hbar__fill {
  fill: hsl(var(--primary) / 0.78);
}

.mg-hbar__value {
  fill: hsl(var(--primary));
  font-size: 15px;
  font-weight: 700;
}

.memory-games-donut-legend {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
  color: hsl(var(--muted-foreground));
}

.memory-games-donut-legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.memory-games-donut-legend__dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.memory-games-donut-legend__dot--workshops {
  background: hsl(var(--primary));
}

.memory-games-donut-legend__dot--classics {
  background: hsl(32 85% 52%);
}

.mg-donut__total {
  fill: hsl(var(--foreground));
  font-size: 28px;
  font-weight: 700;
}

.mg-donut__caption {
  fill: hsl(var(--muted-foreground));
  font-size: 12px;
}

.mg-gauge__value {
  fill: hsl(var(--foreground));
  font-size: 26px;
  font-weight: 700;
}

.mg-gauge__label {
  fill: hsl(var(--muted-foreground));
  font-size: 11px;
}

.memory-games-gauge--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  font-size: 1.25rem;
  color: hsl(var(--muted-foreground));
}

.memory-games-kpi {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.8rem;
  border-radius: 0.65rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background) / 0.85);
}

.memory-games-kpi--accent {
  border-color: hsl(var(--primary) / 0.25);
  background: hsl(var(--primary) / 0.06);
}

.memory-games-kpi__value {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.1;
  color: hsl(var(--foreground));
}

.memory-games-kpi__score small {
  font-size: 0.95rem;
  font-weight: 600;
  opacity: 0.75;
}

.memory-games-kpi__label {
  margin-top: 0.12rem;
  font-size: 0.9rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.25;
}

.memory-games-trend {
  display: inline-flex;
  align-items: center;
  font-size: 1.05rem;
  font-weight: 700;
}

.memory-games-trend--up {
  color: hsl(142 71% 32%);
}

.memory-games-trend--down {
  color: hsl(0 72% 45%);
}

.memory-games-trend--flat {
  color: hsl(var(--muted-foreground));
  font-size: 1.05rem;
}

.memory-games-categories {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
  margin-top: 1.25rem;
}

@media (min-width: 640px) {
  .memory-games-categories {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.memory-games-category {
  display: flex;
  gap: 0.85rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.85rem;
  padding: 1rem;
  background: hsl(var(--background) / 0.7);
}

.memory-games-category__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  background: hsl(var(--muted) / 0.45);
  font-size: 1.35rem;
  flex-shrink: 0;
}

.memory-games-category__body {
  min-width: 0;
  flex: 1;
}

.memory-games-category__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
}

.memory-games-category__stats {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.memory-games-category__count {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1;
  color: hsl(var(--primary));
}

.memory-games-category__unit {
  font-size: 0.88rem;
  color: hsl(var(--muted-foreground));
}

.memory-games-category__meta {
  margin: 0.35rem 0 0.5rem;
  font-size: 0.88rem;
  color: hsl(var(--muted-foreground));
}

.memory-games-category__bar {
  height: 0.35rem;
  border-radius: 999px;
  background: hsl(var(--muted));
  overflow: hidden;
}

.memory-games-category__fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, hsl(var(--primary) / 0.65), hsl(var(--primary)));
}

.memory-games-chart {
  margin-top: 1.35rem;
  padding-top: 1.25rem;
  border-top: 1px solid hsl(var(--border));
}

.memory-games-chart__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin-bottom: 0.85rem;
}

.memory-games-chart__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.memory-games-chart__hint {
  margin: 0;
  font-size: 0.88rem;
  color: hsl(var(--muted-foreground));
}

.memory-games-chart__bars {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  min-height: 140px;
  padding: 0.5rem 0.25rem 0;
}

.memory-games-chart__bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.memory-games-chart__count {
  min-height: 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: hsl(var(--primary));
}

.memory-games-chart__bar-track {
  display: flex;
  align-items: flex-end;
  width: 100%;
  max-width: 2.75rem;
  height: 96px;
}

.memory-games-chart__bar {
  width: 100%;
  border-radius: 0.45rem 0.45rem 0 0;
  background: hsl(var(--muted));
  min-height: 4px;
  transition: height 0.35s ease, background 0.2s ease;
}

.memory-games-chart__bar.has-value {
  background: linear-gradient(180deg, hsl(var(--primary)), hsl(var(--primary) / 0.65));
}

.memory-games-chart__bar-wrap:hover .memory-games-chart__bar.has-value {
  filter: brightness(1.05);
}

.memory-games-chart__label {
  font-size: 0.82rem;
  color: hsl(var(--muted-foreground));
  text-align: center;
  line-height: 1.2;
}

.memory-games-detail {
  margin-top: 1.35rem;
  padding-top: 1.25rem;
  border-top: 1px solid hsl(var(--border));
}

.memory-games-detail__title {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.memory-games-type-grid {
  display: grid;
  gap: 0.65rem;
}

.memory-games-type-section + .memory-games-type-section {
  margin-top: 1rem;
}

.memory-games-type-section__title {
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0 0 0.55rem;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.memory-games-type-row {
  display: grid;
  gap: 0.45rem;
  padding: 0.75rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background) / 0.65);
}

.memory-games-type-row--top {
  border-color: hsl(var(--primary) / 0.25);
  background: hsl(var(--primary) / 0.04);
}

.memory-games-type-row__info {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
}

.memory-games-type-row__name {
  font-size: 1rem;
  font-weight: 600;
}

.memory-games-type-row__meta {
  font-size: 0.88rem;
  color: hsl(var(--muted-foreground));
}

.memory-games-type-row__bar {
  height: 0.45rem;
  border-radius: 999px;
  background: hsl(var(--muted));
  overflow: hidden;
}

.memory-games-type-row__fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, hsl(var(--primary) / 0.55), hsl(var(--primary)));
}

.memory-games-empty {
  text-align: center;
  padding: 1.25rem 0.75rem 1rem;
  border-radius: 0.65rem;
  border: 1px dashed hsl(var(--primary) / 0.25);
  background: hsl(var(--primary) / 0.04);
}

.memory-games-empty__icon {
  font-size: 1.5rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.memory-games-empty__title {
  margin: 0;
  font-weight: 600;
  font-size: 0.9rem;
}

.memory-games-empty__text {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.45;
  max-width: 24rem;
  margin-inline: auto;
}

.memory-games-empty__play {
  margin-top: 0.85rem;
}

.memory-games-skeleton {
  border-radius: 0.65rem;
  background: linear-gradient(90deg, hsl(var(--muted) / 0.45), hsl(var(--muted) / 0.2), hsl(var(--muted) / 0.45));
  background-size: 200% 100%;
  animation: memory-games-shimmer 1.2s ease-in-out infinite;
}

.memory-games-skeleton--title {
  height: 1.5rem;
  width: 12rem;
  margin-bottom: 0.5rem;
}

.memory-games-skeleton--subtitle {
  height: 0.85rem;
  width: 18rem;
}

.memory-games-skeleton--kpi {
  height: 4.5rem;
}

.memory-games-skeleton--chart {
  min-height: 240px;
}

.memory-games-skeleton--chart-side {
  min-height: 180px;
}

@keyframes memory-games-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.memory-games-login-hint {
  text-align: center;
  padding: 1rem;
  border-radius: 0.75rem;
  background: hsl(var(--primary) / 0.06);
  border: 1px dashed hsl(var(--primary) / 0.25);
  margin-bottom: 2rem;
}

.memory-games-play-btn {
  margin-top: 0.75rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.memory-games-modal {
  position: fixed;
  inset: 0;
  z-index: 100010;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.memory-games-modal.is-open {
  display: flex;
}

.memory-games-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.memory-games-modal__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 32rem);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 1rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  padding: 1.5rem;
}

.memory-games-modal__title {
  font-family: var(--font-serif, serif);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.memory-games-modal__body {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.memory-games-modal__prompt {
  color: hsl(var(--muted-foreground));
  margin-bottom: 1rem;
  line-height: 1.5;
}

.memory-games-modal__photo {
  display: block;
  width: 100%;
  min-height: 180px;
  max-height: 280px;
  height: auto;
  flex-shrink: 0;
  object-fit: contain;
  background: hsl(var(--muted) / 0.35);
  border-radius: 0.75rem;
  margin-bottom: 1rem;
}

.memory-games-modal__photo.is-broken {
  object-fit: none;
  background:
    linear-gradient(hsl(var(--muted) / 0.35), hsl(var(--muted) / 0.35)),
    repeating-linear-gradient(
      45deg,
      hsl(var(--border) / 0.45) 0,
      hsl(var(--border) / 0.45) 8px,
      transparent 8px,
      transparent 16px
    );
}

.memory-games-options {
  display: grid;
  gap: 0.5rem;
}

.memory-games-option {
  text-align: left;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.memory-games-option:hover {
  border-color: hsl(var(--primary) / 0.5);
  background: hsl(var(--primary) / 0.05);
}

.memory-games-option.is-correct {
  border-color: hsl(142 71% 35%);
  background: hsl(142 71% 45% / 0.12);
}

.memory-games-option.is-wrong {
  border-color: hsl(0 72% 45%);
  background: hsl(0 72% 50% / 0.1);
}

.memory-games-textarea {
  width: 100%;
  min-height: 120px;
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border));
  padding: 0.75rem;
  resize: vertical;
  font: inherit;
}

.memory-games-checklist {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  gap: 0.5rem;
}

.memory-games-checklist label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
}

.memory-games-result {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: hsl(var(--primary) / 0.08);
  text-align: center;
}

.memory-games-modal__actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.memory-games-session-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.75rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.memory-games-classic-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1rem 0.75rem;
  background: linear-gradient(180deg, hsl(var(--primary) / 0.08), transparent);
}

.memory-games-premium-notice {
  border: 1px solid hsl(var(--primary) / 0.28);
  border-radius: 0.75rem;
  background: linear-gradient(180deg, hsl(var(--primary) / 0.08), hsl(var(--primary) / 0.03));
  padding: 0.9rem 1.1rem;
  text-align: center;
}

.memory-games-premium-notice__title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: hsl(var(--primary));
}

.memory-games-premium-notice__text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: hsl(var(--muted-foreground));
}

.memory-games-classic-plan {
  margin: 0.65rem 0 0;
  padding: 0.45rem 0.55rem;
  border-radius: 0.5rem;
  background: hsl(var(--primary) / 0.08);
  border: 1px solid hsl(var(--primary) / 0.18);
  color: hsl(var(--primary));
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
}

.memory-games-classic-plan--locked {
  background: hsl(var(--muted) / 0.35);
  border-color: hsl(var(--border));
  color: hsl(var(--muted-foreground));
}

.memory-games-classic-icon__img {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 1rem;
  box-shadow: 0 8px 20px hsl(var(--foreground) / 0.08);
}

.memory-games-classic--locked .memory-games-classic-icon__img {
  opacity: 0.72;
  filter: grayscale(0.25);
}

.memory-games-classic-badge {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: hsl(var(--primary) / 0.14);
  border: 1px solid hsl(var(--primary) / 0.35);
  color: hsl(var(--primary));
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.senior-mode .memory-games-stats__title {
  font-size: 1.75rem;
}

.senior-mode .memory-games-kpi__value {
  font-size: 1.75rem;
}

.senior-mode .memory-games-kpi__label,
.senior-mode .memory-games-type-row__meta {
  font-size: 1rem;
}

.senior-mode .memory-games-option {
  font-size: 1.125rem;
  padding: 1rem 1.25rem;
}

.senior-mode .memory-games-play-btn {
  font-size: 1.125rem;
  padding: 0.875rem 1rem;
}
