:root {
  --bg: #0a0d16;
  --bg2: #111626;
  --card: #151b2e;
  --card2: #1b2238;
  --line: #2a3352;
  --text: #e8e6df;
  --muted: #9aa0b4;
  --gold: #ffb412;
  --gold2: #ffe27a;
  --orange: #ff6a00;
  --tank: #4f8fe8;
  --heal: #4fd18b;
  --dd: #e8604f;
  --open: #7d8296;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 50% -200px, #1f3266 0%, transparent 70%),
    radial-gradient(800px 400px at 100% 0, #4a2608 0%, transparent 60%),
    var(--bg);
  min-height: 100vh;
}
h1, h2 { font-family: Georgia, "Times New Roman", serif; letter-spacing: .02em; }
h2 { margin: 0 0 14px; font-size: 1.25rem; color: var(--gold2); }

/* ---------- Kopf ---------- */
.hero { border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(10,13,22,0) 0%, rgba(10,13,22,.6) 100%); }
.hero-inner { max-width: 1200px; margin: 0 auto; padding: 36px 20px 28px; display: flex; gap: 22px; align-items: center; }
.logo { width: 88px; height: auto; filter: drop-shadow(0 6px 22px rgba(255,140,20,.35)); }
.hero h1 {
  margin: 0; font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.05;
  background: linear-gradient(100deg, #ffe814, var(--gold) 50%, var(--orange));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .12em; display: flex; gap: 10px; align-items: center; }
.badge-forever {
  padding: 2px 10px; border-radius: 999px; font-weight: 700; letter-spacing: .08em; color: #0b1834;
  background: linear-gradient(180deg, var(--gold2), var(--gold));
}
.sub { margin: 4px 0 0; color: var(--muted); }
.forever { margin-left: auto; height: 118px; width: auto; filter: drop-shadow(0 8px 24px rgba(40,140,220,.35)); }

main { max-width: 1200px; margin: 0 auto; padding: 24px 20px 40px; display: grid; gap: 22px; }
.panel { background: rgba(21,27,46,.75); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; backdrop-filter: blur(6px); }

/* ---------- Kennzahlen ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat h3 { margin: 0 0 10px; font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 600; }
.big { font-size: 2.4rem; font-weight: 700; font-family: Georgia, serif; color: var(--gold2); line-height: 1; }
.big small { font-size: .95rem; color: var(--muted); font-family: system-ui, sans-serif; font-weight: 400; margin-left: 6px; }
.rolebar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--line); margin: 14px 0 10px; }
.rolebar span { display: block; height: 100%; transition: width .4s; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .88rem; color: var(--muted); }
.legend b { color: var(--text); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.r-Tank { background: var(--tank); } .r-Heiler { background: var(--heal); } .r-DD { background: var(--dd); } .r-Offen { background: var(--open); }

.classbars { display: grid; gap: 6px; }
.classbar { display: grid; grid-template-columns: 22px 92px 1fr 22px; gap: 8px; align-items: center; font-size: .85rem; }
.classbar img { width: 22px; height: 22px; border-radius: 4px; }
.classbar .track { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.classbar .fill { height: 100%; border-radius: 99px; }
.classbar .cn { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.classbar .n { text-align: right; color: var(--muted); }
.classbar.zero img { filter: grayscale(1); opacity: .45; }

/* ---------- Werkzeugleiste ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 18px; }
.toolbar input[type=search] {
  flex: 1 1 260px; background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 14px; font: inherit;
}
.toolbar input[type=search]:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--bg2); color: var(--muted); border-radius: 999px;
  padding: 5px 12px; font: inherit; font-size: .85rem; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.chip img { width: 18px; height: 18px; border-radius: 4px; }
.chip:hover { color: var(--text); border-color: #3c4870; }
.chip[aria-pressed=true] { color: var(--bg); background: var(--gold); border-color: var(--gold); font-weight: 600; }
.chip.icon-only { padding: 3px; }
.chip.icon-only img { width: 24px; height: 24px; }
.chip.icon-only[aria-pressed=true] { background: var(--gold); }

/* ---------- Charkarten ---------- */
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.card {
  position: relative; background: linear-gradient(135deg, var(--card2), var(--card));
  border: 1px solid var(--line); border-left: 4px solid var(--cc, var(--open));
  border-radius: 12px; padding: 14px 14px 12px; display: grid; gap: 10px;
  transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,.35), 0 0 0 1px color-mix(in srgb, var(--cc, #555) 35%, transparent); }
.card-head { display: flex; gap: 12px; align-items: center; }
.avatar { position: relative; width: 52px; height: 52px; flex: none; }
.avatar .cls { width: 52px; height: 52px; border-radius: 10px; border: 2px solid var(--cc, var(--line)); box-shadow: 0 0 14px color-mix(in srgb, var(--cc, #000) 35%, transparent); }
.avatar .race { position: absolute; right: -6px; bottom: -6px; width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--card); }
.avatar .placeholder { width: 52px; height: 52px; border-radius: 10px; border: 2px dashed var(--line); display: grid; place-items: center; color: var(--muted); font-size: 1.4rem; }
.who { min-width: 0; }
.who .name { font-family: Georgia, serif; font-size: 1.2rem; font-weight: 700; color: var(--cc, var(--text)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .meta { color: var(--muted); font-size: .85rem; }
.role {
  margin-left: auto; align-self: flex-start; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; color: #0a0d16;
}
.role.Tank { background: var(--tank); } .role.Heiler { background: var(--heal); } .role.DD { background: var(--dd); } .role.Offen { background: var(--open); }

.rows { display: grid; gap: 6px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pill {
  display: flex; gap: 8px; align-items: center; min-width: 0;
  background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.04); border-radius: 8px; padding: 4px 8px 4px 4px; font-size: .86rem;
}
.pill img { width: 24px; height: 24px; border-radius: 5px; flex: none; }
.pill span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill .ph { width: 24px; height: 24px; border-radius: 5px; flex: none; background: var(--line); display: grid; place-items: center; font-size: .75rem; color: var(--muted); }
.pill.muted { color: var(--muted); }
.pill .k { display: block; font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; line-height: 1.1; }
.note { margin: 0; font-size: .86rem; color: #c9c4b4; font-style: italic; border-left: 2px solid var(--gold); padding-left: 8px; overflow-wrap: anywhere; }
.card-actions { display: flex; gap: 6px; justify-content: flex-end; }
.card-actions .btn { padding: 4px 10px; font-size: .78rem; }
.empty { color: var(--muted); text-align: center; padding: 30px; grid-column: 1 / -1; }

/* ---------- Berufe ---------- */
.prof-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.prof { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.prof img { width: 40px; height: 40px; border-radius: 8px; }
.prof .pn { font-weight: 600; }
.prof .pw { font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.prof.missing { border-style: dashed; }
.prof.missing img { filter: grayscale(1); opacity: .4; }
.prof.missing .pw { color: var(--dd); }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px; padding: 9px 16px;
  border: 1px solid var(--line); background: var(--card2); color: var(--text);
}
.btn:hover { border-color: #46548a; }
.btn-primary { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #1a1405; border-color: #b8892f; }
.btn-primary:hover { filter: brightness(1.08); border-color: #b8892f; }
.btn-danger { background: #3a1517; border-color: #6d2a2e; color: #ffb4b4; }
.btn:disabled { opacity: .5; cursor: wait; }

/* ---------- Dialog ---------- */
dialog {
  width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0;
  background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
dialog::backdrop { background: rgba(4,6,12,.75); backdrop-filter: blur(3px); }
form, .linkbox { padding: 22px; display: grid; gap: 14px; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; font-size: .85rem; color: var(--muted); }
.field legend { padding: 0; margin-bottom: 6px; }
.field input, .field textarea, .copyrow input {
  font: inherit; font-size: 1rem; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.field[disabled] { opacity: .4; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.opt {
  font: inherit; font-size: .85rem; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 9px; padding: 4px 10px 4px 4px;
}
.opt img { width: 26px; height: 26px; border-radius: 6px; }
.opt.txt { padding: 6px 12px; color: var(--muted); }
.opt:hover { border-color: #46548a; }
.opt[aria-pressed=true] { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 18%, var(--card)); box-shadow: 0 0 0 1px var(--gold) inset; }
.opt[aria-pressed=true].txt { color: var(--text); }
.error { margin: 0; min-height: 1.2em; color: #ff8a80; font-size: .9rem; }
.actions { display: flex; gap: 10px; align-items: center; }
.spacer { flex: 1; }
.copyrow { display: flex; gap: 8px; }
.copyrow input { flex: 1; min-width: 0; font-size: .85rem; }
.hint { color: var(--muted); font-size: .85rem; margin: 0; }
.linkbox p { margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--card2); border: 1px solid var(--gold); color: var(--text); padding: 10px 18px; border-radius: 10px; transition: .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

footer { max-width: 1200px; margin: 0 auto; padding: 10px 20px 40px; color: var(--muted); font-size: .8rem; display: flex; justify-content: space-between; }

@media (max-width: 640px) {
  .hero-inner { flex-wrap: wrap; gap: 14px; padding-top: 24px; }
  .logo { width: 64px; }
  .hero-inner > div { flex: 1; min-width: 0; }
  .forever { height: 64px; margin-left: 0; }
  .hero .btn-primary { margin-left: 0; width: 100%; }
  .two { grid-template-columns: 1fr; }
  .roster { grid-template-columns: 1fr; }
}

/* ---------- Reiter ---------- */
[hidden] { display: none !important; }
.tabs { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; gap: 4px; }
.tabs a {
  color: var(--muted); text-decoration: none; font-weight: 600; padding: 10px 16px; border-radius: 10px 10px 0 0;
  border: 1px solid transparent; border-bottom: 0; display: inline-flex; gap: 8px; align-items: center;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current=true] { color: var(--gold2); background: rgba(21,27,46,.85); border-color: var(--line); }
.tabs .count:not(:empty) { background: var(--gold); color: #1a1405; border-radius: 99px; font-size: .72rem; padding: 0 7px; line-height: 1.5; }

/* ---------- Umfrage ---------- */
.survey { max-width: 860px; width: 100%; margin: 0 auto; }
.survey-intro { white-space: pre-line; color: #cfcbbf; margin: 0 0 18px; }
.banner { margin: 0 0 18px; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--heal) 14%, var(--card)); border: 1px solid color-mix(in srgb, var(--heal) 40%, transparent); }
#survey-form { padding: 0; gap: 12px; }
.sq { border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 14px 16px 16px; margin: 0; min-width: 0; }
.sq legend { float: left; width: 100%; padding: 0; margin-bottom: 8px; font-weight: 600; color: var(--text); }
.sq legend + * { clear: both; }
.req { color: var(--dd); }
.sq-hint { margin: 0 0 10px; color: var(--muted); font-size: .85rem; white-space: pre-line; }
.sq input:not([type]), .sq textarea, .sq .sq-other-text {
  width: 100%; font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px;
}
.sq input:focus, .sq textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.sq-opts { display: grid; gap: 6px; }
.sq-opt {
  display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 9px; cursor: pointer;
  background: var(--bg2); border: 1px solid transparent;
}
.sq-opt:hover { border-color: var(--line); }
.sq-opt:has(input:checked) { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, var(--bg2)); }
.sq-opt:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.sq-opt input[type=radio], .sq-opt input[type=checkbox] { accent-color: var(--gold); width: 18px; height: 18px; flex: none; margin: 0; }
.sq-other .sq-other-text { padding: 6px 10px; }
.sq-section { margin: 14px 0 0; font-family: Georgia, serif; color: var(--gold2); font-size: 1.15rem; border-bottom: 1px solid var(--line); padding-bottom: 6px; }

/* ---------- Auswertung ---------- */
.eval-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.eval-head h2 { margin: 0; }
.ev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.ev-grid .wide { grid-column: 1 / -1; }
.ev-block { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.ev-block h3 { margin: 0 0 6px; font-size: .95rem; }
.ev-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 26px; gap: 10px; align-items: center; font-size: .86rem; padding: 3px 0; }
.ev-label { overflow-wrap: anywhere; }
.ev-row .track { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.ev-row .fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold2)); border-radius: 99px; }
.ev-row .n { text-align: right; color: var(--muted); }
.ev-other { margin-top: 8px; font-size: .85rem; display: grid; gap: 2px; }
.ev-who { color: var(--gold2); font-weight: 600; font-style: normal; display: block; font-size: .8rem; }
.ev-other .ev-who { display: inline; }
.ev-text { margin: 6px 0 0; padding: 6px 10px; border-left: 2px solid var(--gold); background: var(--bg2); border-radius: 0 8px 8px 0; white-space: pre-line; font-size: .9rem; overflow-wrap: anywhere; }
.heat-wrap { overflow-x: auto; }
.heat { border-collapse: separate; border-spacing: 4px; font-size: .85rem; }
.heat th { color: var(--muted); font-weight: 600; text-align: left; padding: 2px 6px; white-space: nowrap; }
.heat thead th { text-align: center; }
.heat td {
  width: 52px; height: 34px; text-align: center; border-radius: 6px; font-weight: 700; color: #1a1405;
  background: color-mix(in srgb, var(--gold) calc(var(--a) * 100%), var(--bg2));
}

@media (max-width: 640px) {
  .tabs { padding: 0 12px; overflow-x: auto; }
  .tabs a { padding: 8px 12px; }
  .ev-grid { grid-template-columns: 1fr; }
}
