/* Learn with CoCo — Adventure Game Play Shell */

body[data-page="activity"] {
  --game-tint: #fff3c4;
  background-color: #ffe56a !important;
  background-image:
    radial-gradient(circle at 12% 18%, #ff9f7a 0%, transparent 42%),
    radial-gradient(circle at 88% 12%, #5ad0ff 0%, transparent 40%),
    radial-gradient(circle at 78% 82%, #3de0b5 0%, transparent 45%),
    radial-gradient(circle at 10% 88%, #ff6b8a 0%, transparent 40%),
    linear-gradient(160deg, #ffe56a 0%, #ffd4a8 25%, #b8f0ff 55%, #9ff5d8 80%, #ffc4b0 100%) !important;
}

body[data-page="activity"] .site-header {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 2px solid rgba(26, 43, 74, 0.08);
}

body[data-page="activity"] .activity-shell {
  padding: 18px 0 110px;
}

.game-hud {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px 14px;
  align-items: center;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), var(--game-tint, #fff3c4));
  border: 2px solid rgba(26, 43, 74, 0.1);
  box-shadow: 0 10px 24px rgba(26, 43, 74, 0.1);
}

.game-hud-cover {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 6px 14px rgba(26, 43, 74, 0.16);
  background: #fff;
}

.game-hud-cover-fallback {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2rem;
  background: #ffe56a;
  border: 3px solid #fff;
  box-shadow: 0 6px 14px rgba(26, 43, 74, 0.16);
}

.game-hud-main {
  min-width: 0;
}

.game-hud-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.game-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(26, 43, 74, 0.12);
  color: #1a2b4a;
}

.game-hud-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3.4vw, 1.7rem);
  line-height: 1.15;
  color: #1a2b4a;
}

.game-hud-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.game-hud-actions .btn {
  min-height: 42px;
  padding: 8px 14px;
  font-size: 0.92rem;
}

.game-progress {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.game-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-weight: 800;
  color: #5b6b88;
  font-size: 0.9rem;
}

.game-stars {
  letter-spacing: 2px;
  color: #f0b429;
  font-size: 1.05rem;
}

.game-progress-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(26, 43, 74, 0.1);
  overflow: hidden;
  border: 1px solid rgba(26, 43, 74, 0.08);
}

.game-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffc43a, #ff7a59 55%, #3de0b5);
  transition: width 0.35s ease;
}

body[data-page="activity"] .activity-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 196, 58, 0.28), transparent 36%),
    radial-gradient(circle at 90% 8%, rgba(61, 184, 255, 0.22), transparent 34%),
    rgba(255, 255, 255, 0.96);
  border: 2px solid rgba(26, 43, 74, 0.1);
  border-radius: 30px;
  box-shadow: 0 18px 36px rgba(26, 43, 74, 0.14);
  padding: 18px;
  backdrop-filter: none;
}

body[data-page="activity"] .activity-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 24px;
  border: 2px dashed rgba(255, 196, 58, 0.35);
  pointer-events: none;
}

body[data-page="activity"] .activity-header,
body[data-page="activity"] .lead,
body[data-page="activity"] .activity-area,
body[data-page="activity"] .feedback,
body[data-page="activity"] .level-nav,
body[data-page="activity"] .next-level-wrap,
body[data-page="activity"] .game-hud {
  position: relative;
  z-index: 1;
}

body[data-page="activity"] .activity-header {
  display: none;
}

body[data-page="activity"] #activity-desc.lead {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid rgba(26, 43, 74, 0.08);
  color: #1a2b4a;
  font-weight: 700;
  max-width: none;
}

body[data-page="activity"] .activity-area {
  min-height: 340px;
  border-radius: 26px;
  border: 3px solid rgba(26, 43, 74, 0.1);
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.85), transparent 40%),
    linear-gradient(165deg, #e8f9ff 0%, #fff8e8 48%, #dffcf2 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7), 0 10px 24px rgba(26, 43, 74, 0.08);
  padding: 18px;
}

body[data-page="activity"] .item-grid {
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}

body[data-page="activity"] .photo-grid {
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
}

