:root {
  --bg: #0A130E;
  --surface: #12201A;
  --surface-2: #192A21;
  --frame: #16261D;
  --line: #24382D;
  --text: #EEF3EC;
  --text-2: #C9D6CD;
  --muted: #9DB1A4;
  --lime: #C8F135;
  --lime-hover: #E2FF7A;
  --amber: #F5B544;
  --danger: #FF8A7A;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'Manrope', system-ui, sans-serif;
  --nav-h: 84px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
a { color: var(--lime); }
a:hover { color: var(--lime-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

.shell {
  max-width: 480px; margin: 0 auto; padding: 20px 20px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom));
  padding-top: calc(20px + env(safe-area-inset-top));
  display: flex; flex-direction: column; gap: 18px;
}
.shell.no-nav { padding-bottom: 28px; }

/* Typografi */
h1, h2, h3 { margin: 0; font-family: var(--display); }
.h1 { font-weight: 800; font-size: 32px; line-height: 1.05; letter-spacing: -0.6px; }
.h2 { font-weight: 700; font-size: 19px; }
.h3 { font-weight: 700; font-size: 18px; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--lime); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.row { display: flex; align-items: center; gap: 12px; }
.between { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* Topp */
.topbar { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.wordmark { font-family: var(--display); font-weight: 800; font-size: 21px; letter-spacing: -0.3px; }
.wordmark span { color: var(--lime); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; color: var(--text); cursor: pointer;
  text-decoration: none; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* Kort */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 18px; }
.card.tight { border-radius: 18px; padding: 14px 16px; }
.card.lime { background: var(--lime); color: var(--bg); border: none; }
.card.lime .p { color: var(--bg); font-weight: 500; }
.card.lime .eyebrow { color: var(--bg); }
.card.warn { border-color: var(--amber); }
.card.accent { border-color: var(--lime); }

/* Knapper */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 20px;
  border-radius: 24px; border: none; background: var(--lime); color: var(--bg); font-weight: 800; font-size: 15px;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--lime-hover); color: var(--bg); }
.btn.dark { background: var(--bg); color: var(--lime); }
.btn.ghost { background: transparent; color: var(--lime); border: 1px solid var(--lime); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; padding: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.segmented button { height: 44px; border-radius: 12px; border: none; background: transparent; color: var(--muted); font-weight: 700; font-size: 14px; cursor: pointer; }
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] { background: var(--lime); color: var(--bg); font-weight: 800; }

.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.tabs button { height: 46px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--lime); border-color: var(--lime); color: var(--bg); font-weight: 800; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--lime); border-color: var(--lime); color: var(--bg); font-weight: 800; }
.tag { display: inline-block; padding: 4px 10px; border-radius: 10px; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--text-2); }

/* Prioritet */
.prio {
  width: 34px; height: 34px; border-radius: 17px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 800; font-size: 17px; background: var(--line); color: var(--text);
}
.prio.p1 { background: var(--lime); color: var(--bg); }
.prio.p2 { background: var(--amber); color: var(--bg); }
.focus-link { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--text); min-height: 44px; }
.focus-link.first { border-color: var(--lime); }
.focus-link:hover { color: var(--text); border-color: var(--muted); }
.focus-link .t { font-weight: 700; font-size: 15px; }
.focus-link .s { font-size: 12px; color: var(--muted); }
.chev { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; margin-left: auto; flex-shrink: 0; }

/* Ring */
.ring-wrap { position: relative; width: 84px; height: 84px; flex-shrink: 0; }
.ring-wrap .c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-wrap .big { font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1; }

