/* ==========================================================
   Contoura Labs — Shared Brand Stylesheet
   Used by every page (homepage, tools hub, individual tools, games)
   ========================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-family: 'Inter', sans-serif; }

:root {
  --brand-orange: #FF6B35;
  --brand-red:    #E8384F;
  --brand-teal:   #00B8A9;
  --surface-light:#F8F9FA;
  --surface-dark: #0A0A0A;
  --surface-card: #1A1A1A;
  --surface-alt:  #111111;
  --gradient: linear-gradient(135deg, #FF6B35 0%, #E8384F 40%, #00B8A9 100%);
}

body { font-family: 'Inter', sans-serif; }

/* ===== LOADING SCREEN ===== */
#loader {
  position: fixed; inset: 0; z-index: 9999;
  background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.dark #loader { background: #0A0A0A; }
#loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-c path {
  stroke-dasharray: 100; stroke-dashoffset: 100;
  animation: drawC 1.2s ease forwards;
}
.loader-c path:nth-child(1) { animation-delay: 0s; }
.loader-c path:nth-child(2) { animation-delay: 0.3s; }
.loader-c path:nth-child(3) { animation-delay: 0.6s; }
@keyframes drawC { to { stroke-dashoffset: 0; } }
.loader-text {
  margin-top: 24px; font-weight: 600; font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase;
  color: #555; opacity: 0; animation: fadeUp 0.5s ease 0.9s forwards;
}
.dark .loader-text { color: #aaa; }
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } from { opacity: 0; transform: translateY(8px); } }

/* ===== GRADIENT TEXT & BUTTONS ===== */
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.btn-gradient {
  background: var(--gradient);
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.btn-gradient:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(255,107,53,0.3); }
@keyframes gradientShift { 0%,100%{background-position:0% 50%} 50%{background-position:100% 50%} }

/* ===== REVEAL ANIMATION ===== */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity 0.8s cubic-bezier(0.16,1,0.3,1), transform 0.8s cubic-bezier(0.16,1,0.3,1); }
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }
.reveal-delay-6 { transition-delay: 0.6s; }

/* ===== FLOATING ORBS ===== */
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-16px)} }
.float { animation: float 6s ease-in-out infinite; }
.float-delay { animation: float 6s ease-in-out 2s infinite; }
.orb {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.15; pointer-events: none;
}
.dark .orb { opacity: 0.08; }

/* ===== NAVBAR (always visible with solid background) ===== */
#navbar {
  transition: all 0.3s ease;
  background: rgba(255,255,255,0.95) !important;
  backdrop-filter: blur(20px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}
.dark #navbar {
  background: rgba(10,10,10,0.95) !important;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}
#navbar.nav-scrolled {
  background: rgba(255,255,255,1) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08) !important;
}
.dark #navbar.nav-scrolled {
  background: rgba(10,10,10,1) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important;
}

