/* Zekâ Dünyası — 360×640 referans mobil düzen */
:root {
  --cz-bg: #e8e4f8;
  --cz-purple: #7b6ae8;
  --cz-purple-dark: #4a3f8f;
  --cz-card: #ffffff;
  --cz-text: #2d2850;
  --cz-muted: #8b83b8;
  --cz-radius: 22px;
  --cz-phone-w: 360px;
  --cz-phone-h: 640px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: linear-gradient(160deg, #dfe8ff 0%, var(--cz-bg) 45%, #f5f0ff 100%);
  color: var(--cz-text);
  -webkit-tap-highlight-color: transparent;
}

.cz-phone {
  width: min(100vw, var(--cz-phone-w));
  max-width: var(--cz-phone-w);
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--cz-bg);
  position: relative;
  box-shadow: 0 12px 40px rgba(60, 40, 120, 0.15);
}

.cz-hub-head {
  padding: 28px 20px 12px;
  text-align: center;
}
.cz-hub-head h1 {
  margin: 8px 0 4px;
  font-size: 1.5rem;
  color: var(--cz-text);
}
.cz-hub-head p {
  margin: 0;
  color: var(--cz-muted);
  font-size: 0.9rem;
}
.cz-hub-badge {
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border-radius: 16px;
  background: var(--cz-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.cz-hub-scroll {
  padding: 0 14px 88px;
  max-height: calc(100dvh - 140px);
  overflow-y: auto;
}
.cz-cat h2 {
  font-size: 0.95rem;
  color: var(--cat, var(--cz-purple));
  margin: 18px 0 10px;
  padding-left: 4px;
}
.cz-game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 12px 16px;
}

.cz-game-grid.cz-single {
  grid-template-columns: 1fr;
  max-width: 220px;
  margin: 0 auto;
}

.cz-cat-pack h2 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.cz-game-card-pack img {
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.cz-game-card-pack span {
  display: block;
  text-align: center;
  font-weight: 600;
  margin-top: 6px;
  font-size: 0.9rem;
}
.cz-game-card {
  display: block;
  background: var(--cz-card);
  border-radius: var(--cz-radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--cz-text);
  box-shadow: 0 4px 14px rgba(80, 60, 140, 0.08);
  transition: transform 0.15s ease;
}
.cz-game-card:active { transform: scale(0.98); }
.cz-game-card img {
  width: 100%;
  aspect-ratio: 360/640;
  object-fit: cover;
  object-position: top;
  display: block;
  background: var(--cz-bg);
}
.cz-game-card span {
  display: block;
  padding: 8px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
}

.cz-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100vw, var(--cz-phone-w));
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 12px 24px 18px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
}
.cz-nav a {
  font-size: 1.35rem;
  text-decoration: none;
  opacity: 0.45;
  padding: 8px 16px;
}
.cz-nav a.active { opacity: 1; }

