/* IGRAONICA – sarena, velike zone, brend malikirurziiroboti.com */

:root {
  --brand-teal: #2ec4b6;
  --brand-teal-dark: #1fa89a;
  --brand-purple: #9b6dff;
  --brand-coral: #ff6b6b;
  --brand-sun: #ffd93d;
  --brand-aqua: #4cc9f0;
  --brand-pink: #ff85d8;
  --brand-warm: #ff9f68;
  --bg: #e8fbff;
  --surface: #ffffff;
  --mint: #7ee8d3;
  --peach: #ffc4a8;
  --lavender: #c9b6ff;
  --sky: #9fdcff;
  --lemon: #fff176;
  --text: #1e2d3d;
  --text-soft: #4a5a6a;
  --shadow: rgba(30, 45, 61, 0.12);
  --radius: 28px;
  --radius-sm: 18px;
  --font: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
}

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

html {
  font-size: 22px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(ellipse 120% 80% at 100% 0%, rgba(255, 133, 216, 0.35) 0%, transparent 50%),
    radial-gradient(ellipse 100% 60% at 0% 100%, rgba(76, 201, 240, 0.4) 0%, transparent 55%),
    radial-gradient(ellipse 80% 50% at 50% 30%, rgba(255, 217, 61, 0.25) 0%, transparent 45%),
    linear-gradient(165deg, #e0fff8 0%, #fff5e6 40%, #f0e8ff 100%);
  line-height: 1.45;
}

body.page-game {
  background:
    radial-gradient(ellipse 90% 50% at 10% 20%, rgba(46, 196, 182, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse 70% 40% at 90% 80%, rgba(155, 109, 255, 0.22) 0%, transparent 50%),
    linear-gradient(180deg, #dff8ff 0%, #fff4ec 100%);
}

body.page-coloring .panel--pop {
  background: linear-gradient(145deg, #fff 0%, #fff8f0 45%, #f0fdf9 100%);
  border: 4px solid rgba(255, 154, 118, 0.65);
  box-shadow: 0 14px 36px rgba(255, 107, 107, 0.18);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Header – samo pocetna koristi logo u punom sjaju */
.site-header {
  text-align: center;
  padding: 1.5rem 1rem 0.75rem;
  position: relative;
}

.site-header--pop::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: min(96vw, 720px);
  height: 140px;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 217, 61, 0.45) 0%,
    rgba(76, 201, 240, 0.2) 45%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}

.site-header--pop > * {
  position: relative;
  z-index: 1;
}

.site-logo {
  margin: 0 auto 1rem;
  max-height: 168px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 22px var(--shadow));
}

.site-title {
  font-size: clamp(1.5rem, 4.5vw, 2.35rem);
  margin: 0 0 0.4rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text);
}

.site-tagline {
  margin: 0;
  font-size: clamp(1.1rem, 2.8vw, 1.35rem);
  color: var(--text);
  font-weight: 700;
}

.site-brandline {
  margin: 0.65rem 0 0;
}

.site-brandlink {
  display: inline-block;
  font-size: clamp(1.05rem, 2.8vw, 1.25rem);
  font-weight: 800;
  color: var(--brand-teal-dark);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(75, 196, 176, 0.15);
  transition: transform 0.15s ease, background 0.15s ease;
}

.site-brandlink:hover {
  background: rgba(75, 196, 176, 0.28);
  transform: scale(1.02);
}

/* Kartice na pocetnoj */
.card-grid {
  display: grid;
  gap: 1.5rem;
  padding: 1.25rem 1.25rem 2.5rem;
  max-width: 1200px;
  margin: 0 auto;
  grid-template-columns: 1fr;
}

@media (min-width: 600px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

.game-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem 1.35rem;
  box-shadow: 0 14px 34px var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 4px solid transparent;
}

.game-card--memory {
  border-color: #3dd4c0;
  background: linear-gradient(155deg, #fff 0%, #cfffef 45%, #a8ffe8 100%);
  box-shadow: 0 14px 0 rgba(46, 196, 182, 0.25), 0 14px 34px var(--shadow);
}

.game-card--puzzle {
  border-color: #6bb8ff;
  background: linear-gradient(155deg, #fff 0%, #d4efff 50%, #a8dfff 100%);
  box-shadow: 0 14px 0 rgba(76, 201, 240, 0.3), 0 14px 34px var(--shadow);
}

.game-card--coloring {
  border-color: #ff9a76;
  background: linear-gradient(155deg, #fff 0%, #ffe8d8 45%, #ffc9a8 100%);
  box-shadow: 0 14px 0 rgba(255, 107, 107, 0.22), 0 14px 34px var(--shadow);
}

.game-card--soon {
  border-color: #b794ff;
  background: linear-gradient(155deg, #fff 0%, #ede4ff 50%, #d4c4ff 100%);
  box-shadow: 0 14px 0 rgba(155, 109, 255, 0.28), 0 14px 34px var(--shadow);
}

.game-card:not(.game-card--soon):hover {
  transform: scale(1.02);
  box-shadow: 0 16px 36px rgba(90, 70, 120, 0.18);
}

.game-card__art {
  position: relative;
  width: min(100%, 300px);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.85);
}

.game-card__art--m1 {
  background: linear-gradient(135deg, #fff9c4 0%, #b2f5ea 50%, #80deea 100%);
}

.game-card__art--m2 {
  background: linear-gradient(135deg, #ffe0b2 0%, #bbdefb 55%, #90caf9 100%);
}

.game-card__art--m3 {
  background: linear-gradient(135deg, #f8bbd0 0%, #e1bee7 50%, #ce93d8 100%);
}

.game-card__art--m4 {
  background: linear-gradient(135deg, #d1c4e9 0%, #b39ddb 45%, #9575cd 100%);
}

.game-card__img--main {
  max-height: 85%;
  width: auto;
  object-fit: contain;
}

.game-card__img--float {
  position: absolute;
  right: 6%;
  bottom: 6%;
  width: 38%;
  max-width: 100px;
  filter: drop-shadow(0 4px 8px var(--shadow));
  animation: floaty 3s ease-in-out infinite;
}

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

.game-card__title {
  margin: 0;
  font-size: clamp(1.45rem, 3.8vw, 1.95rem);
  font-weight: 800;
}

/* Gumbi */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 62px;
  min-width: 200px;
  padding: 0.75rem 1.75rem;
  font-size: 1.28rem;
  font-weight: 800;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.07);
}

.btn:active {
  transform: scale(0.96) translateY(2px);
}

.btn--primary {
  background: linear-gradient(180deg, #5eead4 0%, var(--brand-teal) 55%, #0d9488 100%);
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
  border: 3px solid rgba(255, 255, 255, 0.45);
}

.btn--primary:hover {
  transform: scale(1.04);
}

.btn--secondary {
  background: linear-gradient(180deg, #c4b5fd 0%, var(--brand-purple) 55%, #7c3aed 100%);
  color: #fff;
  border: 3px solid rgba(255, 255, 255, 0.4);
}

.btn--ghost {
  background: linear-gradient(145deg, #e9d5ff, #ddd6fe);
  color: var(--text);
  font-weight: 800;
  cursor: default;
  box-shadow: 0 6px 0 rgba(124, 58, 237, 0.2);
  border: 3px solid #c4b5fd;
}

.btn--small {
  min-height: 54px;
  min-width: 150px;
  font-size: 1.12rem;
}

.site-footer {
  text-align: center;
  padding: 1.25rem 1rem 2rem;
  color: var(--text-soft);
  font-size: 1.1rem;
}

.site-footer__lead {
  margin: 0 0 0.35rem;
  font-size: clamp(1.15rem, 3vw, 1.35rem);
  font-weight: 800;
  color: #0d9488;
}

.site-footer__brand {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
}

.site-footer--pop {
  background: linear-gradient(
    90deg,
    rgba(255, 217, 61, 0.35) 0%,
    rgba(76, 201, 240, 0.25) 50%,
    rgba(255, 133, 216, 0.3) 100%
  );
  padding-bottom: 2.5rem;
  border-radius: 24px 24px 0 0;
  margin-top: 0.5rem;
}

/* Stranice igara – zajednicki layout */
.page-game {
  padding-bottom: 2rem;
}

.game-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  background: linear-gradient(90deg, #e0fff7 0%, #fff5fb 50%, #ede9fe 100%);
  box-shadow: 0 6px 20px var(--shadow);
  border-bottom: 4px solid rgba(46, 196, 182, 0.45);
}

.game-topbar__group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-start;
}

.game-topbar__title {
  margin: 0;
  font-size: clamp(1.5rem, 4.5vw, 2rem);
  font-weight: 800;
}

.brand-chip {
  font-size: clamp(0.95rem, 2.8vw, 1.12rem);
  font-weight: 800;
  color: var(--brand-teal-dark);
  text-decoration: none;
  padding: 0.2rem 0;
}

.brand-chip:hover {
  text-decoration: underline;
}

.game-zone {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.25rem;
}

.panel {
  background: linear-gradient(160deg, #ffffff 0%, #f8fffe 100%);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: 0 12px 32px var(--shadow);
  border: 3px solid rgba(46, 196, 182, 0.2);
}

/* Memorija */
.memory-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  max-width: 640px;
  margin: 0 auto;
}

@media (min-width: 480px) {
  .memory-board {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.95rem;
  }
}

.memory-card {
  aspect-ratio: 1;
  perspective: 800px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.memory-card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.45s ease;
  transform-style: preserve-3d;
  border-radius: var(--radius-sm);
}

.memory-card.is-flipped .memory-card__inner,
.memory-card.is-matched .memory-card__inner {
  transform: rotateY(180deg);
}

.memory-card__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  border: 3px solid #fff;
  box-shadow: 0 4px 12px var(--shadow);
}

.memory-card__face--back {
  background: linear-gradient(145deg, #c4b5fd, #5eead4, #fcd34d);
  transform: rotateY(0deg);
}

.memory-card__face--front {
  background: #fff;
  transform: rotateY(180deg);
}

.memory-card__face--front img {
  max-width: 88%;
  max-height: 88%;
  object-fit: contain;
}

.memory-card.is-matched .memory-card__face {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(120, 220, 180, 0.6);
}

.memory-card:active .memory-card__inner {
  transform: scale(0.95);
}

.memory-card.is-flipped:active .memory-card__inner,
.memory-card.is-matched:active .memory-card__inner {
  transform: rotateY(180deg) scale(0.98);
}

.overlay-win {
  position: fixed;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(255, 237, 213, 0.94) 0%,
    rgba(224, 251, 231, 0.92) 50%,
    rgba(237, 233, 254, 0.94) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.overlay-win.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.overlay-win__box {
  text-align: center;
  padding: 2rem 1.5rem;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff 0%, #ecfeff 100%);
  box-shadow:
    0 20px 50px var(--shadow),
    0 0 0 4px rgba(46, 196, 182, 0.35);
  max-width: 90vw;
  animation: popIn 0.5s ease;
}

@keyframes popIn {
  0% {
    transform: scale(0.85);
    opacity: 0;
  }
  60% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.overlay-win__box h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.65rem, 5vw, 2.25rem);
}

/* Slagalica */
.puzzle-wrap {
  max-width: 520px;
  margin: 0 auto;
}

.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  aspect-ratio: 1;
  background: linear-gradient(145deg, #bae6fd, #e9d5ff, #fbcfe8);
  padding: 10px;
  border-radius: var(--radius-sm);
  user-select: none;
  touch-action: none;
  border: 3px solid rgba(255, 255, 255, 0.75);
}

.puzzle-piece {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  cursor: grab;
  box-shadow: 0 4px 10px var(--shadow);
  border: 2px solid #fff;
  transition: transform 0.15s ease;
}

.puzzle-piece:active {
  cursor: grabbing;
}

.puzzle-piece.is-selected {
  outline: 4px solid #7eb6ff;
  transform: scale(1.03);
  z-index: 2;
}

.puzzle-piece.is-correct-flash {
  animation: correctFlash 0.6s ease;
}

@keyframes correctFlash {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.15);
  }
}

.puzzle-piece__img {
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  background-size: 300% 300%;
  /* background-image postavlja puzzle.js */
}

.puzzle-character-pick {
  margin-bottom: 0.75rem;
}

.puzzle-hint--pick {
  margin: 0 0 0.85rem;
  font-weight: 800;
  color: #0369a1;
}

.puzzle-hint {
  text-align: center;
  margin-top: 0.85rem;
  font-size: 1.12rem;
  color: var(--text-soft);
}

body.page-puzzle .panel.puzzle-wrap {
  border: 3px solid rgba(59, 130, 246, 0.35);
  background: linear-gradient(160deg, #fff 0%, #eff6ff 50%, #fdf4ff 100%);
}

/* Bojanka */
.coloring-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
  justify-content: center;
}

.color-swatch {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow:
    0 4px 12px var(--shadow),
    0 0 0 2px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.color-swatch:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 16px rgba(46, 196, 182, 0.35);
}

.color-swatch.is-active {
  outline: 4px solid #1e293b;
  transform: scale(1.14);
  box-shadow: 0 0 0 3px #fff, 0 0 0 7px var(--brand-teal);
}

.coloring-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.character-pick {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* Tri lika uvijek u jednom redu (bojanka, slagalica) */
.character-pick--three {
  width: 100%;
  max-width: 720px;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: stretch;
  gap: clamp(0.35rem, 2vw, 0.85rem);
}

.character-pick--three .pick-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.5rem clamp(0.35rem, 2vw, 0.85rem) 0.65rem;
  font-size: clamp(0.88rem, 3.2vw, 1.2rem);
}

.character-pick--three .pick-btn img {
  width: clamp(52px, 18vw, 88px);
  height: clamp(52px, 18vw, 88px);
}

.pick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 1.2rem;
  border-radius: var(--radius-sm);
  border: 4px solid rgba(0, 0, 0, 0.08);
  background: linear-gradient(180deg, #fff 0%, #f1f5f9 100%);
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 800;
  font-family: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.pick-btn img {
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.12));
}

.pick-btn--robot.is-active {
  border-color: #14b8a6;
  background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
  box-shadow: 0 8px 0 rgba(20, 184, 166, 0.35), 0 10px 24px var(--shadow);
}

.pick-btn--slon.is-active {
  border-color: #f97316;
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
  box-shadow: 0 8px 0 rgba(249, 115, 22, 0.35), 0 10px 24px var(--shadow);
}

.pick-btn--lav.is-active {
  border-color: #a855f7;
  background: linear-gradient(180deg, #faf5ff 0%, #f3e8ff 100%);
  box-shadow: 0 8px 0 rgba(168, 85, 247, 0.35), 0 10px 24px var(--shadow);
}

.pick-btn:hover {
  transform: scale(1.05);
}

.pick-btn:not(.is-active):hover {
  border-color: rgba(46, 196, 182, 0.45);
}

.coloring-hint {
  text-align: center;
  margin: 0;
  font-size: clamp(1.08rem, 3vw, 1.28rem);
  font-weight: 800;
  color: #c2410c;
  background: linear-gradient(90deg, transparent, rgba(255, 217, 61, 0.45), transparent);
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
}

.canvas-shell {
  position: relative;
  width: min(100%, 560px);
  margin: 0 auto;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 12px 36px var(--shadow);
  background: #ececec;
  touch-action: none;
  border: 4px solid rgba(75, 196, 176, 0.45);
}

.canvas-shell--pop {
  box-shadow:
    0 12px 36px var(--shadow),
    0 0 0 4px rgba(255, 154, 118, 0.4);
}

.canvas-shell canvas {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
  cursor: pointer;
}

.canvas-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

/* Pozadinska muzika – mali gumb, emoji zvucnik */
.music-toggle {
  position: fixed;
  top: max(0.65rem, env(safe-area-inset-top));
  right: max(0.65rem, env(safe-area-inset-right));
  z-index: 10000;
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 1.35rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  box-shadow:
    0 3px 0 rgba(0, 0, 0, 0.1),
    0 6px 16px rgba(30, 45, 61, 0.28);
  background: linear-gradient(180deg, #c4b5fd 0%, #7c3aed 100%);
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.5);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.music-toggle:hover {
  transform: scale(1.04);
  filter: brightness(1.1);
}

.music-toggle:active {
  transform: scale(0.98);
}

.music-toggle--off {
  background: linear-gradient(180deg, #94a3b8 0%, #475569 100%);
}

.music-toggle--error {
  background: linear-gradient(180deg, #fb923c 0%, #ea580c 100%);
  cursor: help;
}

/* Igre: gumb ispod topbara */
body.page-game .music-toggle {
  top: max(4.65rem, calc(env(safe-area-inset-top) + 3.85rem));
}
