/* James world themes + Play/Create shelves */
:root,
[data-theme="space"] {
  --world-bg: linear-gradient(160deg, #0b1d3a 0%, #134e6f 45%, #1a237e 100%);
  --world-accent: #26c6da;
  --world-surface: rgba(255, 255, 255, 0.96);
  --world-cta: #ffca28;
  --world-ink: #0d2137;
  --world-pattern: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.12) 0 2px, transparent 3px);
}

[data-theme="vehicles"] {
  --world-bg: linear-gradient(160deg, #263238 0%, #455a64 40%, #0288d1 100%);
  --world-accent: #ffc107;
  --world-surface: rgba(255, 255, 255, 0.96);
  --world-cta: #ff6f00;
  --world-ink: #1c2529;
  --world-pattern: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.04) 0 8px, transparent 8px 16px);
}

[data-theme="heroes"] {
  --world-bg: linear-gradient(160deg, #b71c1c 0%, #0d47a1 55%, #f9a825 120%);
  --world-accent: #ffd54f;
  --world-surface: rgba(255, 255, 255, 0.96);
  --world-cta: #d32f2f;
  --world-ink: #1a237e;
  --world-pattern: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 12px, transparent 12px 24px);
}

[data-theme="robots"] {
  --world-bg: linear-gradient(160deg, #004d40 0%, #00695c 40%, #00bfa5 100%);
  --world-accent: #c6ff00;
  --world-surface: rgba(255, 255, 255, 0.96);
  --world-cta: #00e676;
  --world-ink: #00332c;
  --world-pattern: radial-gradient(circle at 1px 1px, rgba(198, 255, 0, 0.15) 1px, transparent 0);
}

html.james-world body,
body.james-world {
  background: var(--world-bg);
  background-attachment: fixed;
  min-height: 100vh;
}

html.james-world body::before,
body.james-world::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: var(--world-pattern);
  background-size: 24px 24px;
  opacity: 0.55;
  z-index: 0;
}

.james-world .main-content,
.james-world .jw-home {
  position: relative;
  z-index: 1;
}

.jw-sticky {
  position: sticky;
  top: 0;
  z-index: 1100;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(10, 20, 40, 0.88);
  backdrop-filter: blur(8px);
  color: #fff;
}

.jw-sticky a,
.jw-sticky button {
  color: #fff;
  text-decoration: none;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 800;
  font-family: Nunito, sans-serif;
  min-height: 48px;
  cursor: pointer;
}

.jw-sticky .jw-active {
  background: var(--world-cta);
  color: var(--world-ink);
}

.jw-home {
  max-width: 960px;
  margin: 0 auto;
  padding: 18px 16px 40px;
}

.jw-hero {
  text-align: center;
  color: #fff;
  padding: 28px 12px 12px;
}

.jw-hero h1 {
  font-family: "Fredoka One", cursive;
  font-size: clamp(2rem, 7vw, 3.4rem);
  margin: 0 0 8px;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.jw-hero p {
  font-family: Nunito, sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  opacity: 0.95;
  margin: 0 auto 18px;
  max-width: 28ch;
}

.jw-xp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 800;
  margin-bottom: 16px;
}

.jw-themes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 18px;
}

