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

html {
  font-size: clamp(16px, 4.2vw, 20px);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Fredoka', system-ui, sans-serif;
  background: linear-gradient(180deg, #89f7fe 0%, #66a6ff 35%, #a18cd1 70%, #fbc2eb 100%);
  background-attachment: fixed;
  color: #2d2d2d;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

.sky-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.cloud {
  position: absolute;
  font-size: 3rem;
  opacity: 0.5;
  animation: floatCloud 20s ease-in-out infinite;
}

.cloud.c1 { top: 8%; left: 5%; animation-duration: 24s; }
.cloud.c2 { top: 15%; right: 8%; animation-duration: 18s; animation-delay: -5s; }
.cloud.c3 { top: 5%; right: 40%; font-size: 1.5rem; animation-duration: 12s; }

@keyframes floatCloud {
  0%, 100% { transform: translateX(0) translateY(0); }
  50% { transform: translateX(12px) translateY(-6px); }
}

#app {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  min-height: 100vh;
  min-height: 100dvh;
}

#game-view {
  min-height: calc(100dvh - 32px);
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.app-title {
  font-size: 1.85rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
  min-width: 140px;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.lang-toggle {
  background: #fff;
  border: 3px solid #fff;
  color: #6c5ce7;
  font-weight: 700;
  font-family: inherit;
  font-size: 1rem;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 48px;
  touch-action: manipulation;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.lang-toggle:hover {
  background: #f8f8ff;
  transform: scale(1.03);
}

.menu-header {
  margin-bottom: 12px;
}

.menu-top-actions {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.header-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 48px;
  padding: 5px 8px 4px;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.06);
  cursor: pointer;
  touch-action: manipulation;
  font-family: inherit;
}

.header-action-btn.icon-only {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.2rem;
}

.header-action-emoji {
  font-size: 1.15rem;
  line-height: 1;
}

.header-action-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: #6c5ce7;
  line-height: 1.1;
  letter-spacing: 0.02em;
}

.daily-icon-btn.state-done {
  opacity: 0.75;
  cursor: default;
}

.daily-icon-btn.state-done .header-action-label {
  color: #34c759;
}

.pro-btn.is-pro {
  background: linear-gradient(135deg, #fff9e6, #fff);
}

.pro-btn.is-pro .header-action-label {
  color: #c9a000;
}

.header-action-btn:disabled {
  cursor: default;
}

.hero-bar-compact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  border-left: 4px solid var(--hero-color, #6c5ce7);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.05);
}

.hero-bar-emoji {
  font-size: 2rem;
  line-height: 1;
}

.hero-bar-info {
  flex: 1;
  min-width: 120px;
}

.hero-bar-info strong {
  display: block;
  font-size: 1rem;
}

.hero-bar-info span {
  font-size: 0.82rem;
  color: #666;
}

.usage-pill {
  width: 100%;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6c5ce7;
  background: rgba(108, 92, 231, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
  text-align: center;
}

.hero-progress-wrap.compact {
  width: 100%;
  margin: 0;
}

.hero-progress-wrap.compact .hero-progress-bar {
  height: 8px;
}

.gear-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(20, 20, 40, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.gear-sheet-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  color: #444;
  font-size: 1.1rem;
}

.gear-sheet-panel {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 16px 16px max(24px, env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15);
  position: relative;
}

.gear-sheet-title {
  margin: 0 44px 12px 0;
  font-size: 1.2rem;
}

.gear-sheet-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: rgba(108, 92, 231, 0.08);
  margin-bottom: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.ranking-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.ranking-tab {
  flex: 1;
  border: none;
  padding: 10px;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
  background: rgba(108, 92, 231, 0.12);
  color: #6c5ce7;
  cursor: pointer;
}

.ranking-tab.active {
  background: #6c5ce7;
  color: #fff;
}

.auth-screen {
  max-width: 400px;
  margin: 0 auto;
  padding: 24px 0;
}

.auth-title {
  text-align: center;
  margin-bottom: 4px;
}

.auth-subtitle {
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 20px;
}

.auth-input {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 2px solid rgba(108, 92, 231, 0.2);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
}

.auth-buttons {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.auth-btn {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 12px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}

.auth-btn.primary {
  background: #6c5ce7;
  color: #fff;
}

.auth-btn.secondary {
  background: #fff;
  color: #6c5ce7;
  border: 2px solid rgba(108, 92, 231, 0.3);
}

.auth-msg {
  margin-top: 12px;
  font-size: 0.9rem;
}

.auth-msg.error {
  color: #ffc9c9;
}

.fallback-plans-lead {
  margin: 0 0 12px;
  font-weight: 600;
}

.fallback-plans-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fallback-plan-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: none;
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(108, 92, 231, 0.1);
  font-family: inherit;
  cursor: pointer;
}

.paywall-setup-hint {
  padding: 0 16px 16px;
  font-size: 0.85rem;
  color: #666;
  line-height: 1.4;
}

/* Profile picker */
.profile-screen {
  text-align: center;
  padding: 24px 8px;
}

.profile-title {
  font-size: 2rem;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  margin: 0 0 8px;
}

.profile-subtitle {
  font-size: 2rem;
  margin: 0 0 24px;
}

.profile-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 12px;
  background: #fff;
  border: 4px solid var(--hero-color, #ffd93d);
  border-radius: 24px;
  cursor: pointer;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.08), 0 12px 24px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s;
  font-family: inherit;
}

.profile-card:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.08);
}

