/* =============================================================================
   Germix Games — design system
   1. Tokens & themes      5. Hero
   2. Reset & base         6. Game grid / cards
   3. Utilities            7. Game view + shared game UI
   4. Header               8. Responsive
   ========================================================================== */

/* ------------------------------- 1. Tokens ------------------------------- */
:root {
  /* Brand */
  --brand-1: #6d5efc;
  --brand-2: #22d3ee;
  --brand-3: #f472b6;
  --grad: linear-gradient(115deg, var(--brand-1), var(--brand-2) 55%, var(--brand-3));

  /* Radii, spacing, motion */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --shell: 1240px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --dur: .28s;

  --font: "Inter", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system,
          "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, "SF Mono", Consolas, monospace;
}

/* Dark theme (default) */
[data-theme="dark"] {
  --bg: #080b14;
  --bg-2: #0d1220;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .075);
  --stroke: rgba(255, 255, 255, .10);
  --stroke-strong: rgba(255, 255, 255, .20);
  --text: #eef1f8;
  --text-dim: #a3acc4;
  --text-mute: #6f7994;
  --shadow: 0 18px 50px -16px rgba(0, 0, 0, .75);
  --glass-blur: 18px;
  --board-light: #e9e2d4;
  --board-dark: #7b6a52;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
}

/* Light theme */
[data-theme="light"] {
  --bg: #f4f6fc;
  --bg-2: #ffffff;
  --surface: rgba(255, 255, 255, .72);
  --surface-2: rgba(255, 255, 255, .92);
  --stroke: rgba(16, 22, 46, .10);
  --stroke-strong: rgba(16, 22, 46, .20);
  --text: #131a2f;
  --text-dim: #4d566f;
  --text-mute: #7c85a0;
  --shadow: 0 18px 44px -20px rgba(21, 27, 60, .35);
  --glass-blur: 16px;
  --board-light: #eee7d8;
  --board-dark: #8a7659;
  --ok: #059669;
  --warn: #b45309;
  --bad: #e11d48;
}

/* ---------------------------- 2. Reset & base ---------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ambient background wash */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60rem 40rem at 12% -8%, color-mix(in srgb, var(--brand-1) 26%, transparent), transparent 60%),
    radial-gradient(50rem 34rem at 92% 4%, color-mix(in srgb, var(--brand-2) 20%, transparent), transparent 62%),
    radial-gradient(46rem 34rem at 50% 108%, color-mix(in srgb, var(--brand-3) 16%, transparent), transparent 60%);
  opacity: .9;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -.02em; font-weight: 700; }
p { margin: 0; }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }

svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.8;
      stroke-linecap: round; stroke-linejoin: round; }

:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection { background: color-mix(in srgb, var(--brand-1) 45%, transparent); }

.skip-link {
  position: absolute; left: 50%; top: -60px; transform: translateX(-50%);
  z-index: 200; padding: .7rem 1.2rem; border-radius: 0 0 var(--r-md) var(--r-md);
  background: var(--brand-1); color: #fff; text-decoration: none; transition: top var(--dur);
}
.skip-link:focus { top: 0; }

/* ------------------------------ 3. Utilities ----------------------------- */
.shell { width: min(100% - 2.5rem, var(--shell)); margin-inline: auto; }

.glass {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  box-shadow: var(--shadow);
}

.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.muted { color: var(--text-mute); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .72rem 1.25rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600; font-size: .94rem;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform var(--dur) var(--ease), background var(--dur), box-shadow var(--dur), border-color var(--dur);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: .48rem .9rem; font-size: .85rem; }

.btn-primary {
  background: var(--grad); color: #fff;
  box-shadow: 0 10px 26px -10px color-mix(in srgb, var(--brand-1) 90%, transparent);
}
.btn-primary:hover { box-shadow: 0 16px 34px -12px color-mix(in srgb, var(--brand-1) 95%, transparent); }

.btn-ghost {
  background: var(--surface); border-color: var(--stroke); color: var(--text);
  backdrop-filter: blur(10px);
}
.btn-ghost:hover { border-color: var(--stroke-strong); background: var(--surface-2); }

.btn[disabled] { opacity: .45; pointer-events: none; }

.ico-inline { width: 1.05em; height: 1.05em; }

