/* ================================================
   AD-SENSE — Games & Modals
   Game modals, puzzle game, where-is-it game
   ================================================ */

/* ================================================
   MODALS (Authentication & Games)
   ================================================ */

/* ─── Auth Modal ─── */
.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.auth-modal.show {
  display: flex;
}

.auth-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.auth-modal-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 90%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

.auth-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  transition: all var(--transition-fast);
}

.auth-modal-close:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.auth-form-container {
  animation: fadeIn 0.3s ease;
}

.auth-header {
  margin-bottom: 28px;
  text-align: center;
}

.auth-header h2 {
  color: var(--text-primary);
  font-size: 24px;
  margin-bottom: 8px;
  font-weight: 700;
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.switch-form-btn {
  background: none;
  border: none;
  color: var(--accent-purple);
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
  transition: color var(--transition-fast);
  margin-left: 4px;
}

.switch-form-btn:hover {
  color: var(--accent-cyan);
}

/* ─── Game Modal ─── */
.game-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.game-modal.show {
  display: flex;
}

.game-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.game-modal-content {
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-secondary);
  border: none;
  border-radius: 0;
  width: 100%;
  max-width: none;
  max-height: none;
  height: 100vh;
  overflow: hidden;
  box-shadow: none;
  animation: none;
  padding: 0;
}

.game-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  transition: all var(--transition-fast);
  z-index: 10;
}

.game-modal-close:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.game-instructions-screen,
.game-play-screen,
.game-results-screen {
  animation: fadeIn 0.3s ease;
}

.game-instructions-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  padding: 40px;
}

.game-play-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.game-results-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  padding: 40px;
}

.game-header {
  text-align: center;
  margin-bottom: 32px;
}

.game-header h2 {
  font-size: 24px;
  margin-bottom: 8px;
  font-weight: 700;
}

.game-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ─── Instructions Screen ─── */
.instructions-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
}

.instruction-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.instruction-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-main);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.instruction-text {
  padding-top: 4px;
  font-size: 14px;
  color: var(--text-secondary);
}

.difficulty-selector {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px;
}

.difficulty-selector h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
}

.difficulty-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.difficulty-btn {
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all var(--transition-fast);
}

.difficulty-btn:hover {
  background: var(--bg-card);
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.difficulty-btn .reward {
  color: var(--accent-green);
  font-size: 12px;
  font-weight: 700;
}

.difficulty-subtitle {
  font-size: 12px;
  color: var(--accent-green);
  margin: -8px 0 16px 0;
  font-weight: 500;
}

/* ─── Play Screen ─── */
.game-play-header {
  display: flex;
  justify-content: space-around;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-glass);
}

.game-stat {
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.game-play-footer {
  margin-top: 24px;
  text-align: center;
}

/* ─── Results Screen ─── */
.results-content {
  text-align: center;
}

.results-status {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.results-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 28px 0;
  padding: 20px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
}

.result-stat {
  text-align: center;
}

.result-stat .label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-stat .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.result-note {
  font-size: 12px;
  color: var(--accent-green);
  text-align: center;
  margin: 16px 0;
  padding: 8px;
  background: rgba(16, 185, 129, 0.08);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-green);
}

.results-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}

.results-actions .btn {
  width: 100%;
  justify-content: center;
}

/* ─── Ad Zones ─── */
.game-ad-zone {
  margin: 20px 0;
  padding: 12px;
  background: var(--bg-card);
  border: 2px solid var(--border-glass);
  border-radius: var(--radius-md);
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.game-ad-zone-top-play {
  margin-top: 64px;
  margin-bottom: 16px;
  min-height: 60px;
}

.game-ad-zone-bottom-play {
  margin: 16px 0 0 0;
  min-height: 60px;
}

.ad-zone-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
  opacity: 0.7;
}

.ad-placeholder {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ad-placeholder-compact {
  min-height: 50px;
  justify-content: center;
}

.ad-placeholder-img {
  width: 120px;
  height: 50px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(6, 182, 212, 0.1));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.ad-placeholder-compact .ad-placeholder-img {
  width: 100%;
  height: 40px;
}

.ad-placeholder-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* ================================================
   PUZZLE GAME STYLES
   ================================================ */
.puzzle-container {
  flex: 1;
  display: flex;
  justify-content: center;
  overflow-y: auto;
  padding: 20px;
}

.puzzle-grid {
  width: min(520px, 92vw);
  display: grid;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-glass);
}

.puzzle-tile {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition-fast);
  overflow: hidden;
  aspect-ratio: 1 / 1;
  min-width: 60px;
  min-height: 60px;
}

