/* ==========================================================================
   OPTOM KIDS - INTERACTIVE GAME STYLES (kids-game.css)
   ========================================================================== */

/* Core Game Wrapper */
.game-wrapper {
  position: relative;
  background: white;
  border-radius: clamp(16px, 3vw, 36px);
  box-shadow: 0 24px 60px rgba(12, 74, 110, 0.08);
  border: 3px dashed rgba(14, 165, 233, 0.2);
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  font-family: var(--font-main);
  min-height: 520px;
  background-image: radial-gradient(rgba(14, 165, 233, 0.04) 2px, transparent 0);
  background-size: 24px 24px;
}

/* Responsive Scaling for Sandbox */
.game-sandbox {
  position: relative;
  width: 100%;
  height: 480px;
  background: var(--cloud);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: inset 0 8px 24px rgba(12, 74, 110, 0.04);
  border: 2px solid rgba(14, 165, 233, 0.08);
}

canvas#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
}

#gameDomLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

#gameDomLayer * {
  pointer-events: auto;
}

/* Mobile Warning Screen Overlay */
.game-mobile-warning {
  position: absolute;
  inset: 0;
  background: rgba(12, 74, 110, 0.98);
  z-index: 9999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  color: white;
  backdrop-filter: blur(8px);
}

.warning-icon {
  font-size: 4.5rem;
  animation: float 2.5s ease-in-out infinite;
  margin-bottom: 1rem;
}

.game-mobile-warning h3 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.8rem;
  color: var(--sun);
}

.game-mobile-warning p {
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 320px;
  margin-bottom: 1.5rem;
  color: rgba(255, 255, 255, 0.85);
}

@media (max-width: 768px) {
  .game-mobile-warning {
    display: flex;
  }
}

/* Animation floats */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* Game Screens State Manager */
.game-screen {
  display: none;
  width: 100%;
  height: 100%;
  min-height: 520px;
  padding: clamp(1rem, 4vw, 2.5rem);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  animation: fadeInScreen 0.4s var(--ease-spring);
}

.game-screen--active {
  display: flex;
}

@keyframes fadeInScreen {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

/* Start Card Styling */
.start-card {
  text-align: center;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: float 4s ease-in-out infinite;
}

.start-badge {
  background: var(--pink);
  color: white;
  padding: 0.4rem 1rem;
  border-radius: 99px;
  font-weight: 900;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  box-shadow: 0 8px 16px rgba(236, 72, 153, 0.2);
}

.start-card h2 {
  font-size: clamp(1.8rem, 4.5vw, 2.5rem);
  color: var(--navy);
  font-weight: 800;
  line-height: 1.15;
}

.start-card p {
  color: var(--text-soft);
  font-size: 1.05rem;
  line-height: 1.6;
}

.btn-primary-kids--large {
  padding: 1.1rem 2.5rem;
  font-size: 1.2rem;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(14, 165, 233, 0.25);
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary-kids--large:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 36px rgba(14, 165, 233, 0.35);
}

/* World Selector Grid */
.selector-header {
  text-align: center;
  margin-bottom: 2rem;
}

.selector-header h2 {
  font-size: 1.8rem;
  color: var(--navy);
  font-weight: 800;
}

.selector-header p {
  color: var(--text-soft);
  font-size: 0.95rem;
}

.world-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  width: 100%;
  max-width: 860px;
}

@media (max-width: 600px) {
  .world-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.world-card {
  position: relative;
  background: var(--cloud);
  border-radius: 24px;
  padding: 1.5rem;
  border: 2px solid rgba(12, 74, 110, 0.05);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(12, 74, 110, 0.02);
  text-align: left;
}

.world-card:hover {
  transform: translateY(-6px) scale(1.01);
  background: white;
  border-color: var(--blue);
  box-shadow: 0 16px 36px rgba(12, 74, 110, 0.08);
}

.world-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  background: rgba(14, 165, 233, 0.08);
  color: var(--blue);
}

.world-icon {
  font-size: 2.2rem;
}

.world-card h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--navy);
  margin-top: 0.3rem;
}

.world-card p {
  font-size: 0.85rem;
  color: var(--text-soft);
  line-height: 1.45;
}

.world-status {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--blue);
  margin-top: auto;
  align-self: flex-end;
}