/* ------------------------------- 4. Header ------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  padding: .7rem 0;
  border-bottom: 1px solid transparent;
  transition: background var(--dur), border-color var(--dur), backdrop-filter var(--dur);
}
.site-header.is-stuck {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border-bottom-color: var(--stroke);
}
.header-inner { display: flex; align-items: center; gap: 1rem; }

.logo { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--text); }
.logo-mark {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px;
  width: 34px; height: 34px; padding: 6px;
  border-radius: 11px; background: var(--grad);
  box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--brand-1) 90%, transparent);
}
.logo-dot { background: rgba(255, 255, 255, .92); border-radius: 3px; }
.logo-dot:nth-child(2) { opacity: .55; }
.logo-dot:nth-child(3) { opacity: .75; }
.logo-text { font-weight: 800; letter-spacing: -.03em; font-size: 1.06rem; }
.logo-text span { color: var(--text-mute); font-weight: 600; }

.cat-nav { display: flex; gap: .15rem; margin-inline: auto; }
.cat-nav a {
  padding: .5rem .8rem; border-radius: 999px;
  color: var(--text-dim); text-decoration: none; font-size: .9rem; font-weight: 500;
  transition: color var(--dur), background var(--dur);
}
.cat-nav a:hover { color: var(--text); background: var(--surface); }
.cat-nav a.is-active { color: var(--text); background: var(--surface-2); }

.header-tools { display: flex; align-items: center; gap: .5rem; margin-left: auto; }

.search { position: relative; display: flex; align-items: center; }
.search-icon {
  position: absolute; left: .72rem; width: 1.05rem; height: 1.05rem;
  color: var(--text-mute); pointer-events: none;
}
.search input {
  width: 210px; padding: .58rem 2.2rem .58rem 2.35rem;
  background: var(--surface); border: 1px solid var(--stroke);
  border-radius: 999px; font-size: .9rem;
  transition: width var(--dur) var(--ease), border-color var(--dur), background var(--dur);
}
.search input::placeholder { color: var(--text-mute); }
.search input:focus { width: 260px; border-color: var(--stroke-strong); background: var(--surface-2); outline: none; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-kbd {
  position: absolute; right: .6rem; padding: .06rem .38rem;
  font-family: var(--mono); font-size: .7rem; color: var(--text-mute);
  border: 1px solid var(--stroke); border-radius: 5px;
}
.search input:focus ~ .search-kbd { opacity: 0; }

.lang-switch {
  display: flex; padding: 3px; gap: 2px;
  background: var(--surface); border: 1px solid var(--stroke); border-radius: 999px;
}
.lang-btn {
  padding: .32rem .62rem; border: 0; background: transparent; border-radius: 999px;
  font-size: .78rem; font-weight: 700; letter-spacing: .04em;
  color: var(--text-mute); cursor: pointer;
  transition: color var(--dur), background var(--dur);
}
.lang-btn:hover { color: var(--text); }
.lang-btn.is-active { color: #fff; background: var(--grad); }

.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px; padding: 0;
  background: var(--surface); border: 1px solid var(--stroke); border-radius: 50%;
  color: var(--text-dim); cursor: pointer;
  transition: color var(--dur), border-color var(--dur), transform var(--dur) var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--stroke-strong); transform: rotate(-12deg); }
.icon-btn svg { width: 1.15rem; height: 1.15rem; }

[data-theme="dark"] .ico-sun { display: block; }
[data-theme="dark"] .ico-moon { display: none; }
[data-theme="light"] .ico-sun { display: none; }
[data-theme="light"] .ico-moon { display: block; }

.menu-btn { display: none; }

/* -------------------------------- 5. Hero -------------------------------- */
.hero { position: relative; padding: clamp(3rem, 8vw, 6rem) 0 clamp(2.5rem, 5vw, 4rem); overflow: hidden; }
.hero-glow {
  position: absolute; inset: -30% 20% auto; height: 480px;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand-1) 30%, transparent), transparent 65%);
  filter: blur(40px); pointer-events: none;
}
.hero-inner { position: relative; text-align: center; }

.eyebrow {
  display: inline-block; margin-bottom: 1.1rem; padding: .35rem .85rem;
  border: 1px solid var(--stroke); border-radius: 999px;
  background: var(--surface); backdrop-filter: blur(10px);
  font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-dim);
}
.hero-title {
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  letter-spacing: -.045em; font-weight: 800;
}
.hero-title span { display: block; }
.hero-sub {
  max-width: 54ch; margin: 1.2rem auto 0;
  color: var(--text-dim); font-size: clamp(1rem, 1.6vw, 1.12rem);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; margin-top: 2rem; }

.hero-stats {
  display: flex; flex-wrap: wrap; gap: clamp(1.5rem, 5vw, 3.5rem); justify-content: center;
  margin: 3rem 0 0;
}
.hero-stats dt { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-mute); }
.hero-stats dd { margin: .25rem 0 0; font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; }

/* ---------------------------- 6. Grid & cards ---------------------------- */
.section-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.6rem; padding-top: 1rem;
}
.section-head h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }

.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  padding: .42rem .95rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--stroke);
  font-size: .85rem; font-weight: 600; color: var(--text-dim); cursor: pointer;
  transition: color var(--dur), border-color var(--dur), background var(--dur), transform var(--dur) var(--ease);
}
.chip:hover { color: var(--text); transform: translateY(-1px); border-color: var(--stroke-strong); }
.chip.is-active { color: #fff; background: var(--grad); border-color: transparent; }

.game-grid {
  display: grid; gap: 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  padding-bottom: 4rem;
}

.card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  padding: 1.35rem;
  background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-lg);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  text-align: left; cursor: pointer;
  transition: transform var(--dur) var(--ease), border-color var(--dur), box-shadow var(--dur);
  animation: rise .5s var(--ease) backwards;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.card::after {           /* hover sheen following the accent colour */
  content: ""; position: absolute; inset: -40% -10% auto; height: 200px;
  background: radial-gradient(circle, var(--accent, var(--brand-1)), transparent 62%);
  opacity: 0; filter: blur(30px); transition: opacity var(--dur); pointer-events: none;
}
.card:hover { transform: translateY(-6px); border-color: var(--stroke-strong); box-shadow: var(--shadow); }
.card:hover::after { opacity: .28; }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.card-icon {
  display: grid; place-items: center; width: 54px; height: 54px;
  font-size: 1.7rem; border-radius: var(--r-md);
  background: color-mix(in srgb, var(--accent, var(--brand-1)) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent, var(--brand-1)) 35%, transparent);
  transition: transform var(--dur) var(--ease);
}
.card:hover .card-icon { transform: scale(1.08) rotate(-6deg); }

.card-tag {
  padding: .2rem .6rem; border-radius: 999px; border: 1px solid var(--stroke);
  font-size: .68rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-mute);
}
.card h3 { margin-top: 1rem; font-size: 1.16rem; }
.card p { margin-top: .4rem; color: var(--text-dim); font-size: .9rem; flex: 1; }

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-top: 1.2rem; }
.card-best { font-size: .78rem; color: var(--text-mute); }
.card-best strong { color: var(--text); font-variant-numeric: tabular-nums; }
.card-play {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: 999px; border: 0;
  background: var(--grad); color: #fff; font-size: .85rem; font-weight: 700; cursor: pointer;
  transition: gap var(--dur) var(--ease), box-shadow var(--dur);
}
.card:hover .card-play { gap: .7rem; box-shadow: 0 10px 22px -10px color-mix(in srgb, var(--brand-1) 90%, transparent); }

.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  padding: 4rem 0 6rem; color: var(--text-dim); text-align: center;
}

/* ---------------------- 7. Game view + shared game UI --------------------- */
.game-bar {
  display: flex; align-items: center; gap: 1rem;
  margin: 1.2rem 0 1.4rem; padding: .8rem 1rem;
}
.game-bar-title { display: flex; align-items: center; gap: .7rem; margin-inline: auto; }
.game-bar-icon { font-size: 1.5rem; }
.game-bar-title h2 { font-size: clamp(1.05rem, 3vw, 1.4rem); }
.game-bar-score { display: flex; align-items: baseline; gap: .45rem; font-size: .82rem; color: var(--text-mute); }
.game-bar-score strong { font-size: 1.05rem; color: var(--text); font-variant-numeric: tabular-nums; }

.game-mount { padding-bottom: 5rem; }

/* -- Shared layout every game uses: board column + side panel -- */
.g-wrap { display: grid; gap: 1.2rem; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
.g-stage {
  display: grid; place-items: center; padding: clamp(.9rem, 2.5vw, 1.6rem);
  background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-lg);
  backdrop-filter: blur(var(--glass-blur)); min-width: 0;
}
.g-panel { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 86px; }
.g-card {
  padding: 1.1rem; background: var(--surface); border: 1px solid var(--stroke);
  border-radius: var(--r-md); backdrop-filter: blur(var(--glass-blur));
}
.g-card h4 {
  margin-bottom: .8rem; font-size: .74rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-mute); font-weight: 700;
}
.g-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: .7rem; }
.g-stat { text-align: center; padding: .55rem .3rem; border-radius: var(--r-sm); background: var(--surface-2); }
.g-stat span { display: block; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-mute); }
.g-stat strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

.g-controls { display: flex; flex-wrap: wrap; gap: .5rem; }
.g-controls .btn { flex: 1 1 auto; }

.g-status {
  padding: .7rem .9rem; border-radius: var(--r-sm); text-align: center;
  background: var(--surface-2); font-size: .9rem; font-weight: 600; min-height: 2.6rem;
  display: flex; align-items: center; justify-content: center;
}
.g-status.is-ok { color: var(--ok); }
.g-status.is-bad { color: var(--bad); }
.g-status.is-warn { color: var(--warn); }

