/* ===== CSS Custom Properties ===== */
:root {
  --primary: #6b46e0;
  --primary-dark: #5233b8;
  --secondary: #2eb8a3;
  --secondary-dark: #229688;
  --accent: #f59e0b;
  --bg: #f8f8fc;
  --surface: #ffffff;
  --border: #e5e4f0;
  --text: #1a1828;
  --text-muted: #6b6880;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(107, 70, 224, 0.09);
  --shadow-lg: 0 8px 32px rgba(107, 70, 224, 0.14);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

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

html { scroll-behavior: smooth; }

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

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

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Navigation ===== */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(107,70,224,0.06);
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
}

.nav-logo {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.nav-logo span { font-size: 1.4rem; }

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

.nav-links li a {
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-links li a:hover,
.nav-links li a.active {
  background: var(--primary);
  color: #fff;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
  padding: 0.4rem;
}

/* ===== Main & Footer ===== */
main { flex: 1; }

footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

footer a { color: var(--primary); }
footer .footer-links { display: flex; justify-content: center; gap: 1.5rem; margin-top: 0.5rem; flex-wrap: wrap; }

/* ===== Utility ===== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.container-narrow {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ===== Hero ===== */
.hero {
  padding: 4rem 1.25rem 3.5rem;
  text-align: center;
  max-width: 1100px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.85rem;
  border-radius: 50px;
  margin-bottom: 1.2rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

/* ===== Section ===== */
.section { padding: 3rem 1.25rem; }
.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.4rem;
}

/* ===== Cards ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: var(--shadow);
  transition: transform 0.18s, box-shadow 0.18s;
}

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

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
}

.card-icon.purple { background: rgba(107,70,224,0.10); }
.card-icon.teal   { background: rgba(46,184,163,0.12); }
.card-icon.amber  { background: rgba(245,158,11,0.12); }

.card h3 { font-size: 1.05rem; font-weight: 700; }
.card p  { font-size: 0.9rem; color: var(--text-muted); flex: 1; }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 50px;
  margin-bottom: 0.25rem;
  align-self: flex-start;
}
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-gray   { background: #f3f4f6; color: #4b5563; }
.badge-purple { background: rgba(107,70,224,0.1); color: var(--primary); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.4rem;
  min-height: 44px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
  text-decoration: none;
  touch-action: manipulation;
}
.btn:hover { opacity: 0.88; transform: translateY(-1px); text-decoration: none; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-sm { padding: 0.45rem 1rem; font-size: 0.82rem; }

/* ===== Page Header ===== */
.page-header {
  padding: 3rem 1.25rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.page-header .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.8rem;
  text-decoration: none;
}
.page-header .back-link:hover { color: var(--text); text-decoration: none; }

.page-header h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 900; letter-spacing: -0.02em; }
.page-header p  { color: var(--text-muted); font-size: 1rem; max-width: 560px; margin-top: 0.6rem; line-height: 1.7; }

/* ===== Game Container ===== */
.game-container {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

.game-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}

.game-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 1.2rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ===== Chess ===== */
#chess-board-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

#chess-board {
  border-collapse: collapse;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  user-select: none;
}

#chess-board td {
  width: 58px;
  height: 58px;
  text-align: center;
  vertical-align: middle;
  font-size: 2rem;
  cursor: pointer;
  position: relative;
  transition: background 0.12s;
}

.sq-light { background: #f0d9b5; }
.sq-dark  { background: #b58863; }
.sq-selected { background: #f6f669 !important; outline: 3px solid #f0c000; outline-offset: -3px; }
.sq-valid   { background: rgba(0, 200, 80, 0.45) !important; }
.sq-valid::after {
  content: '';
  position: absolute;
  inset: 50% 0 0 50%;
  transform: translate(-50%, -50%);
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(0, 200, 80, 0.55);
}
.sq-check { background: rgba(255,0,0,0.4) !important; }

#chess-labels-top, #chess-labels-bottom {
  display: flex;
  padding-left: 22px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
}
#chess-labels-top span, #chess-labels-bottom span { width: 58px; text-align: center; }

#chess-labels-side {
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 4px;
}
#chess-labels-side span { height: 58px; display: flex; align-items: center; }

.chess-with-labels { display: flex; align-items: flex-start; gap: 0; }

#chess-promo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
#chess-promo-box {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
}
#chess-promo-box h3 { margin-bottom: 1rem; font-size: 1rem; }
#chess-promo-box .promo-choices { display: flex; gap: 1rem; justify-content: center; }
#chess-promo-box .promo-piece {
  font-size: 3rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: background 0.15s;
}
#chess-promo-box .promo-piece:hover { background: #f3f0ff; }