/* Card customizations by state */
.world-card--completed {
  border-color: #10B981;
}
.world-card--completed .world-badge {
  background: rgba(16, 185, 129, 0.1);
  color: #10B981;
}
.world-card--completed::after {
  content: '✔ Zdobyta';
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-size: 0.8rem;
  font-weight: 800;
  color: #10B981;
  background: rgba(16, 185, 129, 0.08);
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
}

/* Instructions Card */
.instruction-card {
  max-width: 600px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  position: relative;
  width: 100%;
}

.btn-back {
  position: absolute;
  top: -1rem;
  left: 0;
  background: none;
  border: none;
  font-family: var(--font-main);
  font-weight: 700;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.btn-back:hover {
  color: var(--navy);
}

.inst-icon {
  font-size: 3.5rem;
  animation: pulseIcon 1.5s infinite;
}

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

.inst-box {
  background: var(--cloud);
  border-radius: 20px;
  padding: 1.5rem;
  border: 2px dashed rgba(12, 74, 110, 0.08);
  width: 100%;
  text-align: left;
}

.inst-box h4 {
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 0.4rem;
}

.inst-box p {
  font-size: 0.95rem;
  color: var(--text-soft);
  line-height: 1.5;
}

.inst-tip {
  font-size: 0.85rem;
  color: var(--navy);
  background: rgba(252, 211, 77, 0.18);
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  border-left: 4px solid var(--sun);
  text-align: left;
  line-height: 1.4;
  width: 100%;
}

/* Countdown Circle */
.countdown-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-size: 4rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 32px rgba(14, 165, 233, 0.3);
  animation: bounceCount 1s ease infinite;
}

@keyframes bounceCount {
  0% { transform: scale(0.6); opacity: 0; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}

.countdown-ready {
  margin-top: 1.5rem;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--navy);
}

/* Play Screen Controls & Top Bar */
.game-top-bar {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}

.game-task-instruction {
  font-size: 1.1rem;
  color: var(--navy);
  font-weight: 800;
  background: white;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  border: 2px solid rgba(12, 74, 110, 0.05);
}

.game-progress-wrapper {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex: 1;
  max-width: 320px;
}

.game-progress-track {
  height: 12px;
  background: rgba(12, 74, 110, 0.06);
  border-radius: 6px;
  overflow: hidden;
  flex: 1;
}

.game-progress-fill {
  width: 100%;
  height: 100%;
  background: var(--blue);
  border-radius: 6px;
  transition: width 0.1s linear;
}

.game-time-text {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-soft);
  min-width: 32px;
}

