/* Level-Up-Arena – Gestaltung (keine externen Schriften, alles lokal) */
@font-face { font-family: "Inter"; src: url(fonts/inter-Regular.woff) format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url(fonts/inter-SemiBold.woff) format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url(fonts/inter-Bold.woff) format("woff"); font-weight: 700 800; font-display: swap; }
/* Cinzel wird bei der Einrichtung auf den Server geladen (fonts/cinzel.ttf); sonst Georgia */
@font-face { font-family: "Cinzel"; src: url(fonts/cinzel.ttf) format("truetype"); font-weight: 400 900; font-display: swap; }

:root {
  --bg: #17110D; --bar: #1E1611; --panel: #241A14; --panel2: #2B1D15; --line: #3A2C22; --line2: #5A4636;
  --text: #EADBC0; --muted: #B9A68A; --dim: #8F7E66;
  --gold: #E0B04A; --gold2: #F2CD78; --red: #C2453A; --green: #6FBF73; --bad: #D98A7F;
  --silver: #C9C3B8; --bronze: #C08451;
  --display: "Cinzel", Georgia, "Times New Roman", serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --r: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 16px; line-height: 1.45; min-height: 100vh; }
a { color: var(--gold); }
a:hover { color: var(--gold2); }
h1, h2, h3 { margin: 0; line-height: 1.15; }
.display { font-family: var(--display); font-weight: 800; letter-spacing: .5px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.good { color: var(--green); }
.bad { color: var(--bad); }
.goldtxt { color: var(--gold); }
.kicker { font-size: 13px; letter-spacing: 2px; color: var(--gold); font-weight: 700; text-transform: uppercase; }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }

/* Kopfzeile */
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 14px 24px; background: var(--bar); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: 2px; color: var(--gold); text-decoration: none; }
.brand small { font-family: var(--body); font-size: 13px; letter-spacing: 0; color: var(--muted); font-weight: 400; margin-left: 8px; }
.mainnav { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mainnav a, .linkbtn { padding: 10px 14px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 15px; min-height: 44px; display: inline-flex; align-items: center; }
.mainnav a.on { background: var(--line); }
.linkbtn { background: none; border: 0; font: inherit; font-weight: 600; cursor: pointer; }
.linkbtn.muted { color: var(--muted); font-weight: 400; }
form.inline { display: inline; margin: 0; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 28px 20px 40px; display: flex; flex-direction: column; gap: 24px; }
.wrap.wide { max-width: 1240px; }
.wrap.narrow { max-width: 900px; }
.foot { text-align: center; font-size: 13px; color: var(--dim); padding: 0 16px 28px; }
.foot a { color: var(--muted); }

/* Karten */
.card { padding: 24px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); }
.card.hero { background: var(--panel2); border: 2px solid var(--gold); }
.card.alert { background: var(--panel2); border: 1px solid var(--red); }
.card h2 { font-size: 20px; margin-bottom: 14px; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.grid.tiles { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 14px; }
.tile { padding: 18px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.tile .lbl { font-size: 13px; color: var(--muted); }
.tile .big { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile .sub { font-size: 13px; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* Knöpfe */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 24px; min-height: 48px; border-radius: 14px; border: 0; background: var(--line); color: var(--text); font: 600 16px var(--body); text-decoration: none; cursor: pointer; }
.btn:hover { color: var(--text); filter: brightness(1.12); }
.btn.fight { background: var(--red); color: #FFF6E8; font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: 1px; padding: 18px 34px; }
.btn.fight:hover { color: #FFF6E8; }
.btn.gold { background: var(--gold); color: #17110D; font-weight: 700; }
.btn.gold:hover { color: #17110D; }
.btn.ghost { background: transparent; border: 1px solid var(--line2); color: var(--muted); }
.btn.danger { background: var(--red); color: #FFF6E8; }
.btn.sm { padding: 8px 14px; min-height: 38px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .5; cursor: default; }
.pill { display: inline-flex; padding: 8px 14px; border-radius: 999px; background: var(--line); border: 1px solid var(--gold); font-weight: 600; font-size: 14px; }
.pill.off { background: transparent; border: 1px dashed var(--line2); color: var(--dim); font-weight: 400; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line2); color: var(--text); text-decoration: none; font-size: 15px; min-height: 44px; display: inline-flex; align-items: center; }
.chip.on { background: var(--gold); color: #17110D; border-color: var(--gold); font-weight: 700; }
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--panel); }
.tabs a { padding: 10px 16px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 600; }
.tabs a.on { background: var(--line); color: var(--text); }

/* Formulare */
label { font-weight: 600; font-size: 15px; display: block; margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], input[type=url], input[type=datetime-local], select, textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line2); background: var(--bg); color: var(--text); font: 16px var(--body); }
textarea { min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.field { margin-bottom: 14px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.err { color: #FFB4A8; background: #3A1D18; border: 1px solid var(--red); padding: 12px 14px; border-radius: 12px; }
.flash { max-width: 1080px; margin: 16px auto 0; padding: 12px 16px; border-radius: 12px; background: #1F3320; border: 1px solid var(--green); }
.flash.error { background: #3A1D18; border-color: var(--red); }

/* Fortschrittsbalken */
.bar { height: 14px; border-radius: 7px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--gold); }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.login .box { width: 100%; max-width: 520px; display: flex; flex-direction: column; align-items: center; gap: 26px; text-align: center; }
.login h1 { font-family: var(--display); font-weight: 800; font-size: clamp(30px, 7vw, 44px); letter-spacing: 3px; color: var(--gold); }
.login form { width: 100%; display: flex; flex-direction: column; gap: 14px; padding: 26px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); text-align: left; }
.login input.code { font-size: 26px; letter-spacing: 3px; text-align: center; text-transform: uppercase; }

/* Arena */
.hello { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; }
.hello .who { flex: 1 1 260px; }
.hello .name { font-family: var(--display); font-weight: 800; font-size: clamp(26px, 5vw, 34px); }
.hello .prog { flex: 1 1 260px; }
.champ { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--bar); }
.champ.me { outline: 2px solid var(--gold); }
.medal { width: 34px; height: 34px; flex: none; border-radius: 17px; display: flex; align-items: center; justify-content: center; font-weight: 700; background: #5A4636; color: var(--text); }
.medal.m1 { background: var(--gold); color: #17110D; } .medal.m2 { background: var(--silver); color: #17110D; } .medal.m3 { background: var(--bronze); color: #17110D; }
.champ .n { flex: 1; min-width: 0; } .champ .n b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.statline { display: flex; flex-wrap: wrap; gap: 26px; }
.statline .v { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.countdown { display: inline-flex; gap: 8px; align-items: center; padding: 8px 14px; border-radius: 10px; background: var(--bar); border: 1px solid var(--line2); font-size: 14px; }

/* Kampf */
.fightbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 12px 20px; background: var(--bar); border-bottom: 2px solid var(--red); }
.clock { padding: 6px 18px; border-radius: 12px; background: var(--panel2); border: 2px solid var(--gold); text-align: center; }
.clock .t { font-size: 34px; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; line-height: 1.1; }
.pbbar { height: 8px; background: var(--line); } .pbbar > i { display: block; height: 100%; background: var(--green); transition: width 1s linear; }
.pbbar.over > i { background: var(--red); }
.pbnote { padding: 6px 20px; font-size: 13px; color: var(--muted); background: var(--bar); }
.fightmain { padding: 14px 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.appframe { width: 100%; height: calc(100vh - 190px); min-height: 560px; border: 0; border-radius: 14px; background: #fff; }
body.infight .topbar { display: none; }
body.bigview #live { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; overflow: auto; }
body.bigview #live .pbnote, body.bigview #live .tiny.dim { display: none; }
body.bigview #live .fightmain { flex: 1; padding: 6px 8px 8px; }
body.bigview .appframe { height: calc(100vh - 150px); min-height: 0; border-radius: 8px; }
#live:fullscreen { background: var(--bg); overflow: auto; }
.prefight { max-width: 720px; margin: 40px auto; text-align: center; display: flex; flex-direction: column; gap: 18px; align-items: center; padding: 0 16px; }
.finishbox { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.finishbox form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; flex: 1 1 420px; }
.finishbox input { max-width: 280px; }

/* Ergebnis / Siegerehrung */
.victory { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.victory .time { font-size: clamp(56px, 12vw, 80px); font-weight: 700; color: var(--gold); line-height: 1; font-variant-numeric: tabular-nums; }
.victory h1 { font-family: var(--display); font-weight: 800; font-size: clamp(32px, 6vw, 46px); }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.podium > div { padding: 16px 10px; border-radius: 16px 16px 0 0; text-align: center; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; min-width: 0; }
.podium .p1 { background: #33261A; border-top: 4px solid var(--gold); min-height: 210px; }
.podium .p2 { background: #2B2620; border-top: 4px solid var(--silver); min-height: 160px; }
.podium .p3 { background: #2B2119; border-top: 4px solid var(--bronze); min-height: 130px; }
.podium .pl { font-size: 32px; font-weight: 800; }
.podium .p1 .pl { color: var(--gold); font-size: 40px; } .podium .p2 .pl { color: var(--silver); } .podium .p3 .pl { color: var(--bronze); }
.podium b { overflow-wrap: anywhere; }
.reveal { transition: opacity .6s, transform .6s; }
.reveal.hide { opacity: 0; transform: translateY(12px); pointer-events: none; }
.award { display: flex; flex-wrap: wrap; gap: 22px; align-items: center; }
.award svg { flex: none; }

/* Rangliste */
.lb { display: flex; flex-direction: column; gap: 8px; }
.lb .r { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; background: var(--panel); border: 2px solid transparent; }
.lb .r.me { background: var(--line); border-color: var(--gold); }
.lb .pos { width: 40px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb .nm { flex: 1; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.lb .cl { width: 70px; color: var(--muted); }
.lb .tm { width: 70px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.duel .r { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 12px; background: var(--panel); flex-wrap: wrap; }
.duel .track { flex: 1 1 200px; height: 16px; border-radius: 8px; background: var(--bar); overflow: hidden; }
.duel .track i { display: block; height: 100%; background: #8F6A3A; }
.duel .r:first-child .track i { background: var(--gold); }

/* Tabellen (Lehrer) */
.tablebox { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 15px; }
table.t th { text-align: left; color: var(--muted); font-size: 13px; font-weight: 600; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px 8px; border-bottom: 1px solid #2E231B; vertical-align: middle; }
table.t tr:hover td { background: #1F1712; }
.list .li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid #2E231B; align-items: center; }

/* Präsentationsmodus (Beamer) */
body.present { overflow: hidden; }
.stage { height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4vh; padding: 4vh 4vw; text-align: center; cursor: pointer; }
.stage h1 { font-family: var(--display); font-weight: 800; font-size: 6vh; }
.stage .podium { width: min(90vw, 1300px); }
.stage .podium b { font-size: 3.4vh; } .stage .podium .p1 b { font-size: 4.2vh; }
.stage .podium .p1 { min-height: 34vh; } .stage .podium .p2 { min-height: 26vh; } .stage .podium .p3 { min-height: 20vh; }
.stage .podium .pl { font-size: 6vh; }
.stage .runners { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.4vh 2vw; width: min(90vw, 1300px); font-size: 2.6vh; }
.stage .runners div { padding: 1vh 1.4vw; border-radius: 12px; background: var(--panel); text-align: left; }
.stage .hint { position: fixed; bottom: 2vh; right: 2vw; }

/* Druck: Code-Kärtchen */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; }
.cardprint { border: 1px dashed #999; padding: 6mm; display: flex; gap: 5mm; align-items: center; break-inside: avoid; background: #fff; color: #111; min-height: 52mm; }
.cardprint img { width: 30mm; height: 30mm; }
.cardprint .t { font-family: var(--display); font-weight: 800; font-size: 13pt; color: #8a5a00; }
.cardprint .c { font: 700 20pt/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 1px; margin: 2mm 0; }
.cardprint .n { font-size: 11pt; }
@media print {
  body { background: #fff; color: #111; }
  .topbar, .noprint, .flash, .foot { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  @page { size: A4; margin: 10mm; }
}

@media (max-width: 640px) {
  .topbar { padding: 10px 14px; }
  .brand { font-size: 18px; }
  .mainnav a, .linkbtn { padding: 8px 10px; font-size: 14px; }
  .wrap { padding: 20px 16px 32px; }
  .card { padding: 18px; }
  .lb .cl { width: 48px; }
  .btn.fight { font-size: 19px; padding: 16px 24px; width: 100%; }
  .podium > div { padding: 12px 6px; }
}
@media (max-width: 640px) { .topbar { position: static; } }