body[data-page="activity"] .item-btn,
body[data-page="activity"] .drag-item,
body[data-page="activity"] .drop-zone {
  min-height: 112px;
  border-radius: 22px;
  border: 2.5px solid rgba(26, 43, 74, 0.12);
  background: linear-gradient(180deg, #ffffff 0%, #fff8ef 100%);
  box-shadow: 0 8px 0 rgba(26, 43, 74, 0.08), 0 12px 20px rgba(26, 43, 74, 0.08);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

body[data-page="activity"] .item-btn:hover,
body[data-page="activity"] .drag-item:hover {
  transform: translateY(-3px) scale(1.03);
}

body[data-page="activity"] .item-btn:focus-visible,
body[data-page="activity"] .drag-item:focus-visible,
body[data-page="activity"] .drop-zone:focus-visible,
body[data-page="activity"] .btn:focus-visible,
body[data-page="activity"] .spelling-input:focus-visible {
  outline: 3px solid #3db8ff;
  outline-offset: 3px;
}

body[data-page="activity"] .item-btn.selected,
body[data-page="activity"] .drag-item.is-picked {
  border-color: #3db8ff;
  background: #e8f7ff;
  box-shadow: 0 0 0 4px rgba(61, 184, 255, 0.25), 0 10px 0 rgba(26, 43, 74, 0.08);
}

body[data-page="activity"] .item-btn.correct,
body[data-page="activity"] .drop-zone.filled {
  border-color: #2fba6d;
  background: #e8fbee;
  box-shadow: 0 0 0 4px rgba(47, 186, 109, 0.22), 0 8px 0 rgba(26, 43, 74, 0.06);
  animation: gamePop 0.35s ease;
}

body[data-page="activity"] .item-btn.wrong {
  border-color: #ff6b6b;
  background: #ffe8e4;
  animation: gameShake 0.35s ease;
}

body[data-page="activity"] .item-btn.face-down {
  background: linear-gradient(145deg, #3db8ff, #7b5cff 45%, #ff8f6b 78%, #ffc43a);
  border-color: #fff;
  color: #fff;
}

body[data-page="activity"] .item-btn.open:not(.face-down) {
  transform: rotateY(0deg);
  animation: cardFlipIn 0.28s ease;
}

body[data-page="activity"] .item-photo {
  border-radius: 16px;
  border: 2px solid rgba(26, 43, 74, 0.14);
  box-shadow: 0 4px 10px rgba(26, 43, 74, 0.08);
}

body[data-page="activity"] .item-label {
  font-size: 0.9rem;
  font-weight: 800;
}

body[data-page="activity"] .drop-zone {
  min-height: 120px;
  border-style: dashed;
  border-width: 2.5px;
  color: #5b6b88;
  font-weight: 800;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.9), transparent 55%),
    #f4fbff;
}

body[data-page="activity"] .drop-zone.is-target {
  border-color: #3db8ff;
  background: #eaf7ff;
}

body[data-page="activity"] .count-photos .item-photo {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  animation: countPop 0.45s ease both;
}

body[data-page="activity"] .count-photos .item-photo:nth-child(2) { animation-delay: 0.04s; }
body[data-page="activity"] .count-photos .item-photo:nth-child(3) { animation-delay: 0.08s; }
body[data-page="activity"] .count-photos .item-photo:nth-child(4) { animation-delay: 0.12s; }
body[data-page="activity"] .count-photos .item-photo:nth-child(5) { animation-delay: 0.16s; }
body[data-page="activity"] .count-photos .item-photo:nth-child(6) { animation-delay: 0.2s; }

body[data-page="activity"] .spell-photo-wrap .item-photo {
  width: min(240px, 72vw);
  height: min(240px, 72vw);
  border-radius: 28px;
  border-width: 3px;
  box-shadow: 0 14px 28px rgba(26, 43, 74, 0.14);
}

body[data-page="activity"] .spelling-input {
  min-width: min(280px, 80vw);
  min-height: 52px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 2.5px solid rgba(26, 43, 74, 0.14);
  font-size: 1.25rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.04em;
  background: #fff;
  box-shadow: 0 8px 0 rgba(26, 43, 74, 0.06);
}

body[data-page="activity"] .counter-display {
  margin: 0 auto 14px;
  max-width: 420px;
  min-height: 52px;
  display: grid;
  place-items: center;
  padding: 10px 14px;
  border-radius: 18px;
  background: #fff;
  border: 2.5px solid rgba(26, 43, 74, 0.12);
  font-size: 1.25rem;
  font-weight: 800;
  color: #1a2b4a;
  box-shadow: 0 8px 0 rgba(26, 43, 74, 0.06);
}

body[data-page="activity"] .sequence-slots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 0 auto 16px;
}