.btn-game-control {
  border: none;
  background: var(--cloud);
  font-family: var(--font-main);
  font-weight: 700;
  color: var(--navy);
  padding: 0.5rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-game-control:hover {
  background: rgba(12, 74, 110, 0.06);
}

/* Sandbox Environments Backgrounds */
.theme-world-1 {
  background: #FEF3C7; /* Detektyw warm cork board environment */
  background-image: linear-gradient(rgba(180, 83, 9, 0.06) 1px, transparent 0),
                    linear-gradient(90deg, rgba(180, 83, 9, 0.06) 1px, transparent 0);
  background-size: 40px 40px;
}

.theme-world-2 {
  background: linear-gradient(to bottom, #BAE6FD, #F0F9FF); /* Sky gradient */
  overflow: hidden;
}

.theme-world-3 {
  background: #D1FAE5; /* Jungle green environment */
  background-image: radial-gradient(rgba(4, 120, 87, 0.1) 20%, transparent 20%),
                    radial-gradient(rgba(4, 120, 87, 0.1) 20%, transparent 20%);
  background-size: 60px 60px;
  background-position: 0 0, 30px 30px;
}

.theme-world-4 {
  background: #0F172A; /* Midnight stars environment */
  box-shadow: inset 0 0 80px rgba(0,0,0,0.6);
}

/* Pause Overlay */
.pause-overlay {
  position: absolute;
  inset: 0;
  background: rgba(12, 74, 110, 0.85);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}

.pause-overlay.active {
  display: flex;
}

.pause-content {
  background: white;
  border-radius: 28px;
  padding: 2.5rem;
  text-align: center;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.15);
  max-width: 320px;
  animation: bounceCount 0.3s ease;
}

.pause-content h3 {
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.pause-content p {
  color: var(--text-soft);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

/* Game Bottom Collection Tray */
.game-bottom-tray {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-top: 1.2rem;
  background: var(--cloud);
  border-radius: 20px;
  padding: 0.8rem 1.2rem;
  border: 1px solid rgba(12, 74, 110, 0.04);
}

.tray-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.tray-elements {
  display: flex;
  gap: 0.6rem;
  min-height: 44px;
  align-items: center;
  flex-wrap: wrap;
}

.collected-badge {
  font-size: 1.6rem;
  animation: popCollected 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popCollected {
  from { transform: scale(0) rotate(-45deg); }
  to { transform: scale(1) rotate(0); }
}

/* Target element positioning & effects */
.detective-target {
  position: absolute;
  font-size: 3rem;
  cursor: pointer;
  user-select: none;
  animation: pulseTarget 1s infinite alternate;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
  z-index: 100;
}

@keyframes pulseTarget {
  from { transform: scale(0.9); }
  to { transform: scale(1.1); }
}

/* World 3 (Kameleon) game layouts */
.kameleon-board {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  gap: 1.5rem;
  padding: 1rem;
}

.kameleon-visual-box {
  position: relative;
  background: rgba(255,255,255,0.7);
  border-radius: 24px;
  padding: 2rem;
  min-width: 180px;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(16, 185, 129, 0.2);
}

.kameleon-emoji {
  position: absolute;
  bottom: -15px;
  right: -15px;
  font-size: 3rem;
  animation: wiggle 3s infinite;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  50% { transform: rotate(15deg); }
}

.kameleon-target-symbol {
  font-size: 4rem;
  font-weight: 900;
  color: var(--navy);
  transition: filter 0.1s linear;
}

.kameleon-options-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
  width: 100%;
  max-width: 420px;
}

.btn-kameleon-option {
  border: 2px solid rgba(12, 74, 110, 0.08);
  background: white;
  border-radius: 14px;
  padding: 0.75rem;
  font-size: 1.5rem;
  font-family: var(--font-main);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.02);
  transition: all 0.2s;
  color: var(--navy);
}

.btn-kameleon-option:hover {
  transform: translateY(-2px);
  border-color: #10B981;
  box-shadow: 0 8px 16px rgba(16, 185, 129, 0.15);
}

/* Drifting clouds styling for fixation background */
.fixation-cloud {
  position: absolute;
  font-size: 2.2rem;
  opacity: 0.2;
  pointer-events: none;
  animation: driftCloud 15s linear infinite;
}

@keyframes driftCloud {
  from { transform: translateX(-100px); }
  to { transform: translateX(900px); }
}

/* Feedback & Completed Cards */
.feedback-card, .break-card {
  text-align: center;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

.badge-animation {
  font-size: 4.5rem;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--sun);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 32px rgba(252, 211, 77, 0.35);
  animation: float 2.5s ease-in-out infinite, pulseGlow 2s infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 12px 32px rgba(252, 211, 77, 0.35); }
  50% { box-shadow: 0 12px 48px rgba(252, 211, 77, 0.55); }
}

.badge-award-box {
  background: var(--cloud);
  border-radius: 20px;
  padding: 1.2rem 2rem;
  border: 2px dashed rgba(12, 74, 110, 0.08);
  width: 100%;
}

.badge-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-soft);
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}

.badge-name {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--navy);
}

/* Eye Break Card Step list */
.break-icon {
  font-size: 4rem;
  animation: float 3s ease-in-out infinite;
}

.break-instruction-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  text-align: left;
  width: 100%;
}

.break-step {
  display: flex;
  gap: 1rem;
  align-items: center;
  background: var(--cloud);
  padding: 0.75rem 1rem;
  border-radius: 14px;
}

.break-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.break-step p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-soft);
}

/* Circular Break Progress */
.break-timer-box {
  margin: 0.5rem 0;
}

.break-timer-progress {
  position: relative;
  width: 80px;
  height: 80px;
}

.circular-progress {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.circular-progress circle {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
}

.circular-progress circle.bg-circle {
  stroke: rgba(12, 74, 110, 0.08);
}

.circular-progress circle.fg-circle {
  stroke: var(--pink);
  stroke-dasharray: 283; /* 2 * PI * 45 */
  stroke-dashoffset: 283;
  transition: stroke-dashoffset 1s linear;
}

.break-timer-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--navy);
}

