/* =====================================================================
   DRACHENHORT — Grundgerüst
   Farbwelt: Obsidian & Schmiedeglut. Gold trägt die Zahlen,
   Glut trägt die Aktionen, Runengrün markiert alles Magische.
   ===================================================================== */

:root {
  /* Flächen */
  --obsidian:    #0a0710;
  --obsidian-2:  #120c1c;
  --slate:       #1a1226;
  --slate-hi:    #241834;
  --hairline:    #34264a;

  /* Akzente */
  --gold:        #f0c35c;
  --gold-deep:   #b8862c;
  --ember:       #ff6a2b;
  --ember-deep:  #c23c10;
  --rune:        #57e3c4;
  --arcane:      #9d6bff;
  --blood:       #d1394f;

  /* Schrift */
  --parchment:   #ece2cf;
  --muted:       #9a8fb3;
  --dim:         #6b6183;

  --font-display: 'Grenze Gotisch', 'Iowan Old Style', serif;
  --font-body:    'Spectral', Georgia, serif;
  --font-data:    'Chivo Mono', ui-monospace, 'SFMono-Regular', monospace;

  --r-sm: 4px;
  --r-md: 10px;
  --r-lg: 18px;

  --shadow-deep: 0 24px 60px -20px rgba(0,0,0,.9);
  --glow-gold:   0 0 24px -4px rgba(240,195,92,.45);
  --glow-ember:  0 0 30px -6px rgba(255,106,43,.55);

  --shell-max: 1320px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 50% -10%, #26163a 0%, transparent 60%),
    radial-gradient(900px 600px at 85% 110%, #2a1010 0%, transparent 55%),
    var(--obsidian);
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1.1;
  margin: 0 0 .4em;
}
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.4rem, 2.4vw, 2rem); }
h3 { font-size: 1.15rem; }

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--ember); }

:focus-visible {
  outline: 2px solid var(--rune);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* Zahlen immer tabellarisch — sie ändern sich zehnmal pro Sekunde */
.num, .stat__value, .cost, td.num {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

/* ---------- Hintergrund: Glutflug + Runenrad ------------------------- */
#emberfield {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: .8;
}

.runewheel {
  position: fixed;
  top: 50%; left: 50%;
  width: min(150vh, 150vw);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
  opacity: .07;
  background:
    repeating-conic-gradient(from 0deg, transparent 0 6deg, var(--gold) 6deg 6.4deg),
    radial-gradient(circle, transparent 38%, rgba(157,107,255,.5) 39%, transparent 41%);
  mask-image: radial-gradient(circle, transparent 30%, #000 42%, #000 58%, transparent 66%);
  -webkit-mask-image: radial-gradient(circle, transparent 30%, #000 42%, #000 58%, transparent 66%);
  animation: spin 240s linear infinite;
}
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* ---------- Kopfleiste ------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 1.4rem;
  padding: .65rem clamp(.8rem, 3vw, 2rem);
  background: linear-gradient(180deg, rgba(10,7,16,.96), rgba(10,7,16,.72));
  border-bottom: 1px solid var(--hairline);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: .55rem; color: var(--parchment); }
.brand__sigil { font-size: 1.5rem; filter: drop-shadow(0 0 10px rgba(255,106,43,.6)); }
.brand__word {
  font-family: var(--font-display);
  font-size: 1.5rem; font-weight: 800;
  background: linear-gradient(180deg, var(--gold) 20%, var(--ember-deep) 130%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.nav { display: flex; gap: .2rem; margin-left: auto; flex-wrap: wrap; }
.nav__link {
  display: flex; align-items: center; gap: .45rem;
  padding: .45rem .85rem;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: .95rem;
  transition: color .18s, background .18s, border-color .18s;
}
.nav__link:hover { color: var(--parchment); background: var(--slate); border-color: var(--hairline); }
.nav__link.is-active {
  color: var(--gold);
  background: linear-gradient(180deg, rgba(240,195,92,.14), rgba(240,195,92,.03));
  border-color: rgba(240,195,92,.35);
}

.account { display: flex; align-items: center; gap: .6rem; }
.account__avatar { border-radius: 50%; border: 2px solid var(--gold-deep); }
.account__name { font-weight: 600; }
.account__out { font-size: .8rem; color: var(--dim); }
.account__out:hover { color: var(--blood); }

/* ---------- Rahmen ----------------------------------------------------- */
.shell {
  position: relative; z-index: 1;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.2rem) clamp(.8rem, 3vw, 2rem) 4rem;
}

.footer {
  position: relative; z-index: 1;
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between;
  max-width: var(--shell-max); margin: 0 auto;
  padding: 1.4rem clamp(.8rem, 3vw, 2rem) 2.5rem;
  border-top: 1px solid var(--hairline);
  color: var(--dim); font-size: .82rem;
}

/* ---------- Panels ------------------------------------------------------ */
.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(36,24,52,.72), rgba(18,12,28,.88));
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-deep);
  padding: 1.2rem 1.3rem;
}
/* Ecken wie Beschläge auf einer Truhe */
.panel::before, .panel::after {
  content: ''; position: absolute; width: 14px; height: 14px;
  border: 1px solid rgba(240,195,92,.35);
  pointer-events: none;
}
.panel::before { top: 8px; left: 8px; border-right: 0; border-bottom: 0; border-radius: 4px 0 0 0; }
.panel::after  { bottom: 8px; right: 8px; border-left: 0; border-top: 0; border-radius: 0 0 4px 0; }