/* Målinger */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.metric { padding: 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.metric .n { font-size: 11px; color: var(--muted); font-weight: 600; }
.metric .v { font-family: var(--display); font-weight: 800; font-size: 22px; }
.metric .v.warn { color: var(--amber); }
.metric .v.good { color: var(--lime); }
.metric .note { font-size: 11px; color: var(--muted); }

/* Bilder */
.frame { position: relative; border-radius: 24px; background: var(--frame); border: 1px solid var(--line); overflow: hidden; }
.frame img { width: 100%; height: 100%; object-fit: contain; background: #000; }
.frame .label { position: absolute; top: 12px; left: 12px; padding: 6px 12px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; font-weight: 700; }
.frame .bubble { position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 10px 12px; border-radius: 14px; background: rgba(10, 19, 14, 0.9); border: 1px solid var(--line); font-size: 13px; line-height: 1.4; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pair .frame { aspect-ratio: 3 / 4; border-radius: 18px; }

/* Øvelser */
.drill { display: flex; flex-direction: column; gap: 10px; }
.drill.done { opacity: 0.7; border-color: #3E5A2A; }
.check {
  width: 44px; height: 44px; border-radius: 22px; flex-shrink: 0; cursor: pointer; display: flex; align-items: center; justify-content: center;
  background: transparent; color: #5C7A68; border: 2px solid #3E5A4A;
}
.check svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.check[aria-pressed="true"] { background: var(--lime); border-color: var(--lime); color: var(--bg); }
.feel { font-size: 12px; font-weight: 700; color: var(--lime); }

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.week .d { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.week .dot { width: 32px; height: 32px; border-radius: 16px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.week .dot.on { background: var(--lime); border-color: var(--lime); }
.week .dot.today { border: 2px solid var(--lime); }
.week .dot svg { width: 16px; height: 16px; fill: none; stroke: var(--bg); stroke-width: 3; stroke-linecap: round; }

/* Fremgangslinjer */
.change { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dir-bedre { color: var(--lime); font-weight: 800; }
.dir-uendret { color: var(--muted); font-weight: 800; }
.dir-verre { color: var(--amber); font-weight: 800; }

/* Skjema */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); }
.input {
  height: 50px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 16px;
}
textarea.input { height: auto; min-height: 80px; padding: 12px 16px; resize: vertical; }
.input:focus, .btn:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.error { color: var(--danger); font-size: 14px; font-weight: 600; }

/* Filming */
.viewer { position: relative; border-radius: 24px; overflow: hidden; background: #000; border: 1px solid var(--line); aspect-ratio: 9 / 14; }
.viewer video { width: 100%; height: 100%; object-fit: contain; display: block; }
.empty-viewer { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; background: var(--frame); text-align: center; }
.empty-viewer svg.guide { width: 140px; height: 210px; }
.scrub { width: 100%; accent-color: var(--lime); height: 32px; }
.slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.slot { display: flex; flex-direction: column; gap: 4px; padding: 4px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--text); }
.slot[aria-pressed="true"] { border-color: var(--lime); }
.slot canvas { width: 100%; aspect-ratio: 3 / 4; border-radius: 10px; background: var(--frame); }
.slot span { font-size: 11px; font-weight: 700; text-align: center; padding-bottom: 2px; }
.slot.set span::before { content: '● '; color: var(--lime); }

/* Laster */
.loading { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; z-index: 50; padding: 32px; text-align: center; }
.loading .ball { width: 72px; height: 72px; border-radius: 36px; background: var(--lime); animation: bounce 1s ease-in-out infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-24px); } }
@media (prefers-reduced-motion: reduce) { .loading .ball { animation: none; } }

/* Bunnmeny */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 8px 6px env(safe-area-inset-bottom);
  background: var(--bg); border-top: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-around; z-index: 20;
}
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 60px; min-height: 44px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; }
.nav a.active { color: var(--lime); font-weight: 700; }
.nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav .nav-film { width: 60px; min-width: 60px; height: 60px; margin-top: -26px; border-radius: 30px; background: var(--lime); color: var(--bg); justify-content: center; border: 5px solid var(--bg); box-sizing: content-box; }
.nav .nav-film svg { width: 26px; height: 26px; stroke-width: 2.2; }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px); transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--line); padding: 12px 18px; border-radius: 16px; font-size: 14px; font-weight: 600; z-index: 60; max-width: calc(100% - 32px); }

/* Skjelett-overlay */
.pose-frame { display: flex; justify-content: center; background: #000; min-height: 200px; }
.pose-wrap { position: relative; height: min(68vh, calc((min(100vw, 480px) - 42px) / var(--r))); max-width: 100%; }
.pose-wrap.cell { height: auto; width: 100%; }
.pose-wrap img { width: 100%; height: 100%; object-fit: fill; display: block; }
.pose-wrap svg.pose { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pose-cell { display: flex; align-items: center; background: #000; aspect-ratio: auto !important; }
.measure { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.measure span { padding: 6px 10px; border-radius: 12px; background: rgba(10, 19, 14, 0.9); border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--text-2); }
.measure b { color: var(--lime); font-weight: 800; }

/* Gjengen */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.avatar { width: 40px; height: 40px; border-radius: 20px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--line); font-weight: 800; font-size: 14px; color: var(--lime); }
.icon-round { width: 40px; height: 40px; border-radius: 20px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--lime); }
.icon-round.dark { background: var(--bg); }
.icon-round svg, .like-btn svg, .btn svg, .icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.like-btn { white-space: nowrap; flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; font-size: 14px; cursor: pointer; }
.like-btn[aria-pressed="true"] { background: var(--lime); border-color: var(--lime); color: var(--bg); }
.like-btn b { min-width: 0; }
.feed .feed-img { display: block; border-radius: 16px; overflow: hidden; background: #000; }
.feed .feed-img img { width: 100%; max-height: 360px; object-fit: contain; }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.commentary { margin: 0; padding: 14px 16px; border-left: 0; border-radius: 16px; background: var(--surface-2); font-size: 15px; line-height: 1.55; font-style: italic; color: var(--text); white-space: pre-line; }
.switch-row { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.switch-row input { width: 22px; height: 22px; accent-color: var(--lime); margin-top: 2px; flex-shrink: 0; }
.rank { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.rank:first-of-type { border-top: 0; }
.rank .nm { flex: 1; font-weight: 600; }
.rank.me .nm { color: var(--lime); }
.medal { width: 30px; height: 30px; border-radius: 15px; display: inline-flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 14px; background: var(--line); color: var(--text); }
.medal.m1 { background: #E9C46A; color: #2A1F00; }
.medal.m2 { background: #C9D1CC; color: #1B2420; }
.medal.m3 { background: #C9875A; color: #2A1405; }
.duel-link { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.duel-link:hover { color: var(--text); border-color: var(--muted); }
.duel-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; text-align: center; }
.duel-score .stack { align-items: center; gap: 6px; opacity: 0.8; }
.duel-score .won { opacity: 1; }
.duel-score .won .avatar { background: var(--lime); color: var(--bg); border-color: var(--lime); }
.duel-score .score { font-family: var(--display); font-weight: 800; font-size: 48px; line-height: 1; }
.duel-score .score span { color: var(--muted); margin: 0 6px; }
.pose-cell.win { border-color: var(--lime); box-shadow: 0 0 0 2px var(--lime) inset; }
.crown { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 16px; background: var(--lime); color: var(--bg); display: flex; align-items: center; justify-content: center; }
.crown svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.brand .wordmark { line-height: 1.05; }
.tagline { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0.2px; }