@media (max-width: 640px) {
  .jw-themes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.jw-theme-btn {
  border: 3px solid transparent;
  border-radius: 18px;
  min-height: 72px;
  font-size: 1.05rem;
  font-weight: 900;
  font-family: Nunito, sans-serif;
  cursor: pointer;
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.jw-theme-btn:active { transform: scale(0.97); }
.jw-theme-btn.is-active { border-color: #fff; transform: scale(1.03); }
.jw-theme-btn[data-theme-pick="vehicles"] { background: linear-gradient(135deg, #455a64, #ffc107); color: #1c2529; }
.jw-theme-btn[data-theme-pick="heroes"] { background: linear-gradient(135deg, #c62828, #1565c0); }
.jw-theme-btn[data-theme-pick="space"] { background: linear-gradient(135deg, #0d47a1, #26c6da); }
.jw-theme-btn[data-theme-pick="robots"] { background: linear-gradient(135deg, #00695c, #c6ff00); color: #00332c; }

.jw-modes {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}

.jw-mode-btn {
  flex: 1;
  max-width: 200px;
  min-height: 56px;
  border: none;
  border-radius: 18px;
  font-weight: 900;
  font-size: 1.2rem;
  font-family: "Fredoka One", cursive;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.jw-mode-btn.is-active {
  background: var(--world-cta);
  color: var(--world-ink);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.jw-shelf {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 700px) {
  .jw-shelf { grid-template-columns: 1fr; }
}

.jw-pad {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 120px;
  padding: 16px;
  border-radius: 22px;
  background: var(--world-surface);
  color: var(--world-ink);
  text-decoration: none;
  font-family: Nunito, sans-serif;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  border: 3px solid transparent;
  transition: transform 0.15s ease;
}

.jw-pad:hover,
.jw-pad:focus {
  transform: translateY(-3px);
  border-color: var(--world-accent);
  color: var(--world-ink);
}

.jw-pad .emoji { font-size: 2.4rem; line-height: 1; }
.jw-pad .label { font-size: 1.15rem; }
.jw-pad .hint { font-size: 0.85rem; font-weight: 700; opacity: 0.7; }

.jw-more {
  margin-top: 22px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 12px;
  color: #fff;
}

.jw-more summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 1.05rem;
  padding: 8px;
}

.jw-more-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
}

.jw-more-links a {
  background: rgba(255, 255, 255, 0.9);
  color: var(--world-ink);
  text-decoration: none;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 800;
}

/* Create / challenge toy shells */
.jw-toy {
  max-width: 900px;
  margin: 16px auto 40px;
  background: var(--world-surface, #fff);
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  color: var(--world-ink, #222);
}

.jw-toy h1 {
  font-family: "Fredoka One", cursive;
  text-align: center;
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
}

.jw-toy .lead {
  text-align: center;
  font-weight: 700;
  margin-bottom: 16px;
}

.jw-big-btn {
  border: none;
  border-radius: 18px;
  min-height: 64px;
  min-width: 64px;
  padding: 12px 18px;
  font-size: 1.4rem;
  font-weight: 900;
  font-family: Nunito, sans-serif;
  cursor: pointer;
  background: var(--world-cta, #ffca28);
  color: var(--world-ink, #222);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.jw-choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin: 16px 0;
}

.jw-choice {
  width: 88px;
  height: 88px;
  border-radius: 20px;
  border: none;
  font-size: 2.2rem;
  font-weight: 900;
  cursor: pointer;
  background: linear-gradient(135deg, #fff8e1, #ffe082);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.jw-choice.correct-flash { background: #c8e6c9 !important; }
.jw-choice.wrong-flash { background: #ffcdd2 !important; }

.jw-stage {
  min-height: 120px;
  border-radius: 18px;
  background: linear-gradient(135deg, #e3f2fd, #fff8e1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 900;
  margin: 12px 0;
  padding: 16px;
  text-align: center;
}

.jw-canvas-board {
  position: relative;
  min-height: 280px;
  border-radius: 18px;
  background: #fffde7;
  border: 3px dashed #ffd54f;
  overflow: hidden;
  touch-action: none;
}

.jw-sticker {
  position: absolute;
  font-size: 2.4rem;
  cursor: grab;
  user-select: none;
  transform: translate(-50%, -50%);
}

.jw-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
}

.jw-tray button {
  font-size: 1.8rem;
  min-width: 56px;
  min-height: 56px;
  border-radius: 14px;
  border: none;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

.jw-page-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 760px) {
  .jw-page-grid { grid-template-columns: 1fr; }
}

.jw-block {
  border: none;
  border-radius: 16px;
  padding: 14px;
  font-weight: 900;
  font-size: 1.05rem;
  cursor: grab;
  background: #e8f5e9;
  min-height: 56px;
}

.jw-dropzone {
  min-height: 220px;
  border-radius: 16px;
  border: 3px dashed #90caf9;
  background: #e3f2fd;
  padding: 10px;
}

.jw-dropzone .placed {
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  margin: 6px 0;
  font-weight: 800;
  cursor: pointer;
}

.jw-preview {
  width: 100%;
  min-height: 260px;
  border: none;
  border-radius: 16px;
  background: #fff;
  box-shadow: inset 0 0 0 2px #e0e0e0;
}

.jw-lyric {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 900;
  animation: jwBounce 0.45s ease;
}

@keyframes jwBounce {
  0% { transform: scale(0.9); opacity: 0.5; }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); opacity: 1; }
}

.james-world .kid-parent-fab {
  opacity: 0.45;
  transform: scale(0.85);
  bottom: 10px;
  right: 10px;
}

.james-world .quick-nav {
  display: none !important;
}
