/* ═══════════════════════════════════════════════════════════════════
   MIA GAMES — Connect Four Game Styles
   File     : games/connect-four/connect-four.css
   Inherits : ../../style.css (global tokens + layout)
   ═══════════════════════════════════════════════════════════════════ */

/* ── Breadcrumb ─────────────────────────────────────────────────── */
.breadcrumb-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.625rem 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.breadcrumb li {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb a:hover { color: var(--accent-purple); }

.breadcrumb [aria-current="page"] {
  color: var(--text-secondary);
  font-weight: var(--fw-medium);
}

/* ── Screen-reader only utility ─────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── SEO Article Content ────────────────────────────────────────── */
.seo-content {
  padding: 2.5rem 0 1rem;
  border-top: 1px solid var(--border-subtle);
}

.seo-content h2 {
  font-size: clamp(var(--fs-xl), 2.5vw, var(--fs-2xl));
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.seo-content h3 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin-top: 1.75rem;
  margin-bottom: 0.6rem;
}

.seo-content p {
  font-size: var(--fs-base);
  color: var(--text-secondary);
  line-height: 1.85;
  max-width: none;
  margin-bottom: 1rem;
}

.seo-content ul {
  padding-left: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}

.seo-content ul li {
  list-style: disc;
  font-size: var(--fs-base);
  color: var(--text-secondary);
  line-height: 1.75;
}

/* ══════════════════════════════════════════════════════════════════
   CONNECT FOUR BOARD — FIXED
   ══════════════════════════════════════════════════════════════════ */

.cf-board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 7 / 6;
  background: #2a4a7f;
  border-radius: var(--radius-lg);
  padding: 12px;
  position: relative;
  box-shadow: inset 0 4px 20px rgba(0,0,0,0.4);
  overflow: hidden;
  box-sizing: border-box;
}

/* ── Individual Cell ────────────────────────────────────────────── */
.cf-cell {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 50%;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  position: relative;
  transition: background var(--transition-fast), transform var(--transition-spring);
  border: 2px solid rgba(255, 255, 255, 0.08);
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}

/* ── Column hover effect ────────────────────────────────────────── */
.cf-column {
  display: contents;
}

.cf-column .cf-cell:not(.cf-cell--red):not(.cf-cell--yellow):hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.02);
}

/* ── Disc styles ────────────────────────────────────────────────── */
.cf-cell--red {
  background: radial-gradient(circle at 35% 35%, #ff6b6b, #cc0000);
  cursor: default;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: inset -3px -3px 8px rgba(0,0,0,0.4),
              inset 3px 3px 8px rgba(255,255,255,0.2);
}

.cf-cell--yellow {
  background: radial-gradient(circle at 35% 35%, #ffe066, #e6b800);
  cursor: default;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: inset -3px -3px 8px rgba(0,0,0,0.4),
              inset 3px 3px 8px rgba(255,255,255,0.2);
}

/* ── Drop animation ──────────────────────────────────────────────── */
.cf-cell--red,
.cf-cell--yellow {
  animation: discDrop 0.25s var(--ease-spring) both;
}

@keyframes discDrop {
  0% {
    transform: scale(0.3) translateY(-40px);
    opacity: 0;
  }
  60% {
    transform: scale(1.15) translateY(2px);
    opacity: 1;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* ── Win highlight ────────────────────────────────────────────────── */
.cf-cell--win {
  animation: winPulse 0.6s ease-in-out infinite alternate;
}

.cf-cell--win.cf-cell--red {
  box-shadow: 0 0 24px rgba(255, 0, 0, 0.6), 
              inset -3px -3px 8px rgba(0,0,0,0.4),
              inset 3px 3px 8px rgba(255,255,255,0.2);
}

.cf-cell--win.cf-cell--yellow {
  box-shadow: 0 0 24px rgba(255, 215, 0, 0.6),
              inset -3px -3px 8px rgba(0,0,0,0.4),
              inset 3px 3px 8px rgba(255,255,255,0.2);
}

@keyframes winPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.08); }
}

/* ── Column header (column click area) ──────────────────────────── */
.cf-column-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  user-select: none;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  background: transparent;
  border: none;
  font-family: inherit;
  min-width: 0;
  box-sizing: border-box;
}

.cf-column-header:hover {
  background: rgba(255, 255, 255, 0.06);
}

.cf-column-header:focus-visible {
  outline: 2px solid var(--accent-purple);
  outline-offset: 2px;
}

.cf-column-header .cf-drop-arrow {
  opacity: 0.4;
  transition: opacity var(--transition-fast), transform var(--transition-spring);
}

