/* ============================================================
   JCC – Johanna's Cheer Coach · Design-System (self-hosted)
   Portiert aus v1: Dark-Glassmorphism, Neon-Cyan + Pink, Poppins.
   iPad Air (Querformat) = primäre Referenz.
   ============================================================ */
@font-face {
  font-family: 'Poppins'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: local('Poppins'), local('Inter'), local('Segoe UI');
}

:root {
  --bg: #0b1220;            /* tiefes Dunkelblau-Grau */
  --bg-2: #0f172a;          /* slate-900 */
  --card: rgba(30, 41, 59, 0.55);
  --card-solid: #1e293b;
  --line: rgba(255, 255, 255, 0.10);
  --ink: #f1f5f9;
  --ink-dim: #94a3b8;
  --ink-dimmer: #64748b;
  --cyan: #22d3ee;
  --pink: #ec4899;
  --violet: #a855f7;
  --neon: #39ff14;
  --ok: #34d399;
  --warn: #f59e0b;
  --danger: #f43f5e;
  --radius: 22px;
  --radius-lg: 30px;
  --grad: linear-gradient(120deg, #ec4899, #a855f7 55%, #22d3ee);
  --grad-r: linear-gradient(90deg, #ec4899, #22d3ee);
  --shadow: 0 18px 40px -20px rgba(0,0,0,0.7);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Poppins', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink); -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
  line-height: 1.5;
}
/* Gradient-Schleier fix am Viewport verankert – scrollt/kachelt nicht mit dem Inhalt. */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1100px 600px at 12% -8%, rgba(236,72,153,0.18), transparent 55%),
    radial-gradient(1100px 600px at 105% 8%, rgba(34,211,238,0.16), transparent 55%);
}
h1, h2, h3, h4 { font-weight: 800; letter-spacing: -0.02em; margin: 0 0 .3em; line-height: 1.15; }
p { margin: 0 0 .6em; }
a { color: var(--cyan); text-decoration: none; }
::selection { background: var(--pink); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,.3); border-radius: 99px; }
img { max-width: 100%; }
button { font-family: inherit; }

/* ---------- Layout-Shell ---------- */
#app { min-height: 100dvh; }
.shell { display: flex; min-height: 100dvh; }
.sidebar {
  width: 264px; flex-shrink: 0; position: sticky; top: 0; height: 100dvh;
  background: var(--card); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 6px;
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; padding: 26px clamp(16px, 4vw, 40px); max-width: 1180px; width: 100%; margin: 0 auto; padding-bottom: 120px; }
.topbar { display: none; }

