/* ===== GAME CONTAINER ===== */
.game-container {
  padding: 20px 16px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  box-sizing: border-box;
  background: linear-gradient(160deg, #0d0d2b 0%, #1a0a3e 50%, #0d1b3e 100%);
}

.game-container > h1 {
  margin-top: 10px;
  margin-bottom: 10px;
  font-size: 1.6rem;
  background: linear-gradient(135deg, #a78bfa, #7c3aed, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
  text-align: center;
}

/* ===== GAME UI WRAPPER ===== */
#game-ui {
  position: relative;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-bottom: 10px;
}

/* ===== TOP BAR ===== */
#top-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.stat-box {
  flex: 1;
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(124, 58, 237, 0.35);
  border-radius: 14px;
  padding: 10px 14px;
  text-align: center;
  backdrop-filter: blur(8px);
}

.stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(167, 139, 250, 0.7);
  margin-bottom: 3px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #a78bfa;
  line-height: 1;
}

#timer-value {
  color: #f472b6;
}

/* ===== LEVEL BADGE ===== */
#level-badge {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.level-text {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.level-number {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 20px;
  padding: 2px 12px;
}

/* ===== PROGRESS BAR ===== */
#progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.07);
  border-radius: 10px;
  overflow: hidden;
}

#progress-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #7c3aed, #ec4899);
  border-radius: 10px;
  transition: width 1s linear;
}

/* ===== PUZZLE CATEGORY HINT ===== */
#category-hint {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.55);
  text-align: center;
  letter-spacing: 0.5px;
  padding: 4px 16px;
  background: rgba(255,255,255,0.04);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.08);
}

/* ===== GRID AREA ===== */
#grid-area {
  width: 100%;
  max-width: 420px;
}

#tile-grid {
  display: grid;
  gap: 10px;
  width: 100%;
}

/* grid sizes */
#tile-grid.grid-4  { grid-template-columns: repeat(2, 1fr); }
#tile-grid.grid-6  { grid-template-columns: repeat(3, 1fr); }
#tile-grid.grid-9  { grid-template-columns: repeat(3, 1fr); }
#tile-grid.grid-12 { grid-template-columns: repeat(4, 1fr); }
#tile-grid.grid-16 { grid-template-columns: repeat(4, 1fr); }
#tile-grid.grid-20 { grid-template-columns: repeat(5, 1fr); }
#tile-grid.grid-25 { grid-template-columns: repeat(5, 1fr); }

/* ===== TILE ===== */
.tile {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 2px solid rgba(255,255,255,0.08);
  background: rgba(255, 255, 255, 0.05);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.tile:active {
  transform: scale(0.92);
}

.tile .tile-inner {
  font-size: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  transition: transform 0.2s ease;
}

/* Color-mode tiles */
.tile.color-tile .tile-inner {
  font-size: 0;
  width: 60%;
  height: 60%;
  border-radius: 50%;
}

/* Shape SVG tiles */
.tile.shape-tile .tile-inner {
  font-size: 0;
  width: 58%;
  height: 58%;
}

.tile.shape-tile svg {
  width: 100%;
  height: 100%;
}

/* Grid with more tiles = smaller emoji */
#tile-grid.grid-12 .tile .tile-inner,
#tile-grid.grid-16 .tile .tile-inner { font-size: 1.8rem; }
#tile-grid.grid-20 .tile .tile-inner,
#tile-grid.grid-25 .tile .tile-inner { font-size: 1.5rem; }

/* Tap feedback states */
.tile.correct {
  animation: tileCorrect 0.5s ease forwards;
  border-color: #4ade80 !important;
  pointer-events: none;
}
.tile.wrong {
  animation: tileWrong 0.4s ease forwards;
  border-color: #f87171 !important;
  pointer-events: none;
}
.tile.reveal-correct {
  background: rgba(74, 222, 128, 0.15) !important;
  border-color: #4ade80 !important;
}

@keyframes tileCorrect {
  0%   { transform: scale(1);    background: rgba(74,222,128,0.1); }
  40%  { transform: scale(1.12); background: rgba(74,222,128,0.35); }
  100% { transform: scale(1);    background: rgba(74,222,128,0.18); }
}

@keyframes tileWrong {
  0%, 100% { transform: translateX(0); background: rgba(248,113,113,0.1); }
  25%       { transform: translateX(-7px); background: rgba(248,113,113,0.3); }
  75%       { transform: translateX(7px); }
}

/* Tile hover glow */
.tile:hover:not(.correct):not(.wrong) {
  transform: scale(1.04);
  border-color: rgba(167, 139, 250, 0.4);
  box-shadow: 0 0 16px rgba(124, 58, 237, 0.3);
}

/* ===== SCORE POPUP ===== */
.score-pop {
  position: fixed;
  pointer-events: none;
  font-size: 1.8rem;
  font-weight: 900;
  z-index: 9999;
  animation: scorePop 1s ease forwards;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.score-pop.positive { color: #4ade80; }
.score-pop.negative { color: #f87171; }

@keyframes scorePop {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  60%  { opacity: 1; transform: translateY(-50px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-90px) scale(0.9); }
}

/* ===== AD BANNER ===== */
#ad-banner {
  width: 100%;
  max-width: 420px;
  min-height: 60px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
  overflow: hidden;
}

/* ===== OVERLAYS ===== */
.overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(13, 13, 43, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 200;
  text-align: center;
  padding: 30px 24px;
  box-sizing: border-box;
}

.hidden { display: none !important; }

.overlay-card {
  background: linear-gradient(145deg, rgba(124,58,237,0.18), rgba(236,72,153,0.12));
  border: 1px solid rgba(167, 139, 250, 0.25);
  border-radius: 28px;
  padding: 36px 28px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.08);
}

.overlay-icon {
  font-size: 4.5rem;
  display: block;
  margin-bottom: 16px;
  animation: iconBounce 1s ease infinite alternate;
}

@keyframes iconBounce {
  from { transform: translateY(0); }
  to   { transform: translateY(-8px); }
}

.overlay h2 {
  font-size: 2rem;
  font-weight: 900;
  margin: 0 0 10px;
  background: linear-gradient(135deg, #a78bfa, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1px;
}

.overlay p {
  color: rgba(255,255,255,0.65);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 24px;
}

.overlay-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.overlay-stat {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 12px;
}

.overlay-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.45);
  margin-bottom: 4px;
}

.overlay-stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: #a78bfa;
}