.profile-hero-emoji {
  font-size: 3rem;
  line-height: 1;
}

.profile-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.profile-hero-title {
  font-size: 0.8rem;
  color: #666;
}

.profile-points {
  font-size: 0.85rem;
  font-weight: 600;
  color: #6c5ce7;
}

.add-hero-row {
  display: flex;
  gap: 10px;
  max-width: 400px;
  margin: 0 auto;
}

.hero-name-input {
  flex: 1;
  padding: 14px 18px;
  border: 3px solid #fff;
  border-radius: 999px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.add-hero-btn {
  padding: 14px 20px;
  background: #ffd93d;
  border: none;
  border-radius: 999px;
  font-weight: 700;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 0 #e6b800;
  touch-action: manipulation;
}

.add-hero-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #e6b800;
}

/* Hero card on menu */
.hero-card {
  background: #fff;
  border-radius: 28px;
  padding: 18px;
  margin-bottom: 18px;
  border: 4px solid var(--hero-color, #ffd93d);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.06), 0 12px 28px rgba(0, 0, 0, 0.12);
}

.hero-card-top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero-big-emoji {
  font-size: 4rem;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.hero-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.hero-name {
  font-size: 1.3rem;
  font-weight: 700;
}

.hero-title {
  font-size: 0.95rem;
  color: #6c5ce7;
  font-weight: 600;
}

.hero-points {
  font-size: 0.9rem;
  color: #888;
}

.hero-progress-wrap {
  margin-top: 14px;
}

.hero-progress-bar {
  height: 14px;
  background: #eee;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.hero-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffd93d, #ff6bcb);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.hero-progress-label {
  font-size: 0.8rem;
  color: #666;
}

.switch-hero-btn {
  margin-top: 12px;
  width: 100%;
  padding: 10px;
  background: #f0f0ff;
  border: 2px dashed #6c5ce7;
  border-radius: 14px;
  color: #6c5ce7;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.hero-promo-toast {
  position: fixed;
  top: max(20px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #ffd93d, #ff6bcb);
  color: #fff;
  padding: 14px 24px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1.1rem;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  animation: heroPop 0.5s ease;
}

.hero-promo-emoji {
  font-size: 1.8rem;
}

@keyframes heroPop {
  0% { transform: translateX(-50%) scale(0.5); opacity: 0; }
  70% { transform: translateX(-50%) scale(1.08); }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

.hero-promo-msg {
  font-weight: 700;
  font-size: 1.1rem;
  color: #6c5ce7;
  margin: 8px 0;
}

.game-level-pill {
  background: #6c5ce7;
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  margin-left: auto;
}

.points-badge {
  background: #fff;
  padding: 8px 14px;
  border-radius: 20px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Daily challenge card */
.daily-challenge-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 18px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #fff 0%, #fff9f0 100%);
  border: 3px solid #ff9500;
  border-radius: 20px;
  box-shadow: 0 6px 20px rgba(255, 149, 0, 0.2);
  cursor: pointer;
  touch-action: manipulation;
}

.daily-challenge-card.completed {
  border-color: #34c759;
  opacity: 0.95;
}

.daily-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.daily-card-emoji {
  font-size: 2.5rem;
  line-height: 1;
}

.daily-card-titles {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.daily-card-titles strong {
  font-size: 1.15rem;
}

.daily-card-sub {
  font-size: 0.85rem;
  color: #666;
  line-height: 1.3;
}

.daily-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.daily-duration-badge {
  background: #f0f0f0;
  color: #555;
  padding: 4px 12px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.85rem;
}

.streak-badge {
  background: #fff5e6;
  color: #e68600;
  padding: 4px 12px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.9rem;
}

.daily-progress-text {
  font-weight: 600;
  color: #ff9500;
}

.daily-cta {
  display: block;
  text-align: center;
  background: #ff9500;
  color: #fff;
  font-weight: 700;
  padding: 12px;
  border-radius: 14px;
  font-size: 1rem;
}

.daily-challenge-card.completed .daily-cta {
  display: none;
}

.daily-status.done {
  font-size: 0.9rem;
  color: #34c759;
  font-weight: 600;
}

.daily-game-tag {
  text-align: center;
  background: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0 auto 8px;
  width: fit-content;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.stars-row {
  display: flex;
  gap: 4px;
}

.star {
  font-size: 1.6rem;
  color: #ddd;
}

.star.filled {
  color: #ffcc00;
}

.game-level-badge {
  font-size: 0.75rem;
  color: #ff9500;
  font-weight: 700;
  background: #fff5e6;
  padding: 2px 8px;
  border-radius: 10px;
}

.completion-stats {
  font-size: 1.1rem;
  color: #666;
  margin: 8px 0 16px;
}

.level-change {
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.level-change.up {
  background: #e8f8ed;
  color: #248a3d;
}

.level-change.down {
  background: #fff5e6;
  color: #c93400;
}

.streak-msg, .perfect-msg {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 8px 0;
}

.perfect-msg {
  color: #ff9500;
}

.streak-msg {
  color: #e68600;
}

.daily-complete .stars-row {
  justify-content: center;
  margin: 12px 0;
}

/* Subscription & paywall */
.subscription-card {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.05);
  border: 2px solid rgba(108, 92, 231, 0.15);
}

.subscription-card.is-pro {
  border-color: rgba(255, 217, 61, 0.8);
  background: linear-gradient(135deg, rgba(255, 249, 230, 0.95), rgba(255, 255, 255, 0.95));
}

.subscription-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.subscription-badge {
  font-size: 1.6rem;
  line-height: 1;
}

.subscription-card strong {
  display: block;
  font-size: 1rem;
}

.subscription-sub {
  display: block;
  font-size: 0.82rem;
  color: #666;
  margin-top: 2px;
}

.subscription-actions {
  display: flex;
  gap: 8px;
}

.subscription-btn {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.subscription-btn.primary {
  background: #6c5ce7;
  color: #fff;
  box-shadow: 0 3px 0 #5a4bd1;
}

.subscription-btn.secondary {
  background: #fff;
  color: #6c5ce7;
  border: 2px solid rgba(108, 92, 231, 0.35);
}

body.paywall-open {
  overflow: hidden;
}

/* Cloud sync panel */
.cloud-sync-panel {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.05);
  border: 2px dashed rgba(108, 92, 231, 0.25);
}

.cloud-sync-panel.signed-in {
  border-style: solid;
  border-color: rgba(108, 92, 231, 0.35);
}

.cloud-sync-lead {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: #555;
}

.cloud-sync-status {
  margin: 0 0 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #6c5ce7;
}

.cloud-sync-hint {
  margin: 0;
  font-size: 0.85rem;
  color: #777;
}

.cloud-sync-input {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 2px solid rgba(108, 92, 231, 0.2);
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.95rem;
}

.cloud-sync-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.cloud-sync-btn {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.cloud-sync-btn.primary {
  background: #6c5ce7;
  color: #fff;
}

.cloud-sync-btn.secondary {
  background: #fff;
  color: #6c5ce7;
  border: 2px solid rgba(108, 92, 231, 0.3);
}

.cloud-sync-btn.link {
  background: transparent;
  color: #888;
  text-decoration: underline;
  padding-left: 0;
}

.cloud-sync-msg {
  margin: 10px 0 0;
  font-size: 0.85rem;
}

.cloud-sync-msg.success { color: #2d8a4e; }
.cloud-sync-msg.error { color: #c0392b; }

.paywall-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(20, 20, 40, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}

.paywall-overlay[hidden] {
  display: none !important;
}

.paywall-sheet {
  width: min(968px, 100%);
  max-height: min(92dvh, 900px);
  background: #fff;
  border-radius: 24px 24px 20px 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.paywall-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.paywall-sheet-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.paywall-close {
  border: none;
  background: rgba(0, 0, 0, 0.06);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  color: #444;
  flex-shrink: 0;
}

.paywall-status {
  margin: 0;
  padding: 8px 16px;
  font-size: 0.9rem;
  color: #666;
}

.paywall-status.error {
  color: #c0392b;
  font-weight: 600;
  line-height: 1.4;
}

.paywall-container {
  flex: 1 1 auto;
  overflow: auto;
  min-height: 360px;
  width: 100%;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.paywall-container:empty {
  min-height: 360px;
}

/* RevenueCat paywall root — ensure visible inside our modal */
.paywall-container .paywall,
.paywall-container .rcb-ui-root {
  width: 100%;
  min-height: 320px;
}

@media (min-width: 600px) {
  .paywall-overlay {
    align-items: center;
  }

  .paywall-sheet {
    border-radius: 24px;
  }
}

/* Game carousel */
.level-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0 0 4px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.04);
}

.level-filter-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #555;
  width: 100%;
}

@media (min-width: 480px) {
  .level-filter-label {
    width: auto;
    flex-shrink: 0;
  }
}

.level-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}

.level-filter-chip {
  border: 2px solid rgba(108, 92, 231, 0.25);
  background: #fff;
  color: #6c5ce7;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.level-filter-chip.active {
  background: #6c5ce7;
  border-color: #6c5ce7;
  color: #fff;
}

.level-filter-chip:active {
  transform: scale(0.97);
}

.carousel-empty-filter {
  text-align: center;
  padding: 32px 16px;
  margin: 12px 0 0;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.activity-log-section {
  margin: 28px 0 24px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
}

.activity-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.activity-log-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.activity-log-date {
  border: none;
  border-radius: 10px;
  padding: 6px 10px;
  font: inherit;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.92);
  color: #333;
}

.activity-log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.activity-log-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: #2d3436;
  font-size: 0.9rem;
}

.activity-log-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.activity-log-text {
  font-weight: 600;
  line-height: 1.35;
}

.activity-log-time {
  font-size: 0.78rem;
  color: #636e72;
  white-space: nowrap;
}

.activity-log-empty {
  padding: 14px 12px;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  font-size: 0.9rem;
}

.game-category-section {
  margin: 16px 0 8px;
}

.category-heading {
  margin: 0 8px 8px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.letter-grid-wrap {
  width: 100%;
  max-width: min(340px, 92vw);
  margin: 12px auto;
}

.letter-grid {
  display: grid;
  gap: 6px;
  user-select: none;
  -webkit-user-select: none;
}

.letter-cell {
  aspect-ratio: 1;
  border: none;
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-size: clamp(1rem, 4vw, 1.35rem);
  font-weight: 700;
  color: #2d3436;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.letter-cell.selected {
  background: #74b9ff;
  color: #fff;
  transform: scale(1.05);
}

.letter-cell.hint {
  box-shadow: 0 0 0 3px #ffd93d;
  animation: hint-pulse 1.2s ease-in-out infinite;
}

@keyframes hint-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.word-selected-preview {
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  margin: 8px 0 4px;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: 0.08em;
}

.word-hint-banner {
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 217, 61, 0.35);
  color: #fff;
}

.word-game-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.word-game-actions .answer-btn {
  flex: 0 1 auto;
  min-width: 100px;
  max-width: 160px;
}

.type-practice-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

.type-practice-notice {
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 154, 118, 0.35);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
}

.type-practice-label {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
}

.type-practice-target {
  margin: 0;
  padding: 16px 18px;
  border-radius: 12px;
  background: #fff;
  color: #2d3436;
  font-size: clamp(1.05rem, 3.5vw, 1.35rem);
  font-weight: 600;
  line-height: 1.55;
  text-align: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.type-practice-input-wrap {
  width: 100%;
}

.type-practice-input {
  width: 100%;
  min-height: 96px;
  padding: 14px 16px;
  border: 3px solid rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  color: #2d3436;
  font-family: inherit;
  font-size: clamp(1rem, 3.2vw, 1.2rem);
  line-height: 1.55;
  resize: vertical;
  box-sizing: border-box;
}

.type-practice-input:focus {
  outline: none;
  border-color: #ffd93d;
  box-shadow: 0 0 0 3px rgba(255, 217, 61, 0.35);
}

.type-practice-status {
  margin: 0;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.type-practice-status.ready {
  color: #a8e6cf;
}

.word-clear-btn {
  background: #fff;
  color: #636e72;
  border: 2px solid #b2bec3;
}

.word-search-area,
.word-rush-area {
  width: 100%;
}

.word-list-targets {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 0 0 12px;
  padding: 0;
}

.word-target {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.word-target.found {
  background: #6bcb77;
  color: #fff;
  text-decoration: line-through;
}

.word-rush-timer {
  height: 10px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}

.word-rush-timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ffd93d, #ff6b6b);
  transition: width 1s linear;
}

.word-rush-found {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 0 0 8px;
  padding: 0;
  min-height: 28px;
}

.word-rush-found li {
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  font-size: 0.85rem;
}

.word-rush-count {
  text-align: center;
  font-weight: 600;
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.95);
}

.game-carousel-wrap {
  position: relative;
  margin: 8px -8px 0;
  padding: 0 4px;
}

.game-carousel-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 12px 36px 16px;
  scrollbar-width: none;
}

.game-carousel-track::-webkit-scrollbar {
  display: none;
}

.game-carousel-card {
  flex: 0 0 min(88vw, 340px);
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 18px 22px;
  min-height: 260px;
  background: #fff;
  border: none;
  border-radius: 24px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.06), 0 8px 16px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: transform 0.12s;
  touch-action: pan-x;
  -webkit-user-select: none;
  user-select: none;
  font-family: inherit;
}

.game-carousel-card.color-0 { border-bottom: 5px solid #ff6b6b; }
.game-carousel-card.color-1 { border-bottom: 5px solid #ffd93d; }
.game-carousel-card.color-2 { border-bottom: 5px solid #6bcb77; }
.game-carousel-card.color-3 { border-bottom: 5px solid #4d96ff; }
.game-carousel-card.color-4 { border-bottom: 5px solid #ff6bcb; }
.game-carousel-card.color-5 { border-bottom: 5px solid #6c5ce7; }

.game-carousel-card:active {
  transform: scale(0.98);
}

.game-variety-hint {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6c5ce7;
  background: rgba(108, 92, 231, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
}

.game-play-btn {
  margin-top: 4px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  background: #6c5ce7;
  padding: 8px 24px;
  border-radius: 999px;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: #6c5ce7;
  touch-action: manipulation;
}

.carousel-prev { left: 0; }
.carousel-next { right: 0; }

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 12px 8px;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border: none;
  border-radius: 50%;
  background: rgba(108, 92, 231, 0.25);
  padding: 0;
  cursor: pointer;
}

.carousel-dot.active {
  background: #6c5ce7;
  transform: scale(1.2);
}

.family-ranking-btn {
  display: block;
  width: 100%;
  margin: 12px 0 4px;
  padding: 12px 16px;
  border: none;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: #6c5ce7;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.05);
  touch-action: manipulation;
}

.ranking-screen {
  padding: 8px 0 24px;
}

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

.ranking-title {
  margin: 0;
  font-size: 1.3rem;
}

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

.ranking-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.05);
  border-left: 4px solid var(--hero-color, #6c5ce7);
}

.ranking-place {
  font-size: 1.2rem;
  font-weight: 700;
  min-width: 24px;
  color: #888;
}

.ranking-emoji {
  font-size: 1.8rem;
}

.ranking-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ranking-info span {
  font-size: 0.8rem;
  color: #666;
}

.ranking-score {
  font-size: 1.1rem;
  font-weight: 700;
  color: #6c5ce7;
}

.ranking-empty {
  text-align: center;
  color: #888;
  padding: 24px;
}

.diversity-msg {
  font-weight: 700;
  color: #6c5ce7;
  font-size: 1rem;
  margin: 8px 0;
}

/* Legacy game grid (deprecated) */
.game-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.game-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 12px;
  min-height: 120px;
  background: #fff;
  border: none;
  border-radius: 22px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.06), 0 8px 16px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: transform 0.12s;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  font-family: inherit;
}

.game-card.color-0 { border-bottom: 5px solid #ff6b6b; }
.game-card.color-1 { border-bottom: 5px solid #ffd93d; }
.game-card.color-2 { border-bottom: 5px solid #6bcb77; }
.game-card.color-3 { border-bottom: 5px solid #4d96ff; }
.game-card.color-4 { border-bottom: 5px solid #ff6bcb; }
.game-card.color-5 { border-bottom: 5px solid #6c5ce7; }

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

.game-card:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.06);
}

.game-emoji {
  font-size: 2.2rem;
  line-height: 1;
}

.game-name {
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
}

/* Game screen */
.game-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: calc(100dvh - 48px);
}

.game-body {
  flex: 1 1 auto;
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

.game-answers {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 16px max(8px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(255, 255, 255, 0.95) 70%, transparent);
}

.game-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.back-btn {
  background: #fff;
  border: 2px solid #ff3b30;
  color: #ff3b30;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.35rem;
  cursor: pointer;
  font-weight: 700;
  touch-action: manipulation;
  flex-shrink: 0;
}

/* Circular icon-only buttons (back, close) */
.icon-circle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  line-height: 1;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, sans-serif;
  text-align: center;
}

.back-btn.icon-circle-btn {
  padding-bottom: 2px;
}

.paywall-close.icon-circle-btn,
.gear-sheet-close.icon-circle-btn {
  font-family: system-ui, -apple-system, sans-serif;
}

.difficulty-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.diff-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #ff9500;
  background: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  color: #ff9500;
  cursor: pointer;
  touch-action: manipulation;
  flex-shrink: 0;
}

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

.diff-label {
  font-weight: 700;
  font-size: 1rem;
  min-width: 80px;
  text-align: center;
}

.game-header {
  text-align: center;
  margin-bottom: 16px;
}

.game-emoji-large {
  font-size: 2.5rem;
  display: block;
}

.game-header h2 {
  margin: 8px 0 0;
  font-size: clamp(1.1rem, 4.5vw, 1.4rem);
  line-height: 1.2;
  padding: 0 4px;
}

/* Progress */
.progress-wrap {
  margin-bottom: 20px;
}

.progress-label {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 6px;
}

.progress-bar {
  height: 10px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff9500, #ffcc00);
  border-radius: 10px;
  transition: width 0.3s ease;
}

/* Question */
.question-text {
  font-size: clamp(1.2rem, 5vw, 1.5rem);
  font-weight: 700;
  text-align: center;
  margin: 12px 0 16px;
  line-height: 1.3;
  padding: 0 4px;
  word-wrap: break-word;
}

/* Visual area */
.visual-area {
  display: flex;
  justify-content: center;
  margin: 16px 0;
  flex-wrap: wrap;
}

.visual-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  max-width: min(320px, 100%);
}

.dot {
  font-size: 1.6rem;
}

.dot.crossed {
  opacity: 0.25;
  text-decoration: line-through;
}

.visual-groups {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 160px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
}

.block, .lego-block {
  font-size: 1.2rem;
}

.plus-sign {
  font-size: 1.8rem;
  font-weight: 800;
  color: #ff9500;
}

/* Coins */
.visual-coins {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.coin {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffd700, #daa520);
  border: 3px solid #b8860b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

/* Multiply / divide */
.visual-multiply {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.multiply-row {
  display: flex;
  gap: 4px;
}

.visual-divide {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.divide-pile {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 80px;
  padding: 10px;
  background: #fff;
  border-radius: 12px;
  border: 2px dashed #ff9500;
}

.domino-dot {
  font-size: 0.7rem;
  color: #333;
}

/* Sequence */
.visual-sequence {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.seq-box {
  min-width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 2px solid #ff9500;
  border-radius: 12px;
  font-size: 1.3rem;
  font-weight: 700;
}

.seq-box.gap {
  background: #fff9db;
  color: #ff9500;
}

.seq-box.gap.highlight {
  border-style: dashed;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* One more / less */
.visual-one-more-less {
  text-align: center;
}

.oml-center {
  font-size: 3rem;
  font-weight: 800;
  color: #ff9500;
  margin-bottom: 8px;
}

.oml-labels {
  display: flex;
  justify-content: space-between;
  max-width: 280px;
  margin: 0 auto;
  font-size: 0.95rem;
  color: #666;
}

/* Number line */
.visual-numberline {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #fff;
  border-radius: 16px;
}

.nl-point {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.nl-point.target {
  background: #ff9500;
  color: #fff;
}

.nl-arrow {
  font-size: 1.5rem;
  color: #ff9500;
}

/* Even odd */
.visual-even-odd {
  text-align: center;
}

.eo-number {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.eo-dots {
  max-width: 280px;
  margin: 0 auto;
}

.eo-more {
  font-size: 0.9rem;
  color: #666;
  align-self: center;
}

.visual-compare {
  display: flex;
  gap: 24px;
  justify-content: center;
  align-items: flex-end;
}

.compare-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.compare-number {
  font-size: 2rem;
  font-weight: 800;
}

.compare-bar-wrap {
  height: 90px;
  display: flex;
  align-items: flex-end;
}

.compare-bar {
  width: 36px;
  background: linear-gradient(180deg, #74b9ff, #0984e3);
  border-radius: 8px 8px 4px 4px;
  min-height: 12px;
}

.visual-half {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.half-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 120px;
  justify-content: center;
  padding: 8px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
}

.half-divider {
  font-size: 1.5rem;
  font-weight: 800;
  color: #636e72;
}

.visual-make-ten {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.make-ten-missing {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  max-width: 140px;
  justify-content: center;
}

.visual-tens-ones {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  justify-content: center;
  flex-wrap: wrap;
}

.tens-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: rgba(116, 185, 255, 0.25);
  border-radius: 8px;
}

.tens-block {
  font-size: 0.65rem;
  line-height: 1;
}

.ones-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 80px;
}

/* Missing */
.visual-missing {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.question-dot {
  background: #fff9db;
  border-radius: 8px;
  padding: 2px 6px;
}

.equals-total {
  font-size: 1.4rem;
  font-weight: 700;
}

/* Clock */
.clock-svg {
  display: block;
  margin: 0 auto;
  width: min(280px, 85vw);
  height: auto;
  max-height: 45vh;
  touch-action: none;
}

.clock-interactive {
  cursor: grab;
}

.clock-touch-area {
  fill: transparent;
  stroke: none;
  pointer-events: all;
}

.clock-face {
  fill: #fff;
  stroke: #333;
  stroke-width: 3;
}

.clock-number {
  font-size: 14px;
  font-weight: 700;
  fill: #333;
}

.clock-hand {
  stroke: #333;
  stroke-width: 4;
  stroke-linecap: round;
}

.hour-hand {
  stroke: #ff9500;
  stroke-width: 5;
}

.minute-hand {
  stroke: #666;
  stroke-width: 3;
}

.clock-center {
  fill: #ff9500;
}

.clock-check-btn {
  display: block;
  margin: 16px auto 0;
  max-width: 200px;
}

/* Answers */
.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 520px;
  margin: 0;
  justify-items: stretch;
}

.even-odd-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 340px;
}

.answer-btn {
  min-height: 64px;
  font-size: clamp(1.2rem, 5vw, 1.5rem);
  font-weight: 700;
  font-family: inherit;
  background: #fff;
  border: 3px solid #6c5ce7;
  border-radius: 20px;
  color: #333;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
  touch-action: manipulation;
  box-shadow: 0 4px 0 #5a4bd1;
  -webkit-user-select: none;
  user-select: none;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.answer-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #5a4bd1;
}

.continue-btn {
  background: linear-gradient(135deg, #ffd93d, #ff9a76);
  color: #fff;
  border: none;
  padding: 16px 40px;
  font-size: 1.2rem;
  font-weight: 700;
  font-family: inherit;
  border-radius: 999px;
  cursor: pointer;
  min-height: 56px;
  box-shadow: 0 6px 0 #e68600;
  touch-action: manipulation;
}

.continue-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #e68600;
}

.even-odd-btn {
  font-size: 1.3rem;
}

.correct-picked {
  background: #34c759 !important;
  color: #fff !important;
  border-color: #34c759 !important;
}

.wrong-picked {
  animation: shake 0.4s;
  background: #ffebee !important;
}

/* Order */
.order-area {
  margin-top: 12px;
}

.order-hint {
  text-align: center;
  font-size: 1rem;
  color: #666;
  margin-bottom: 16px;
}

.order-slots {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.order-slot {
  width: 64px;
  height: 64px;
  border: 3px dashed #ff9500;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  background: #fff9db;
}

.order-slot.filled {
  border-style: solid;
  background: #fff;
}

.order-pool {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.order-chip {
  width: 64px;
  height: 64px;
  font-size: 1.4rem;
  font-weight: 700;
  background: #fff;
  border: 3px solid #ff9500;
  border-radius: 14px;
  cursor: grab;
  touch-action: manipulation;
}

.order-chip.placed {
  opacity: 0.3;
  cursor: default;
}

.order-chip.dragging {
  opacity: 0.6;
}

/* Dual */
.dual-area {
  margin-top: 12px;
}

.dual-step {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

/* Feedback */
.feedback-toast {
  position: fixed;
  bottom: max(32px, calc(env(safe-area-inset-bottom) + 16px));
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 28px;
  border-radius: 24px;
  font-size: clamp(1rem, 4vw, 1.2rem);
  font-weight: 700;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-width: calc(100vw - 32px);
  text-align: center;
}

.feedback-toast.correct {
  background: #34c759;
  color: #fff;
}

.feedback-toast.wrong {
  background: #ff9500;
  color: #fff;
}

.flash-wrong {
  animation: flashWrong 0.5s;
}

@keyframes flashWrong {
  0%, 100% { background: transparent; }
  30% { background: rgba(255, 107, 107, 0.2); }
}

.confetti-piece {
  position: fixed;
  top: -10px;
  font-size: 1.4rem;
  pointer-events: none;
  z-index: 300;
  animation: confettiFall 1.1s ease-in forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

.star-helper .star-item {
  font-size: 1.35rem;
  filter: drop-shadow(0 1px 2px rgba(255, 200, 0, 0.4));
}

.level-progress-msg {
  font-size: 0.95rem;
  color: #6c5ce7;
  font-weight: 600;
  margin-bottom: 12px;
}

.flash-correct {
  animation: flashGreen 0.6s;
}

@keyframes flashGreen {
  0%, 100% { background: transparent; }
  30% { background: rgba(52, 199, 89, 0.15); }
}

.shake {
  animation: shake 0.5s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* Completion */
.completion-screen {
  text-align: center;
  padding: 40px 20px;
}

.completion-emoji {
  font-size: 5rem;
  margin-bottom: 16px;
}

.completion-screen h2 {
  font-size: 1.8rem;
  margin-bottom: 24px;
}

.continue-btn:hover {
  filter: brightness(1.05);
}

/* Responsive — tablet & desktop */
@media (min-width: 600px) {
  .game-carousel-card {
    flex: 0 0 min(88vw, 340px);
    min-height: 240px;
  }

  .game-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .answer-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 640px;
  }

  .even-odd-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 420px;
  }

  .game-answers {
    position: static;
    background: transparent;
    padding-bottom: 0;
  }

  .game-screen {
    min-height: auto;
  }
}

/* Responsive — phones */
@media (max-width: 599px) {
  #app {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .app-header {
    margin-bottom: 16px;
  }

  .app-title {
    font-size: clamp(1.35rem, 6vw, 1.75rem);
  }

  .game-carousel-card {
    flex: 0 0 min(88vw, 320px);
    min-height: 240px;
    padding: 24px 16px 20px;
  }

  .carousel-nav {
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
  }

  .game-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .game-card {
    min-height: 100px;
    padding: 16px 8px;
  }

  .game-emoji {
    font-size: 1.9rem;
  }

  .game-name {
    font-size: 0.85rem;
  }

  .game-top-bar {
    gap: 8px;
  }

  .diff-label {
    font-size: 0.9rem;
    min-width: 70px;
  }

  .answer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .answer-btn {
    min-height: 56px;
  }

  .even-odd-btn {
    min-height: 72px;
  }

  .seq-box {
    min-width: 44px;
    height: 44px;
    font-size: 1.1rem;
  }

  .visual-sequence {
    gap: 6px;
  }

  .order-slot,
  .order-chip {
    width: 56px;
    height: 56px;
    font-size: 1.2rem;
  }

  .coin {
    width: 50px;
    height: 50px;
    font-size: 0.85rem;
  }

  .oml-center {
    font-size: 2.5rem;
  }

  .eo-number {
    font-size: 2rem;
  }

  .completion-emoji {
    font-size: 4rem;
  }

  .continue-btn {
    width: 100%;
    max-width: 280px;
  }
}

/* Very narrow phones */
@media (max-width: 360px) {
  .game-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .game-card {
    min-height: 88px;
  }

  .points-badge {
    width: 100%;
    text-align: center;
    order: 3;
  }

  .app-header {
    justify-content: center;
  }

  .app-title {
    text-align: center;
    flex: 1 1 100%;
  }
}

/* Landscape phones — reduce vertical clutter */
@media (max-height: 500px) and (orientation: landscape) {
  .game-header {
    margin-bottom: 8px;
  }

  .game-emoji-large {
    font-size: 1.8rem;
  }

  .game-header h2 {
    font-size: 1rem;
    margin-top: 4px;
  }

  .progress-wrap {
    margin-bottom: 10px;
  }

  .visual-area {
    margin: 8px 0;
  }

  .clock-svg {
    max-height: 35vh;
    width: min(200px, 40vw);
  }

  .answer-btn {
    min-height: 48px;
  }

  .completion-screen {
    padding: 20px 16px;
  }

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

/* Touch devices — larger tap targets */
@media (hover: none) and (pointer: coarse) {
  .lang-toggle,
  .continue-btn {
    min-height: 48px;
  }

  .game-card:hover {
    transform: none;
  }

  .answer-btn:hover {
    transform: none;
  }

  .game-card:active {
    transform: scale(0.97);
    background: #fff9f0;
  }

  .answer-btn:active {
    transform: scale(0.97);
    background: #fff5e6;
  }
}
