/* ============================================================================
 *  main.css  —  Grundlayout, Reset & Design-Variablen (Grimmtal: Horde)
 * ========================================================================== */

/* ---- Lokale Schriften (DSGVO: KEIN Google-CDN) -------------------------- *
 *  Lege die woff2-Dateien neben index.html in einen Ordner `fonts/`. Fehlen
 *  sie, greift automatisch die Fallback-Kette (Georgia / System-Schrift).
 *  Kostenlos & frei (SIL OFL): Cinzel + Inter, z. B. via gwfh.mranftl.com.
 * ------------------------------------------------------------------------ */
@font-face {
  font-family: 'Cinzel'; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url('fonts/cinzel.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('fonts/inter.woff2') format('woff2');
}

/* ---- Rechtliche Pflicht-Links (Impressum/Datenschutz) ------------------- */
.gt-legal {
  position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
  bottom: calc(4px + env(safe-area-inset-bottom, 0px));
  display: flex; gap: 8px; align-items: center;
  font-family: system-ui, sans-serif; font-size: 11px; opacity: 0.55;
  color: #9a9182; pointer-events: auto;
}
.gt-legal a { color: #9a9182; text-decoration: none; }
.gt-legal a:hover { color: #e8c14a; text-decoration: underline; }
.gt-legal:hover { opacity: 0.95; }

:root {
  /* ---- Farbpalette (Dark Fantasy: Tiefschwarz + Gold/Teal-Akzente) ----- */
  --bg:          #05070b;
  --bg-2:        #090c14;            /* leicht hellerer Tiefton für Verläufe */
  --panel:       rgba(14, 16, 24, 0.92);
  --panel-solid: #0e1018;
  --panel-hi:    #1b2030;            /* obere Kante von Karten-Verläufen */
  --panel-lo:    #11141f;            /* untere Kante von Karten-Verläufen */
  --ink:         #e6e0d2;
  --ink-dim:     #9a9182;
  --ink-faint:   #6f6758;            /* sehr dezente Beschriftungen */
  --gold:        #c9a14a;
  --gold-bright: #e8c14a;
  --gold-glow:   rgba(201, 161, 74, 0.45);
  --teal:        #5fe0c0;
  --teal-glow:   rgba(95, 224, 192, 0.35);
  --blood:       #b53030;
  --border:      rgba(180, 150, 80, 0.45);
  --border-soft: rgba(180, 150, 80, 0.22);
  --border-faint:rgba(180, 150, 80, 0.12);

  /* ---- Abstands-Skala (4er-Raster) — einheitliche Paddings/Gaps -------- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 40px;

  /* ---- Radius-Skala --------------------------------------------------- */
  --radius-sm: 8px;
  --radius:    12px;               /* Standard (etwas weicher als zuvor) */
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* ---- Schatten-Skala (weiche Tiefe + innerer Lichtsaum) --------------- */
  --shadow:      0 10px 40px rgba(0, 0, 0, 0.6);
  --shadow-sm:   0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-md:   0 6px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg:   0 16px 48px rgba(0, 0, 0, 0.62);
  --inset-top:   inset 0 1px 0 rgba(255, 255, 255, 0.06);  /* feiner Glanz oben */
  --ring-gold:   0 0 0 1px rgba(201, 161, 74, 0.5), 0 0 18px var(--gold-glow);

  /* ---- Übergänge ------------------------------------------------------ */
  --ease:        cubic-bezier(0.2, 0.9, 0.3, 1.05);
  --t-fast:      0.12s ease;
  --t-mid:       0.2s ease;

  /* ---- Typografie ----------------------------------------------------- */
  --font-head:   'Cinzel', Georgia, serif;
  --font-body:   'Inter', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  user-select: none; -webkit-user-select: none;
}

#game {
  position: fixed; inset: 0; width: 100%; height: 100%;
  display: block; background: var(--bg);
  image-rendering: pixelated; touch-action: none;
}

#ui-root { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

/* ---- Scrollbars (dezent, goldgetönt) ----------------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); border-radius: 6px; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--border-soft), rgba(180,150,80,0.14));
  border-radius: 6px; border: 2px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--border); background-clip: padding-box; }
/* Firefox */
* { scrollbar-width: thin; scrollbar-color: var(--border-soft) rgba(0,0,0,0.3); }

/* ---- Touch-/Vollbild-Steuerleiste (oben rechts, über allem) ------------- */
.gt-controls {
  position: fixed; z-index: 30; display: flex; gap: 8px; pointer-events: auto;
  top: calc(8px + env(safe-area-inset-top, 0px));
  right: calc(8px + env(safe-area-inset-right, 0px));
}
.gt-ctrl-btn {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; font-size: 20px; line-height: 1;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(26,30,42,0.82), rgba(10,12,18,0.82));
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
  box-shadow: var(--inset-top), var(--shadow-sm);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: border-color var(--t-mid), box-shadow var(--t-mid), transform var(--t-fast), color var(--t-mid);
  -webkit-tap-highlight-color: transparent;
}
.gt-ctrl-btn:hover { border-color: var(--gold); color: var(--gold-bright);
  box-shadow: var(--inset-top), var(--shadow-sm), 0 0 14px var(--gold-glow); }
.gt-ctrl-btn:active { transform: translateY(1px); }

/* ---- Mobile / iPad: Grundverhalten (Touch-Größen siehe Block unten) ---- */
html, body { overscroll-behavior: none; }
button { -webkit-tap-highlight-color: transparent; }

/* ---- „Bitte drehen"-Hinweis (NUR Handys im Hochformat; iPads dürfen spielen) -- */
.gt-rotate { display: none; }
@media (orientation: portrait) and (max-width: 600px) {
  .gt-rotate {
    display: flex; position: fixed; inset: 0; z-index: 60;
    flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-4);
    color: var(--gold-bright); text-align: center; padding: var(--sp-6);
    font-family: var(--font-head); letter-spacing: 0.04em;
    /* dezente radiale Tiefe statt flachem Schwarz */
    background:
      radial-gradient(ellipse at 50% 38%, rgba(201,161,74,0.10), transparent 60%),
      radial-gradient(ellipse at center, var(--bg-2), var(--bg) 75%);
  }
  .gt-rotate h2 { font-size: clamp(1.4rem, 6vw, 2rem); color: var(--gold-bright); letter-spacing: 0.08em; }
  .gt-rotate .gt-rot-icon { font-size: clamp(3rem, 16vw, 4.5rem); animation: gt-rot 2s ease-in-out infinite;
    filter: drop-shadow(0 0 18px var(--gold-glow)); }
  .gt-rotate p { color: var(--ink-dim); font-family: var(--font-body); max-width: 280px; line-height: 1.5; }
}
@keyframes gt-rot { 0%,100% { transform: rotate(-12deg); } 50% { transform: rotate(78deg); } }

