/* Hulkify me – Prexletics-Stil: Braun, Bordeaux, Karamell. Schrift Poppins. (Variablennamen stammen aus dem ersten Entwurf.) */
:root {
  --black: #5e1a30;
  --green: #4a2c22;
  --green-deep: #2b1a14;
  --green-line: #6b4536;
  --gold: #c9a58a;
  --gold-light: #e8cdb6;
  --gold-dark: #8a5f45;
  --bone: #f8ece4;
  --bone-dim: #cdb6a8;
  --bad: #ef7a55;
  --display: 'Poppins', system-ui, sans-serif;
  --ui: 'Poppins', system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--green-deep);
  color: var(--bone);
  font: 400 16px/1.5 var(--ui);
  -webkit-tap-highlight-color: transparent;
}
.sprite { position: absolute; width: 0; height: 0; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.05; margin: 0; letter-spacing: .01em; }
p { margin: 0; }
a { color: var(--gold-light); }

.app {
  max-width: 520px; margin: 0 auto;
  padding: calc(var(--safe-t) + 16px) 16px calc(96px + var(--safe-b));
}
.boot { display: grid; place-items: center; min-height: 70dvh; }
.boot-arm { width: 120px; height: 120px; border-radius: 50%; }

/* ---------- Kopf ---------- */
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.head-mark { width: 52px; height: 52px; flex: none; border-radius: 50%; }

.head h1 { font-size: 22px; color: var(--gold); }
.head p { color: var(--bone-dim); font-size: 16px; }

/* ---------- Das Abzeichen mit der Tageszahl ---------- */
.plate {
  position: relative; margin: 8px auto 20px; width: min(280px, 74vw); aspect-ratio: 1;
  border-radius: 50%; background: var(--black);
  display: grid; place-items: center; text-align: center;
  box-shadow: 0 0 0 4px var(--gold), 0 0 0 9px var(--black), 0 0 0 11px var(--gold-dark), 0 18px 40px rgba(0,0,0,.55);
}
.plate::before { content: ''; position: absolute; inset: 14px; border-radius: 50%; border: 1.5px dashed var(--gold-dark); }
.plate svg.ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.plate svg.ring text { font-family: var(--display); font-size: 15px; fill: var(--gold); letter-spacing: 3px; }
.plate-num {
  font-family: var(--display); font-weight: 800; color: var(--gold); line-height: .9;
  font-size: clamp(76px, 26vw, 118px);
  letter-spacing: -.03em; text-shadow: 0 6px 18px rgba(0,0,0,.45);
}
.plate-sub { color: var(--bone-dim); font-size: 17px; margin-top: 6px; }
.plate-sub b { color: var(--bone); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 2px solid var(--gold-dark); border-bottom: 2px solid var(--gold-dark); margin-bottom: 22px; }
.stats div { padding: 10px 4px; text-align: center; }
.stats div + div { border-left: 1px solid var(--green-line); }
.stats b { display: block; font-family: var(--display); font-weight: 800; font-size: 26px; color: var(--bone); }
.stats span { font-size: 15px; color: var(--bone-dim); }

/* ---------- Knöpfe ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  min-height: 58px; padding: 12px 18px; border: 0; border-radius: 4px;
  background: var(--gold); color: var(--black);
  font: 600 19px/1 var(--ui); letter-spacing: .02em;
  box-shadow: 0 4px 0 var(--gold-dark), 0 5px 0 var(--black);
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--gold-dark), 0 2px 0 var(--black); }
.btn svg { width: 26px; height: 26px; }
.btn[disabled] { opacity: .5; }
.btn-quiet { background: transparent; color: var(--gold-light); box-shadow: none; border: 2px solid var(--gold-dark); min-height: 50px; font-size: 20px; }
.btn-quiet:active { transform: none; background: rgba(212,167,44,.1); box-shadow: none; }
.btn-danger { background: transparent; color: var(--bad); border: 2px solid var(--bad); box-shadow: none; font-size: 19px; min-height: 46px; }
.link { background: none; border: 0; padding: 6px 0; color: var(--gold-light); text-decoration: underline; text-underline-offset: 3px; font-size: 18px; }
.private { display: flex; gap: 8px; align-items: flex-start; color: var(--bone-dim); font-size: 16px; margin: 12px 2px 0; }
.private svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--gold); }

/* ---------- Abschnitte ---------- */
.block { margin-top: 28px; }
.block > h2 { font-size: 22px; color: var(--gold); margin-bottom: 4px; }
.block > p.hint { color: var(--bone-dim); font-size: 17px; margin-bottom: 12px; }