.cf-column-header:hover .cf-drop-arrow {
  opacity: 0.8;
  transform: translateY(2px);
}

.cf-column-header .cf-col-label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  opacity: 0.3;
  margin-left: 4px;
}

/* ── Board disabled (game over) ─────────────────────────────────── */
.cf-board.game-over .cf-cell:not(.cf-cell--win) {
  opacity: 0.5;
}

.cf-board.draw .cf-cell {
  opacity: 0.6;
}

.cf-board.game-over .cf-column-header,
.cf-board.draw .cf-column-header {
  cursor: default;
  opacity: 0.4;
  pointer-events: none;
}

/* ── Thinking indicator ──────────────────────────────────────────── */
.cf-thinking {
  display: none;
  align-items: center;
  gap: 4px;
  height: 20px;
  margin-top: 0.5rem;
}

.cf-thinking.is-visible {
  display: flex;
}

.thinking-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-purple);
  animation: thinkBounce 1.1s ease-in-out infinite;
}

.thinking-dot:nth-child(2) { animation-delay: 0.18s; }
.thinking-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes thinkBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%            { transform: scale(1.1); opacity: 1;   }
}

/* ── Game Status Message ─────────────────────────────────────────── */
.game-status {
  font-family: var(--font-display);
  font-size: clamp(var(--fs-base), 2vw, var(--fs-lg));
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
  text-align: center;
  min-height: 1.8em;
  letter-spacing: var(--ls-snug);
  transition: color var(--transition-base);
}

.game-status.status--win  { color: var(--accent-green); }
.game-status.status--lose { color: var(--accent-red);   }
.game-status.status--draw { color: var(--accent-amber);  }

/* ── Score bump animation ───────────────────────────────────────── */
.score-bump {
  animation: scoreBump 0.35s var(--ease-spring) both;
}

@keyframes scoreBump {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.45); color: var(--accent-green); }
  100% { transform: scale(1); }
}

/* ── Responsive Adjustments ─────────────────────────────────────── */
@media (max-width: 768px) {
  .cf-board {
    max-width: 420px;
    padding: 8px;
    gap: 4px;
  }
}

@media (max-width: 480px) {
  .cf-board {
    max-width: 320px;
    padding: 6px;
    gap: 3px;
    border-radius: var(--radius-md);
  }
  
  .cf-column-header {
    padding: 2px 0;
    font-size: var(--fs-xs);
  }
  
  .cf-column-header .cf-col-label {
    display: none;
  }
}

@media (max-width: 360px) {
  .cf-board {
    max-width: 280px;
    padding: 4px;
    gap: 2px;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   CONNECT FOUR GAME OVER MODAL
   ═══════════════════════════════════════════════════════════════════ */

.cf-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: modalFadeIn 0.4s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cf-modal-content {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--border-accent);
  animation: modalPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPopIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.cf-modal-icon {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
  display: block;
}

.cf-modal-content h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.cf-modal-content p {
  font-size: var(--fs-base);
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.cf-modal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.cf-modal-stat {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.5rem;
}

.cf-modal-stat-label {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
  font-weight: var(--fw-medium);
}

.cf-modal-stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  line-height: 1.2;
}

.cf-modal-content .control-btn {
  padding: 0.75rem 2.5rem;
  font-size: var(--fs-base);
  background: var(--gradient-brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: transform var(--transition-spring), box-shadow var(--transition-base);
  box-shadow: 0 4px 18px rgba(124, 109, 250, 0.3);
}

.cf-modal-content .control-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(124, 109, 250, 0.4);
}

/* Modal responsiveness */
@media (max-width: 480px) {
  .cf-modal-content {
    padding: 1.5rem 1rem;
  }

  .cf-modal-content h2 {
    font-size: 1.4rem;
  }

  .cf-modal-icon {
    font-size: 2.5rem;
  }

  .cf-modal-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.3rem;
  }

  .cf-modal-stat {
    padding: 0.5rem 0.3rem;
  }

  .cf-modal-stat-value {
    font-size: var(--fs-lg);
  }

  .cf-modal-content .control-btn {
    padding: 0.6rem 1.5rem;
    font-size: var(--fs-sm);
  }
}

/* ═══════════════════════════════════════════════════════════════════
   UNIVERSAL CONTROLS FIX — All Games
   Keeps game title and controls on one row on all screen sizes
   ═══════════════════════════════════════════════════════════════════ */

/* ── Game Controls Container ────────────────────────────────────── */
.game-controls {
  display: flex;
  align-items: center;
  flex-wrap: nowrap !important;
  gap: var(--space-2);
  width: 100%;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  min-height: 44px;
}

.game-controls-title {
  font-family: var(--font-display);
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  flex: 0 0 auto;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-controls-title span {
  margin-right: 2px;
}

/* ── Right side controls wrapper ────────────────────────────────── */
.game-controls-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
}

/* ── Controls inside the right wrapper ──────────────────────────── */
.game-controls-right .difficulty-select,
.game-controls-right select {
  flex: 0 1 auto;
  min-width: 60px;
  max-width: 120px;
  padding: var(--space-1) var(--space-6) var(--space-1) var(--space-2);
  font-size: var(--fs-xs);
  height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239898b8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 26px;
}

.game-controls-right .difficulty-select:hover,
.game-controls-right select:hover {
  border-color: var(--border-strong);
}

.game-controls-right .difficulty-select:focus,
.game-controls-right select:focus {
  outline: 2px solid var(--accent-purple);
  outline-offset: 1px;
}

.game-controls-right .control-btn {
  flex: 0 0 auto;
  padding: var(--space-1) var(--space-3);
  font-size: var(--fs-xs);
  min-height: 32px;
  min-width: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
}

.game-controls-right .control-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.game-controls-right .control-btn.control-btn--primary {
  background: var(--accent-purple-dim);
  color: var(--accent-purple);
  border-color: var(--border-accent);
}

.game-controls-right .control-btn.control-btn--primary:hover {
  background: var(--accent-purple);
  color: #fff;
}

.game-controls-right .control-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.game-controls-right .btn-text {
  display: inline;
  white-space: nowrap;
}

/* ── Game Stats Row ──────────────────────────────────────────────── */
.game-stats-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  width: 100%;
  flex-wrap: wrap;
}

