/* =========================================================
   BASE RESET & DESIGN TOKENS

   Look & Feel ist an die Spielstunde-App angelehnt
   (src/frontend/src/main.ts + assets/styles/main.css):
   dunkles Amber/Braun, Primaerfarbe amber-500, Akzent orange-600,
   Text amber-100, Karten im TileCard-Stil (Olivgrund, Akzentrand).
   Die --clr-*-Namen sind absichtlich unveraendert geblieben, damit
   Inline-Styles im Markup weiter greifen.
========================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Amber/Orange — identisch zum Vuetify-Theme der App */
  --clr-primary:   #f59e0b;   /* amber-500  */
  --clr-primary-l: #fbbf24;   /* amber-400  */
  --clr-primary-d: #d97706;   /* amber-600  */
  --clr-accent:    #ea580c;   /* orange-600 */
  --clr-accent-l:  #f97316;   /* orange-500 */
  --clr-accent-d:  #c2410c;   /* orange-700 */

  /* Flaechen */
  --clr-bg:        #111008;
  --clr-bg-2:      #2a2510;
  --clr-surface:   #1c1a10;
  --clr-surface-2: #241f12;
  --clr-bg-card:   #283018;   /* warmes Oliv wie TileCard */
  --clr-sunken:    rgba(0,0,0,.28);

  /* Text */
  --clr-text:      #fef3c7;   /* amber-100 */
  --clr-text-soft: rgba(254,243,199,.68);
  --clr-text-mute: rgba(254,243,199,.42);
  --clr-border:    rgba(255,255,255,.08);

  --radius:        16px;
  --radius-lg:     24px;
  --radius-sm:     10px;
  --shadow:        0 4px 12px rgba(0,0,0,.25);
  --shadow-hover:  0 16px 40px rgba(0,0,0,.45);
  --gradient-primary: linear-gradient(135deg, #f59e0b, #d97706);
  --gradient-accent:  linear-gradient(135deg, #ea580c, #c2410c);
  --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --nav-h:         64px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: linear-gradient(160deg, var(--clr-bg) 0%, var(--clr-bg-2) 100%);
  color: var(--clr-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

::selection { background: rgba(245,158,11,.3); color: #fff; }

:focus-visible {
  outline: 2px solid var(--clr-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,.02); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.25); }

/* =========================================================
   WERBEPLAETZE

   Anbieterneutral: das Markup liefert nur leere Container,
   den Inhalt setzt loadAds() nach Einwilligung. Details und
   Anbietervergleich: docs/current/werbung-anbieter.md

   WICHTIG — AdSense-Regel: keine Anzeigen auf der
   Spieloberflaeche. Deshalb liegen alle Slots ausserhalb des
   Spielbereichs (ueber der Seite, zwischen Auswahl und Spiel,
   unter den Spielregeln) und niemals am Canvas.
========================================================= */
.ad-band {
  width: 100%;
  background: rgba(255,255,255,.02);
  border-bottom: 1px solid var(--clr-border);
}

.ad-band--inline {
  background: none;
  border: none;
  max-width: 1200px;
  margin: 0 auto 56px;
  padding: 0 24px;
}

.ad-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
}

.ad-band--inline .ad-container { padding: 0; }

/* Kennzeichnungspflicht (Trennungsgebot): Werbung muss als
   solche erkennbar sein — das Label gehoert zum Slot, nicht zur Deko. */
.ad-label {
  display: block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--clr-text-mute);
  margin-bottom: 6px;
}

.ad-slot {
  display: block;
  min-height: 90px;
}

.ad-band--inline .ad-slot {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 14px;
}

.ad-placeholder {
  min-height: 90px;
  border: 1px dashed rgba(245,158,11,.35);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--clr-text-mute);
  font-size: 0.8rem;
  letter-spacing: .04em;
  text-align: center;
  padding: 12px;
}

/* Solange kein Anbieter konfiguriert ist, bleibt vom Werbeplatz
   nichts sichtbar — kein Loch im Layout. */
.ad-band[hidden] { display: none !important; }

/* =========================================================
   HEADER / NAV  (angelehnt an components/layout/TopNavBar.vue)
========================================================= */
header {
  background: rgba(28,26,16,.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--clr-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}
.logo:hover { text-decoration: none; }

.logo-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--clr-primary);
  background: linear-gradient(135deg, rgba(245,158,11,.2), rgba(217,119,6,.2));
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.logo-text {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -.01em;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}

nav { display: flex; gap: 4px; align-items: center; }

nav a {
  color: var(--clr-text-soft);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.925rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, color .15s;
}

nav a:hover, nav a.active {
  background: rgba(245,158,11,.12);
  color: var(--clr-primary);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--clr-border);
  color: var(--clr-text);
  font-size: 1.3rem;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.nav-toggle:hover { background: rgba(245,158,11,.12); }