/* ===== Minesweeper ===== */
#ms-board {
  display: inline-grid;
  gap: 3px;
  padding: 1rem;
  background: #ddd;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.ms-cell {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 800;
  transition: transform 0.1s;
  user-select: none;
}

.ms-cell-hidden { background: #bbb; box-shadow: inset 0 2px 0 rgba(255,255,255,0.4), inset 0 -2px 0 rgba(0,0,0,0.2); }
.ms-cell-hidden:hover { background: #c8c8c8; transform: scale(1.04); }
.ms-cell-hidden:active { transform: scale(0.96); }
.ms-cell-revealed { background: #e9e9e9; box-shadow: none; cursor: default; }
.ms-cell-mine { background: #fecaca; }
.ms-cell-flag { font-size: 1.1rem; }

.ms-num-1 { color: #1d4ed8; }
.ms-num-2 { color: #15803d; }
.ms-num-3 { color: #b91c1c; }
.ms-num-4 { color: #1e3a8a; }
.ms-num-5 { color: #7c2d12; }
.ms-num-6 { color: #0e7490; }
.ms-num-7 { color: #1f2937; }
.ms-num-8 { color: #4b5563; }

#ms-stats { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; gap: 1rem; }
.ms-stat { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.1rem; }

/* ===== Snake ===== */
#snake-canvas { border-radius: 12px; display: block; max-width: 100%; }

/* ===== Lexikon ===== */
.article {
  max-width: 760px;
  margin: 0 auto;
  padding: 3rem 1.25rem 5rem;
}

.article .breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}
.article .breadcrumb a { color: var(--text-muted); }
.article .breadcrumb a:hover { color: var(--primary); text-decoration: none; }

.article h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 900; letter-spacing: -0.02em; margin-bottom: 0.75rem; }
.article .subtitle { font-size: 1.05rem; color: var(--text-muted); margin-bottom: 2.5rem; line-height: 1.7; }

.article h2 { font-size: 1.2rem; font-weight: 700; margin: 2rem 0 0.75rem; }
.article h3 { font-size: 1rem; font-weight: 700; margin: 1.5rem 0 0.5rem; }
.article p { color: var(--text-muted); margin-bottom: 0.75rem; line-height: 1.75; }
.article ul { color: var(--text-muted); padding-left: 1.4rem; margin-bottom: 1rem; }
.article ul li { margin-bottom: 0.4rem; line-height: 1.65; }
.article strong { color: var(--text); font-weight: 600; }
.article a { color: var(--primary); }
.article a:hover { color: var(--primary-dark, var(--primary)); }

/* ===== FAQ Grid (Lexikon Unterkategorien) ===== */
.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1rem;
  max-width: 900px;
  margin: 2rem auto 0;
  padding: 0 1.25rem;
}
.faq-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.faq-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(107,70,224,0.12);
  transform: translateY(-2px);
  text-decoration: none;
}
.faq-card .faq-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  display: block;
}
.faq-card h3 {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.45rem;
  line-height: 1.4;
}
.faq-card p {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 0.75rem;
}
.faq-card .faq-link {
  font-size: 0.83rem;
  color: var(--primary);
  font-weight: 600;
}

.faq-page-header {
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 0;
}
.faq-page-header .breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.faq-page-header .breadcrumb a { color: var(--text-muted); }
.faq-page-header .breadcrumb a:hover { color: var(--primary); }
.faq-page-header h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 900; letter-spacing: -0.02em; margin-bottom: 0.6rem; }
.faq-page-header .subtitle { font-size: 1.02rem; color: var(--text-muted); line-height: 1.7; max-width: 620px; }

.faq-cta {
  max-width: 900px;
  margin: 2.5rem auto 4rem;
  padding: 0 1.25rem;
}
@media (max-width: 600px) {
  .faq-grid { grid-template-columns: 1fr; }
  .faq-page-header { padding-top: 1.5rem; }
}

/* ===== SEO Content block (for overview pages) ===== */
.seo-content {
  max-width: 860px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2.5rem;
}
.seo-content h2 { font-size: 1.15rem; font-weight: 800; margin: 1.75rem 0 0.6rem; color: var(--text); }
.seo-content h2:first-child { margin-top: 0; }
.seo-content h3 { font-size: 0.97rem; font-weight: 700; margin: 1.25rem 0 0.4rem; color: var(--text); }
.seo-content p { color: var(--text-muted); line-height: 1.8; margin-bottom: 0.75rem; font-size: 0.93rem; }
.seo-content a { color: var(--primary); font-weight: 500; }
.seo-content a:hover { text-decoration: underline; }
@media (max-width: 600px) {
  .seo-content { padding: 1.25rem 1rem; }
}

.info-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 0.85rem;
}
.info-box strong { display: block; margin-bottom: 0.25rem; color: var(--text); }
.info-box span { font-size: 0.9rem; color: var(--text-muted); }

.cta-box {
  margin-top: 2.5rem;
  background: linear-gradient(135deg, rgba(107,70,224,0.06), rgba(46,184,163,0.06));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.cta-box div strong { display: block; font-size: 0.95rem; }
.cta-box div span { font-size: 0.85rem; color: var(--text-muted); }

.lexikon-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.lexikon-index-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: box-shadow 0.15s, transform 0.15s;
  text-decoration: none;
  color: inherit;
}
.lexikon-index-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); text-decoration: none; }
.lexikon-index-card .icon { font-size: 1.6rem; margin-bottom: 0.2rem; }
.lexikon-index-card strong { font-size: 0.95rem; }
.lexikon-index-card span { font-size: 0.82rem; color: var(--text-muted); }

/* ===== Promo Banner ===== */
.promo-banner {
  background: linear-gradient(135deg, var(--primary), #4f33b0);
  color: #fff;
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  margin: 2rem 0;
}
.promo-banner h2 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.promo-banner p { font-size: 0.9rem; opacity: 0.85; margin-bottom: 1.25rem; }

/* ===== Info note ===== */
.coming-soon-card {
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}
.coming-soon-card .icon { font-size: 2.2rem; margin-bottom: 0.5rem; }
.coming-soon-card strong { display: block; font-size: 0.95rem; color: var(--text); margin-bottom: 0.25rem; }

/* ===== Table ===== */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-bottom: 1rem; }
th { text-align: left; padding: 0.6rem 1rem; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 0.85rem; color: var(--text); }
td { padding: 0.6rem 1rem; border-bottom: 1px solid var(--border); color: var(--text-muted); }

/* ===== Responsive ===== */
@media (max-width: 640px) {
  body { overflow-x: hidden; }
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 62px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    gap: 0.2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  }
  .nav-links.open { display: flex; }
  .nav-links a { min-height: 44px; display: flex; align-items: center; padding: 0.4rem 0.75rem; }
  nav { position: relative; }
  .nav-toggle { display: block; min-height: 44px; min-width: 44px; }
  #chess-board td { width: 42px; height: 42px; font-size: 1.5rem; }
  #chess-labels-top span, #chess-labels-bottom span { width: 42px; }
  #chess-labels-side span { height: 42px; }
  .ms-cell { width: 32px; height: 32px; font-size: 0.78rem; }
  .cta-box { flex-direction: column; align-items: flex-start; }
  .card-grid { grid-template-columns: 1fr; }
  .section { padding-left: 1rem; padding-right: 1rem; }
  main { max-width: 100%; overflow-x: hidden; }
}
