:root {
  --bg: #0C0C0D;
  --card: #17171A;
  --card-2: #1E1E22;
  --line: #2A2A2D;
  --line-2: #3A3A3E;
  --text: #EFEAE0;
  --text-2: #C9C4B9;
  --muted: #A8A49B;
  --amber: #EFA81A;
  --amber-bg: #211A0C;
  --green: #8FD19E;
  --red: #F08A7E;
  --nav-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --display: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --body: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 16px; }
html { touch-action: manipulation; text-size-adjust: 100%; -webkit-text-size-adjust: 100%; }
body { overscroll-behavior-y: none; }
button, input, textarea, select { font-family: inherit; font-size: 16px; color: inherit; }
button { cursor: pointer; }
a { color: var(--amber); }
img { max-width: 100%; }
.hidden { display: none !important; }

.splash { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.splash img { width: 120px; opacity: .9; }

/* ---------- Grundgerüst ---------- */
.screen { min-height: 100vh; padding: calc(var(--safe-t) + 8px) 0 calc(var(--nav-h) + var(--safe-b) + 24px); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; }
.topbar .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar img.logo { width: 44px; height: 44px; object-fit: contain; flex: none; }
h1.title { margin: 0; font-family: var(--display); font-weight: 800; font-size: 30px; letter-spacing: .5px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: transparent; display: inline-flex; align-items: center; justify-content: center; color: var(--text); text-decoration: none; flex: none; }
.back { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px 0 6px; height: 44px; border: 0; background: transparent; color: var(--text); font-weight: 600; }
.label { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.label.amber { color: var(--amber); }
.section { padding: 0 20px; }
.section + .section { margin-top: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.empty { padding: 28px 20px; text-align: center; color: var(--muted); font-size: 15px; line-height: 1.5; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: #111113; border-top: 1px solid #222225; padding: 8px 4px calc(10px + var(--safe-b)); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 44px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; position: relative; }
.tabbar a.active { color: var(--amber); }
.tabbar .dot { position: absolute; top: 0; right: calc(50% - 18px); width: 9px; height: 9px; border-radius: 5px; background: var(--amber); }

/* ---------- Knöpfe und Felder ---------- */
.btn { min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-2); background: transparent; color: var(--text); font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #0C0C0D; font-weight: 700; }
.btn.outline-amber { border-color: var(--amber); color: var(--amber); font-weight: 700; }
.btn.danger { border-color: #5A2A26; color: var(--red); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input, textarea.input, select.input { width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--card); color: var(--text); outline: none; }
.input:focus { border-color: var(--amber); }
textarea.input { min-height: 120px; resize: vertical; line-height: 1.45; }
.check { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: var(--line-2); transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 12px; background: var(--text); transition: transform .15s; }
.switch input:checked + span { background: var(--amber); }
.switch input:checked + span::after { transform: translateX(20px); background: #0C0C0D; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.card.pad { padding: 16px; }
.card.hl { border-color: var(--amber); }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 32px 24px calc(32px + var(--safe-b)); max-width: 460px; margin: 0 auto; }
.auth .logo { width: 140px; align-self: center; }
.auth h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 34px; text-transform: uppercase; text-align: center; line-height: 1; }
.auth p { margin: 0; color: var(--text-2); line-height: 1.5; text-align: center; }
.code-input { letter-spacing: 8px; text-align: center; font-size: 26px; font-weight: 700; }

/* ---------- Training ---------- */
.days { display: flex; gap: 8px; padding: 4px 20px 16px; overflow-x: auto; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.day { flex: 1 1 0; min-width: 0; height: 58px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--text); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.day .wd { font-size: 11px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; }
.day .n { font-family: var(--display); font-weight: 800; font-size: 20px; }
.day.on { background: var(--amber); border-color: var(--amber); color: #0C0C0D; }

.wod { margin: 0 20px 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.wodwrap { margin: 0 0 18px; }
.wodwrap > .card.wod { margin: 0 20px; }
.wod-label { display: flex; justify-content: space-between; align-items: baseline; padding: 0 20px 8px; }
.wod-track { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 20px; scroll-padding: 0 20px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.wod-track::-webkit-scrollbar { display: none; }
.wod-track .slide { margin: 0; flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; }
.wod-track.multi .slide { flex-basis: 88%; }
.wod-track.multi::after { content: ""; flex: 0 0 10px; }
.dots { display: flex; justify-content: center; gap: 6px; padding-top: 10px; }
.dots span { width: 7px; height: 7px; border-radius: 4px; background: var(--line-2); transition: width .2s, background .2s; }
.dots span.on { width: 18px; background: var(--amber); }
.wod .head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.wod .wtitle { margin: 0; font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1.05; text-transform: uppercase; }
.wod .wbody { margin: 0; font-size: 15px; line-height: 1.5; color: var(--text-2); white-space: pre-line; }
.wod .wbody.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.wod .part + .part { border-top: 1px solid var(--line); padding-top: 12px; }
.wod .ptitle { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.wod .actions { display: flex; gap: 8px; }
.wod .actions > * { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; }
.chip.on { border-color: var(--amber); color: var(--amber); }

.classes { list-style: none; margin: 0; padding: 0 20px; display: flex; flex-direction: column; gap: 8px; }
.cls { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.cls.booked { background: var(--amber-bg); border-color: var(--amber); }
.cls .time { width: 64px; flex: none; font-family: var(--display); font-weight: 800; font-size: 24px; color: transparent; -webkit-text-stroke: 1.2px var(--amber); }
.cls .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; background: none; border: 0; padding: 0; margin: 0; text-align: left; color: inherit; font: inherit; }
.cls .name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cls .status { font-size: 13px; font-weight: 500; color: var(--green); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cls .status.full { color: var(--muted); }
.cls .status.mine { color: var(--amber); }
.cls .btn { min-width: 100px; padding: 0 10px; font-size: 14px; }

.banner { margin: 0 20px 16px; padding: 14px 16px; border-radius: 14px; background: var(--amber-bg); border: 1px solid var(--amber); display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 1.45; }

/* ---------- Events und News ---------- */
.ev { overflow: hidden; display: block; color: inherit; text-decoration: none; }
.ev .img { height: 140px; background: var(--card-2) center/cover no-repeat; }
.ev .row { display: flex; align-items: center; gap: 14px; padding: 14px 16px 16px; }
.datebox { width: 52px; flex: none; display: flex; flex-direction: column; align-items: center; }
.datebox .d { font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1; color: transparent; -webkit-text-stroke: 1.2px var(--amber); }
.datebox .m { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.ev .t { font-size: 16px; font-weight: 700; }
.ev .s { font-size: 13px; color: var(--muted); }
.ev .s.mine { color: var(--amber); font-weight: 600; }
.detail-img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 16px; display: block; }
.detail h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 32px; line-height: 1.05; text-transform: uppercase; }
.prose { font-size: 16px; line-height: 1.6; color: var(--text-2); }
.prose p { margin: 0 0 12px; }
.prose ul { margin: 0 0 12px; padding-left: 20px; }
.prose strong { color: var(--text); }

.news-item { display: flex; align-items: center; gap: 14px; padding: 14px 14px 14px 12px; color: inherit; text-decoration: none; min-height: 72px; }
.news-item .kw { width: 48px; flex: none; display: flex; flex-direction: column; align-items: center; }
.news-item .kw .k { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--muted); }
.news-item .kw .n { font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1; color: transparent; -webkit-text-stroke: 1.2px var(--amber); }
.news-item .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.news-item .tt { font-size: 16px; font-weight: 700; color: var(--text); }
.news-item .dd { font-size: 13px; color: var(--muted); }
.unread-dot { width: 10px; height: 10px; border-radius: 5px; background: var(--amber); flex: none; }
.reactions { display: flex; gap: 8px; flex-wrap: wrap; }
.react { min-height: 40px; padding: 0 12px; border-radius: 20px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.react.on { border-color: var(--amber); color: var(--amber); background: var(--amber-bg); }

/* ---------- Community ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; padding: 0 16px 90px; }
.chat .hint { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0 8px; }
.chat .daysep { text-align: center; font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); padding: 8px 0 2px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 88%; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.avatar { width: 32px; height: 32px; border-radius: 16px; background: var(--card-2); border: 1px solid var(--line); flex: none; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--amber); }
.bubble { background: var(--card); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 8px 12px; min-width: 0; }
.msg.me .bubble { background: var(--amber-bg); border-color: #4A3812; border-radius: 16px 16px 4px 16px; }
.bubble .who { font-size: 12px; font-weight: 700; color: var(--amber); margin-bottom: 2px; }
.bubble .txt { font-size: 15px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.bubble .meta { display: flex; justify-content: flex-end; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); margin-top: 4px; }
.bubble .meta button { border: 0; background: transparent; color: var(--muted); font-size: 11px; padding: 6px 2px; min-height: 28px; }
.bubble .media { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; margin: 4px 0; background: #000; }
.composer { position: fixed; left: 0; right: 0; bottom: calc(62px + var(--safe-b)); z-index: 15; display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; background: var(--bg); border-top: 1px solid #222225; }
.composer textarea { flex: 1; min-height: 44px; max-height: 120px; resize: none; padding: 11px 14px; border-radius: 22px; border: 1px solid var(--line-2); background: var(--card); color: var(--text); outline: none; line-height: 1.35; }
.composer .attach-preview { position: absolute; left: 12px; bottom: 66px; display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--card); border: 1px solid var(--line-2); border-radius: 12px; font-size: 13px; }
.send { width: 44px; height: 44px; border-radius: 22px; border: 0; background: var(--amber); color: #0C0C0D; display: inline-flex; align-items: center; justify-content: center; flex: none; }

/* ---------- Profil und Admin ---------- */
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; min-height: 56px; color: inherit; text-decoration: none; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; }
.tabs { display: flex; gap: 6px; padding: 0 20px 14px; overflow-x: auto; }
.admin-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.admin-item .grow { flex: 1; min-width: 0; }
.admin-item .grow .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Toast und Dialog ---------- */
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 90px); transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; z-index: 50; background: var(--text); color: #0C0C0D; font-weight: 600; font-size: 14px; padding: 12px 16px; border-radius: 12px; max-width: calc(100% - 40px); transition: opacity .2s, transform .2s; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; }
.sheet { width: 100%; background: #141416; border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; padding: 20px 20px calc(20px + var(--safe-b)); display: flex; flex-direction: column; gap: 10px; max-height: 90vh; overflow-y: auto; }
.sheet h3 { margin: 0 0 4px; font-size: 18px; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line-2); border-top-color: var(--amber); border-radius: 50%; animation: spin .8s linear infinite; margin: 28px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 700px) {
  .screen, .composer, .tabbar { max-width: 560px; margin-left: auto; margin-right: auto; }
  .composer, .tabbar { left: 0; right: 0; }
}