/* ===========================================================================
 *  RESPONSIVE — Handy ≤480 · Querformat-Handy (niedrige Höhe) · Tablet · Touch
 *  Detail-Anpassungen einzelner Komponenten stehen in ui.css; hier liegen die
 *  übergreifenden Layout-/Größen-Stellschrauben.
 * ========================================================================= */

/* ---- Handy (≤480): kompakte Paddings, große Touch-Ziele, fluide Schrift -- */
@media (max-width: 480px) {
  .gt-game-title, .gt-title { font-size: clamp(2.2rem, 13vw, 3rem); letter-spacing: 0.1em; }
  .gt-menu { padding: var(--sp-4) var(--sp-3); gap: var(--sp-3); max-width: 96vw; }
  .gt-btn.big { min-width: 200px; width: 100%; max-width: 320px; font-size: 1rem; padding: 14px 18px; }
  .gt-lore { font-size: 0.88rem; }
  /* Touch-Mindesthöhe für normale Buttons */
  .gt-btn { min-height: 44px; padding: 11px 16px; }
  .gt-btn.small { min-height: 38px; }
}

/* ---- Niedrige Höhe (Handy quer, ~max 560px): alles bleibt im Viewport --- */
@media (max-height: 560px) {
  .gt-title { font-size: clamp(2rem, 7vh, 3.2rem); }
  .gt-sub { font-size: 0.7rem; }
  .gt-lore { display: none; }                 /* Fließtext weglassen, Platz für Buttons */
  .gt-menu { padding: var(--sp-3) var(--sp-5); gap: var(--sp-2); max-height: 96vh; }
  .gt-btncol { gap: var(--sp-2); }
  .gt-btn.big { padding: 10px 20px; }
}

/* ---- Tablet / iPad (~768–1024): Menüs angenehm breit ------------------- */
@media (min-width: 768px) and (max-width: 1024px) {
  .gt-menu { max-width: min(820px, 92vw); padding: var(--sp-6) var(--sp-7); }
}

/* ---- Touch-Geräte: größere Tap-Ziele (≥44px) für alle Interaktionen ----- */
@media (pointer: coarse) {
  .gt-ctrl-btn { width: 52px; height: 52px; font-size: 24px; }
  .gt-btn { min-height: 46px; }
  .gt-btn.small, .gt-btn.tiny { min-height: 40px; padding: 8px 14px; }
  .gt-emblem { width: 48px; height: 48px; font-size: 1.6rem; }
  .gt-swatch { width: 40px; height: 40px; }
  .gt-ctrl-btn:hover { transform: none; }     /* kein Hover-Versatz auf Touch */
}

/* ---- Bewegung reduzieren (Systemeinstellung respektieren) -------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; }
}

/* ---- Barrierefreiheit: „Große Schrift" skaliert alle rem-basierten UI --- */
html.gt-large-ui { font-size: 18.5px; }       /* Standard 16px → ~+16 % */
