/* ============================================================ Genkidama */

:root {
  --bg:        #05070f;
  --bg-2:      #0a0f1e;
  --panel:     rgba(18, 26, 46, 0.72);
  --panel-2:   rgba(12, 18, 34, 0.9);
  --line:      rgba(120, 170, 220, 0.14);
  --line-2:    rgba(120, 170, 220, 0.28);

  --txt:       #e8eefc;
  --txt-dim:   #93a3c4;
  --txt-mute:  #64748b;

  --energy:    #67e8f9;
  --energy-2:  #38bdf8;
  --energy-3:  #a5f3fc;
  --gold:      #fbbf24;
  --danger:    #f87171;
  --ok:        #4ade80;

  --r:         16px;
  --r-sm:      10px;
  --shadow:    0 18px 50px rgba(0, 0, 0, 0.55);
  --glow:      0 0 40px rgba(103, 232, 249, 0.28);
  --wrap:      1120px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(1100px 620px at 50% -12%, #10203f 0%, transparent 62%),
    radial-gradient(800px 520px at 88% 8%, #131a3a 0%, transparent 60%),
    var(--bg);
  color: var(--txt);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.centered {
  display: grid;
  place-items: center;
  padding: 24px;
}

/* Sternenfeld */
.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1px 1px at 12% 22%, rgba(255,255,255,.55) 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 12%, rgba(255,255,255,.4)  50%, transparent 51%),
    radial-gradient(1px 1px at 33% 68%, rgba(255,255,255,.35) 50%, transparent 51%),
    radial-gradient(1px 1px at 62% 82%, rgba(255,255,255,.3)  50%, transparent 51%),
    radial-gradient(1px 1px at 88% 54%, rgba(255,255,255,.4)  50%, transparent 51%),
    radial-gradient(1px 1px at 20% 90%, rgba(255,255,255,.3)  50%, transparent 51%),
    radial-gradient(2px 2px at 46% 30%, rgba(165,243,252,.35) 50%, transparent 51%);
  animation: twinkle 7s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .55; } to { opacity: 1; } }

/* ------------------------------------------------------------- Struktur */

.wrap {
  position: relative;
  z-index: 1;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 22px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.wrap.narrow { max-width: 760px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.page-head { display: flex; flex-direction: column; gap: 2px; }
.page-title { margin: 0; font-size: 24px; letter-spacing: -.4px; font-weight: 650; }

/* -------------------------------------------------------------- Topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 20px;
  background: rgba(5, 8, 17, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--txt);
  font-weight: 650;
  letter-spacing: -.3px;
}
.brand-orb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 32%, #fff 0%, var(--energy-3) 22%, var(--energy) 48%, var(--energy-2) 100%);
  box-shadow: 0 0 14px rgba(103, 232, 249, .8);
  animation: pulse 3.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1);    box-shadow: 0 0 14px rgba(103,232,249,.8); }
  50%      { transform: scale(1.12); box-shadow: 0 0 22px rgba(103,232,249,1); }
}

.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--txt-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background .18s, color .18s;
}
.nav a:hover { color: var(--txt); background: rgba(255,255,255,.05); }
.nav a.active { color: #04121a; background: var(--energy); font-weight: 650; }

.btn-add { flex: none; }

/* --------------------------------------------------------------- Karten */

.card {
  position: relative;
  z-index: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head h2 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: .2px; }

/* -------------------------------------------------------- Genkidama-Orb */

.orb-stage {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 340px;
  margin-top: 6px;
}
#orb {
  width: 100%;
  max-width: 460px;
  height: 340px;
  display: block;
}
.orb-readout {
  position: absolute;
  bottom: 6px;
  text-align: center;
  pointer-events: none;
}
.orb-total {
  font-size: clamp(30px, 7vw, 46px);
  font-weight: 200;
  letter-spacing: -1.5px;
  color: #fff;
  text-shadow: 0 0 34px rgba(103, 232, 249, .65);
  font-variant-numeric: tabular-nums;
}
.orb-total .cur { font-size: .48em; margin-left: 6px; color: var(--energy-3); font-weight: 400; }
.orb-sub { font-size: 12px; letter-spacing: 2.6px; text-transform: uppercase; color: var(--txt-mute); }

/* ------------------------------------------------------------- Levelbar */

.levelbar { position: relative; z-index: 1; }
.levelbar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 14px;
}
.lvl-chip {
  padding: 3px 11px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--energy), var(--energy-2));
  color: #04121a;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .3px;
}
.progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  overflow: hidden;
  border: 1px solid var(--line);
}
.progress i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--energy-2), var(--energy), #fff);
  box-shadow: 0 0 18px rgba(103,232,249,.75);
  transition: width 1.1s cubic-bezier(.22,1,.36,1);
}

/* ---------------------------------------------------------------- Tiles */

