/* ============================================================
   renju.eu – Design-System (eigene Styles, keine externen Assets)
   ============================================================ */

:root {
  --bg: #f6f2ea;
  --bg-alt: #ece6d8;
  --surface: #ffffff;
  --border: #ddd3bf;
  --text: #262019;
  --text-muted: #6d6453;
  --primary: #a8552f;
  --primary-hover: #8c4423;
  --on-primary: #ffffff;
  --accent: #8f6a1c;
  --danger: #b3261e;
  --success: #2e7d32;
  --header-bg: #ffffff;
  --header-text: #262019;
  --shadow: 0 2px 12px rgba(60, 45, 20, 0.10);
  --shadow-lg: 0 8px 30px rgba(60, 45, 20, 0.14);
  --radius: 10px;
  --board: #dcb584;
  --board-line: #8a5a2b;
  --stone-black: #23272f;
  --stone-white: #f7f4ee;
}

:root[data-theme="dark"] {
  --bg: #191512;
  --bg-alt: #211c16;
  --surface: #262019;
  --border: #3a3124;
  --text: #efe7d8;
  --text-muted: #a89a83;
  --primary: #d0714a;
  --primary-hover: #e08a63;
  --on-primary: #221208;
  --accent: #d4a43f;
  --danger: #e57368;
  --success: #81c784;
  --header-bg: #211c16;
  --header-text: #efe7d8;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  --board: #8a6a3f;
  --board-line: #4d3a1f;
  --stone-black: #0f1216;
  --stone-white: #ece8df;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

img { max-width: 100%; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.6em; }
h1 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
h2 { font-size: clamp(1.25rem, 2.2vw, 1.6rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.lead { font-size: 1.15rem; color: var(--text-muted); }
.muted { color: var(--text-muted); }
.hint { font-size: 0.85rem; color: var(--text-muted); }

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 860px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--primary); color: var(--on-primary); padding: 8px 14px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.header-inner { display: flex; align-items: center; gap: 18px; min-height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--header-text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; }
.brand-name { font-size: 1.25rem; letter-spacing: 0.02em; }
/* „.eu"-Akzent: deutlich kleiner, hochgestellt, Theme-Akzentfarbe
   (Gold ist in hellem UND dunklem Design auf dem Header lesbar). */
.brand-name .accent,
.footer-brand .accent {
  font-size: 0.6em;
  vertical-align: 0.42em;
  margin-left: 1px;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0;
}
/* Alias: alte Klasse bleibt für Übergang/OPcache-Stand stilisiert */
.brand-name .brand-tld { font-size: 0.6em; vertical-align: 0.42em; color: var(--accent); font-weight: 800; }
/* Beta-Abzeichen: kleine Kapsel neben der Wortmarke, Akzentfarbe mit
   WCAG-AA-Kontrast in beiden Themes (hell 4,95:1 / dunkel 7,39:1). */
.beta-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 1px 8px;
  line-height: 1.4;
  white-space: nowrap;
  text-transform: uppercase;
}
.main-nav { display: flex; align-items: center; gap: 4px; flex: 1; flex-wrap: wrap; }
.main-nav a {
  color: var(--header-text); padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: 0.95rem;
}
.main-nav a:hover { background: var(--bg-alt); text-decoration: none; }
.main-nav a.is-active { color: var(--primary); font-weight: 700; }
.nav-logout { display: inline; margin: 0; }
.header-tools { display: flex; align-items: center; gap: 10px; }
.icon-button {
  background: none; border: 1px solid var(--border); color: var(--header-text);
  border-radius: 8px; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; fill: currentColor;
}
.icon-button:hover { background: var(--bg-alt); }
.lang-toggle { font-size: 0.9rem; font-weight: 600; }
.nav-burger { display: none; }

/* ---------- Buttons ---------- */
.button {
  display: inline-block; border: 1px solid transparent; border-radius: var(--radius);
  padding: 10px 18px; font-size: 0.95rem; font-weight: 600; cursor: pointer;
  text-align: center; transition: background 0.15s, border-color 0.15s; font-family: inherit; line-height: 1.4;
}
.button:hover { text-decoration: none; }
.button-primary { background: var(--primary); color: var(--on-primary); }
.button-primary:hover { background: var(--primary-hover); }
.button-secondary { background: var(--surface); border-color: var(--primary); color: var(--primary); }
.button-secondary:hover { border-color: var(--primary-hover); }
.button-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.button-ghost:hover { background: var(--bg-alt); }
.button-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.button-danger:hover { background: var(--danger); color: #fff; }
.button-large { padding: 14px 26px; font-size: 1.05rem; }
.button-small { padding: 6px 12px; font-size: 0.85rem; }
.button:disabled { opacity: 0.5; cursor: not-allowed; }
.link-button {
  background: none; border: none; color: var(--header-text); font: inherit; font-size: 0.95rem;
  padding: 8px 12px; cursor: pointer; border-radius: 8px; font-weight: 500;
}
.link-button:hover { background: var(--bg-alt); }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

/* ---------- Karten & Sektionen ---------- */
.section { padding: 42px 0; }
.section-alt { background: var(--bg-alt); }
.section-title { text-align: center; margin-bottom: 0.8em; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.center-card { text-align: center; padding: 44px 24px; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.feature-icon {
  width: 52px; height: 52px; border-radius: 12px; background: var(--bg-alt);
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px; fill: var(--primary); color: var(--primary);
}
.feature-card h3 { margin-bottom: 0.4em; }
.feature-card p { color: var(--text-muted); margin: 0; }

.how-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; padding: 0; margin: 0; }
.how-list li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.how-num {
  display: inline-flex; width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary); font-weight: 700;
  align-items: center; justify-content: center; margin-bottom: 10px;
}
.how-list p { color: var(--text-muted); margin: 0; }

/* ---------- Hero ---------- */
.hero { background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.hero-inner {
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 40px; align-items: center;
  padding: 60px 20px 70px;
}
.hero-text h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); margin-bottom: 0.35em; }
.hero-subtitle { font-size: 1.12rem; color: var(--text-muted); max-width: 560px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 18px; }
.hero-stats { color: var(--text-muted); }
.hero-stats strong { color: var(--text); }
.hero-board svg { width: 100%; max-width: 430px; display: block; margin: 0 auto; }
.hb-bg { fill: var(--board); }
.hb-grid line { stroke: var(--board-line); stroke-width: 2; opacity: 0.8; }
.hb-stones circle { fill: var(--stone-black); stroke: rgba(0,0,0,0.25); stroke-width: 1; }
.hb-win line { stroke: var(--accent); stroke-width: 3; }

/* ---------- Forbidden-Teaser ---------- */
.forbidden-teaser { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 40px; align-items: center; }
.forbidden-diagram svg { width: 100%; max-width: 340px; display: block; margin: 0 auto; }
.fd-bg { fill: var(--board); }
.fd-grid line { stroke: var(--board-line); stroke-width: 1.5; opacity: 0.8; }
.stone-dark { fill: var(--stone-black); stroke: rgba(0,0,0,0.3); stroke-width: 1; }
.stone-white { fill: var(--stone-white); stroke: #7a7468; stroke-width: 1; }
.stone-accent { stroke: var(--accent); stroke-width: 2.5; }
.fd-badge { fill: var(--danger); font: bold 20px sans-serif; }

/* ---------- Formulare ---------- */
.form { display: flex; flex-direction: column; gap: 6px; }
.form label { font-weight: 600; font-size: 0.9rem; margin-top: 8px; }
.form input, .form select {
  font: inherit; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); width: 100%;
}
.form input:focus, .form select:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.form button[type="submit"] { margin-top: 16px; }
.auth-card { max-width: 440px; margin: 0 auto; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 14px; }
.alert-error { background: rgba(179, 38, 30, 0.1); border: 1px solid var(--danger); color: var(--danger); }
.alert-ok { background: rgba(46, 125, 50, 0.1); border: 1px solid var(--success); color: var(--success); }
.flash-row { padding-top: 16px; }
.flash-row .alert { margin-bottom: 0; }

/* ---------- Tabellen ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table th { font-weight: 700; color: var(--text-muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table tr:last-child td { border-bottom: none; }
.table tr.is-me { background: var(--bg-alt); }
.elo-big { font-weight: 700; color: var(--primary); font-size: 1.05rem; }

/* ---------- Spielen-Layout ---------- */
.play-layout { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; }
.play-setup { display: flex; flex-direction: column; gap: 18px; }
.play-game { display: grid; grid-template-columns: 1fr; gap: 24px; }
.board-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.board { width: 100%; max-width: 660px; touch-action: manipulation; user-select: none; }
.board-note { min-height: 1.5em; color: var(--text-muted); font-size: 0.9rem; }
.play-sidebar { display: flex; flex-direction: column; gap: 18px; }
.status-line { font-weight: 700; font-size: 1.05rem; margin-bottom: 8px; }
.status-line.is-win { color: var(--success); }
.status-line.is-loss { color: var(--danger); }
.timers { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.88rem; color: var(--text-muted); margin-bottom: 4px; }
.timers .clock { font-variant-numeric: tabular-nums; }
.timers .clock.active { color: var(--primary); font-weight: 700; }
.moves-title { font-size: 1rem; margin-top: 0; }
.move-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; font-size: 0.9rem; }
.move-list li { padding: 4px 6px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; }
.move-list li:last-child { border-bottom: none; }
.move-list .mv-num { color: var(--text-muted); min-width: 34px; }
.move-list .mv-cell { font-weight: 600; }
.move-list li.is-last { background: var(--bg-alt); border-radius: 6px; }
.badge {
  display: inline-block; background: var(--accent); color: #2a1e05; font-size: 0.75rem;
  font-weight: 700; padding: 2px 9px; border-radius: 999px; vertical-align: middle;
}