/* =========================================================
   HERO  (angelehnt an views/HomeView.vue → .hero-banner)
========================================================= */
/* width:100% ist Pflicht — body ist ein Column-Flex-Container, und ein
   Flex-Item mit `margin: … auto` verliert das Stretch-Verhalten. Ohne die
   Zeile schrumpft der Hero auf Inhaltsbreite. */
.hero-wrap {
  width: 100%;
  max-width: 1200px;
  margin: 40px auto 56px;
  padding: 0 24px;
}

.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
  border-radius: var(--radius-lg);
  padding: 56px 48px;
}

.hero-content { position: relative; z-index: 1; max-width: 560px; }

.hero-chip {
  display: inline-block;
  background: rgba(234,88,12,.9);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 40px;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1.1;
  color: #fff;
  margin-bottom: 12px;
}

.hero p {
  font-size: 1.1rem;
  color: rgba(255,255,255,.78);
  margin-bottom: 8px;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 24px;
}

.hero-tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,.8);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 40px;
  padding: 4px 12px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-graphic {
  position: absolute;
  right: 48px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11rem;
  line-height: 1;
  opacity: .15;
  pointer-events: none;
  user-select: none;
}

/* =========================================================
   BUTTONS
========================================================= */
.btn {
  display: inline-block;
  padding: 13px 26px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #000;
}
.btn-primary:hover { color: #000; }

.btn-ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
}
.btn-ghost:hover { background: rgba(255,255,255,.08); color: #fff; }

.btn-sm { padding: 9px 18px; font-size: 0.875rem; }

/* =========================================================
   SECTIONS
========================================================= */
main { flex: 1; }

.section {
  max-width: 1200px;
  margin: 0 auto 56px;
  padding: 0 24px;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--clr-text);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(245,158,11,.45), transparent);
}

.section-sub {
  color: var(--clr-text-soft);
  font-size: 0.95rem;
  margin-bottom: 4px;
}

/* =========================================================
   SPIEL-BEREICH
========================================================= */
.game-section {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-top: 20px;
  box-shadow: var(--shadow);
}

.game-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* Canvas wrapper — scales responsively */
.canvas-wrap {
  position: relative;
  width: 480px;
  max-width: 100%;
}

/* Variante fuer breitere 3:2-Canvases (z.B. Schneeballschlacht 720x480) */
.canvas-wrap.canvas-wrap-wide {
  width: 720px;
}

#gameCanvas, #fgCanvas, #sbCanvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--clr-border);
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  cursor: pointer;
  touch-action: none;
}

#sbCanvas { cursor: crosshair; }

/* Sidebar */
.game-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-width: 240px;
}

.status-box {
  background: var(--clr-sunken);
  border: 1px solid var(--clr-border);
  border-left: 4px solid var(--clr-primary);
  border-radius: var(--radius);
  padding: 16px;
}

.status-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--clr-text-mute);
  margin-bottom: 4px;
}

#statusText, #fgStatus, #sbStatus {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--clr-primary);
  min-height: 1.5em;
}

.score-box {
  display: flex;
  gap: 12px;
}

.score-item {
  flex: 1;
  background: var(--clr-sunken);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-align: center;
}

.score-label { font-size: 0.72rem; color: var(--clr-text-soft); margin-bottom: 2px; }
.score-val   { font-size: 1.4rem; font-weight: 800; color: var(--clr-text); }
.score-white .score-val { color: #fef3c7; }
.score-black .score-val { color: var(--clr-accent-l); }

.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.select-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--clr-text-mute);
  margin-bottom: 6px;
}

select {
  width: 100%;
  padding: 11px 14px;
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--clr-text);
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--clr-primary) 50%),
                    linear-gradient(135deg, var(--clr-primary) 50%, transparent 50%);
  background-position: calc(100% - 18px) 51%, calc(100% - 13px) 51%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
select:hover { border-color: rgba(245,158,11,.4); }

#newGameBtn, #fgNewGame, #sbNewGame {
  width: 100%;
  background: var(--gradient-accent);
  color: #fff;
  border: none;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
#newGameBtn:hover, #fgNewGame:hover, #sbNewGame:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

.history-box {
  background: var(--clr-sunken);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 14px;
}

.history-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--clr-text-mute);
  margin-bottom: 8px;
}

#moveHistory {
  list-style: none;
  max-height: 160px;
  overflow-y: auto;
  font-size: 0.84rem;
  color: var(--clr-text-soft);
  line-height: 1.8;
}
#moveHistory li:last-child { color: var(--clr-primary); font-weight: 700; }

/* =========================================================
   SPIELAUSWAHL-KARTEN  (angelehnt an components/tiles/TileCard.vue)
========================================================= */
.game-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.game-card {
  display: flex;
  flex-direction: column;
  background: var(--clr-bg-card);
  border: 2px solid var(--clr-accent);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: transform .25s cubic-bezier(.4,0,.2,1),
              box-shadow .25s cubic-bezier(.4,0,.2,1),
              border-color .25s ease;
}