.manual { display: grid; grid-template-columns: 54px 1fr 54px; gap: 8px; align-items: stretch; margin-bottom: 10px; }
.manual button.step { border: 2px solid var(--gold-dark); background: var(--black); border-radius: 4px; color: var(--gold); font: 800 28px/1 var(--display); }
.manual input {
  width: 100%; min-width: 0; text-align: center; border: 2px solid var(--gold-dark); border-radius: 4px;
  background: var(--black); color: var(--bone); font: 800 34px/1 var(--display); padding: 8px 4px;
}
.manual input::-webkit-inner-spin-button { -webkit-appearance: none; }
.quick { display: flex; gap: 8px; margin-bottom: 10px; }
.quick button { flex: 1; border: 1px solid var(--green-line); background: var(--green); border-radius: 4px; padding: 8px 0; color: var(--bone); font-weight: 500; }

.log { list-style: none; margin: 10px 0 0; padding: 0; }
.log li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--green-line); }
.log b { font-family: var(--display); font-weight: 800; font-size: 22px; min-width: 52px; color: var(--bone); }
.log span { flex: 1; color: var(--bone-dim); font-size: 17px; }
.log button { background: none; border: 0; color: var(--bone-dim); text-decoration: underline; font-size: 16px; padding: 6px; }

/* ---------- Formular ---------- */
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-weight: 500; margin-bottom: 4px; }
.field small { display: block; color: var(--bone-dim); font-size: 15px; margin-top: 4px; }
.field input {
  width: 100%; padding: 13px 14px; border: 2px solid var(--gold-dark); border-radius: 4px;
  background: var(--black); color: var(--bone); font-size: 21px; font-weight: 500;
}
.err { color: var(--bad); font-weight: 500; min-height: 1.4em; margin: 4px 0 10px; }

/* ---------- Willkommen ---------- */
.welcome { text-align: center; padding-top: 12px; }
.emblem { width: min(240px, 64vw); height: auto; margin: 0 auto 18px; display: block; border-radius: 50%; box-shadow: 0 12px 30px rgba(0,0,0,.45); }


.welcome h1 { font-size: clamp(42px, 13vw, 58px); color: var(--gold); letter-spacing: -.01em; }
.welcome .lead { font-size: 18px; font-weight: 400; color: var(--bone); margin: 10px auto 26px; max-width: 26ch; }
.welcome form { text-align: left; }
.code-card {
  border: 3px double var(--gold); background: var(--black); padding: 18px; text-align: center; margin: 18px 0;
}
.code-card code { display: block; font: 800 clamp(24px, 8vw, 32px)/1.2 var(--display); color: var(--gold); letter-spacing: .04em; user-select: all; margin: 8px 0; }
.code-card p { color: var(--bone-dim); font-size: 17px; }

