/* Binit Hunter – Design: spielerisch-minimal, Winter-Akzent */
:root {
  --bg: #F3F6FB; --surface: #FFFFFF; --surface-2: #E9EFF8; --border: #DDE5F0;
  --text: #0F1B2D; --muted: #5E6E86; --accent: #1E6FE8; --accent-2: #7FD3FF; --accent-soft: #E3EDFF;
  --ok: #17A75F; --ok-soft: #DDF5E8; --warn: #E0891B; --warn-soft: #FFF0DB; --danger: #D9453D;
  --r: 14px; --r-lg: 20px; --shadow: 0 6px 24px rgba(15, 27, 45, .06);
  --nav-h: 64px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1220; --surface: #131C2E; --surface-2: #1B2639; --border: #24314A;
    --text: #EAF0FA; --muted: #8C9CB8; --accent: #5AA2FF; --accent-2: #7FD3FF; --accent-soft: #17335F;
    --ok: #34D07F; --ok-soft: #123A2A; --warn: #F2A33A; --warn-soft: #3D2C12; --danger: #FF6B62;
    --shadow: 0 6px 24px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  --bg: #0B1220; --surface: #131C2E; --surface-2: #1B2639; --border: #24314A;
  --text: #EAF0FA; --muted: #8C9CB8; --accent: #5AA2FF; --accent-2: #7FD3FF; --accent-soft: #17335F;
  --ok: #34D07F; --ok-soft: #123A2A; --warn: #F2A33A; --warn-soft: #3D2C12; --danger: #FF6B62;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 26px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 10px 16px; font-weight: 700; cursor: pointer; transition: transform .08s ease, background .15s ease, border-color .15s ease; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); }
.btn-lg { padding: 14px 22px; font-size: 17px; border-radius: 14px; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }

/* Forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px; outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.error { color: var(--danger); font-size: 14px; margin: 4px 0 10px; min-height: 1em; }

/* Layout */
.shell { display: grid; grid-template-rows: auto 1fr auto; min-height: 100dvh; }
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 980px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.02em; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.topnav { display: none; gap: 4px; margin-left: 18px; }
.topnav a { padding: 8px 12px; border-radius: 10px; font-weight: 700; color: var(--muted); }
.topnav a.active { background: var(--accent-soft); color: var(--accent); }
.spacer { flex: 1; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; font-size: 14px; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }
main.content { max-width: 980px; width: 100%; margin: 0 auto; padding: 18px 16px calc(var(--nav-h) + 24px); }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(4, 1fr); }
.bottomnav a { display: grid; place-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--muted); }
.bottomnav a .ic { font-size: 20px; line-height: 1; }
.bottomnav a.active { color: var(--accent); }
@media (min-width: 760px) {
  .topnav { display: flex; }
  .bottomnav { display: none; }
  main.content { padding-bottom: 40px; }
  .grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
}

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 0 8px; }

