/* Connect Four - Modern Stylesheet */

:root {
  --bg-primary: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-hover: #273549;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;

  --board-blue: #2563eb;
  --board-shadow: #1d4ed8;
  --slot-bg: #070a13;

  --player-red: #ef4444;
  --player-red-shadow: #b91c1c;
  --player-yellow: #facc15;
  --player-yellow-shadow: #ca8a04;

  --radius: 12px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.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;
}

.hidden {
  display: none !important;
}

/* Header */
.site-header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.15s ease;
  min-height: 44px;
  padding: 0.25rem 0.5rem;
}

.back-link:hover, .back-link:focus-visible {
  color: var(--player-yellow);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.game-icon {
  font-size: 1.5rem;
}

.brand-title {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text-main);
}

.icon-button {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 1.25rem;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.icon-button:hover, .icon-button:focus-visible {
  background: var(--border);
  border-color: var(--player-yellow);
  outline: 2px solid var(--player-yellow);
  outline-offset: 2px;
}

/* Main Container */
.game-container {
  flex: 1;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-header-text {
  text-align: center;
  margin-bottom: 1rem;
}

.game-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.game-subtitle {
  color: var(--text-muted);
  font-size: 0.925rem;
  max-width: 560px;
  margin: 0 auto;
}

/* Settings Bar */
.game-settings-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.mode-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  min-height: 40px;
  transition: all 0.15s ease;
}

.mode-btn.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.diff-select {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  min-height: 40px;
}

/* Match HUD */
.match-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 500px;
  margin-bottom: 1rem;
  gap: 0.5rem;
}

.score-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.disc-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
}

.disc-dot.red {
  background-color: var(--player-red);
  box-shadow: inset 0 -2px 0 var(--player-red-shadow);
}

.disc-dot.yellow {
  background-color: var(--player-yellow);
  box-shadow: inset 0 -2px 0 var(--player-yellow-shadow);
}

.turn-status-badge {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border);
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Connect Four Cabinet */
.connect-cabinet {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 480px;
  user-select: none;
}

/* Drop Column Indicators */
.col-selectors {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  width: 100%;
  padding: 0 10px;
  margin-bottom: 6px;
}

.col-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  color: var(--player-yellow);
  font-size: 1.25rem;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  cursor: pointer;
}

.col-trigger.hovered {
  opacity: 1;
  transform: translateY(2px);
}

/* Board Frame */
.board-frame {
  background-color: var(--board-blue);
  border: 4px solid var(--board-shadow);
  border-radius: 16px;
  padding: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 3px 0 rgba(255, 255, 255, 0.2);
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 8px;
  width: 100%;
  aspect-ratio: 7 / 6;
}

/* Individual Slot & Dropping Disc */
.slot {
  background-color: var(--slot-bg);
  border-radius: 50%;
  aspect-ratio: 1 / 1;
  box-shadow: inset 0 4px 6px rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.slot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  transition: background-color 0.15s ease;
}

.slot.red::after {
  background-color: var(--player-red);
  box-shadow: inset 0 -4px 0 var(--player-red-shadow), inset 0 2px 0 rgba(255, 255, 255, 0.3);
  animation: drop-disc 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.slot.yellow::after {
  background-color: var(--player-yellow);
  box-shadow: inset 0 -4px 0 var(--player-yellow-shadow), inset 0 2px 0 rgba(255, 255, 255, 0.3);
  animation: drop-disc 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes drop-disc {
  from { transform: translateY(-300%); }
  to { transform: translateY(0); }
}

.slot.win-pulse::after {
  animation: pulse-win 0.6s infinite alternate;
}

@keyframes pulse-win {
  from { transform: scale(0.92); filter: brightness(1); }
  to { transform: scale(1.08); filter: brightness(1.3); }
}

/* Action Controls */
.action-bar {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.action-btn {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.action-btn:hover {
  background-color: var(--border);
}

.action-btn.secondary {
  color: var(--text-muted);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  animation: modal-enter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-enter {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-badge {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.35rem;
}

.modal-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.btn-primary {
  width: 100%;
  background: #3b82f6;
  color: #ffffff;
  border: none;
  font-weight: 700;
  font-size: 0.95rem;
  min-height: 46px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: #2563eb;
}

/* SEO Content */
.content-block {
  max-width: 680px;
  width: 100%;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.article-header {
  margin-bottom: 1.5rem;
}

.article-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.35rem;
}

.freshness-tag {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.article-section {
  margin-bottom: 2rem;
}

.article-section h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.85rem;
}

.article-section h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: #e2e8f0;
  margin: 1.25rem 0 0.6rem;
}

.article-section p {
  color: #cbd5e1;
  margin-bottom: 1rem;
  line-height: 1.7;
}

.rules-list {
  padding-left: 1.25rem;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.rules-list strong {
  color: #ffffff;
}

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.strategy-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.strategy-card h4 {
  color: #38bdf8;
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.strategy-card p {
  color: #94a3b8;
  font-size: 0.9rem;
  margin-bottom: 0;
  line-height: 1.6;
}

.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.faq-item[open] {
  border-color: #3b82f6;
}

.faq-question {
  padding: 1rem 1.25rem;
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question::after {
  content: "+";
  font-size: 1.25rem;
  color: #3b82f6;
}

.faq-item[open] .faq-question::after {
  content: "−";
}

.faq-answer {
  padding: 0 1.25rem 1.25rem;
  color: #cbd5e1;
  font-size: 0.925rem;
  line-height: 1.6;
}

.cross-links {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.related-games-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.related-games-list li a {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 500;
}

.related-games-list li a:hover {
  text-decoration: underline;
}

/* Footer */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

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