body[data-page="activity"] .sequence-slot {
  min-width: 52px;
  min-height: 52px;
  padding: 8px 12px;
  border-radius: 16px;
  display: inline-grid;
  place-items: center;
  font-size: 1.2rem;
  font-weight: 800;
  border: 2.5px dashed rgba(26, 43, 74, 0.18);
  background: rgba(255, 255, 255, 0.75);
  color: #8a97ad;
}

body[data-page="activity"] .sequence-slot.is-filled {
  border-style: solid;
  border-color: #3db8ff;
  background: #fff;
  color: #1a2b4a;
  box-shadow: 0 6px 0 rgba(26, 43, 74, 0.08);
  animation: gamePop 0.28s ease;
}

body[data-page="activity"] .shadow-photo.shadow-revealed {
  filter: none;
  opacity: 1;
  transform: scale(1.04);
  transition: transform 0.25s ease, filter 0.25s ease, opacity 0.25s ease;
}

body[data-page="activity"] .feedback {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  font-size: 1.05rem;
  border: 2px solid transparent;
  box-shadow: 0 8px 18px rgba(26, 43, 74, 0.08);
}

body[data-page="activity"] .feedback.ok {
  background: #e5fbee;
  color: #0f7a40;
  border-color: rgba(47, 186, 109, 0.35);
}

body[data-page="activity"] .feedback.bad {
  background: #ffe9e5;
  color: #b42318;
  border-color: rgba(255, 107, 107, 0.35);
}

.game-complete {
  margin-top: 16px;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(135deg, #fff3b0, #dffcf2);
  border: 2px solid rgba(26, 43, 74, 0.1);
  text-align: center;
  box-shadow: 0 12px 24px rgba(26, 43, 74, 0.1);
  animation: gamePop 0.4s ease;
}

.game-complete h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.game-complete p {
  margin: 0 0 12px;
  font-weight: 700;
  color: #5b6b88;
}

.game-complete-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

body[data-page="activity"] .next-level-btn,
.game-complete-actions .btn-primary {
  min-width: 200px;
  min-height: 52px;
  font-size: 1.12rem;
  border-radius: 999px;
  box-shadow: 0 8px 0 rgba(196, 84, 42, 0.35);
}

body[data-page="activity"] .level-nav {
  margin-top: 10px;
}

body[data-page="activity"] .level-info {
  display: none;
}

body[data-page="activity"].has-ads {
  padding-bottom: 96px;
}

body[data-page="activity"] .ad-slot.ad-bottom {
  border-radius: 18px 18px 0 0;
  background: rgba(255, 248, 232, 0.96);
  border-top: 2px solid rgba(26, 43, 74, 0.1);
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

body[data-page="activity"] .ad-slot.ad-top-banner,
body[data-page="activity"] .ad-slot.ad-inline {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px dashed rgba(26, 43, 74, 0.14);
}

@keyframes gamePop {
  0% { transform: scale(0.92); }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

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

@keyframes cardFlipIn {
  from { transform: rotateY(70deg) scale(0.92); opacity: 0.55; }
  to { transform: rotateY(0) scale(1); opacity: 1; }
}

@keyframes countPop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@media (max-width: 760px) {
  .game-hud {
    grid-template-columns: auto 1fr;
  }

  .game-hud-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .game-hud-actions .btn {
    flex: 1 1 auto;
  }

  body[data-page="activity"] .item-grid,
  body[data-page="activity"] .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-page="activity"] .item-btn,
  body[data-page="activity"] .drag-item,
  body[data-page="activity"] .drop-zone {
    min-height: 104px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-page="activity"] .item-btn,
  body[data-page="activity"] .drag-item,
  body[data-page="activity"] .drop-zone,
  .game-progress-fill,
  .game-complete,
  body[data-page="activity"] .count-photos .item-photo {
    transition: none !important;
    animation: none !important;
  }
}