/* Global Completed Banner */
.map-complete-banner {
  width: 100%;
  max-width: 860px;
  background: rgba(16, 185, 129, 0.08);
  border: 2px solid #10B981;
  border-radius: 24px;
  padding: 1.5rem;
  text-align: center;
  margin-top: 1rem;
  animation: fadeInScreen 0.5s ease;
}

.map-complete-banner h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: #065F46;
  margin-bottom: 0.3rem;
}

.map-complete-banner p {
  font-size: 0.95rem;
  color: #065F46;
}

/* Parent Disclaimer style */
.game-disclaimer {
  background: rgba(12, 74, 110, 0.02);
  border-radius: 20px;
  padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--text-soft);
  text-align: left;
}

.game-disclaimer h4 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--navy);
  margin-top: 0;
  margin-bottom: 0.4rem;
}

.game-disclaimer p {
  font-size: 0.8rem;
  color: var(--text-soft);
  line-height: 1.5;
  margin: 0;
}

/* PARENTS DASHBOARD */
.parents-dashboard {
  background: white;
  border-radius: 24px;
  margin-top: 1.5rem;
  box-shadow: 0 8px 30px rgba(12, 74, 110, 0.03);
  border: 2px dashed rgba(12, 74, 110, 0.1);
  overflow: hidden;
  transition: border-color 0.2s;
}

.parents-dashboard:hover {
  border-color: rgba(14, 165, 233, 0.2);
}

.dashboard-toggle {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 1.5rem;
  background: none;
  border: none;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 800;
  color: var(--navy);
  cursor: pointer;
  outline: none;
}

.toggle-arrow {
  font-size: 0.8rem;
  color: var(--text-soft);
  transition: transform 0.3s;
}

.parents-dashboard--expanded .toggle-arrow {
  transform: rotate(180deg);
}

.dashboard-content {
  padding: 0 1.5rem 1.5rem 1.5rem;
  animation: fadeInScreen 0.3s ease;
}

.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.2rem;
}

@media (max-width: 768px) {
  .dashboard-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .dashboard-stats-grid {
    grid-template-columns: 1fr;
  }
}

.dash-stat-card {
  background: var(--cloud);
  border-radius: 16px;
  padding: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dash-stat-num {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--blue);
}

.dash-stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-soft);
  margin-top: 0.2rem;
}

.dashboard-feedback-box {
  background: rgba(14, 165, 233, 0.05);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  text-align: left;
}

.dashboard-feedback-box h4 {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.dashboard-feedback-box p {
  font-size: 0.85rem;
  color: var(--text-soft);
  line-height: 1.5;
  margin: 0;
}

/* ==========================================================================
   GAME SPLIT LAYOUT WITH SIDE-BY-SIDE ILLUSTRATION
   ========================================================================== */
.game-split-layout {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0 auto 2.5rem;
}

.game-split-layout .game-wrapper {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 2; /* higher than illustration to keep the board on top */
}

.game-side-illustration {
  position: absolute;
  right: max(0px, calc(50% - 850px)); /* Keeps the decorative figure visible without creating horizontal scroll */
  top: -30px; /* Raised higher to make her face and expression stand out clearly */
  width: clamp(520px, 40vw, 660px); /* Large and impressive size */
  display: flex;
  justify-content: center;
  align-items: center;
  animation: floatIllustration 8s ease-in-out infinite;
  user-select: none;
  pointer-events: none;
  z-index: 1; /* behind the game-wrapper */
}

.game-side-illustration img {
  width: 100%;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 20px 48px rgba(12, 74, 110, 0.16));
}

@keyframes floatIllustration {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(1.5deg); }
}

/* Align Parent Disclaimer & Dashboard with Game Container */
.game-disclaimer,
.parents-dashboard {
  max-width: 900px;
  margin-left: auto !important;
  margin-right: auto !important;
  position: relative;
  z-index: 2; /* Keep above background details */
}

/* Responsive layout adjustments */
@media (max-width: 1200px) {
  .game-split-layout .game-wrapper {
    max-width: 100%;
  }
  .game-side-illustration {
    position: relative;
    right: auto;
    top: auto;
    width: 100%;
    max-width: 380px;
    margin: 2.5rem auto 0;
    z-index: 1;
    animation-duration: 6s;
  }
}