.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 16px; }
.brand .logo { width: 44px; height: 44px; border-radius: 16px; background: var(--grad); display: grid; place-items: center; font-size: 22px; box-shadow: 0 8px 20px -6px rgba(236,72,153,.5); }
.brand b { font-size: 18px; background: var(--grad-r); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand span { display: block; font-size: 11px; color: var(--ink-dimmer); margin-top: -2px; }

.profile-chip { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 16px; padding: 10px; margin-bottom: 10px; }
.profile-chip .av { width: 40px; height: 40px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-weight: 800; }
.profile-chip b { font-size: 14px; } .profile-chip span { font-size: 11px; color: var(--ink-dim); }

.nav { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; flex: 1; }
.nav-group-label { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-dimmer); padding: 12px 12px 4px; }
.nav-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 13px; border: 0; background: transparent; color: var(--ink-dim); border-radius: 14px; font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; transition: background .15s, color .15s, transform .1s; }
.nav-btn .ic { font-size: 18px; width: 22px; text-align: center; }
.nav-btn:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-btn:active { transform: scale(.98); }
.nav-btn.active { color: #fff; background: linear-gradient(90deg, rgba(236,72,153,.25), rgba(34,211,238,.22)); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- Sidebar einklappen (Rail) ---------- */
.rail-toggle { margin-left: auto; width: 28px; height: 28px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--ink-dim); cursor: pointer; font-size: 13px; line-height: 1; flex-shrink: 0; transition: .15s; }
.rail-toggle:hover { color: #fff; background: rgba(255,255,255,.12); }
.shell.rail .sidebar { width: 76px; padding: 16px 10px; align-items: center; }
.shell.rail .brand-txt,
.shell.rail .profile-chip,
.shell.rail .nav-btn > span:not(.ic),
.shell.rail .nav-group-label { display: none; }
.shell.rail .brand { flex-direction: column; gap: 10px; justify-content: center; padding: 0 0 12px; margin: 0; width: 100%; }
.shell.rail .brand .logo { width: 44px; height: 44px; flex: 0 0 auto; }
.shell.rail .nav { width: 100%; }
.shell.rail .nav-btn { justify-content: center; padding: 11px 0; }
.shell.rail .nav-btn .ic { width: auto; }
.shell.rail .rail-toggle { transform: rotate(180deg); margin: 0; }

/* ---------- Bottom nav (mobile/portrait) ---------- */
.botnav { display: none; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; font-weight: 700; font-size: 15px; padding: 13px 20px; border-radius: 16px; color: #fff; background: rgba(255,255,255,.08); transition: transform .12s, box-shadow .2s, background .15s; min-height: 46px; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--grad-r); box-shadow: 0 10px 24px -10px rgba(236,72,153,.6); }
.btn-ghost { background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.btn-danger { background: rgba(244,63,94,.16); color: #fecdd3; border: 1px solid rgba(244,63,94,.35); }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 24px; font-size: 16px; border-radius: 18px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 8px 12px; font-size: 13px; min-height: 36px; border-radius: 12px; }

/* ---------- Cards ---------- */
.card { background: var(--card); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-pad-lg { padding: 26px; }
.card.solid { background: rgba(30,41,59,.8); }
/* Flache Karte ohne backdrop-filter – für lange Listen (Scroll-Performance auf iPad). */
.card.flat { background: #16203a; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; gap: 12px; align-items: center; } .wrap { flex-wrap: wrap; } .between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Typo helpers ---------- */
.eyebrow { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--cyan); font-weight: 700; margin-bottom: 6px; }
.h-grad { background: var(--grad-r); -webkit-background-clip: text; background-clip: text; color: transparent; }
.dim { color: var(--ink-dim); } .dimmer { color: var(--ink-dimmer); }
.small { font-size: 13px; } .tiny { font-size: 11px; }
.center { text-align: center; }

/* ---------- Badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border: 1px solid var(--line); }
.badge.ok { background: rgba(52,211,153,.14); color: #6ee7b7; border-color: rgba(52,211,153,.3); }
.badge.warn { background: rgba(245,158,11,.14); color: #fcd34d; border-color: rgba(245,158,11,.3); }
.badge.danger { background: rgba(244,63,94,.14); color: #fda4af; border-color: rgba(244,63,94,.3); }
.badge.cyan { background: rgba(34,211,238,.14); color: #67e8f9; border-color: rgba(34,211,238,.3); }
.badge.pink { background: rgba(236,72,153,.14); color: #f9a8d4; border-color: rgba(236,72,153,.3); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid var(--line); font-size: 13px; font-weight: 600; cursor: pointer; }
.chip.on { background: linear-gradient(90deg, rgba(236,72,153,.3), rgba(34,211,238,.25)); border-color: transparent; color: #fff; }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > .lab { display: block; font-size: 13px; font-weight: 600; color: var(--ink-dim); margin-bottom: 6px; }
.input, select.input, textarea.input { width: 100%; background: rgba(15,23,42,.7); border: 1px solid var(--line); color: var(--ink); border-radius: 14px; padding: 13px 15px; font-size: 15px; outline: none; font-family: inherit; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34,211,238,.25); }
select.input { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round'><path d='M5 8l5 5 5-5'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 40px; }
textarea.input { min-height: 90px; resize: vertical; }
.seg { display: inline-flex; padding: 4px; border-radius: 14px; background: rgba(15,23,42,.6); border: 1px solid var(--line); gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--ink-dim); padding: 8px 14px; border-radius: 10px; font-weight: 700; font-size: 13px; cursor: pointer; }
.seg button.on { background: var(--grad-r); color: #fff; }
.toggle-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.toggle { padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.04); cursor: pointer; font-weight: 600; transition: .15s; }
.toggle.on { border-color: var(--cyan); background: rgba(34,211,238,.12); box-shadow: 0 0 0 3px rgba(34,211,238,.15); }

/* ---------- Progress ---------- */
.progress { height: 10px; border-radius: 99px; background: rgba(255,255,255,.1); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--grad-r); transition: width .6s cubic-bezier(.2,.7,.3,1); }
.kpi { border: 1px solid var(--line); background: rgba(255,255,255,.03); border-radius: 18px; padding: 16px; }
.kpi .n { font-size: 26px; font-weight: 800; } .kpi .l { font-size: 12px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 420px; }
.login-logo { width: 80px; height: 80px; border-radius: 26px; background: var(--grad); display: grid; place-items: center; font-size: 40px; margin: 0 auto 18px; box-shadow: 0 14px 34px -8px rgba(236,72,153,.55); animation: floaty 3s ease-in-out infinite; }

/* ---------- Video / Pose ---------- */
.player-wrap { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 18px; overflow: hidden; }
.player-wrap.portrait { aspect-ratio: 9/16; max-height: 70dvh; margin: 0 auto; }
.player-wrap video, .player-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.player-wrap canvas { pointer-events: none; }
.pose-badge { position: absolute; top: 10px; left: 10px; font-size: 11px; font-weight: 800; padding: 5px 10px; border-radius: 99px; background: rgba(0,0,0,.6); color: var(--neon); border: 1px solid rgba(57,255,20,.4); }
.framing-guide { position: absolute; inset: 8%; border: 2px dashed rgba(255,255,255,.35); border-radius: 16px; pointer-events: none; }

/* ---------- Feedback blocks ---------- */
.fb-block { border-left: 3px solid var(--cyan); padding: 8px 0 8px 14px; margin-bottom: 12px; }
.fb-block.focus { border-color: var(--pink); }
.fb-block.safety { border-color: var(--warn); }
.fb-block h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-dim); margin-bottom: 4px; }

/* ---------- Skeleton / loader ---------- */
.loader { width: 42px; height: 42px; border-radius: 50%; border: 4px solid rgba(148,163,184,.25); border-top-color: var(--cyan); border-right-color: var(--pink); animation: spin .8s linear infinite; }
.skeleton { background: linear-gradient(90deg, rgba(255,255,255,.05), rgba(255,255,255,.12), rgba(255,255,255,.05)); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 12px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: calc(20px + var(--safe-b)); left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--card-solid); border: 1px solid var(--line); border-radius: 14px; padding: 12px 18px; font-weight: 600; box-shadow: var(--shadow); animation: pop .3s ease; max-width: 90vw; }
.toast.ok { border-color: rgba(52,211,153,.4); } .toast.danger { border-color: rgba(244,63,94,.4); }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; z-index: 80; background: rgba(2,6,23,.7); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; }
.modal { width: 100%; max-width: 480px; max-height: 88dvh; overflow-y: auto; animation: pop .28s ease; }