.panel__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  margin-bottom: .9rem; padding-bottom: .6rem;
  border-bottom: 1px solid var(--hairline);
}
.panel__head h2, .panel__head h3 { margin: 0; }
.panel__hint { color: var(--dim); font-size: .82rem; }

/* ---------- Buttons ------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .6rem 1.1rem;
  font-family: var(--font-body); font-size: .95rem; font-weight: 600;
  color: var(--parchment);
  background: linear-gradient(180deg, var(--slate-hi), var(--slate));
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .2s, border-color .2s, background .2s;
}
.btn:hover  { border-color: var(--gold-deep); box-shadow: var(--glow-gold); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .4; cursor: not-allowed; box-shadow: none; transform: none; }

.btn--gold {
  background: linear-gradient(180deg, #f7d27a, var(--gold-deep));
  color: #2a1a02; border-color: #f7d27a;
}
.btn--ember {
  background: linear-gradient(180deg, var(--ember), var(--ember-deep));
  color: #1a0a02; border-color: var(--ember);
}
.btn--ghost { background: transparent; }
.btn--danger { border-color: rgba(209,57,79,.5); color: #ffb3bd; }
.btn--danger:hover { background: rgba(209,57,79,.15); box-shadow: 0 0 24px -8px var(--blood); border-color: var(--blood); }
.btn--twitch { background: linear-gradient(180deg, #9146ff, #6b21d6); border-color: #9146ff; color: #fff; }
.btn--sm { padding: .32rem .6rem; font-size: .82rem; }
.btn--block { width: 100%; }

/* ---------- Formulare ----------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .8rem; }
.field label { font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
input[type=text], input[type=number], input[type=search], select, textarea {
  padding: .55rem .7rem;
  color: var(--parchment);
  background: rgba(10,7,16,.7);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  font-family: var(--font-body); font-size: .95rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--rune); outline: none; }
.checkline { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .9rem; }

/* ---------- Tabellen ------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th {
  text-align: left; padding: .5rem .6rem;
  font-family: var(--font-body); font-size: .74rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em; color: var(--dim);
  border-bottom: 1px solid var(--hairline);
}
.table td { padding: .55rem .6rem; border-bottom: 1px solid rgba(52,38,74,.5); }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: rgba(157,107,255,.07); }
.table .rank { font-family: var(--font-data); color: var(--dim); width: 3rem; }
.table tr:nth-child(1) .rank { color: var(--gold); }
.table tr:nth-child(2) .rank { color: #cfd3dc; }
.table tr:nth-child(3) .rank { color: #c98b52; }

.player { display: flex; align-items: center; gap: .6rem; }
.player img { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--hairline); }
.tag { font-family: var(--font-data); font-size: .74rem; color: var(--rune); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); display: inline-block; }
.dot.is-on { background: var(--rune); box-shadow: 0 0 8px var(--rune); }

/* ---------- Chips / Pills --------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .18rem .55rem;
  font-size: .76rem; letter-spacing: .04em;
  border: 1px solid var(--hairline); border-radius: 999px;
  color: var(--muted); background: rgba(10,7,16,.5);
}
.chip--gold  { color: var(--gold);  border-color: rgba(240,195,92,.4); }
.chip--rune  { color: var(--rune);  border-color: rgba(87,227,196,.35); }
.chip--blood { color: #ff8497;      border-color: rgba(209,57,79,.4); }

/* ---------- Tabs ------------------------------------------------------------- */
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tab {
  padding: .45rem .9rem;
  background: transparent; border: 1px solid transparent; border-radius: var(--r-md);
  color: var(--muted); font-family: var(--font-body); font-size: .92rem; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.tab:hover { color: var(--parchment); }
.tab.is-active {
  color: var(--gold); border-color: rgba(240,195,92,.35);
  background: linear-gradient(180deg, rgba(240,195,92,.12), transparent);
}

/* ---------- Toasts ------------------------------------------------------------ */
.toasts {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 60;
  display: flex; flex-direction: column; gap: .5rem; align-items: flex-end;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: .6rem;
  max-width: 340px; padding: .65rem .9rem;
  background: linear-gradient(180deg, var(--slate-hi), var(--obsidian-2));
  border: 1px solid var(--hairline); border-left: 3px solid var(--gold);
  border-radius: var(--r-md); box-shadow: var(--shadow-deep);
  font-size: .9rem;
  animation: toastIn .35s cubic-bezier(.2,.9,.3,1.3);
}
.toast--good { border-left-color: var(--rune); }
.toast--bad  { border-left-color: var(--blood); }
.toast--epic { border-left-color: var(--arcane); }
.toast.is-out { animation: toastOut .3s forwards; }
.toast__rune { font-size: 1.3rem; }
@keyframes toastIn  { from { opacity: 0; transform: translateX(30px) scale(.95); } }
@keyframes toastOut { to   { opacity: 0; transform: translateX(30px); } }

/* ---------- Modal --------------------------------------------------------------- */
.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 70;
  display: grid; place-items: center;
  background: rgba(5,3,9,.78); backdrop-filter: blur(6px);
  padding: 1rem;
}
.modal__box {
  width: min(520px, 100%);
  background: linear-gradient(180deg, var(--slate), var(--obsidian-2));
  border: 1px solid var(--hairline); border-radius: var(--r-lg);
  box-shadow: var(--shadow-deep);
  padding: 1.5rem;
  animation: toastIn .3s cubic-bezier(.2,.9,.3,1.2);
}
.modal__actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.2rem; }

/* ---------- Hilfsklassen ------------------------------------------------------- */
.grid { display: grid; gap: 1rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.muted { color: var(--muted); }
.dim   { color: var(--dim); }
.gold  { color: var(--gold); }
.rune  { color: var(--rune); }
.center { text-align: center; }
.stack > * + * { margin-top: .8rem; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--dim); }

.hero-line {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 7vw, 4.4rem);
  background: linear-gradient(180deg, var(--parchment) 10%, var(--gold) 55%, var(--ember-deep) 120%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

@media (max-width: 720px) {
  .nav__label { display: none; }
  .account__name { display: none; }
  .brand__word { font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .runewheel { display: none; }
}