/* ===== BACK-NAV BREADCRUMB BANNER ===== */
.back-nav-banner {
  position: fixed;
  top: 4rem; /* below navbar (h-16 = 4rem) */
  left: 0; right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 1.5rem;
  background: rgba(248,249,250,0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  font-size: 0.8125rem;
  font-weight: 500;
}
.dark .back-nav-banner {
  background: rgba(17,17,17,0.95);
  border-bottom-color: rgba(255,255,255,0.05);
}
.back-nav-crumbs {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  min-width: 0;
  flex-wrap: wrap;
}
.back-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: 0.5rem;
  color: #6b7280;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.dark .back-nav-btn { color: #9ca3af; }
.back-nav-btn:hover {
  background: rgba(255,107,53,0.08);
  color: var(--brand-orange);
}
.back-nav-home:hover { color: var(--brand-orange); }
.back-nav-hub:hover { color: var(--brand-teal); background: rgba(0,184,169,0.08); }
.back-nav-sep {
  color: #d1d5db;
  font-size: 1rem;
  font-weight: 300;
}
.dark .back-nav-sep { color: #4b5563; }
/* Visible CTA button on the right side of the banner */
.back-nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4rem 0.9rem;
  border-radius: 0.625rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  background: var(--brand-orange);
  color: #fff;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}
.back-nav-cta:hover {
  transform: translateY(-1px);
  background: #ff7a47;
  box-shadow: 0 4px 12px rgba(255,107,53,0.35);
}
.back-nav-cta svg { flex-shrink: 0; }
@media (max-width: 640px) {
  .back-nav-banner { padding: 0.4rem 1rem; gap: 0.5rem; }
  .back-nav-cta { padding: 0.35rem 0.7rem; font-size: 0.72rem; }
  .back-nav-btn { padding: 0.2rem 0.45rem; font-size: 0.75rem; }
}

/* Push tool-page content below the back-nav banner */
body.has-back-nav .tool-page { padding-top: 7.5rem; }
body.has-back-nav .hub-hero { padding-top: 8rem; }
/* Fallback for browsers without :has() support */
body:has(.back-nav-banner) .tool-page { padding-top: 7.5rem; }
body:has(.back-nav-banner) .hub-hero { padding-top: 8rem; }

/* ===== SUBTLE FADE-IN ON LOAD for individual tool/game pages ===== */
body.has-back-nav .tool-page {
  animation: toolPageFadeIn 0.5s cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes toolPageFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
#mobile-menu {
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1);
}
#mobile-menu.open { transform: translateX(0); }
#menu-backdrop {
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
#menu-backdrop.open { opacity: 1; visibility: visible; }

/* ===== THEME TOGGLE ===== */
#theme-toggle-fixed {
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}
#theme-toggle-fixed:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.dark #theme-toggle-fixed:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.4); }

/* ===== TOAST ===== */
#toast {
  transform: translateY(20px); opacity: 0; visibility: hidden;
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1), opacity 0.4s ease, visibility 0.4s ease;
}
#toast.show { transform: translateY(0); opacity: 1; visibility: visible; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
.dark ::-webkit-scrollbar-thumb { background: #333; }

/* ===== FORM INPUTS ===== */
.form-input:focus { border-color: var(--brand-orange); box-shadow: 0 0 0 3px rgba(255,107,53,0.1); outline: none; }

/* ===== TOOL PAGE LAYOUT ===== */
.tool-page {
  min-height: auto;
  padding-top: 5rem;
  padding-bottom: 2rem;
}
body.has-back-nav .tool-page { padding-top: 6.5rem; }
.tool-container {
  max-width: 4xl;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.tool-header {
  text-align: center;
  margin-bottom: 1.5rem;
}
.tool-title {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.tool-subtitle {
  color: #6b7280;
  font-size: 0.9rem;
  max-width: 36rem;
  margin: 0 auto;
}
.dark .tool-subtitle { color: #9ca3af; }

/* ===== TOOL CARD ===== */
.tool-card {
  background: #fff;
  border: 1px solid #f3f4f6;
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.dark .tool-card {
  background: #1A1A1A;
  border-color: rgba(255,255,255,0.05);
}

/* ===== TOOL GRID (Hub Pages) ===== */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.tool-card-link {
  display: block;
  background: #fff;
  border: 1px solid #f3f4f6;
  border-radius: 1rem;
  padding: 1.5rem;
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1), box-shadow 0.4s ease, border-color 0.4s ease;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}
.dark .tool-card-link {
  background: #1A1A1A;
  border-color: rgba(255,255,255,0.05);
}
.tool-card-link:hover {
  transform: translateY(-6px);
  border-color: rgba(255,107,53,0.4);
  box-shadow: 0 16px 32px rgba(255,107,53,0.12);
}
.dark .tool-card-link:hover {
  box-shadow: 0 16px 32px rgba(255,107,53,0.18);
}
/* Top accent bar reveal on hover (mirrors .why-card::before treatment from homepage) */
.tool-card-link::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--brand-orange), var(--brand-red), var(--brand-teal));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1);
}
.tool-card-link:hover::before { transform: scaleX(1); }
/* Icon scale + rotate on hover (mirrors .why-card .why-icon from homepage) */
.tool-card-icon {
  width: 3rem; height: 3rem;
  border-radius: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, rgba(255,107,53,0.12), rgba(232,56,79,0.08), rgba(0,184,169,0.12));
  transition: transform 0.5s cubic-bezier(0.16,1,0.3,1), background 0.4s ease;
}
.tool-card-link:hover .tool-card-icon {
  transform: scale(1.15) rotate(-5deg);
}
/* Title color shift on hover */
.tool-card-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  transition: color 0.3s ease;
}
.tool-card-desc {
  font-size: 0.8125rem;
  color: #6b7280;
  line-height: 1.5;
}
.dark .tool-card-desc { color: #9ca3af; }
.tool-card-link:hover .tool-card-title { color: var(--brand-orange); }
.dark .tool-card-link:hover .tool-card-title { color: var(--brand-orange); }

/* ===== DROPZONE ===== */
.dropzone {
  border: 2px dashed #d1d5db;
  border-radius: 1rem;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #fafafa;
}
.dark .dropzone {
  border-color: #374151;
  background: #111;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--brand-orange);
  background: rgba(255,107,53,0.04);
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--gradient);
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
  color: #fff;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(255,107,53,0.25); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary {
  background: #f3f4f6;
  color: #374151;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: background 0.2s ease;
  font-size: 0.875rem;
}
.dark .btn-secondary {
  background: rgba(255,255,255,0.05);
  color: #e5e7eb;
  border-color: rgba(255,255,255,0.1);
}
.btn-secondary:hover { background: #e5e7eb; }
.dark .btn-secondary:hover { background: rgba(255,255,255,0.1); }

/* ===== TEXTAREA / INPUT ===== */
textarea, input[type="text"], input[type="number"], input[type="email"], select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  color: #111;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.dark textarea, .dark input[type="text"], .dark input[type="number"], .dark input[type="email"], .dark select {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
  color: #f3f4f6;
}
textarea:focus, input:focus, select:focus {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px rgba(255,107,53,0.1);
}
textarea {
  font-family: 'Sarasa Mono SC', 'JetBrains Mono', 'Menlo', monospace;
  resize: vertical;
  min-height: 200px;
  line-height: 1.5;
}

