/* Spelloria Wiki. Farben aus dem Spiel (client/scripts/systems/ui_kit.gd):
   tiefes Nachtblau, Gold als Kante, Edelsteinviolett als Akzent. */

@font-face {
  font-family: 'Cinzel';
  src: url('/static/Cinzel-VF.ttf') format('truetype');
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --bg: #0d0e16;
  --bg-2: #141625;
  --panel: #1a1d31;
  --panel-2: #222640;
  --line: #34395c;
  --text: #e6e7ef;
  --dim: #9a9db2;
  --gold: #f5cc5c;
  --gold-hi: #ffe680;
  --gold-edge: #b8923a;
  --gem: #a873f2;
  --good: #72d98c;
  --bad: #f26b6b;
  --r-common: #b8bfcc;
  --r-rare: #5999f5;
  --r-valuable: #47c78f;
  --r-epic: #b36ef0;
  --r-legendary: #f5b34d;
  --r-mystic: #d9590f;
  --r-ultimate: #fa734d;
  --r-universal: #6fe0e8;
  --radius: 10px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html { scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg) radial-gradient(ellipse at top, #1f1a3a 0%, var(--bg) 60%) fixed;
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-hi); text-decoration: underline; }
h1, h2, h3, .brand { font-family: 'Cinzel', Georgia, serif; letter-spacing: 0.02em; }
h1 { color: var(--gold); font-size: 2rem; margin: 0 0 0.4em; line-height: 1.2; }
h2 { color: var(--gold); font-size: 1.35rem; margin: 1.8em 0 0.6em; padding-bottom: 0.25em; border-bottom: 1px solid var(--line); }
h3 { font-size: 1.1rem; margin: 1.4em 0 0.4em; }
code { background: var(--panel-2); padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.9em; }
img.px { image-rendering: pixelated; }

/* Kopfleiste */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: rgba(13, 14, 22, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--gold-edge);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.15rem; color: var(--gold); white-space: nowrap; }
.brand img { width: 32px; height: 32px; }
.brand:hover { text-decoration: none; }
.search { flex: 1; max-width: 420px; margin-left: auto; position: relative; }
.search input {
  width: 100%; padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 15px;
}
.search input:focus { outline: none; border-color: var(--gold); }
.search .results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); max-height: 60vh; overflow: auto; display: none;
}
.search .results.open { display: block; }
.search .results a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; color: var(--text); }
.search .results a:hover, .search .results a.sel { background: var(--panel-2); text-decoration: none; }
.search .results img { width: 28px; height: 28px; object-fit: contain; }
.search .results small { color: var(--dim); margin-left: auto; }
.lang { color: var(--dim); font-size: 14px; white-space: nowrap; }
.menu-btn { display: none; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 6px 10px; font-size: 18px; }

/* Rahmen */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); max-width: 1320px; margin: 0 auto; }
nav.side { position: sticky; top: 57px; align-self: start; height: calc(100vh - 57px); overflow: auto; padding: 20px 12px 40px 16px; border-right: 1px solid var(--line); }
nav.side h4 { font-family: 'Cinzel', serif; color: var(--dim); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; margin: 18px 0 6px; }
nav.side h4:first-child { margin-top: 0; }
nav.side a { display: block; padding: 4px 10px; border-radius: 6px; color: var(--text); font-size: 15px; }
nav.side a:hover { background: var(--panel); text-decoration: none; }
nav.side a.on { background: var(--panel-2); color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); }
main { padding: 28px 32px 80px; min-width: 0; }
.crumbs { font-size: 14px; color: var(--dim); margin-bottom: 8px; }
.lead { font-size: 1.08rem; color: #cfd1e0; max-width: 72ch; }
main p, main li { max-width: 78ch; }
footer { border-top: 1px solid var(--line); color: var(--dim); font-size: 13px; padding: 20px 32px 40px; grid-column: 2; }

/* Bausteine */
.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 230, 128, 0.08);
  padding: 16px 18px;
}
.gold-frame { border-color: var(--gold-edge); }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
a.card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; color: var(--text); transition: transform 0.12s, border-color 0.12s; }
a.card:hover { transform: translateY(-2px); border-color: var(--gold); text-decoration: none; }
a.card img { width: 96px; height: 96px; object-fit: contain; }
a.card .name { font-weight: 600; }
a.card .sub { color: var(--dim); font-size: 13px; }
.tile { display: flex; gap: 14px; align-items: center; }
.tile img { width: 56px; height: 56px; object-fit: contain; flex: none; }
.hero-art { width: 100%; max-height: 240px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--gold-edge); margin: 6px 0 14px; }
aside.tip { border-left: 3px solid var(--gem); background: rgba(168, 115, 242, 0.1); padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 14px 0; max-width: 78ch; }