.g-seg { display: flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 999px; }
.g-seg button {
  flex: 1; padding: .42rem .5rem; border: 0; background: transparent; border-radius: 999px;
  font-size: .82rem; font-weight: 600; color: var(--text-dim); cursor: pointer;
  transition: color var(--dur), background var(--dur);
}
.g-seg button.is-active { color: #fff; background: var(--grad); }

.g-hint { font-size: .82rem; color: var(--text-mute); line-height: 1.5; }
.g-hint kbd {
  padding: .05rem .35rem; border: 1px solid var(--stroke); border-radius: 5px;
  font-family: var(--mono); font-size: .74rem;
}

/* On-screen d-pad (touch) */
.dpad { display: none; grid-template-columns: repeat(3, 56px); gap: .4rem; justify-content: center; margin-top: 1rem; }
.dpad button {
  display: grid; place-items: center; height: 56px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--stroke); color: var(--text); cursor: pointer;
  -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.dpad button:active { background: var(--grad); color: #fff; }
.dpad .sp { visibility: hidden; }

/* Canvas games */
.g-canvas {
  width: min(100%, 520px); aspect-ratio: 1; border-radius: var(--r-md);
  background: color-mix(in srgb, var(--bg-2) 88%, transparent);
  border: 1px solid var(--stroke); touch-action: none;
}

/* Generic square grid boards (memory, 2048, puzzle, sudoku, tic-tac-toe) */
.g-board { display: grid; gap: .5rem; width: min(100%, 520px); }
.g-cell {
  display: grid; place-items: center; aspect-ratio: 1;
  border-radius: var(--r-sm); border: 1px solid var(--stroke);
  background: var(--surface-2); cursor: pointer;
  font-weight: 700; transition: transform var(--dur) var(--ease), background var(--dur), color var(--dur);
  -webkit-user-select: none; user-select: none;
}
.g-cell:hover { transform: translateY(-2px); }

/* Winner banner overlay */
.g-overlay {
  position: absolute; inset: 0; display: grid; place-items: center; gap: .8rem;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(6px); border-radius: var(--r-md);
  animation: fade .3s var(--ease); text-align: center; padding: 1rem; z-index: 5;
}
@keyframes fade { from { opacity: 0; } }
.g-overlay h3 { font-size: 1.6rem; }
.g-overlay p { color: var(--text-dim); }

.g-rel { position: relative; width: 100%; display: grid; place-items: center; }

/* ------------------------------- 8. Footer ------------------------------- */
.site-footer { border-top: 1px solid var(--stroke); padding: 2rem 0; margin-top: auto; }
.footer-inner {
  display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between;
  color: var(--text-dim); font-size: .88rem;
}

/* ----------------------------- 9. Responsive ----------------------------- */
@media (max-width: 1080px) {
  .g-wrap { grid-template-columns: 1fr; }
  .g-panel { position: static; }
}

@media (max-width: 900px) {
  .cat-nav {
    position: absolute; top: calc(100% + .5rem); left: 1.25rem; right: 1.25rem;
    flex-direction: column; gap: .2rem; padding: .6rem;
    background: color-mix(in srgb, var(--bg-2) 96%, transparent);
    border: 1px solid var(--stroke); border-radius: var(--r-md);
    box-shadow: var(--shadow); display: none;
  }
  .cat-nav.is-open { display: flex; }
  .menu-btn { display: grid; }
  .search input { width: 44px; padding-right: .6rem; }
  .search input:focus { width: 190px; }
  .search-kbd { display: none; }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 1.6rem, var(--shell)); }
  .game-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 1.6rem; }
  .dpad { display: grid; }
  .game-bar { flex-wrap: wrap; justify-content: center; }
  .game-bar-title { margin-inline: 0; order: -1; width: 100%; justify-content: center; }
  .logo-text { display: none; }
}

@media (hover: none) { .dpad { display: grid; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ============================== Rechtstexte ============================== */
.legal { max-width: 74ch; padding: 3.5rem 0 4.5rem; }
.legal h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin: 0 0 .35rem; }
.legal h2 { font-size: 1.12rem; margin: 2.2rem 0 .6rem; }
.legal p, .legal li { line-height: 1.75; color: var(--fg-muted, #a9b1c6); }
.legal ul { margin: .4rem 0 1rem 1.2rem; }
.legal li { margin: .3rem 0; }
.legal a { color: var(--accent, #6d5efc); }
.legal code { padding: .1em .4em; border-radius: .3em; background: rgba(127,127,127,.16); }
.legal-meta { margin: 0 0 1.6rem; font-size: .92rem; opacity: .75; }
.legal-updated { margin-top: 2.6rem; font-size: .88rem; opacity: .7; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem; }
.footer-links a { color: inherit; text-decoration: none; opacity: .8; }
.footer-links a:hover { opacity: 1; text-decoration: underline; }
