/* ===== CSS Variables ===== */
:root {
  --primary: #d97706;
  --primary-light: #f59e0b;
  --primary-dark: #b45309;
  --accent: #dc2626;
  --bg: #fffbeb;
  --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: 'Exo 2', sans-serif;
  --border-light: rgba(0,0,0,0.06);
  --border-input: rgba(0,0,0,0.1);
  --cell-size: 36px;
}

/* Dark Theme */
[data-theme="dark"] {
  --bg: #0f172a;
  --bg-dark: #020617;
  --text: #e2e8f0;
  --text-light: #94a3b8;
  --white: #1e293b;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
  --border-light: rgba(255,255,255,0.08);
  --border-input: rgba(255,255,255,0.15);
}

[data-theme="dark"] .site-header {
  background: rgba(15,23,42,0.92);
  border-bottom-color: var(--border-light);
}

[data-theme="dark"] .mode-btn { border-color: rgba(217,119,6,0.3); }
[data-theme="dark"] .lang-btn { border-color: var(--border-input); }
[data-theme="dark"] .faq-item { box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
[data-theme="dark"] .info-box { box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
[data-theme="dark"] #cookie-banner { background: #020617; }

[data-theme="dark"] .ms-cell:not(.revealed) {
  background: #334155;
  border-color: #475569 #1e293b #1e293b #475569;
}
[data-theme="dark"] .ms-cell:not(.revealed):hover { background: #3b4f6b; }
[data-theme="dark"] .ms-cell.revealed { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .ms-cell.revealed .num { filter: brightness(1.3); }

/* Theme Toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  transition: all 0.2s;
  color: var(--text);
}
.theme-toggle:hover { border-color: var(--primary); }

/* ===== 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); }

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,251,235,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
}

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

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

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

nav ul { list-style: none; display: flex; align-items: center; gap: 6px; }
nav a {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-light);
  border-radius: 8px;
  transition: all 0.2s;
}
nav a:hover { color: var(--text); background: rgba(0,0,0,0.04); }
nav a.active { color: var(--primary); font-weight: 600; }

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

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 56px 24px 36px;
  max-width: 700px;
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.15;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 18px;
  color: var(--text-light);
  max-width: 520px;
  margin: 0 auto 20px;
}

.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  background: var(--white);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.badge .icon { width: 16px; height: 16px; stroke: var(--primary); }

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

.game-container {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Mode Selector */
.mode-selector {
  position: relative;
  margin-bottom: 16px;
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--white);
  border: 2px solid rgba(217,119,6,0.2);
  border-radius: 12px;
  padding: 8px 20px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}
.mode-btn:hover { border-color: var(--primary); }

.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: 260px;
  z-index: 60;
  animation: slideDownCenter 0.2s ease;
  overflow: hidden;
}

.mode-dropdown button {
  display: block;
  width: 100%;
  padding: 12px 18px;
  text-align: left;
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
.mode-dropdown button:hover { background: rgba(217,119,6,0.08); }
.mode-dropdown button.active { color: var(--primary); font-weight: 600; }
.diff-info { font-size: 12px; color: var(--text-light); margin-left: 6px; }

/* ===== Game Panel ===== */
.game-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  width: 100%;
  max-width: 340px;
}

.counter-box {
  background: #1a1a2e;
  color: #ff3333;
  font-family: 'Courier New', monospace;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 3px;
  padding: 6px 12px;
  border-radius: 6px;
  min-width: 72px;
  text-align: center;
  border: 2px inset #333;
  line-height: 1.2;
}

.face-btn {
  font-size: 28px;
  background: var(--white);
  border: 2px outset #ccc;
  border-radius: 8px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s;
  line-height: 1;
}
.face-btn:active { transform: scale(0.92); border-style: inset; }

.flag-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--white);
  border: 2px solid var(--border-input);
  border-radius: 8px;
  padding: 6px 14px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.flag-toggle:hover { border-color: var(--accent); }
.flag-toggle.active { background: #fef2f2; border-color: var(--accent); color: var(--accent); }

/* ===== Game Status ===== */
.game-status {
  text-align: center;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.result-text {
  font-size: 20px;
  font-weight: 700;
  animation: fadeIn 0.3s ease;
}
.result-text.win { color: #16a34a; }
.result-text.lose { color: #dc2626; }

/* ===== Minesweeper Board ===== */
.board-wrapper {
  background: #c0c0c0;
  border-radius: 4px;
  padding: 4px;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.2);
  margin: 0 auto;
  overflow: hidden;
  max-width: fit-content;
}

[data-theme="dark"] .board-wrapper {
  background: #1e293b;
}

.board {
  display: grid;
  gap: 1px;
  background: #999;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overflow: hidden;
}

[data-theme="dark"] .board { background: #475569; }

.ms-cell {
  width: var(--cell-size);
  height: var(--cell-size);
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #d4d4d4;
  border: 2px outset #eee;
  padding: 0;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.08s;
  font-size: calc(var(--cell-size) * 0.5);
  font-weight: 700;
  position: relative;
  color: #333;
  box-sizing: border-box;
}

.ms-cell:hover:not(.revealed) { background: #e0e0e0; }
.ms-cell:active:not(.revealed) { border-style: inset; background: #ccc; }

.ms-cell.revealed {
  background: #e8e8e8;
  border: 1px solid #bbb;
  cursor: default;
}

.ms-cell.revealed .num {
  font-family: var(--font);
  font-weight: 800;
  font-size: calc(var(--cell-size) * 0.5);
  line-height: 1;
}

.ms-cell.mine { color: #333; }
.ms-cell .cell-icon {
  width: calc(var(--cell-size) * 0.55);
  height: calc(var(--cell-size) * 0.55);
}
.ms-cell.exploded { background: #ff4444 !important; color: #fff; }
.ms-cell.flagged { cursor: pointer; }
.ms-cell.wrong-flag {
  background: #ffcccc;
  text-decoration: line-through;
  color: #dc2626;
}

/* Reset Button */
.reset-btn {
  display: block;
  margin: 16px 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(217,119,6,0.3);
  text-underline-offset: 4px;
  transition: all 0.2s;
}
.reset-btn:hover { text-decoration-color: var(--primary); }

/* ===== How to Play Section ===== */
.howtoplay-section { text-align: center; }

.howtoplay-steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  margin-top: 32px;
}

.howtoplay-step {
  flex: 1;
  max-width: 220px;
  text-align: center;
}

.step-num {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  margin: 0 auto 14px;
  box-shadow: 0 4px 16px rgba(217,119,6,0.3);
}

.howtoplay-step h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.howtoplay-step p { font-size: 13px; color: var(--text-light); line-height: 1.55; }

.step-connector {
  display: flex;
  align-items: center;
  padding-top: 10px;
  opacity: 0.35;
  flex-shrink: 0;
}

/* ===== 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(217,119,6,0.1), rgba(245,158,11,0.15));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
  color: var(--primary);
}
.feature-icon svg { stroke: var(--primary); }

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

/* SEO Blocks Grid */
.seo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 24px; }

.seo-block {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border-left: 3px solid var(--primary);
}
.seo-block h3 { font-size: 16px; font-weight: 700; margin: 0 0 8px; color: var(--text); }
.seo-block p { font-size: 14px; margin: 0; line-height: 1.65; }

/* 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 { text-align: center; margin: 24px auto; max-width: var(--max-width); }
.ad-slot:empty { display: none; }

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

.lang-btn {
  background: none;
  border: 1px solid var(--border-input);
  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 pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.02); } }

/* ===== 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 var(--border-light);
  }
  .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; }
  .howtoplay-steps { flex-wrap: wrap; gap: 24px; }
  .howtoplay-step { flex: 0 0 calc(50% - 12px); max-width: none; }
  .step-connector { display: none; }
  .seo-grid { grid-template-columns: 1fr; }

  .board-wrapper { max-width: 100% !important; overflow: hidden; }
  .game-panel { max-width: 100%; }
}

@media (max-width: 480px) {
  .counter-box { font-size: 22px; min-width: 62px; padding: 5px 8px; }
  .face-btn { width: 38px; height: 38px; font-size: 24px; }
}