:root {
  --bg: #f4efe3;
  --paper: #fffdf7;
  --ink: #1f2a1c;
  --muted: #6b7363;
  --line: #e3dccb;
  --green: #2f5d34;
  --green-2: #3f7a45;
  --wheat: #e6b23c;
  --wheat-soft: #f7e7bd;
  --soil: #8a5a34;
  --red: #b4432f;
  --gold: #d9a521;
  --silver: #9aa3a8;
  --bronze: #b0733f;
  --shadow: 0 1px 0 rgba(31, 42, 28, .04), 0 8px 24px -12px rgba(31, 42, 28, .25);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141a12;
    --paper: #1c2419;
    --ink: #eef0e6;
    --muted: #9aa48f;
    --line: #2e3a29;
    --green: #8cc47f;
    --green-2: #6fae62;
    --wheat: #e9bd52;
    --wheat-soft: #3a3320;
    --soil: #c48b5c;
    --red: #e0745f;
    --shadow: 0 8px 24px -12px rgba(0, 0, 0, .6);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 Inter, system-ui, sans-serif;
}
a { color: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
h1, h2 { font-family: "Bricolage Grotesque", Inter, sans-serif; letter-spacing: -.01em; }

/* Kopf */
.top { background: var(--green); color: #fff; }
@media (prefers-color-scheme: dark) { .top { background: #1f3a22; } }
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: 19px; }
.brand small { font-weight: 500; opacity: .75; font-size: 14px; margin-left: 4px; }
.brand-mark { display: grid; place-items: center; min-width: 36px; height: 36px; padding: 0 6px; border-radius: 10px; background: var(--wheat); color: #2a2208; font-size: 13px; }
.beta { font-size: 12px; padding: 4px 10px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 99px; white-space: nowrap; }

/* Hero */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; align-items: end; padding: 40px 0 24px; }
.hero h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.02; margin: 0 0 12px; font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--green-2); background: linear-gradient(transparent 62%, var(--wheat-soft) 62%); }
.hero p { margin: 0; color: var(--muted); max-width: 46ch; font-size: 16px; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpis.wide { grid-template-columns: repeat(4, 1fr); margin: 18px 0; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.kpi b { display: block; font-family: "Bricolage Grotesque", sans-serif; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi span { color: var(--muted); font-size: 13px; }

/* Reiter */
.tabs { display: flex; gap: 6px; margin: 8px 0 18px; flex-wrap: wrap; }
.tabs a { text-decoration: none; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--paper); font-weight: 600; font-size: 14px; }
.tabs a small { font-weight: 400; color: var(--muted); }
.tabs a.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tabs a.on small { color: inherit; opacity: .7; }

/* Ranglisten */
.boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.board { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.board header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.board h2 { font-size: 18px; margin: 0; }
.ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--wheat-soft); font-size: 18px; }
.board ol { list-style: none; margin: 0; padding: 0; }
.board li { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; padding: 8px 4px; border-top: 1px dashed var(--line); }
.board li:first-child { border-top: 0; }
.pos { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 700; font-size: 13px; color: var(--muted); }
.rank1 .pos { background: var(--gold); color: #2a2208; }
.rank2 .pos { background: var(--silver); color: #1d2124; }
.rank3 .pos { background: var(--bronze); color: #fff; }
.who { text-decoration: none; min-width: 0; }
.who strong, .who small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: var(--muted); font-size: 12px; }
.who:hover strong { color: var(--green-2); }
.val { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.flagged .val { color: var(--red); }
.val i { font-style: normal; }
.empty { grid-column: 1 / -1; padding: 30px; text-align: center; color: var(--muted); background: var(--paper); border: 1px dashed var(--line); border-radius: 16px; }

/* Hofliste */
.farms h2 { margin: 36px 0 12px; font-size: 22px; }
.farm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.farm { display: grid; grid-template-columns: 12px 1fr auto; gap: 12px; align-items: start; text-decoration: none; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.farm:hover { border-color: var(--green-2); }
.farm strong, .farm small { display: block; }
.farm small { color: var(--muted); font-size: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--line); margin-top: 6px; vertical-align: middle; }
.dot.live { background: #3fbf5a; box-shadow: 0 0 0 4px rgba(63, 191, 90, .2); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.badge { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.badge.std { background: rgba(63, 122, 69, .14); color: var(--green-2); }
.badge.mod { background: var(--wheat-soft); color: var(--soil); }
.badge.warn { background: rgba(180, 67, 47, .14); color: var(--red); }

/* Hofseite */
.back { margin: 22px 0 0; }
.back a { color: var(--muted); text-decoration: none; }
.farm-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding-top: 10px; flex-wrap: wrap; }
.farm-head h1 { font-size: clamp(28px, 4vw, 42px); margin: 0 0 4px; }
.farm-head p { margin: 2px 0; }
.muted { color: var(--muted); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { font-size: 18px; margin: 0 0 12px; }
.card h2 small { font-weight: 500; color: var(--muted); font-size: 13px; }
.card h2.mt { margin-top: 22px; }
.span2 { grid-column: 1 / -1; }
.stats { width: 100%; border-collapse: collapse; }
.stats th, .stats td { padding: 7px 0; border-top: 1px dashed var(--line); font-size: 14px; }
.stats tr:first-child th, .stats tr:first-child td { border-top: 0; }
.stats th { text-align: left; font-weight: 500; color: var(--muted); }
.stats td { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: 160px; display: block; }
.chart .line { fill: none; stroke: var(--green-2); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.chart .area { fill: var(--green-2); opacity: .12; }
.chart-legend { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span { font-size: 13px; padding: 4px 10px; border-radius: 8px; background: var(--wheat-soft); }
.flags { list-style: none; margin: 0; padding: 0; }
.flags li { padding: 6px 0; border-top: 1px dashed var(--line); color: var(--red); font-size: 14px; }
.flags li span { color: var(--muted); font-size: 12px; margin-right: 6px; }

.foot { color: var(--muted); font-size: 13px; padding: 40px 16px; }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding-top: 28px; }
  .kpis.wide { grid-template-columns: repeat(2, 1fr); }
  .cols { grid-template-columns: 1fr; }
  .boards { grid-template-columns: 1fr; }
  .beta { display: none; }
}

/* Live-Anzeige */
.live-state { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; margin-left: auto; }
.live-state i { width: 8px; height: 8px; border-radius: 50%; background: #5fdc78; animation: pulse 2s infinite; }
.live-state.off i { background: #e0745f; animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(95, 220, 120, .6); } 70% { box-shadow: 0 0 0 8px rgba(95, 220, 120, 0); } 100% { box-shadow: 0 0 0 0 rgba(95, 220, 120, 0); } }
.flash { animation: flash .8s ease-out; }
@keyframes flash { from { opacity: .55; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .live-state i, .flash { animation: none; } }

/* Benutzer-Navigation */
.usernav { display: flex; align-items: center; gap: 14px; font-size: 14px; font-weight: 600; }
.usernav a { text-decoration: none; }
.usernav form { margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; opacity: .85; }
.linkbtn:hover { opacity: 1; text-decoration: underline; }
.linkbtn.danger { color: var(--red); font-size: 13px; }
.btn-small { background: var(--wheat); color: #2a2208; padding: 6px 12px; border-radius: 99px; }
.live-state + .usernav { margin-left: 18px; }
.top .beta { display: none; }

/* Hinweise */
.notice { margin: 18px 0 0; padding: 12px 16px; border-radius: 12px; background: rgba(63, 122, 69, .14); color: var(--green-2); font-weight: 600; }
.error { margin: 10px 0; padding: 10px 14px; border-radius: 10px; background: rgba(180, 67, 47, .12); color: var(--red); font-size: 14px; }
.error a { font-weight: 700; }

/* Formulare */
.auth { max-width: 440px; margin: 40px auto; }
.auth h1 { font-size: 34px; margin: 0 0 6px; }
.form { display: grid; gap: 14px; margin: 18px 0; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.form label small { font-weight: 400; color: var(--muted); }
.form input { font: inherit; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
.form input:focus { outline: 2px solid var(--green-2); outline-offset: 1px; }
.form.inline { grid-template-columns: 1fr auto; align-items: center; }
.btn { font: inherit; font-weight: 700; padding: 11px 18px; border-radius: 10px; border: 0; background: var(--green); color: #fff; cursor: pointer; }
.btn:hover { background: var(--green-2); }
@media (prefers-color-scheme: dark) { .btn { background: var(--green-2); color: #10200f; } }
.code-input { font-family: ui-monospace, Consolas, monospace !important; font-size: 20px !important; letter-spacing: .12em; text-transform: uppercase; text-align: center; }
code { font-family: ui-monospace, Consolas, monospace; background: var(--wheat-soft); padding: 1px 6px; border-radius: 6px; }

/* Konto */
.konto-head { padding: 26px 0 8px; }
.konto-head h1 { font-size: clamp(28px, 4vw, 40px); margin: 0; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--muted); font-size: 14px; }
.card .farm-grid { margin-top: 4px; }
.farm a { text-decoration: none; }
.badge.free { background: var(--line); color: var(--muted); }
.badge.own { background: var(--green-2); color: #fff; }

@media (max-width: 760px) {
  .brand small { display: none; }
  .usernav { gap: 10px; font-size: 13px; }
  .live-state span { display: none; }
  .form.inline { grid-template-columns: 1fr; }
}