/* ---------- Rangliste ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 2px solid var(--gold-dark); border-radius: 4px; overflow: hidden; margin-bottom: 14px; }
.seg button { border: 0; background: var(--black); padding: 11px; font-weight: 600; font-size: 20px; color: var(--bone-dim); }
.seg button[aria-pressed="true"] { background: var(--gold); color: var(--black); }
.period { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.period h2 { font-size: 21px; color: var(--bone); text-align: center; flex: 1; }
.period small { display: block; font: 400 13px/1.2 var(--ui); color: var(--bone-dim); margin-top: 3px; }
.period button { width: 46px; height: 46px; border: 2px solid var(--gold-dark); background: var(--black); color: var(--gold); border-radius: 4px; font: 800 22px/1 var(--display); }
.period button[disabled] { opacity: .3; }
.rank { list-style: none; padding: 0; margin: 0; }
.rank li {
  display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 6px; background: var(--green); border-left: 4px solid var(--green-line);
}
.rank li.me { border-left-color: var(--gold); background: #6b2238; }
.rank .pos { font: 800 26px/1 var(--display); color: var(--bone-dim); text-align: center; }
.rank li.first { background: var(--gold); color: var(--black); border-left-color: var(--black); }
.rank li.first .pos, .rank li.first .sum, .rank li.first small { color: var(--black); }
.rank .who { font-weight: 600; font-size: 21px; overflow-wrap: anywhere; }
.rank small { display: block; font-weight: 500; font-size: 15px; color: var(--bone-dim); }
.rank .sum { font: 800 26px/1 var(--display); color: var(--gold); }
.empty { text-align: center; color: var(--bone-dim); padding: 28px 10px; border: 2px dashed var(--green-line); }

/* ---------- Medaillen ---------- */
.medals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 10px; }
.medal { background: none; border: 0; padding: 0; text-align: center; color: var(--bone); }
.medal svg { width: 100%; max-width: 104px; aspect-ratio: 1; display: block; margin: 0 auto 4px; }
.medal .m-name { display: block; font-weight: 500; font-size: 16px; line-height: 1.15; }
.medal .m-count { display: block; font: 800 18px/1.2 var(--display); color: var(--gold); }
.medal.locked { color: var(--bone-dim); }
.medal.locked .m-count { color: var(--green-line); }
.medal-info { margin-top: 18px; padding: 14px; background: var(--black); border-left: 4px solid var(--gold); min-height: 76px; }
.medal-info b { display: block; font-size: 20px; color: var(--gold); }

/* ---------- Ich ---------- */
.me-list { list-style: none; padding: 0; margin: 0 0 8px; }
.me-list li { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--green-line); }
.me-list b { font-family: var(--display); font-weight: 800; color: var(--gold); }
.steps { margin: 6px 0 0; padding-left: 22px; }
.steps li { margin-bottom: 6px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--green-line); }
.switch input { width: 26px; height: 26px; accent-color: var(--gold); }
.foot { margin-top: 36px; color: var(--bone-dim); font-size: 15px; text-align: center; }

/* ---------- Admin ---------- */
.adm-user { background: var(--green); padding: 12px; margin-bottom: 8px; border-left: 4px solid var(--gold-dark); }
.adm-user h3 { font-family: var(--ui); font-weight: 600; font-size: 21px; }
.adm-user p { color: var(--bone-dim); font-size: 16px; }
.adm-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.adm-actions button { border: 1px solid var(--gold-dark); background: var(--black); color: var(--gold-light); padding: 6px 10px; border-radius: 3px; font-size: 16px; }
.adm-actions button.del { color: var(--bad); border-color: var(--bad); }
.adm-entries { list-style: none; padding: 0; margin: 8px 0 0; font-size: 16px; }
.adm-entries li { display: flex; gap: 8px; align-items: center; padding: 5px 0; border-top: 1px solid var(--green-line); }
.adm-entries li span { flex: 1; color: var(--bone-dim); }
.adm-entries li b { min-width: 46px; }
.adm-entries button { border: 0; background: none; color: var(--gold-light); text-decoration: underline; padding: 4px; }
.adm-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.adm-row input { flex: 1; min-width: 90px; padding: 8px; background: var(--black); border: 1px solid var(--gold-dark); color: var(--bone); border-radius: 3px; font-size: 17px; }