/* ===== LABELS ===== */
.field-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #374151;
}
.dark .field-label { color: #d1d5db; }

/* ===== BADGE / TAG ===== */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(255,107,53,0.1);
  color: var(--brand-orange);
}

/* ===== UTILITY ===== */
.text-center { text-align: center; }
.text-muted { color: #6b7280; }
.dark .text-muted { color: #9ca3af; }
.hidden { display: none; }
.mt-1 { margin-top: 0.25rem; } .mt-2 { margin-top: 0.5rem; } .mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; } .mt-8 { margin-top: 2rem; }
.mb-2 { margin-bottom: 0.5rem; } .mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; }
.flex { display: flex; } .flex-col { flex-direction: column; } .items-center { align-items: center; }
.justify-center { justify-content: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; } .gap-3 { gap: 0.75rem; } .gap-4 { gap: 1rem; } .gap-6 { gap: 1.5rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ===== HUB HERO ===== */
.hub-hero {
  position: relative;
  padding: 6rem 1.5rem 4rem;
  text-align: center;
  overflow: hidden;
}
.hub-hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
@media (min-width: 768px) { .hub-hero h1 { font-size: 3.5rem; } }
.hub-hero p {
  color: #6b7280;
  font-size: 1.125rem;
  max-width: 36rem;
  margin: 0 auto;
}
.dark .hub-hero p { color: #9ca3af; }

/* ===== CATEGORY SECTION ===== */
.category-section {
  max-width: 80rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}
.category-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.category-title::before {
  content: '';
  display: inline-block;
  width: 4px; height: 1.5rem;
  border-radius: 2px;
  background: var(--gradient);
}

/* ===== GAME IFRAME / CANVAS ===== */
.game-canvas {
  background: #111;
  border-radius: 1rem;
  display: block;
  margin: 0 auto;
  max-width: 100%;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #9ca3af;
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}
.dark .progress-bar { background: #374151; }
.progress-bar-fill {
  height: 100%;
  background: var(--gradient);
  background-size: 200% 200%;
  animation: gradientShift 2s ease infinite;
  transition: width 0.3s ease;
}

/* ===== CODE OUTPUT ===== */
.code-output {
  font-family: 'Sarasa Mono SC', 'JetBrains Mono', 'Menlo', monospace;
  font-size: 0.8125rem;
  background: #0a0a0a;
  color: #e5e7eb;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ==========================================================
   MARQUEE — Auto-scrolling horizontal strip of cards/items
   Used on homepage #tools section + hub pages hero strips
   Pauses on hover. Works with [data-marquee] attribute.
   ========================================================== */
.marquee {
  position: relative;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
/* Scrollable variant — user can drag/scroll horizontally, auto-scroll continues */
.marquee-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,107,53,0.3) transparent;
  -webkit-mask-image: none;
  mask-image: none;
  scroll-behavior: smooth;
  cursor: grab;
}
.marquee-scroll:active { cursor: grabbing; }
.marquee-scroll::-webkit-scrollbar { height: 8px; }
.marquee-scroll::-webkit-scrollbar-thumb { background: rgba(255,107,53,0.4); border-radius: 4px; }
.marquee-scroll::-webkit-scrollbar-track { background: rgba(0,0,0,0.05); border-radius: 4px; }
.dark .marquee-scroll::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }
.marquee-track {
  display: flex;
  gap: 0.875rem;
  width: max-content;
  animation: marqueeScroll 76s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marqueeScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.marquee-item {
  flex: 0 0 auto;
  width: 290px;
  padding: 1.25rem 1.4rem;
  border-radius: 0.85rem;
  border: 1px solid #f3f4f6;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s cubic-bezier(0.16,1,0.3,1), border-color 0.25s ease, box-shadow 0.25s ease;
}
.dark .marquee-item { background: #1A1A1A; border-color: rgba(255,255,255,0.05); }
.marquee-item:hover {
  transform: translateY(-3px);
  border-color: rgba(255,107,53,0.4);
  box-shadow: 0 10px 22px rgba(255,107,53,0.1);
}
.marquee-item .mi-icon {
  width: 50px; height: 50px;
  border-radius: 0.6rem;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(255,107,53,0.14), rgba(232,56,79,0.10), rgba(0,184,169,0.14));
  flex-shrink: 0;
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1);
}
.marquee-item:hover .mi-icon { transform: scale(1.15) rotate(-5deg); }
.marquee-item .mi-title { font-weight: 600; font-size: 0.95rem; line-height: 1.2; }
.marquee-item .mi-sub   { font-size: 0.78rem; color: #6b7280; line-height: 1.3; margin-top: 0.2rem; }
.dark .marquee-item .mi-sub { color: #9ca3af; }

/* Reverse direction variant (for the second row so they move opposite) */
.marquee.reverse .marquee-track { animation-direction: reverse; }

/* ==========================================================
   PULSING DOT — small accent for "LIVE"/"NEW" badges
   ========================================================== */
.pulse-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brand-teal);
  position: relative;
  margin-right: 0.4rem;
}
.pulse-dot::after {
  content: '';
  position: absolute; inset: -3px;
  border-radius: 50%;
  background: var(--brand-teal);
  opacity: 0.5;
  animation: pulseDot 1.8s ease-out infinite;
}
@keyframes pulseDot {
  0%   { transform: scale(0.7); opacity: 0.6; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ==========================================================
   HUB PAGE ENHANCEMENTS — richer hero, badge chip row
   ========================================================== */
.hub-stat-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}
.hub-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(0,0,0,0.05);
  color: #374151;
  backdrop-filter: blur(8px);
}
.dark .hub-stat-chip {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.08);
  color: #d1d5db;
}

/* ==========================================================
   BACKGROUND ANIMATIONS for hub pages
   Tools page: animated diagonal gradient waves
   Games page: floating geometric shapes
   Both visible in light and dark themes
   ========================================================== */

/* TOOLS PAGE: Animated diagonal waves */
.bg-waves {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-wave {
  position: absolute;
  width: 200%;
  height: 200%;
  top: -50%;
  left: -50%;
  opacity: 0.08;
  animation: waveDrift 20s linear infinite;
}
.dark .bg-wave { opacity: 0.12; }
.bg-wave:nth-child(1) {
  background: radial-gradient(ellipse at 30% 40%, var(--brand-orange) 0%, transparent 40%);
  animation-duration: 25s;
}
.bg-wave:nth-child(2) {
  background: radial-gradient(ellipse at 70% 60%, var(--brand-teal) 0%, transparent 40%);
  animation-duration: 30s;
  animation-direction: reverse;
}
.bg-wave:nth-child(3) {
  background: radial-gradient(ellipse at 50% 80%, var(--brand-red) 0%, transparent 35%);
  animation-duration: 35s;
  animation-delay: -5s;
}
@keyframes waveDrift {
  0%   { transform: translate(0, 0) rotate(0deg); }
  33%  { transform: translate(5%, -5%) rotate(120deg); }
  66%  { transform: translate(-5%, 5%) rotate(240deg); }
  100% { transform: translate(0, 0) rotate(360deg); }
}

/* GAMES PAGE: Floating geometric shapes */
.bg-shapes {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-shape {
  position: absolute;
  opacity: 0.1;
  animation: shapeFloat 15s ease-in-out infinite;
}
.dark .bg-shape { opacity: 0.15; }
.bg-shape:nth-child(1) {
  top: 15%; left: 10%;
  width: 60px; height: 60px;
  border: 2px solid var(--brand-orange);
  border-radius: 12px;
  transform: rotate(15deg);
  animation-delay: 0s;
}
.bg-shape:nth-child(2) {
  top: 60%; left: 20%;
  width: 40px; height: 40px;
  border: 2px solid var(--brand-teal);
  border-radius: 50%;
  animation-delay: 2s;
}
.bg-shape:nth-child(3) {
  top: 25%; right: 15%;
  width: 50px; height: 50px;
  background: var(--brand-red);
  border-radius: 8px;
  transform: rotate(-20deg);
  animation-delay: 4s;
}
.bg-shape:nth-child(4) {
  top: 70%; right: 10%;
  width: 70px; height: 70px;
  border: 2px solid var(--brand-orange);
  border-radius: 50%;
  animation-delay: 6s;
}
.bg-shape:nth-child(5) {
  top: 45%; left: 50%;
  width: 30px; height: 30px;
  background: var(--brand-teal);
  border-radius: 6px;
  transform: rotate(45deg);
  animation-delay: 8s;
}
.bg-shape:nth-child(6) {
  top: 10%; left: 45%;
  width: 45px; height: 45px;
  border: 2px solid var(--brand-red);
  border-radius: 50%;
  animation-delay: 10s;
}
@keyframes shapeFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.08; }
  25% { transform: translateY(-30px) rotate(90deg); opacity: 0.15; }
  50% { transform: translateY(-60px) rotate(180deg); opacity: 0.1; }
  75% { transform: translateY(-30px) rotate(270deg); opacity: 0.18; }
}
.dark .bg-shape { opacity: 0.15; }
.dark .bg-shape:nth-child(1),
.dark .bg-shape:nth-child(2),
.dark .bg-shape:nth-child(4),
.dark .bg-shape:nth-child(6) { opacity: 0.2; }

/* ==========================================================
   CATEGORY CARD CAROUSEL (Hangman + Trivia use this)
   ========================================================== */
.cat-carousel-wrap { position: relative; margin: 0 -0.25rem; }
.cat-carousel-track {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  padding: 0.5rem 0.25rem 1rem;
  scrollbar-width: thin;
}
.cat-carousel-track::-webkit-scrollbar { height: 6px; }
.cat-carousel-track::-webkit-scrollbar-thumb { background: rgba(255,107,53,0.4); border-radius: 3px; }
.cat-carousel-track::-webkit-scrollbar-track { background: transparent; }
.cat-carousel-card {
  flex: 0 0 auto;
  width: 220px;
  padding: 1.25rem 1.1rem;
  border-radius: 0.9rem;
  border: 2px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.16,1,0.3,1),
              border-color 0.22s ease,
              box-shadow 0.22s ease;
  scroll-snap-align: center;
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem;
  text-align: left;
}
.dark .cat-carousel-card { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.1); }
.cat-carousel-card:hover {
  transform: translateY(-4px);
  border-color: var(--brand-orange);
  box-shadow: 0 12px 30px rgba(255,107,53,0.15);
}
.cat-carousel-card.selected {
  border-color: var(--brand-orange);
  transform: scale(1.05);
  box-shadow: 0 14px 32px rgba(255,107,53,0.3);
  background: linear-gradient(135deg, rgba(255,107,53,0.08), rgba(232,56,79,0.06), rgba(0,184,169,0.06));
}
.cat-carousel-card .cc-icon {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-red), var(--brand-teal));
  color: #fff; font-size: 1.5rem;
  box-shadow: 0 6px 14px rgba(255,107,53,0.2);
}
.cat-carousel-card .cc-name { font-weight: 700; font-size: 1.05rem; }
.cat-carousel-card .cc-desc { font-size: 0.8rem; color: #6b7280; line-height: 1.4; }
.dark .cat-carousel-card .cc-desc { color: #9ca3af; }
.cat-carousel-card .cc-meta { font-size: 0.7rem; color: #9ca3af; font-weight: 600; margin-top: auto; }
.cat-carousel-btn {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #e5e7eb;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: all 0.2s ease;
  z-index: 5;
}
.dark .cat-carousel-btn { background: #1A1A1A; border-color: rgba(255,255,255,0.1); color: #fff; }
.cat-carousel-btn:hover { background: var(--brand-orange); color: #fff; border-color: transparent; }
.cat-carousel-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.cat-carousel-btn.prev { left: -8px; }
.cat-carousel-btn.next { right: -8px; }
@media (max-width: 640px) {
  .cat-carousel-btn { display: none; }
}

/* ==========================================================
   GAME RESULT MODAL — shared across all games
   Shows on game end with Play Again + Return to All Games buttons
   ========================================================== */
.cl-game-result {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.cl-game-result.visible { opacity: 1; visibility: visible; }
.cl-game-result-card {
  background: #fff; border-radius: 1.25rem;
  padding: 2.5rem 2.25rem; max-width: 400px; width: 100%;
  text-align: center;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.16,1,0.3,1);
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
  border: 1px solid rgba(0,0,0,0.05);
}
.dark .cl-game-result-card {
  background: #1A1A1A; border-color: rgba(255,255,255,0.08);
}
.cl-game-result.visible .cl-game-result-card {
  transform: scale(1) translateY(0);
}
.cl-game-result-emoji {
  font-size: 3.5rem; line-height: 1; margin-bottom: 0.75rem;
}
.cl-game-result-title {
  font-size: 1.6rem; font-weight: 800; margin-bottom: 0.5rem;
  color: #111;
}
.dark .cl-game-result-title { color: #fff; }
.cl-game-result-message {
  font-size: 0.95rem; color: #6b7280; margin-bottom: 1.75rem;
  line-height: 1.5;
}
.dark .cl-game-result-message { color: #9ca3af; }
.cl-game-result-message strong {
  color: var(--brand-teal); font-weight: 700;
}
.cl-game-result-buttons {
  display: flex; flex-direction: column; gap: 0.625rem;
}
.cl-game-result-btn {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.8rem 1.5rem; border-radius: 0.75rem; border: none;
  font-size: 0.875rem; font-weight: 600; cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: 'Inter', sans-serif; text-decoration: none;
  width: 100%;
}
.cl-game-result-btn-play {
  background: linear-gradient(135deg, #FF6B35, #E8384F, #00B8A9);
  background-size: 200% 200%; color: #fff;
  animation: gradientShift 4s ease infinite;
}
.cl-game-result-btn-play:hover {
  transform: translateY(-2px); box-shadow: 0 8px 20px rgba(255,107,53,0.3);
}
.cl-game-result-btn-return {
  background: #f3f4f6; color: #374151; border: 1px solid #e5e7eb;
}
.dark .cl-game-result-btn-return {
  background: rgba(255,255,255,0.05); color: #e5e7eb; border-color: rgba(255,255,255,0.1);
}
.cl-game-result-btn-return:hover {
  border-color: var(--brand-orange); color: var(--brand-orange);
  transform: translateY(-1px);
}
