@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,600;12..96,800&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --bg: #f4f1ec;
  --surface: #ffffff;
  --surface-2: #ebe6de;
  --text: #1c1a17;
  --muted: #7a7268;
  --line: #1c1a1714;
  --accent: #e2591c;
  --gold: #e8b335;
  --silver: #aab2bd;
  --bronze: #c27a45;
  --shadow: 0 1px 2px #0000000d, 0 8px 24px -12px #00000026;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141312;
    --surface: #1d1c1a;
    --surface-2: #272523;
    --text: #f1ece4;
    --muted: #8f877c;
    --line: #ffffff12;
    --accent: #ff7a3d;
    --shadow: 0 1px 2px #00000040, 0 8px 24px -12px #00000099;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141312;
  --surface: #1d1c1a;
  --surface-2: #272523;
  --text: #f1ece4;
  --muted: #8f877c;
  --line: #ffffff12;
  --accent: #ff7a3d;
  --shadow: 0 1px 2px #00000040, 0 8px 24px -12px #00000099;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { background: var(--bg); }

body {
  min-height: 100vh;
  color: var(--text);
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  transition: background .25s, color .25s;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px; }

.num { font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }

/* ---------- Kopf ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--text); text-decoration: none; }
.brand .marble { --size: 22px; }

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  box-shadow: var(--shadow);
}
.icon-btn:hover { background: var(--surface-2); }

.hero { padding: 32px 0 40px; }
h1 {
  font-weight: 800;
  font-size: clamp(38px, 8vw, 64px);
  line-height: .95;
  letter-spacing: -.035em;
}
h1 span { color: var(--accent); }
.sub { color: var(--muted); margin-top: 12px; font-size: 15px; }

/* ---------- Avatar / Murmel ---------- */
.avatar {
  --size: 40px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  background: var(--surface-2);
}

.marble {
  --h: 200;
  --size: 40px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  flex-shrink: 0;
  background:
    radial-gradient(circle at 32% 28%, #fff 0 6%, #ffffffaa 10%, transparent 26%),
    conic-gradient(from calc(var(--h) * 1deg) at 55% 60%,
      hsl(var(--h) 80% 45% / .95) 0 18%,
      hsl(calc(var(--h) + 40) 90% 70% / .6) 24%,
      transparent 30% 46%,
      hsl(var(--h) 85% 40% / .9) 52% 64%,
      transparent 70% 84%,
      hsl(calc(var(--h) - 30) 80% 55% / .8) 90%),
    radial-gradient(circle at 50% 55%, hsl(var(--h) 60% 88%), hsl(var(--h) 55% 30%) 95%);
  box-shadow: inset -3px -5px 8px hsl(var(--h) 60% 15% / .55), inset 3px 3px 6px #ffffff66;
}

/* ---------- Podium ---------- */
.podium {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  align-items: end;
  margin-bottom: 32px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px 12px 18px;
  text-align: center;
  box-shadow: var(--shadow);
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: up .5s both;
}
.card.first { padding-top: 28px; padding-bottom: 26px; }
.card .pic { position: relative; margin-bottom: 12px; }
.card .avatar, .card .marble { --size: 64px; box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--ring); }
.card.first .avatar, .card.first .marble { --size: 88px; }
.card .badge {
  position: absolute;
  right: -6px;
  bottom: -4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ring);
  color: #1c1a17;
  font-weight: 800;
  font-size: 14px;
  display: grid;
  place-items: center;
  border: 3px solid var(--surface);
}
.card .who { font-weight: 600; font-size: 17px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.first .who { font-size: 20px; }
.card .pts { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card.r1 { --ring: var(--gold); }
.card.r2 { --ring: var(--silver); }
.card.r3 { --ring: var(--bronze); }
.card.empty { visibility: hidden; }

/* ---------- Liste ---------- */
.list {
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.row {
  display: grid;
  grid-template-columns: 36px 40px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  animation: up .4s both;
}
.row:first-child { border-top: 0; }
.row:hover { background: var(--surface-2); }
.row .rank { color: var(--muted); font-size: 14px; text-align: right; }
.row .name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .bar { height: 4px; border-radius: 4px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.row .bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.row .score { font-weight: 700; font-size: 18px; }

@keyframes up { from { opacity: 0; transform: translateY(8px); } }

.empty-state { text-align: center; padding: 64px 20px; color: var(--muted); }

footer {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  padding: 40px 0 56px;
}
footer a { color: inherit; }

/* ---------- Admin ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 16px;
}
.panel h2 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 14px; }
.form { display: grid; grid-template-columns: 1fr 120px auto; gap: 10px; }

input {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  width: 100%;
  min-width: 0;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button.ghost { background: var(--surface-2); color: var(--text); }
button.danger { background: transparent; color: var(--accent); border-color: var(--line); }
button.small { padding: 7px 11px; font-size: 14px; }

.admin-row {
  display: grid;
  grid-template-columns: 32px 1fr 90px auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.admin-row:first-child { border-top: 0; }
.admin-row .avatar, .admin-row .marble { --size: 32px; }
.admin-row input { padding: 8px 10px; }
.admin-row .actions { display: flex; gap: 6px; }

.msg { font-size: 14px; margin-top: 10px; min-height: 1.4em; color: var(--muted); }
.msg.err { color: var(--accent); }
.hidden { display: none !important; }

/* ---------- Mobil ---------- */
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 16px 0 28px; }
  .podium { gap: 8px; }
  .card { padding: 16px 6px 14px; border-radius: 16px; }
  .card .avatar, .card .marble { --size: 48px; }
  .card.first .avatar, .card.first .marble { --size: 64px; }
  .card .who, .card.first .who { font-size: 14px; }
  .row { grid-template-columns: 24px 34px 1fr auto; gap: 10px; padding: 10px 14px; }
  .row .avatar, .row .marble { --size: 34px; }
  .form { grid-template-columns: 1fr 1fr; }
  .form button { grid-column: span 2; }
  .admin-row { grid-template-columns: 32px 1fr 80px; }
  .admin-row .actions { grid-column: 2 / -1; justify-content: flex-end; }
}