/* ===== BUTTONS ===== */
.btn-primary {
  width: 100%;
  padding: 16px 32px;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.5);
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  text-transform: uppercase;
}

.btn-primary:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 28px rgba(124, 58, 237, 0.7);
}

.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  width: 100%;
  padding: 13px 32px;
  font-size: 0.95rem;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50px;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.15s;
  touch-action: manipulation;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.07);
  color: white;
}

/* ===== FEEDBACK TOAST ===== */
#feedback-toast {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: linear-gradient(135deg, #4ade80, #22c55e);
  color: white;
  font-weight: 800;
  font-size: 1rem;
  padding: 12px 28px;
  border-radius: 50px;
  z-index: 9999;
  letter-spacing: 1px;
  box-shadow: 0 6px 24px rgba(74,222,128,0.4);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  pointer-events: none;
}

#feedback-toast.wrong-toast {
  background: linear-gradient(135deg, #f87171, #ef4444);
  box-shadow: 0 6px 24px rgba(248,113,113,0.4);
}

#feedback-toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ===== INSTRUCTIONS ===== */
.how-to-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  text-align: left;
}

.how-to-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.step-num {
  width: 26px;
  height: 26px;
  min-width: 26px;
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: white;
  margin-top: 1px;
}

.step-text {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.5;
}

/* ===== GAME DESCRIPTION (SEO) ===== */
.game-description {
  width: 100%;
  max-width: 420px;
  margin-top: 24px;
  padding: 20px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 20px;
  box-sizing: border-box;
}

.game-description h2 {
  font-size: 1.1rem;
  color: #a78bfa;
  margin: 0 0 10px;
}

.game-description h3 {
  font-size: 0.95rem;
  color: #f472b6;
  margin: 16px 0 8px;
}

.game-description p,
.game-description li {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.7;
  margin: 0 0 8px;
}

.game-description ul {
  padding-left: 18px;
  margin: 0;
}

/* ===== COOKIE CONSENT ===== */
.cookie-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(13, 13, 43, 0.97);
  border-top: 1px solid rgba(124, 58, 237, 0.3);
  padding: 8px 12px;
  z-index: 10000;
  font-size: 11px;
  animation: slideUp 0.3s ease-out;
  backdrop-filter: blur(8px);
}

.cookie-banner.hidden { display: none; }

.cookie-content {
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.cookie-text {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 150px;
  color: rgba(255,255,255,0.75);
  line-height: 1.3;
}

.cookie-icon { font-size: 14px; }

.cookie-buttons { display: flex; gap: 6px; flex-shrink: 0; }

.cookie-btn {
  padding: 5px 10px;
  border: none;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.cookie-btn-accept {
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  color: white;
}

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

.cookie-btn-decline {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.65);
  border: 1px solid rgba(255,255,255,0.18);
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ===== FOOTER ===== */
footer {
  width: 100%;
  text-align: center;
  padding: 20px;
  margin-top: 10px;
}

footer .footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 10px;
}

footer .footer-links a {
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  font-size: 0.8rem;
  transition: color 0.2s;
}

footer .footer-links a:hover { color: #a78bfa; }

footer .copyright {
  color: rgba(255,255,255,0.25);
  font-size: 0.75rem;
}

/* ===== STREAK INDICATOR ===== */
#streak-bar {
  display: flex;
  gap: 5px;
  justify-content: center;
  align-items: center;
}

.streak-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  transition: background 0.3s, transform 0.3s;
}

.streak-dot.filled {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border-color: #fbbf24;
  box-shadow: 0 0 8px rgba(251,191,36,0.5);
  transform: scale(1.15);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 380px) {
  .game-container { padding: 12px 10px 8px; }
  .tile .tile-inner { font-size: 1.8rem; }
  #tile-grid { gap: 7px; }
  .overlay-card { padding: 28px 20px; }
  .overlay h2 { font-size: 1.7rem; }
}

@media (max-height: 700px) {
  .tile .tile-inner { font-size: 1.6rem; }
  #tile-grid { gap: 7px; }
  #game-ui { gap: 10px; }
}
