/* ===== CSS Variables ===== */
:root {
  --primary: #0d9488;
  --primary-light: #14b8a6;
  --primary-dark: #0f766e;
  --accent: #f59e0b;
  --bg: #f0fdfa;
  --bg-dark: #0c0c0c;
  --text: #1e293b;
  --text-light: #64748b;
  --white: #ffffff;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --max-width: 1100px;
  --font: 'Outfit', sans-serif;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

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

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; display: block; }

/* ===== Header ===== */
.site-header {
  background: var(--white);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.92);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  font-weight: 800;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 8px;
  align-items: center;
}

.nav-links a {
  color: var(--text-light);
  font-weight: 500;
  font-size: 15px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
  background: rgba(13, 148, 136, 0.08);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  color: var(--text);
}

/* ===== Hero Section ===== */
.hero {
  background: linear-gradient(145deg, var(--primary) 0%, var(--primary-light) 40%, var(--primary-dark) 100%);
  color: white;
  padding: 60px 24px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 70%, rgba(255,255,255,0.08) 0%, transparent 50%);
  pointer-events: none;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -1px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.1);
  position: relative;
}

.hero p {
  font-size: 18px;
  opacity: 0.9;
  max-width: 560px;
  margin: 0 auto 24px;
  position: relative;
}

.hero-badges {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  position: relative;
}

.badge {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 500;
  backdrop-filter: blur(4px);
}

/* ===== Game Section ===== */
.game-section {
  padding: 48px 24px;
  display: flex;
  justify-content: center;
}

.game-container {
  width: 100%;
  max-width: 420px;
}

/* Mode Selector */
.mode-selector {
  position: relative;
  text-align: center;
  margin-bottom: 20px;
}

.mode-btn {
  background: var(--white);
  border: 2px solid rgba(13,148,136,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 24px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mode-btn:hover { border-color: var(--primary); box-shadow: var(--shadow); }

.mode-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  z-index: 200;
  overflow: hidden;
  animation: slideDownCenter 0.2s ease;
}

.mode-dropdown button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.mode-dropdown button:hover { background: var(--bg); }
.mode-dropdown button.active { background: var(--bg); color: var(--primary); font-weight: 600; }

/* Scoreboard */
.scoreboard {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.score-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  border: 2px solid transparent;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  min-width: 135px;
  transition: all 0.3s;
}

.score-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.12);
}

.score-card .label { color: var(--text-light); font-size: 13px; font-weight: 500; }
.score-card .num { color: var(--text); font-size: 22px; font-weight: 700; margin-left: auto; }
.vs-text { color: var(--text-light); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }

/* Turn Indicator */
.turn-area {
  text-align: center;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--text-light);
  font-size: 15px;
  font-weight: 500;
}

.result-text {
  color: var(--primary);
  font-size: 20px;
  font-weight: 700;
  animation: fadeIn 0.3s ease;
}

/* Board */
.board-wrapper {
  background: linear-gradient(145deg, var(--primary) 0%, var(--primary-light) 40%, var(--primary-dark) 100%);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  aspect-ratio: 1;
  gap: 0;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
  position: relative;
}

.cell:hover:not(.filled) { background: rgba(255,255,255,0.08); }
.cell.win { animation: winPulse 1s ease infinite; background: rgba(255,255,255,0.12); }

.cell-border-right { border-right: 3px solid rgba(255,255,255,0.25); }
.cell-border-bottom { border-bottom: 3px solid rgba(255,255,255,0.25); }

.cell svg { width: 56px; height: 56px; }

/* Reset Button */
.reset-btn {
  display: block;
  margin: 20px auto 0;
  background: transparent;
  border: none;
  color: var(--primary);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  padding: 12px 24px;
  text-decoration: underline;
  text-decoration-color: rgba(13,148,136,0.3);
  text-underline-offset: 4px;
  transition: all 0.2s;
}

.reset-btn:hover { text-decoration-color: var(--primary); }

/* ===== Features Section ===== */
.features {
  padding: 64px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.features h2 {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 40px;
  color: var(--text);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.feature-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.feature-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, rgba(13,148,136,0.1), rgba(20,184,166,0.15));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
}

.feature-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature-card p {
  color: var(--text-light);
  font-size: 14px;
  line-height: 1.6;
}

/* ===== Content Sections ===== */
.content-section {
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 24px;
}