/* Hero (Heute) */
.hero-today { background: linear-gradient(135deg, var(--accent), #0B3D91); color: #fff; border: none; position: relative; overflow: hidden; }
.hero-today::after { content: "❄"; position: absolute; right: -10px; top: -30px; font-size: 140px; opacity: .12; }
.hero-today .muted { color: rgba(255,255,255,.75); }
.hero-today .big { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.progress { height: 10px; background: rgba(255,255,255,.25); border-radius: 99px; overflow: hidden; margin-top: 14px; }
.progress > i { display: block; height: 100%; background: #fff; border-radius: 99px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.stat { background: rgba(255,255,255,.14); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 12px; opacity: .85; }
.date-nav { display: flex; align-items: center; gap: 8px; }
.date-nav .btn { padding: 6px 10px; }

/* Tasks */
.task { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--border); }
.task:last-child { border-bottom: none; }
.tick { width: 30px; height: 30px; border-radius: 10px; border: 2px solid var(--border); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none; transition: all .15s ease; font-size: 16px; color: #fff; }
.tick:hover { border-color: var(--accent); }
.task.done .tick { background: var(--ok); border-color: var(--ok); animation: pop .35s cubic-bezier(.2,1.6,.4,1); }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.task .body { flex: 1; min-width: 0; }
.task .title { font-weight: 700; }
.task .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.pill.leicht { background: var(--ok-soft); color: var(--ok); }
.pill.mittel { background: var(--accent-soft); color: var(--accent); }
.pill.schwer { background: var(--warn-soft); color: var(--warn); }
.pill.brutal { background: #FDE2E1; color: var(--danger); }
:root[data-theme="dark"] .pill.brutal, :root:not([data-theme="light"]) .pill.brutal { background: #3F1A1A; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .pill.brutal { background: #FDE2E1; } }
.pts { font-weight: 800; color: var(--accent); white-space: nowrap; }
.task .thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: none; border: 1px solid var(--border); cursor: pointer; }
.task .del { opacity: 0; transition: opacity .15s; }
.task:hover .del, .task .del:focus { opacity: 1; }
@media (hover: none) { .task .del { opacity: .7; } }
.sidequest-card { border: 1px dashed var(--accent); background: var(--accent-soft); }
.empty { text-align: center; color: var(--muted); padding: 18px 8px; }

/* Punkte-Flug */
.float-pts { position: fixed; z-index: 50; font-weight: 800; color: var(--accent); pointer-events: none; animation: floatUp 1s ease-out forwards; font-size: 20px; }
@keyframes floatUp { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(-60px) scale(1.3); } }
@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* Rangliste */
.tabs { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 2px; }
.tabs button { border: none; background: transparent; padding: 7px 12px; border-radius: 9px; font-weight: 700; color: var(--muted); cursor: pointer; }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.rank { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--border); }
.rank:last-child { border-bottom: none; }
.rank .pos { width: 28px; text-align: center; font-weight: 800; color: var(--muted); }
.rank.top1 .pos { color: #E5B100; font-size: 20px; }
.rank .body { flex: 1; min-width: 0; }
.rank .name { font-weight: 700; }
.rank .pts { font-size: 18px; }
.rank.me { background: var(--accent-soft); border-radius: 12px; }

/* Feed */
.feed-item { display: flex; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: none; }
.feed-item .body { flex: 1; min-width: 0; }
.feed-item img.photo { width: 100%; max-height: 360px; object-fit: cover; border-radius: 12px; margin-top: 8px; border: 1px solid var(--border); cursor: pointer; }
.feed-item .when { font-size: 12px; color: var(--muted); }
.feed-item .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }

/* Reactions */
.reactions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.rx { border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: 4px 10px; font-size: 14px; cursor: pointer; transition: transform .1s ease, border-color .15s ease; line-height: 1; }
.rx:not(.has) { opacity: .55; }
.rx:hover { opacity: 1; border-color: var(--accent); }
.rx.mine { background: var(--accent-soft); border-color: var(--accent); opacity: 1; }
.rx b { font-size: 12px; color: var(--accent); }
.rx.bump { animation: pop .3s cubic-bezier(.2,1.6,.4,1); }
.pill.mine { background: var(--accent-soft); color: var(--accent); }

/* Wochenverlauf */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 110px; }
.week .bar { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 6px; text-align: center; font-size: 11px; color: var(--muted); }
.week .bar i { display: block; align-self: end; background: var(--accent-soft); border-radius: 8px 8px 4px 4px; min-height: 4px; position: relative; transition: height .4s ease; }
.week .bar i.has { background: var(--accent); }
.week .bar.today span { color: var(--accent); font-weight: 800; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(5, 10, 20, .55); z-index: 40; display: grid; place-items: end center; padding: 0; }
.modal { background: var(--surface); width: min(560px, 100%); border-radius: 22px 22px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); max-height: 92dvh; overflow: auto; animation: up .25s ease; }
@media (min-width: 640px) { .modal-bg { place-items: center; padding: 20px; } .modal { border-radius: 22px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h2 { margin-bottom: 12px; }
.photo-drop { border: 2px dashed var(--border); border-radius: 14px; padding: 16px; text-align: center; color: var(--muted); cursor: pointer; }
.photo-drop.has { border-style: solid; padding: 0; overflow: hidden; }
.photo-drop img { width: 100%; max-height: 260px; object-fit: cover; display: block; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 60; display: grid; place-items: center; cursor: zoom-out; }
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 10px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 700; z-index: 70; animation: up .2s ease; max-width: 90vw; }
@media (min-width: 760px) { .toast { bottom: 24px; } }

/* Auth */
.auth { max-width: 420px; margin: 8vh auto 0; }
.auth .brand { justify-content: center; margin-bottom: 20px; font-size: 22px; }
.auth .brand img { width: 44px; height: 44px; border-radius: 12px; }
.auth h1 { text-align: center; margin-bottom: 6px; }
.auth .sub { text-align: center; color: var(--muted); margin-bottom: 22px; }
.switch { text-align: center; margin-top: 16px; color: var(--muted); }
.switch a { color: var(--accent); font-weight: 700; }

/* Admin */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.tbl .inactive { opacity: .5; }
.tbl-wrap { overflow-x: auto; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.spin { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 40px; }

/* ---- Erweiterungen: Ankündigung, Duell, Abzeichen, Galerie, Kommentare, Wochenaufgaben, Admin-Quoten ---- */
.announce { display: flex; gap: 10px; align-items: flex-start; border-color: var(--accent); background: var(--accent-soft); }
.announce .body { flex: 1; }
.duel { border-color: var(--border); }
.duel-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.duel-row .side { display: flex; align-items: center; gap: 10px; }
.duel-row .vs { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; text-align: center; }
.duel-bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.duel-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .5s ease; }
.ulink { color: inherit; }
.ulink:hover { text-decoration: underline; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.badge { border: 1px solid var(--border); border-radius: 14px; padding: 12px 10px; text-align: center; display: grid; gap: 2px; opacity: .45; filter: grayscale(1); }
.badge.on { opacity: 1; filter: none; border-color: var(--accent); background: var(--accent-soft); }
.badge .em { font-size: 28px; }
.badge b { font-size: 13px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); cursor: pointer; }
.comments { margin-top: 8px; display: grid; gap: 6px; }
.comment { font-size: 14px; padding: 6px 10px; background: var(--surface-2); border-radius: 10px; }
.comment .cdel { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0 4px; }
.comment-form { display: flex; gap: 6px; }
.comment-form .input { padding: 7px 11px; font-size: 14px; }
.comment-form .btn { flex: none; }
.rules { margin: 12px 0 0; padding-left: 18px; display: grid; gap: 6px; }
.tick small { font-size: 10px; font-weight: 800; color: var(--muted); }
.rate { display: grid; grid-template-columns: 1fr 120px 44px; align-items: center; gap: 10px; font-size: 14px; padding: 4px 0; }
.rate-bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.rate-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.tbl tr.warnrow td { color: var(--warn); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 2px 8px; border-radius: 8px; font-weight: 800; letter-spacing: .1em; }
textarea.input { resize: vertical; }
/* Chat */
.bottomnav { grid-template-columns: repeat(5, 1fr); }
.dot { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); margin-left: 2px; }
.topnav a, .bottomnav .ic { position: relative; }
.chat { display: flex; flex-direction: column; height: calc(100dvh - 140px); max-height: 820px; }
@media (max-width: 759px) { .chat { height: calc(100dvh - var(--nav-h) - 110px - env(safe-area-inset-bottom)); } }
.msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 85%; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.bubble { background: var(--surface-2); border-radius: 16px 16px 16px 4px; padding: 8px 12px; }
.msg.mine .bubble { background: var(--accent); color: #fff; border-radius: 16px 16px 4px 16px; }
.msg.mine .bubble .muted { color: rgba(255,255,255,.75); }
.bubble .who { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.bubble .txt { white-space: pre-wrap; word-break: break-word; }
.bubble .cdel { border: none; background: transparent; color: inherit; opacity: .6; cursor: pointer; font-size: 11px; }
.chat-form { display: flex; gap: 8px; }
.chat-form .input { flex: 1; }
/* Health-Link */
.linkbox { background: var(--surface-2); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.linkrow { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.linkrow code { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; user-select: all; -webkit-user-select: all; }
.linkrow .btn { flex: none; }