.table-wrap { overflow-x: auto; margin: 10px 0 18px; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--panel-2); color: var(--gold); font-weight: 600; position: sticky; top: 0; white-space: nowrap; cursor: default; }
th.sortable { cursor: pointer; }
th.sortable::after { content: ' ⇅'; color: var(--dim); font-size: 11px; }
tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); }
tbody tr:hover { background: rgba(245, 204, 92, 0.06); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td img { width: 36px; height: 36px; object-fit: contain; vertical-align: middle; }
td .with-icon { display: flex; align-items: center; gap: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; color: var(--text); }
button.chip { cursor: pointer; font: inherit; font-size: 13px; }
button.chip.on { border-color: var(--gold); color: var(--gold); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0; }
.filters input[type=search] { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); min-width: 200px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 10px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.stat b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.two { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 24px; align-items: start; }
.portrait { text-align: center; }
.portrait img { width: 100%; max-width: 240px; image-rendering: pixelated; }
.two { grid-template-columns: 260px minmax(0, 1fr); }
/* Gegnerbilder tragen wie im Spiel viel Rand (Figur zwischen 27 und 74 Prozent
   der Hoehe); der Rahmen schneidet auf die Figur zu. */
.sprite { display: block; overflow: hidden; margin: 0 auto; }
.sprite img { display: block; width: 100%; height: 100%; object-fit: contain; transform: scale(1.75); transform-origin: 50% 52%; image-rendering: pixelated; }
.portrait .sprite { width: 220px; height: 220px; max-width: 100%; }
a.card .sprite { width: 96px; height: 96px; }
a.card .sprite img { width: 100%; height: 100%; }
.anim { width: 240px; height: 240px; margin: 0 auto; background-repeat: no-repeat; background-size: auto 100%; image-rendering: pixelated; }

.r-common { color: var(--r-common); }
.r-rare { color: var(--r-rare); }
.r-valuable { color: var(--r-valuable); }
.r-epic { color: var(--r-epic); }
.r-legendary { color: var(--r-legendary); }
.r-mystic { color: var(--r-mystic); }
.r-ultimate { color: var(--r-ultimate); }
.r-universal { color: var(--r-universal); }
.pill { font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.muted { color: var(--dim); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.tree-branch { margin-bottom: 18px; }
.node { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.node:last-child { border-bottom: none; }
.node img { width: 48px; height: 48px; flex: none; image-rendering: pixelated; }
.node .meta { color: var(--dim); font-size: 13px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  nav.side { position: fixed; top: 0; left: 0; width: 280px; height: 100vh; height: 100dvh; padding-top: 76px; background: var(--bg-2); z-index: 19; transform: translateX(-100%); transition: transform 0.2s; border-right: 1px solid var(--gold-edge); }
  body.nav-open nav.side { transform: none; }
  .menu-btn { display: block; }
  main { padding: 20px 16px 60px; }
  footer { grid-column: 1; padding: 20px 16px 40px; }
  .two { grid-template-columns: 1fr; }
  .brand span { display: none; }
  .lang { display: none; }
  h1 { font-size: 1.6rem; }
}