/* ---------- Leiste unten ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--black); border-top: 3px solid var(--gold);
  padding-bottom: var(--safe-b);
}
.tabs button { background: none; border: 0; padding: 9px 0 8px; color: var(--bone-dim); display: grid; justify-items: center; gap: 2px; font-size: 12px; font-weight: 500; }
.tabs svg { width: 26px; height: 26px; }
.tabs button[aria-current="page"] { color: var(--gold); }
.tabs button[aria-current="page"] span { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* ---------- Kamera ---------- */
.cam { position: fixed; inset: 0; z-index: 30; background: var(--black); overflow: hidden; }
.cam video, .cam canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam video { opacity: .85; }
.cam-top { position: absolute; top: calc(var(--safe-t) + 10px); left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; z-index: 2; }
.cam-top button { border: 2px solid var(--gold); background: rgba(0,0,0,.7); color: var(--gold); border-radius: 4px; padding: 8px 14px; font-weight: 600; font-size: 19px; }
.cam-top .cam-voice[aria-pressed="false"] { color: var(--bone-dim); border-color: var(--bone-dim); }
.cam-today { background: rgba(0,0,0,.7); padding: 6px 12px; border-radius: 4px; font-size: 18px; }
.cam-today b { font-family: var(--display); font-weight: 800; color: var(--gold); margin-left: 4px; }
.cam-count {
  position: absolute; left: 0; right: 0; top: calc(var(--safe-t) + 64px); text-align: center; z-index: 2;
  font: 800 clamp(110px, 34vmin, 220px)/1 var(--display); color: var(--gold);
  text-shadow: 0 2px 0 var(--gold-dark), 0 4px 0 #4a2c22, 0 6px 0 #000, 0 0 30px rgba(0,0,0,.9);
}
.cam-count.pop { animation: pop .28s ease-out; }
@keyframes pop { 0% { transform: scale(1.25); } 100% { transform: scale(1); } }
.cam-msg {
  position: absolute; left: 12px; right: 12px; bottom: calc(var(--safe-b) + 58px); z-index: 2;
  background: rgba(0,0,0,.78); border-left: 5px solid var(--gold); padding: 12px 14px; font-size: 24px; font-weight: 600;
}
.cam-msg.bad { border-left-color: var(--bad); color: #ffd3c4; }
.cam-private { position: absolute; left: 12px; right: 12px; bottom: calc(var(--safe-b) + 14px); z-index: 2; display: flex; gap: 6px; align-items: center; font-size: 15px; color: var(--bone); text-shadow: 0 1px 3px #000; }
.cam-private svg { width: 16px; height: 16px; color: var(--gold); flex: none; }
.cam-gauge { position: absolute; right: 14px; top: 34%; bottom: 30%; width: 14px; z-index: 2; background: rgba(0,0,0,.6); border: 2px solid var(--gold-dark); border-radius: 8px; overflow: hidden; }
.cam-gauge i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--gold); transition: height .08s linear; }
.cam-gauge i.deep { background: #7fd18b; }
.cam-gauge-mark { position: absolute; left: -2px; right: -2px; bottom: 62%; border-top: 2px solid var(--bone); }

/* ---------- Meldungen ---------- */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--safe-b) + 88px); z-index: 40; max-width: 488px; margin: 0 auto;
  background: var(--black); border: 2px solid var(--gold); color: var(--bone); padding: 12px 14px; font-weight: 500; font-size: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,.6);
}
.toast.bad { border-color: var(--bad); }
.award { border: 0; padding: 0; background: transparent; color: var(--bone); max-width: 340px; width: calc(100% - 32px); }
.award::backdrop { background: rgba(0,0,0,.78); }
.award-in { background: var(--black); border: 3px double var(--gold); padding: 22px 18px 18px; text-align: center; }
.award-in svg { width: 150px; height: 150px; display: block; margin: 0 auto 8px; }
.award-in .kicker { color: var(--bone-dim); font-size: 18px; }
.award-in h2 { color: var(--gold); font-size: 30px; margin: 4px 0 6px; }
.award-in p { margin-bottom: 16px; }
.award[open] .award-in svg { animation: stamp .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes stamp { 0% { transform: scale(.3) rotate(-25deg); opacity: 0; } 100% { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .cam-count.pop, .award[open] .award-in svg { animation: none; }
  .btn { transition: none; }
}
@media (min-width: 560px) { .medals { grid-template-columns: repeat(4, 1fr); } }