.puzzle-tile:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.puzzle-tile.empty {
  background: transparent;
  border: 2px dashed var(--border-glass);
  cursor: default;
  box-shadow: none;
}

/* ================================================
   WHERE IS IT GAME STYLES
   ================================================ */
.whereis-play-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

.whereis-input-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(10, 10, 15, 0.95);
  backdrop-filter: blur(8px);
  padding: 16px;
  border-bottom: 1px solid var(--border-glass);
}

.whereis-input-container {
  max-width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.whereis-input-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.whereis-input-box label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.whereis-answer-input {
  width: 100px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  transition: all var(--transition-fast);
}

.whereis-answer-input:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.whereis-answer-input::placeholder {
  color: var(--text-muted);
}

.whereis-target {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

.whereis-target-label {
  color: var(--text-secondary);
  font-size: 14px;
}

.whereis-target-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--gradient-main);
  border-radius: var(--radius-md);
  font-size: 24px;
  font-weight: 700;
  color: white;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.whereis-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.whereis-canvas-container {
  position: absolute;
  top: 100px;
  left: 0;
  right: 0;
  bottom: 60px;
  background: var(--bg-secondary);
  overflow-y: auto;
  overflow-x: hidden;
}

.whereis-canvas-container:active {
  cursor: grabbing;
}

.whereis-canvas {
  position: relative;
  width: 100%;
  padding: 0;
  background: var(--bg-secondary);
}

.whereis-ad-block {
  position: absolute;
  display: inline-flex;
  background: var(--bg-card);
  border: 2px solid var(--border-glass);
  border-radius: var(--radius-sm);
  user-select: none;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  cursor: default;
  flex-shrink: 0;
  margin: 0;
  padding: 8px;
}

.whereis-ad-block:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
}

.whereis-ad-block.correct {
  background: var(--gradient-main);
  border-color: var(--accent-purple);
  color: white;
  box-shadow: 0 0 25px rgba(139, 92, 246, 0.5);
  animation: pulse-correct 0.6s ease;
}

.whereis-ad-block.wrong {
  background: rgba(255, 107, 107, 0.2);
  border-color: #ff6b6b;
  animation: pulse-wrong 0.4s ease;
}

.whereis-ad-block-number {
  position: absolute;
  bottom: 4px;
  right: 4px;
  font-size: 10px;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 700;
}

.whereis-ad-block.correct .whereis-ad-block-number {
  color: white;
  background: rgba(0, 0, 0, 0.2);
}

.whereis-ad-block-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-align: center;
  padding: 8px;
}

.whereis-ad-img {
  width: 24px;
  height: 24px;
  margin-bottom: 4px;
  opacity: 0.7;
}

.whereis-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 20px;
  background: rgba(10, 10, 15, 0.95);
  border-top: 1px solid var(--border-glass);
  text-align: center;
}

/* ================================================
   FLAPPY AD GAME STYLES
   ================================================ */
.flappy-play-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.flappy-canvas-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a14;
  overflow: hidden;
  min-height: 0;
}

.flappy-quit-overlay-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 12;
  padding: 6px 14px !important;
  font-size: 12px !important;
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

.flappy-quit-overlay-btn:hover {
  opacity: 1;
}

.flappy-stats-bar {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  display: flex;
  gap: 20px;
  padding: 4px 16px;
  background: rgba(10, 10, 20, 0.65);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  font-size: 13px;
  color: var(--text-secondary);
  pointer-events: none;
  white-space: nowrap;
}

.flappy-stat strong {
  color: var(--text-primary);
  font-weight: 700;
}

#flappy-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.12), 0 0 0 1px var(--border-glass);
  cursor: pointer;
  user-select: none;
}

/* ─── Start Overlay ─── */
.flappy-start-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 20, 0.55);
  backdrop-filter: blur(2px);
  z-index: 5;
  border-radius: var(--radius-md);
}

.flappy-start-text {
  text-align: center;
  color: var(--text-primary);
  animation: flappyPulse 1.8s ease-in-out infinite;
}

.flappy-bird-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

.flappy-start-text p {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ─── Game Over Overlay ─── */
.flappy-gameover-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 20, 0.75);
  backdrop-filter: blur(4px);
  z-index: 10;
  border-radius: var(--radius-md);
  animation: fadeIn 0.3s ease;
}

.flappy-gameover-content {
  text-align: center;
  padding: 32px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 320px;
  width: 90%;
}

.flappy-gameover-content h3 {
  font-size: 24px;
  font-weight: 800;
  color: #e94560;
  margin-bottom: 8px;
}

.flappy-gameover-content p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.flappy-gameover-score {
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.flappy-gameover-score strong {
  color: var(--accent-cyan);
  font-size: 28px;
}

@keyframes flappyPulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}