/* ---------- Online ---------- */
.online-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.online-game-layout { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; }
.lobby-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 4px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.lobby-row:last-child { border-bottom: none; }
.lobby-row span:nth-child(2) { flex: 1; font-size: 0.92rem; }
.variant-tag {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 6px;
  padding: 1px 8px; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); white-space: nowrap;
}
.result-tag { font-weight: 700; font-size: 0.85rem; }
.back-link { font-size: 0.9rem; }
.player-cards { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.player-card {
  flex: 1; min-width: 150px; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 0.9rem; background: var(--surface);
}
.player-card.active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.player-card .pc-name { font-weight: 700; }
.player-card .pc-elo { color: var(--text-muted); font-size: 0.82rem; }
.draw-offer-box { margin-top: 8px; font-size: 0.9rem; }

/* ---------- Profil ---------- */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-bottom: 18px; }
.profile-name { margin-bottom: 0.2em; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0; }
.stats-grid dt { font-size: 0.8rem; color: var(--text-muted); }
.stats-grid dd { margin: 0; font-size: 1.2rem; font-weight: 700; }

/* ---------- Regeln ---------- */
.diagram-row { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin: 18px 0 26px; }
.rule-diagram { width: 230px; flex: none; }
.rd-bg { fill: var(--board); }
.rd-grid line { stroke: var(--board-line); stroke-width: 1.5; opacity: 0.8; }
.rd-stones circle { stroke-width: 1; }
.diagram-caption { flex: 1; min-width: 240px; color: var(--text-muted); margin: 0; }
.simple-list { padding-left: 1.2em; }
.simple-list li { margin-bottom: 0.6em; }

