:root {
  --stone: #2b2b2b;
  --stone-line: #333;
  --panel: #3d3d3d;
  --border: #111;
  --green: #5dca3a;
  --gold: #e0b72b;
  --silver: #9aa5ad;
  --bronze: #a9692f;
  --red: #c0392b;
  --text: #fff;
  --muted: #b5b5b5;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Courier New', Consolas, monospace;
  color: var(--text);
  background: var(--stone);
  background-image: linear-gradient(var(--stone-line) 1px, transparent 1px), linear-gradient(90deg, var(--stone-line) 1px, transparent 1px);
  background-size: 16px 16px;
  min-height: 100vh;
  line-height: 1.4;
}
a { color: var(--green); }
.wrap { max-width: 980px; margin: 0 auto; padding: 14px; }

/* Kopf und Navigation */
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.logo { color: var(--green); font-weight: bold; font-size: 20px; letter-spacing: 1px; text-shadow: 2px 2px 0 #000; text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; }
.nav a, .tab {
  display: inline-block; padding: 5px 10px; background: #555; color: #fff; text-decoration: none; cursor: pointer;
  border: 2px solid var(--border); box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .2); font: inherit; font-size: 13px;
}
.nav a.on, .tab.on { background: var(--green); color: #111; font-weight: bold; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.live::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); }
.live.off::before { background: var(--red); box-shadow: none; }

/* Panels, Buttons */
.mc-card { background: var(--panel); border: 3px solid var(--border); box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .12); padding: 12px; margin-bottom: 12px; }
.mc-card h2, .mc-card h3 { margin: 0 0 8px; text-shadow: 2px 2px 0 #000; }
.mc-btn {
  font: inherit; font-weight: bold; font-size: 13px; color: #fff; background: #6b6b6b; cursor: pointer; padding: 6px 12px;
  border: 2px solid var(--border); box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .3), inset -2px -2px 0 rgba(0, 0, 0, .4);
  text-decoration: none; display: inline-block;
}
.mc-btn:hover { filter: brightness(1.15); }
.mc-btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.mc-btn--green { background: var(--green); color: #111; }
.mc-btn--red { background: var(--red); }
.mc-btn--gold { background: var(--gold); color: #111; }
input.mc-input, select.mc-input, textarea.mc-input {
  font: inherit; background: #111; color: #fff; border: 2px solid #555; padding: 6px 8px; width: 100%;
}
input.mc-input.num { width: 64px; text-align: center; }
.msg { padding: 8px 10px; border: 2px solid var(--border); margin: 8px 0; background: #222; }
.msg.err { background: #5a1f1a; }
.msg.ok { background: #1f4d1a; }
.muted { color: var(--muted); }

/* Kennzahlen */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 3px solid var(--border); padding: 8px; text-align: center; }
.stat b { display: block; font-size: 22px; color: var(--green); text-shadow: 2px 2px 0 #000; }
.stat span { font-size: 11px; color: var(--muted); text-transform: uppercase; }

/* Podest */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 8px; margin: 16px 0 18px; }
.podium .col { text-align: center; flex: 1; max-width: 220px; min-width: 0; }
.podium .nm { font-weight: bold; margin: 4px 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 2px 2px 0 #000; }
.podium .pt { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.podium .head { width: 56px; height: 56px; }
.mc-block {
  display: flex; align-items: flex-start; justify-content: center; font-weight: bold; font-size: 28px; padding-top: 8px;
  border: 3px solid var(--border); box-shadow: inset -5px -5px 0 rgba(0, 0, 0, .35), inset 5px 5px 0 rgba(255, 255, 255, .25); text-shadow: 2px 2px 0 #000;
}
.mc-block--gold { background: var(--gold); height: 120px; }
.mc-block--silver { background: var(--silver); height: 86px; }
.mc-block--bronze { background: var(--bronze); height: 64px; }
.podium .empty { opacity: .5; }

/* Zeilen */
.mc-row {
  display: flex; align-items: center; gap: 8px; background: var(--panel); border: 2px solid var(--border);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .12); padding: 5px 8px; margin-bottom: 3px; font-size: 14px;
}
.mc-row .rk { width: 38px; color: var(--muted); }
.mc-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-row .col { width: 56px; text-align: right; }
.mc-row.head-row { background: #222; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.mc-row.top1 .rk { color: var(--gold); font-weight: bold; }
.mc-row.top2 .rk { color: var(--silver); font-weight: bold; }
.mc-row.top3 .rk { color: var(--bronze); font-weight: bold; }
.mc-row.out { opacity: .5; }
.head { width: 24px; height: 24px; image-rendering: pixelated; flex: none; background: #222; }
.divider { margin: 14px 0 6px; color: var(--muted); font-size: 12px; text-transform: uppercase; }

/* Runden-Seite */
.rounds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.kit-img { display: block; width: 100%; height: auto; background: #222; border: 2px solid var(--border); }
.kit-ph { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; color: var(--muted); background: #222; border: 2px solid var(--border); }
table.set { width: 100%; border-collapse: collapse; font-size: 15px; }
table.set td { padding: 7px 10px; border-bottom: 1px solid #222; }
table.set tr:nth-child(odd) td { background: rgba(0, 0, 0, .18); }
table.set td:last-child { text-align: right; font-weight: bold; }
td.val-on { color: #7CFC8A; }
td.val-off { color: #ff8a7a; }

/* Runden-Seite */
.round-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.round-head h2 { margin: 0; }
.round-body { display: grid; grid-template-columns: minmax(240px, 1fr) 1fr; gap: 18px; align-items: start; }
.round-body h3 { margin: 0 0 8px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; text-shadow: none; }
.badge { display: inline-block; padding: 2px 8px; border: 2px solid var(--border); font-size: 11px; font-weight: bold; background: #555; }
.badge.running { background: var(--gold); color: #111; }
.badge.completed { background: var(--green); color: #111; }

/* Helfer */
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.toolbar .grow { flex: 1; min-width: 160px; }
.mc-row .kills { width: 34px; text-align: center; font-weight: bold; }
.mc-row.win .name::after { content: ' 🏆'; }

@media (max-width: 720px) {
  .rounds { grid-template-columns: 1fr; }
  .round-body { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .mc-row .hide-sm { display: none; }
  /* Helfer-Zeilen: Name oben, Buttons darunter, damit Namen nicht abgeschnitten werden */
  .hrow { flex-wrap: wrap; }
  .hrow .name { flex: 1 1 calc(100% - 90px); }
  .hrow .mc-btn { flex: 1 1 0; }
  .mc-block--gold { height: 100px; }
  .mc-block--silver { height: 72px; }
  .mc-block--bronze { height: 54px; }
  .podium .head { width: 40px; height: 40px; }
}

[hidden] { display: none !important; }

/* Seitenauswahl */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; font-size: 13px; }
.pager select.pager-size { width: auto; }
.pager-nav { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.pager-nav .mc-btn { padding: 4px 10px; }
.pager-page { min-width: 54px; text-align: center; }

/* Admin: Rundenkarten breiter, damit Einstellungswerte lesbar bleiben */
.rounds.rounds-wide { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
table.set td input.mc-input { min-width: 150px; text-align: right; }