.content-section h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.content-section .subtitle {
  color: var(--text-light);
  font-size: 18px;
  margin-bottom: 32px;
}

.content-section h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 36px 0 12px;
  color: var(--text);
}

.content-section h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 24px 0 8px;
}

.content-section p {
  color: var(--text-light);
  margin-bottom: 16px;
  line-height: 1.7;
}

.content-section ol,
.content-section ul {
  color: var(--text-light);
  margin-bottom: 16px;
  padding-left: 24px;
  line-height: 1.8;
}

.content-section li { margin-bottom: 4px; }

.info-box {
  background: var(--white);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 20px 24px;
  margin: 24px 0;
  box-shadow: var(--shadow);
}

.info-box p { margin-bottom: 0; }

/* FAQ */
.faq-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.faq-item h3 {
  color: var(--text);
  margin: 0 0 8px;
  font-size: 16px;
}

.faq-item p {
  margin: 0;
  font-size: 14px;
}

/* ===== Breadcrumbs ===== */
.breadcrumbs {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 24px 0;
  font-size: 13px;
  color: var(--text-light);
}

.breadcrumbs a { color: var(--text-light); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs span { margin: 0 6px; opacity: 0.4; }

/* ===== Footer ===== */
.site-footer {
  margin-top: auto;
  background: var(--bg-dark);
  color: rgba(255,255,255,0.6);
  padding: 48px 24px 32px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
}

.footer-brand .logo { color: white; margin-bottom: 12px; }
.footer-brand p { font-size: 14px; line-height: 1.6; max-width: 320px; }

.footer-col h4 {
  color: white;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 10px; }
.footer-col a { color: rgba(255,255,255,0.5); font-size: 14px; transition: color 0.2s; }
.footer-col a:hover { color: white; }

.footer-bottom {
  max-width: var(--max-width);
  margin: 32px auto 0;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.footer-bottom a { color: rgba(255,255,255,0.4); margin-left: 16px; }
.footer-bottom a:hover { color: white; }

/* ===== Ad Placeholder ===== */
.ad-slot {
  background: rgba(0,0,0,0.03);
  border: 1px dashed rgba(0,0,0,0.1);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  color: var(--text-light);
  font-size: 12px;
  margin: 24px auto;
  max-width: var(--max-width);
}

/* ===== Language Switcher ===== */
.lang-switcher { position: relative; }

.lang-btn {
  background: none;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.lang-btn:hover { border-color: var(--primary); color: var(--primary); }
.lang-arrow { font-size: 10px; opacity: 0.5; }

.lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 300;
  animation: slideDown 0.2s ease;
}

.lang-dropdown.open { display: block; }

.lang-dropdown a {
  display: block;
  padding: 10px 18px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
  white-space: nowrap;
}

.lang-dropdown a:hover { background: var(--bg); }
.lang-dropdown a.active { background: var(--bg); color: var(--primary); font-weight: 600; }

/* ===== CTA Button ===== */
.cta-btn {
  display: inline-block;
  background: var(--primary);
  color: #fff !important;
  padding: 14px 32px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  transition: all 0.2s;
}
.cta-btn:hover { background: var(--primary-dark); transform: translateY(-2px); }

/* ===== Animations ===== */
@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDownCenter { from { opacity: 0; transform: translateX(-50%) translateY(-8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes winPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.02); } }
@keyframes drawX1 { to { stroke-dashoffset: 0; } }
@keyframes drawX2 { to { stroke-dashoffset: 0; } }
@keyframes drawO { to { stroke-dashoffset: 0; } }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .footer-inner { grid-template-columns: 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
  .footer-bottom a { margin-left: 0; margin-right: 16px; }
  
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--white);
    padding: 16px;
    box-shadow: var(--shadow-lg);
    border-bottom: 1px solid rgba(0,0,0,0.06);
  }
  .mobile-menu-btn { display: block; }
  
  .lang-switcher { width: 100%; }
  .lang-btn { width: 100%; justify-content: center; }
  .lang-dropdown {
    position: static;
    box-shadow: none;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-top: 6px;
    animation: none;
  }
  
  .hero { padding: 40px 20px 30px; }
  .features { padding: 40px 16px; }
  .cell svg { width: 40px; height: 40px; }
}

@media (max-width: 480px) {
  .scoreboard { gap: 8px; }
  .score-card { padding: 8px 12px; min-width: 115px; }
  .board-wrapper { padding: 14px; }
}