.game-card:hover {
  transform: translateY(-6px);
  border-color: var(--clr-primary);
  box-shadow: var(--shadow-hover);
  text-decoration: none;
}
.game-card:active { transform: translateY(-2px); }

.game-card-preview {
  background: linear-gradient(135deg, rgba(245,158,11,.14), rgba(234,88,12,.14));
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  height: 160px;
}

.game-card-preview svg {
  max-width: 120px;
  max-height: 120px;
  border-radius: 6px;
}

.game-card-body {
  padding: 18px 20px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.game-card-body h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--clr-primary);
  margin: 0;
}

.game-card-body p {
  font-size: 0.85rem;
  color: var(--clr-text-soft);
  margin: 0;
  flex: 1;
}

.game-card-btn {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 20px;
  background: var(--gradient-primary);
  color: #000;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.875rem;
  text-align: center;
  text-decoration: none;
}
.game-card-btn:hover { color: #000; text-decoration: none; filter: brightness(1.08); }

/* =========================================================
   SPIELREGELN
========================================================= */
.instructions {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

summary {
  list-style: none;
  cursor: pointer;
  padding: 20px 24px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--clr-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
summary:hover { background: rgba(245,158,11,.06); }
summary::-webkit-details-marker { display: none; }

summary::after {
  content: '▾';
  color: var(--clr-primary);
  font-size: 1rem;
  transition: transform .2s;
}
details[open] summary::after { transform: rotate(180deg); }

.instructions-content {
  padding: 0 24px 24px;
  border-top: 1px solid var(--clr-border);
  padding-top: 20px;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.rule-card {
  background: var(--clr-sunken);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.rule-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--clr-primary);
  margin-bottom: 6px;
}

.rule-card p { font-size: 0.875rem; color: var(--clr-text-soft); line-height: 1.6; }

/* =========================================================
   FOOTER
========================================================= */
footer {
  background: rgba(0,0,0,.35);
  border-top: 1px solid var(--clr-border);
  color: var(--clr-text-soft);
  padding: 32px 24px;
  margin-top: 24px;
  text-align: center;
  font-size: 0.875rem;
}

footer a { color: var(--clr-text-soft); }
footer a:hover { color: var(--clr-primary); }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: center;
  margin-bottom: 12px;
}

.footer-link-btn {
  background: none;
  border: none;
  font: inherit;
  color: var(--clr-text-soft);
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}
.footer-link-btn:hover { color: var(--clr-primary); text-decoration: underline; }



/* =========================================================
   TEXTSEITEN — Regeln, Tipps, Hintergrund unter dem Spiel
   und die Seite "Über Spielstunde"
========================================================= */
.page-head { max-width: 1200px; margin: 32px auto 24px; padding: 0 24px; }
.page-head h1 { font-size: 2rem; font-weight: 800; line-height: 1.2; margin-bottom: 8px; }
.page-head p { color: var(--clr-text-soft); max-width: 760px; }

.article {
  max-width: 820px;
  margin: 0 auto 56px;
  padding: 0 24px;
}
.article h2 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 36px 0 12px;
  color: var(--clr-text);
}
.article h2:first-child { margin-top: 0; }
.article h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 24px 0 8px;
  color: var(--clr-primary);
}
.article p, .article li { color: var(--clr-text-soft); }
.article p { margin-bottom: 14px; }
.article ul, .article ol { margin: 0 0 16px 22px; }
.article li { margin-bottom: 6px; }
.article strong { color: var(--clr-text); }

.faq dt { font-weight: 700; color: var(--clr-text); margin-top: 18px; }
.faq dd { color: var(--clr-text-soft); margin: 4px 0 0; }

.more-games {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

/* =========================================================
   RESPONSIVE
========================================================= */
@media (max-width: 960px) {
  .hero { padding: 36px 28px; }
  .hero h1 { font-size: 2.25rem; }
  .hero-graphic { display: none; }
  .hero-content { max-width: 100%; }
}

@media (max-width: 760px) {
  .game-layout { flex-direction: column; }
  .canvas-wrap, .canvas-wrap.canvas-wrap-wide { width: 100%; }
  .game-sidebar { width: 100%; }
  .game-section { padding: 18px; }

  nav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: rgba(28,26,16,.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--clr-border);
    padding: 8px;
    gap: 2px;
  }
  nav.open { display: flex; }
  nav a { padding: 13px 16px; border-radius: 8px; }

  .nav-toggle { display: block; }
  .header-inner { position: relative; padding: 0 16px; }

  .hero-wrap, .section, .ad-container, .ad-band--inline, .page-head, .article { padding-left: 16px; padding-right: 16px; }
      .page-head h1 { font-size: 1.6rem; }
}

@media (max-width: 400px) {
  .hero { padding: 24px 20px; }
  .hero h1 { font-size: 1.75rem; }
  .hero p { font-size: 1rem; }
  .btn { width: 100%; text-align: center; }
  .game-cards { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .game-cards { grid-template-columns: 1fr; }
  .score-box { flex-direction: row; }
}