/* ---------- Footer ---------- */
.site-footer { background: var(--header-bg); border-top: 1px solid var(--border); margin-top: 30px; }
.footer-inner {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 26px;
  padding: 34px 20px; color: var(--text-muted);
}
.footer-brand { font-weight: 700; color: var(--text); font-size: 1.1rem; }
.footer-nav { display: flex; flex-direction: column; gap: 6px; }
.footer-text { font-size: 0.9rem; margin: 6px 0 0; }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 14px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  background: var(--bg);
}
.footer-bottom p { margin: 0; }
.footer-bottom .footer-beta { font-size: 0.8rem; margin-top: 4px; opacity: 0.9; }

/* ---------- Cookie-Banner ---------- */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
  padding: 14px 20px;
  display: flex; gap: 16px; align-items: center; justify-content: center; flex-wrap: wrap;
}
.cookie-banner p { margin: 0; font-size: 0.9rem; max-width: 760px; }
.cookie-banner[hidden] { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; padding: 40px 20px 46px; }
  .hero-board { order: -1; }
  .forbidden-teaser { grid-template-columns: 1fr; }
  .play-layout { grid-template-columns: 1fr; }
  .main-nav {
    display: none; position: absolute; top: 62px; left: 0; right: 0;
    background: var(--header-bg); border-bottom: 1px solid var(--border);
    flex-direction: column; align-items: stretch; padding: 10px 16px; gap: 2px;
  }
  .main-nav.is-open { display: flex; }
  .nav-burger { display: inline-flex; }
  .nav-logout { display: block; }
  .link-button { width: 100%; text-align: left; }
  .header-inner { position: relative; }
}
