/* Lunaria – Basis der öffentlichen Seite
   Tokens, Reset, Typografie, Buttons, Formulare, Badges, Ladezustände.
   Bewusst schlicht: neutraler dunkler Grund, eine Akzentfarbe, Rahmen statt Leuchteffekte. */

:root {
  color-scheme: dark;

  /* Farben der Spielmodi / Ränge – nur als Markierung, nie als Fläche */
  --c-purple: #b39dfa;
  --c-blue: #6aa9f4;
  --c-pink: #ef7fb6;
  --c-yellow: #eec643;
  --c-green: #74c365;
  --c-red: #ef7b73;
  --c-purple-soft: rgba(179, 157, 250, .12);
  --c-blue-soft: rgba(106, 169, 244, .12);
  --c-pink-soft: rgba(239, 127, 182, .12);
  --c-yellow-soft: rgba(238, 198, 67, .12);
  --c-green-soft: rgba(116, 195, 101, .12);
  --c-red-soft: rgba(239, 123, 115, .12);

  /* Flächen */
  --bg-0: #111214;
  --bg-1: #151618;
  --bg-2: #1a1b1e;
  --surface: #1b1c1f;
  --surface-2: #232428;
  --surface-solid: #1b1c1f;
  --border: #2d2f34;
  --border-strong: #42454c;

  /* Text */
  --text: #ecebe8;
  --text-muted: #b4b4af;
  --text-dim: #8e8f8a;
  --text-on-accent: #0f1d0a;

  /* Akzent (Gras-Grün), sparsam: Hauptbutton, aktive Navigation, Links */
  --accent: #82c35b;
  --accent-hover: #95d16f;
  --accent-soft: rgba(130, 195, 91, .12);
  --focus: #eec643;

  /* Schrift */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --font-display: var(--font-sans);
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;

  --fs-xs: .8rem;
  --fs-s: .9rem;
  --fs-m: 1rem;
  --fs-l: 1.125rem;
  --fs-xl: clamp(1.25rem, 1.1rem + .6vw, 1.5rem);
  --fs-2xl: clamp(1.6rem, 1.3rem + 1.4vw, 2.25rem);
  --fs-3xl: clamp(2.2rem, 1.6rem + 3vw, 3.4rem);

  /* Form */
  --radius-s: 4px;
  --radius: 6px;
  --radius-l: 8px;
  --shadow: 0 8px 24px rgba(0, 0, 0, .35);

  /* Bewegung (nur für Hover/Fokus, keine Deko-Animationen) */
  --ease: ease;
  --dur: 120ms;
}

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

[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-1);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-m);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }

h1, h2, h3, h4 {
  margin: 0 0 .5em;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.01em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-l); }

p { margin: 0 0 1em; text-wrap: pretty; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { color: var(--accent-hover); }

::selection { background: rgba(130, 195, 91, .35); color: #fff; }

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

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.mono { font-family: var(--font-mono); }
.num { font-variant-numeric: tabular-nums; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  min-height: 42px;
  padding: .55em 1em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  font-size: var(--fs-s);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn:hover { color: var(--text); border-color: #5a5e66; background: #2a2b30; }
.btn:active { background: #202125; }
.btn:disabled { opacity: .55; }
.btn svg { width: 1.1em; height: 1.1em; flex: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
}
.btn-primary:hover {
  color: var(--text-on-accent);
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-primary:active { background: #74b44f; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-small { min-height: 32px; padding: .3em .75em; font-size: var(--fs-xs); }

/* Karten */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  padding: .1em .5em;
  border-radius: 3px;
  border: 1px solid currentColor;
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
.badge-purple { color: var(--c-purple); background: var(--c-purple-soft); }
.badge-blue { color: var(--c-blue); background: var(--c-blue-soft); }
.badge-pink { color: var(--c-pink); background: var(--c-pink-soft); }
.badge-yellow { color: var(--c-yellow); background: var(--c-yellow-soft); }
.badge-green { color: var(--c-green); background: var(--c-green-soft); }
.badge-red { color: var(--c-red); background: var(--c-red-soft); }

.dot {
  display: inline-block;
  width: .55em; height: .55em;
  border-radius: 50%;
  background: var(--text-dim);
  flex: none;
}
.dot-online { background: var(--c-green); }
.dot-offline { background: var(--text-dim); }
.dot-warn { background: var(--c-yellow); }

/* Formulare */
.field { display: grid; gap: .4rem; }
.field-label { font-weight: 600; font-size: var(--fs-s); }
.field-label .req { color: var(--c-red); margin-left: .15em; }
.field-hint { font-size: var(--fs-xs); color: var(--text-dim); }
.field-error { font-size: var(--fs-xs); color: var(--c-red); font-weight: 600; }
.field-error:empty { display: none; }

.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: .6em .8em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  background: var(--bg-0);
  color: var(--text);
  transition: border-color var(--dur) var(--ease);
}
.textarea { min-height: 150px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--text-dim); }
.input:hover, .select:hover, .textarea:hover { border-color: #5a5e66; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 0;
  border-color: var(--border-strong);
}
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] {
  border-color: var(--c-red);
}
.select { appearance: none; padding-right: 2.4em;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.select option { background: var(--surface-solid); }

.check { display: flex; gap: .65rem; align-items: flex-start; font-size: var(--fs-s); }
.check input { width: 1.15rem; height: 1.15rem; margin-top: .2rem; accent-color: var(--accent); flex: none; }

/* Hinweise */
.alert {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .8rem 1rem;
  border-radius: var(--radius-s);
  border: 1px solid;
  border-left-width: 3px;
  font-size: var(--fs-s);
}
.alert svg { width: 1.2rem; height: 1.2rem; flex: none; margin-top: .1rem; }
.alert-error { border-color: rgba(239, 123, 115, .5); background: var(--c-red-soft); color: #f8cdc9; }
.alert-warn { border-color: rgba(238, 198, 67, .5); background: var(--c-yellow-soft); color: #f6e3a3; }
.alert-info { border-color: rgba(106, 169, 244, .5); background: var(--c-blue-soft); color: #c6dcf8; }
.alert-success { border-color: rgba(116, 195, 101, .5); background: var(--c-green-soft); color: #cde9c6; }

/* Ladezustände */
.skeleton {
  display: block;
  border-radius: var(--radius-s);
  background: var(--surface-2);
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}
.skeleton-text { height: .9em; margin: .45em 0; }
.skeleton-title { height: 1.4em; width: 55%; margin-bottom: .8em; }
.skeleton-circle { border-radius: 50%; }
@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}

.spinner {
  width: 1.1em; height: 1.1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .75s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .skeleton { animation: none; }
  .spinner { animation: spin 1.5s linear infinite !important; animation-iteration-count: infinite !important; }
}