.tiles {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.tile {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tile-k { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--txt-mute); }
.tile-v { font-size: 20px; font-weight: 600; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.tile-v small { font-size: 12px; font-weight: 400; color: var(--txt-dim); }

/* -------------------------------------------------------------- Formular */

.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--txt-dim);
  font-weight: 500;
}

input[type=text], input[type=password], input[type=date], input[type=number],
input[type=search], input[type=email], select, textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: rgba(4, 8, 18, .7);
  color: var(--txt);
  font: inherit;
  transition: border-color .16s, box-shadow .16s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--energy);
  box-shadow: 0 0 0 3px rgba(103, 232, 249, .16);
}
input::placeholder, textarea::placeholder { color: #4b5b78; }
textarea { resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--txt-dim) 50%), linear-gradient(135deg, var(--txt-dim) 50%, transparent 50%); background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
input[type=color] { padding: 3px; height: 40px; cursor: pointer; }

.hint { font-size: 12px; color: var(--txt-mute); font-weight: 400; }

.check { flex-direction: row; align-items: center; gap: 9px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--energy); }
.check span { color: var(--txt); }
.check.inline { white-space: nowrap; }

.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* --------------------------------------------------------------- Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s, filter .16s, background .16s, border-color .16s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.99); }

.btn-primary {
  background: linear-gradient(135deg, var(--energy-3), var(--energy) 42%, var(--energy-2));
  color: #04121a;
  box-shadow: 0 6px 22px rgba(56, 189, 248, .3);
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost {
  background: rgba(255,255,255,.05);
  border-color: var(--line-2);
  color: var(--txt);
}
.btn-ghost:hover { background: rgba(255,255,255,.1); }

.btn-danger { background: rgba(248,113,113,.13); border-color: rgba(248,113,113,.4); color: #fca5a5; }
.btn-danger:hover { background: rgba(248,113,113,.22); }

.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

.link { color: var(--energy); text-decoration: none; font-size: 13px; font-weight: 500; }
.link:hover { text-decoration: underline; }
.strong-link { color: var(--txt); text-decoration: none; font-weight: 600; }
.strong-link:hover { color: var(--energy); }

/* ------------------------------------------------------------ Quick-Add */

.quickadd { display: flex; flex-direction: column; gap: 11px; }

.preset-box { display: flex; flex-direction: column; gap: 8px; }
.preset-hint { font-size: 12px; color: var(--txt-mute); }
.presets { display: flex; flex-wrap: wrap; gap: 7px; }
.preset {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: rgba(255,255,255,.04);
  color: var(--txt-dim);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.preset:hover { border-color: var(--energy); color: var(--txt); background: rgba(103,232,249,.1); }

/* ----------------------------------------------------------------- Feed */

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed li {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.feed li:last-child { border-bottom: 0; padding-bottom: 0; }

.dot {
  flex: none;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 17px;
  background: color-mix(in srgb, var(--c) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
}
.feed-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.feed-title { color: var(--txt); text-decoration: none; font-weight: 550; }
.feed-title:hover { color: var(--energy); }
.feed-meta { font-size: 12px; color: var(--txt-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-val { flex: none; font-weight: 650; color: var(--energy-3); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- Tabelle */

.table-card { padding: 6px 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--txt-mute);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.table td { padding: 12px 16px; border-bottom: 1px solid rgba(120,170,220,.08); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255,255,255,.03); }
.table .num { text-align: right; }
.table .strong { font-weight: 650; color: var(--energy-3); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; color: var(--txt-dim); }
.sub { font-size: 12px; color: var(--txt-mute); margin-top: 2px; }
.only-sm { display: none; }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: color-mix(in srgb, var(--c) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 38%, transparent);
  color: var(--txt);
  white-space: nowrap;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.filters input, .filters select { width: auto; min-width: 130px; flex: 0 1 auto; }
.filters input[type=search] { flex: 1 1 200px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; }

/* ---------------------------------------------------------------- Charts */

.chart { width: 100%; height: 240px; }
.chart-sm { height: 150px; }
.chart-lg { height: 300px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }

.range-tabs { display: flex; gap: 4px; }
.range-tabs button {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--txt-dim);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.range-tabs button.active { background: var(--energy); border-color: var(--energy); color: #04121a; font-weight: 650; }

.legend { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--txt-dim); }
.legend li { display: flex; align-items: center; gap: 7px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend b { color: var(--txt); font-weight: 600; }

.chart-tip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  padding: 7px 11px;
  border-radius: 9px;
  background: rgba(6, 12, 26, .96);
  border: 1px solid var(--line-2);
  color: var(--txt);
  font-size: 12.5px;
  white-space: nowrap;
  box-shadow: 0 8px 26px rgba(0,0,0,.5);
  transform: translate(-50%, -130%);
  opacity: 0;
  transition: opacity .12s;
}
.chart-tip.on { opacity: 1; }
.chart-tip b { color: var(--energy-3); }

/* --------------------------------------------------------------- Ranking */

.ranking { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.ranking li { display: grid; grid-template-columns: 22px 1fr 1fr auto; align-items: center; gap: 10px; font-size: 13.5px; }
.rank { color: var(--txt-mute); font-variant-numeric: tabular-nums; font-size: 12px; }
.rank-name { color: var(--txt); text-decoration: none; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-name:hover { color: var(--energy); }
.rank-bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--energy-2), var(--energy)); border-radius: 999px; }
.rank-val { color: var(--txt-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-val small { color: var(--txt-mute); }

.record { display: flex; flex-direction: column; gap: 3px; }
.record-k { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--txt-mute); }
.record-v { font-size: 30px; font-weight: 250; letter-spacing: -1px; color: var(--gold); }

/* ------------------------------------------------------------ Kategorien */

.cats { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.cat-row {
  display: grid;
  grid-template-columns: 58px 1fr 52px 74px auto auto auto;
  gap: 8px;
  align-items: center;
}
.cat-new { padding-top: 14px; border-top: 1px dashed var(--line-2); grid-template-columns: 58px 1fr 52px 74px auto; }
.cat-row input { padding: 8px 10px; }
.i-icon { text-align: center; }
.cat-stat { font-size: 12px; color: var(--txt-mute); white-space: nowrap; }

/* -------------------------------------------------------------- Diverses */

.muted { color: var(--txt-dim); }
.muted.small { font-size: 12.5px; color: var(--txt-mute); }
.empty { color: var(--txt-mute); text-align: center; padding: 22px 10px; margin: 0; line-height: 1.6; }
.lead { font-size: 16px; }

.flash {
  position: relative;
  z-index: 5;
  max-width: var(--wrap);
  margin: 14px auto 0;
  padding: 11px 16px;
  border-radius: var(--r-sm);
  font-size: 14px;
  border: 1px solid;
  animation: slideIn .3s cubic-bezier(.22,1,.36,1);
}
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.flash-ok   { background: rgba(74,222,128,.1);  border-color: rgba(74,222,128,.35);  color: #bbf7d0; }
.flash-err  { background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.35); color: #fecaca; }
.flash-warn { background: rgba(251,191,36,.1);  border-color: rgba(251,191,36,.35);  color: #fde68a; }

.danger-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-color: rgba(248,113,113,.22); }
.danger-card p { margin: 2px 0 0; font-size: 13px; }

.foot {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 26px 20px 40px;
  color: var(--txt-mute);
  font-size: 12.5px;
}
.foot a { color: var(--txt-dim); }

/* ------------------------------------------------------------- Auth/Setup */

.auth-card { width: min(430px, 100%); text-align: center; display: flex; flex-direction: column; gap: 14px; }
.auth-card.wide { width: min(560px, 100%); text-align: left; }
.auth-card h1 { margin: 0; font-size: 25px; font-weight: 300; letter-spacing: 3px; text-transform: uppercase; }
.auth-card.wide h1 { letter-spacing: -.3px; text-transform: none; font-weight: 600; font-size: 22px; }
.auth-card p { margin: 0; }

.auth-orb {
  width: 86px; height: 86px;
  margin: 4px auto 2px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff 0%, var(--energy-3) 20%, var(--energy) 45%, rgba(56,189,248,.25) 78%, transparent 100%);
  box-shadow: 0 0 60px rgba(103, 232, 249, .55);
  animation: float 5s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-9px) scale(1.05); }
}

.steps { list-style: none; display: flex; gap: 8px; margin: 0; padding: 0; font-size: 12.5px; color: var(--txt-mute); }
.steps li { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); }
.steps li.now { color: #04121a; background: var(--energy); border-color: var(--energy); font-weight: 650; }
.steps li.ok  { color: var(--ok); border-color: rgba(74,222,128,.4); }

.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: rgba(255,255,255,.07); padding: 1px 6px; border-radius: 5px; }

/* --------------------------------------------------------------- Responsive */

@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .cat-row { grid-template-columns: 50px 1fr 46px; grid-auto-rows: auto; }
  .cat-row .i-sort, .cat-row .cat-stat { grid-column: span 1; }
}

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .brand-name { font-size: 15px; }
  .nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .nav a { padding: 7px 12px; font-size: 13px; }
  .btn-add { margin-left: auto; padding: 8px 14px; }
  .btn-add span { display: none; }

  .wrap { padding: 16px 14px 70px; gap: 16px; }
  .card { padding: 16px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .row { grid-template-columns: 1fr; }
  .orb-stage { min-height: 300px; }
  #orb { height: 300px; }

  .hide-sm { display: none; }
  .only-sm { display: block; }
  .table th, .table td { padding: 10px 12px; }

  .filters { gap: 8px; }
  .filters input, .filters select { min-width: 0; flex: 1 1 46%; }
  .ranking li { grid-template-columns: 20px 1fr auto; }
  .ranking .rank-bar { display: none; }
}

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