/* ── Mobile Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .game-controls {
    gap: var(--space-1);
    padding-bottom: var(--space-2);
    min-height: 40px;
  }

  .game-controls-title {
    font-size: var(--fs-sm);
    max-width: 45%;
  }

  .game-controls-right {
    gap: var(--space-1);
  }

  .game-controls-right .difficulty-select,
  .game-controls-right select {
    min-width: 50px;
    max-width: 80px;
    font-size: 0.65rem;
    height: 28px;
    padding: 0 var(--space-4) 0 var(--space-1);
    padding-right: 20px;
    background-size: 8px 5px;
    background-position: right 5px center;
  }

  .game-controls-right .control-btn {
    padding: var(--space-1) var(--space-2);
    font-size: 0.65rem;
    min-height: 28px;
    min-width: 28px;
  }

  .game-controls-right .control-btn svg {
    width: 12px;
    height: 12px;
  }

  .game-controls-right .btn-text {
    display: none;
  }

  .game-controls-right .control-btn.control-btn--primary .btn-text {
    display: inline;
    font-size: 0.65rem;
  }

  .game-stats-row {
    gap: var(--space-4);
  }

  .game-stat-item .game-stat-value {
    font-size: var(--fs-lg);
  }
}

@media (max-width: 400px) {
  .game-controls-title {
    font-size: 0.7rem;
    max-width: 35%;
  }

  .game-controls-right .difficulty-select,
  .game-controls-right select {
    min-width: 40px;
    max-width: 60px;
    font-size: 0.55rem;
    height: 24px;
    padding: 0 var(--space-3) 0 var(--space-1);
    padding-right: 16px;
    background-size: 6px 4px;
    background-position: right 4px center;
  }

  .game-controls-right .control-btn {
    padding: var(--space-1);
    min-height: 24px;
    min-width: 24px;
    font-size: 0.55rem;
  }

  .game-controls-right .control-btn svg {
    width: 10px;
    height: 10px;
  }

  .game-controls-right .control-btn.control-btn--primary .btn-text {
    display: none !important;
  }

  .game-stats-row {
    gap: var(--space-3);
  }

  .game-stat-item .game-stat-value {
    font-size: var(--fs-base);
  }

  .game-stat-item .game-stat-label {
    font-size: 0.6rem;
  }
}

@media (max-width: 340px) {
  .game-controls-title {
    font-size: 0.6rem;
    max-width: 30%;
  }

  .game-controls-right .difficulty-select,
  .game-controls-right select {
    min-width: 35px;
    max-width: 50px;
    font-size: 0.5rem;
    height: 22px;
    padding: 0 var(--space-2) 0 var(--space-1);
    padding-right: 14px;
  }

  .game-controls-right .control-btn {
    min-height: 22px;
    min-width: 22px;
  }

  .game-controls-right .control-btn svg {
    width: 8px;
    height: 8px;
  }
}