/* Oyun oyuncu */
.cz-player {
  min-height: 100dvh;
  overflow: hidden;
  position: relative;
}
.cz-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}
.cz-screen-ref {
  position: relative;
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: var(--cz-bg);
}
/* Referans arka plan + oynanabilir katman */
.cz-ref-gameplay {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 100%;
  background-size: contain;
  background-position: top center;
  background-repeat: no-repeat;
}
.cz-play-layer {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 30%;
  bottom: 22%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: auto;
  padding: 4px;
}
.cz-hotspot-game {
  bottom: 12%;
  z-index: 2;
}
.cz-play-feedback {
  display: none;
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.35;
  padding: 8px 10px;
  border-radius: 12px;
  margin-bottom: 6px;
  width: 100%;
  max-width: 300px;
}
.cz-play-feedback-info { background: #e8e4f8; color: #5a4f8c; }
.cz-play-feedback-ok { background: #e8f5e9; color: #2e7d32; }
.cz-play-feedback-hint { background: #fff8e1; color: #6d5a00; }
.cz-play-toolbar {
  width: 100%;
  max-width: 300px;
  margin-bottom: 6px;
}
.cz-play-objective {
  font-size: 0.75rem;
  color: var(--cz-muted);
  margin: 0 0 6px;
  line-height: 1.35;
  text-align: center;
}
.cz-play-toolbar-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
.cz-play-tool-btn {
  border: none;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--cz-text);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.cz-choice-btn.cz-wrong-soft,
.cz-mem-card.cz-wrong-soft {
  animation: cz-wrong-pulse 0.6s ease;
  background: #ffe8e8 !important;
}
@keyframes cz-wrong-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.96); }
}
.cz-mem-card.peek {
  background: #fff9c4;
}
.cz-play-hint {
  text-align: center;
  font-size: 0.82rem;
  margin: 0 0 8px;
  color: var(--cz-muted);
  line-height: 1.3;
}
  text-align: center;
  font-size: 0.82rem;
  margin: 0 0 8px;
  color: var(--cz-muted);
  line-height: 1.3;
}
.cz-choice-grid {
  display: grid;
  gap: 8px;
  width: 100%;
  max-width: 280px;
}
.cz-choice-btn {
  border: none;
  border-radius: 14px;
  padding: 12px 8px;
  font-size: 1.1rem;
  font-weight: 600;
  background: var(--cz-card);
  color: var(--cz-text);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(60, 40, 120, 0.1);
  transition: transform 0.1s ease;
}
.cz-choice-btn:active { transform: scale(0.96); }
.cz-choice-btn.cz-correct {
  background: #d4f5dc;
  outline: 2px solid #4caf50;
}
.cz-choice-btn.cz-wrong {
  background: #ffe0e0;
  animation: cz-shake 0.35s ease;
}
@keyframes cz-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.cz-sound-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 200px;
}
.cz-sound-bar {
  height: 14px;
  border-radius: 999px;
  transition: transform 0.15s ease;
}
.cz-sound-bar.cz-pulse { transform: scaleX(1.08); }
.cz-simon-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 260px;
}
.cz-simon-cell {
  aspect-ratio: 1;
  border: none;
  border-radius: 14px;
  background: #ede8ff;
  font-size: 1.5rem;
  cursor: pointer;
}
.cz-simon-cell.cz-lit {
  background: var(--cat, var(--cz-purple));
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(123, 106, 232, 0.5);
}
.cz-stroop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 260px;
}
.cz-stroop-btn {
  border: none;
  border-radius: 16px;
  padding: 18px 8px;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--cz-text);
  cursor: pointer;
  min-height: 64px;
}
.cz-maze-grid {
  display: grid;
  gap: 3px;
  width: 100%;
  max-width: 260px;
}
.cz-maze-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  font-size: 0.7rem;
  border: none;
  background: #ede8ff;
}
.cz-maze-cell.wall { background: #c4b8f0; }
.cz-maze-cell.goal { background: #ffe082; }
.cz-maze-cell.player { background: var(--cat, var(--cz-purple)); color: #fff; }

.cz-screen-ref img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: top center;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.cz-hotspot {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 14%;
  height: 52px;
  border: none;
  background: rgba(123, 106, 232, 0.25);
  cursor: pointer;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  z-index: 5;
}
.cz-hotspot:focus-visible {
  outline: 3px solid var(--cz-purple);
  outline-offset: 2px;
}

/* Hafıza kartları — referans UI */
.cz-mem-wrap {
  flex: 1;
  padding: 8px 16px 0;
  display: flex;
  flex-direction: column;
  background: var(--cz-bg);
}
.cz-mem-header {
  background: var(--cz-card);
  border-radius: 20px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  box-shadow: 0 2px 12px rgba(80, 60, 140, 0.06);
}
.cz-mem-level {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: var(--cat, var(--cz-purple));
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.cz-mem-title {
  flex: 1;
  font-weight: 700;
  font-size: 0.95rem;
}
.cz-mem-title small {
  display: block;
  color: var(--cat, var(--cz-purple));
  font-weight: 600;
  font-size: 0.75rem;
}
.cz-mem-stars {
  color: #f5b942;
  font-size: 0.85rem;
  letter-spacing: 2px;
}
.cz-mem-label {
  text-align: center;
  margin: 6px 0 10px;
}
.cz-mem-label strong {
  display: block;
  font-size: 1rem;
}
.cz-mem-label span {
  font-size: 0.8rem;
  color: var(--cz-muted);
}
.cz-mem-board {
  flex: 1;
  background: var(--cz-card);
  border-radius: 24px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  min-height: 280px;
}
.cz-mem-grid {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 300px;
}
.cz-mem-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cz-mem-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cz-mem-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.cz-mem-card {
  aspect-ratio: 1;
  border: none;
  border-radius: 16px;
  background: var(--cat, var(--cz-purple));
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.cz-mem-card:disabled { cursor: default; }
.cz-mem-card.flipped,
.cz-mem-card.matched {
  background: #ede8ff;
  color: var(--cz-purple-dark);
}
.cz-mem-card.matched {
  opacity: 0.55;
  transform: scale(0.96);
}
.cz-mem-card .cz-icon { font-size: 1.6rem; line-height: 1; }

.cz-btn-primary {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 0 auto 16px;
  padding: 16px 24px;
  border: none;
  border-radius: 999px;
  background: var(--cat, var(--cz-purple));
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(100, 80, 200, 0.35);
}
.cz-btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.cz-timer {
  text-align: center;
  font-weight: 700;
  color: var(--cat, var(--cz-purple));
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.cz-panel-form {
  padding: 20px 18px 100px;
}
.cz-panel-form label {
  display: block;
  margin-bottom: 18px;
  font-size: 0.9rem;
}
.cz-panel-form input[type="range"] { width: 100%; }

body.cz-night {
  --cz-bg: #1e1a2e;
  --cz-text: #ece8ff;
  --cz-card: #2a2540;
  --cz-muted: #a89ec8;
}

@media (min-width: 400px) {
  .cz-phone {
    border-radius: 24px;
    margin-top: 12px;
    margin-bottom: 12px;
    min-height: calc(100dvh - 24px);
  }
}

/* CC0 oyun kartları (emoji, PNG yok) */
.cz-game-card-emoji {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 108px;
  padding: 14px 10px;
  text-decoration: none;
  background: var(--cz-card);
  border-radius: 18px;
  box-shadow: 0 6px 18px rgba(74, 63, 143, 0.08);
}
.cz-card-emoji {
  font-size: 2.2rem;
  line-height: 1;
  margin-bottom: 8px;
}
.cz-game-card-emoji span:last-child {
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  color: var(--cz-text);
}

/* Oyun oynatıcı */
.cz-play-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(123, 106, 232, 0.15);
}
.cz-back {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f0ecff;
  color: var(--cz-purple-dark);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 700;
}
.cz-play-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.95rem;
}
.cz-play-emoji { font-size: 1.4rem; }
.cz-play-spacer { width: 40px; }
.cz-game-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #000;
  min-height: calc(100dvh - 60px);
}
.cz-player.cz-phone {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* Mobil oyun kabuğu — geri + sanal D-pad */
.cz-game-back {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  z-index: 9999;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #3d2f8f;
  font-size: 1.4rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  touch-action: manipulation;
}
.cz-game-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}
.cz-dpad {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 9998;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 16px;
  pointer-events: none;
  gap: 12px;
}
.cz-dpad-outer { position: absolute; bottom: 8px; left: 0; right: 0; }
.cz-dpad-grid {
  display: grid;
  grid-template-columns: 52px 52px 52px;
  grid-template-rows: 52px 52px;
  gap: 6px;
  pointer-events: auto;
}
.cz-dpad-btn,
.cz-dpad-action {
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  color: #3d2f8f;
  font-size: 1.2rem;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.cz-dpad-btn { width: 52px; height: 52px; }
.cz-dpad-btn:first-child { grid-column: 2; }
.cz-dpad-left { grid-column: 1; grid-row: 2; }
.cz-dpad-right { grid-column: 3; grid-row: 2; }
.cz-dpad-down { grid-column: 2; grid-row: 2; }
.cz-dpad-action {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  pointer-events: auto;
  align-self: flex-end;
  font-size: 1rem;
}
.cz-game-frame {
  touch-action: manipulation;
}
.cz-game-hint {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(118px, calc(env(safe-area-inset-bottom) + 100px));
  z-index: 9997;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(61, 47, 143, 0.88);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.35;
  pointer-events: none;
}
.cz-dpad-vertical,
.cz-dpad-lr {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}
.cz-dpad-vertical {
  flex-direction: column;
}
.cz-dpad-action-big {
  width: 88px !important;
  height: 88px !important;
  font-size: 1.1rem !important;
  margin-left: auto;
  margin-right: auto;
}