/* ---------- Safety callout ---------- */
.callout { border-radius: 16px; padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; }
.callout .ic { font-size: 20px; flex-shrink: 0; }
.callout.warn { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.3); }
.callout.danger { background: rgba(244,63,94,.1); border: 1px solid rgba(244,63,94,.3); }
.callout.ok { background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.3); }
.callout.info { background: rgba(34,211,238,.08); border: 1px solid rgba(34,211,238,.25); }

/* ---------- Step card (plan/session) ---------- */
.step-card { border: 1px solid var(--line); border-radius: 18px; padding: 16px; background: rgba(255,255,255,.03); }
.step-card h4 { font-size: 16px; margin-bottom: 4px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.meta-pill { font-size: 12px; padding: 4px 10px; border-radius: 10px; background: rgba(255,255,255,.06); border: 1px solid var(--line); color: var(--ink-dim); }

/* ---------- Animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes shimmer { 100% { background-position: -200% 0; } }
@keyframes pop { 0% { transform: scale(.9); opacity: 0; } 60% { transform: scale(1.02); } 100% { transform: scale(1); opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.view { animation: fadeUp .35s ease; }
.confetti-i { position: fixed; top: -10px; width: 10px; height: 14px; z-index: 95; pointer-events: none; }

/* ---------- Responsive: iPad Hochformat / iPhone ---------- */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .botnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 60; background: var(--card); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); justify-content: space-around; padding: 8px 4px calc(8px + var(--safe-b)); }
  .botnav button { background: transparent; border: 0; color: var(--ink-dim); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; font-weight: 700; padding: 4px 10px; border-radius: 12px; cursor: pointer; }
  .botnav button .ic { font-size: 22px; }
  .botnav button.active { color: #fff; background: linear-gradient(180deg, rgba(236,72,153,.2), rgba(34,211,238,.18)); }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; position: sticky; top: 0; z-index: 40; background: var(--card); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
  .content { padding: 18px 16px 130px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .g2.keep2 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 901px) and (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(2, 1fr); } }
