:root {
  --bg: #0b0b0f;
  --fg: #f6f6f8;
  --muted: #9a9aa6;
  --glass: rgba(255, 255, 255, 0.08);
  --stroke: rgba(255, 255, 255, 0.14);
  --accent: #7c5cff;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f4f7;
    --fg: #14141a;
    --muted: #6b6b77;
    --glass: rgba(255, 255, 255, 0.72);
    --stroke: rgba(0, 0, 0, 0.08);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  overscroll-behavior: none;
}

/* topprad */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) 20px 12px;
  backdrop-filter: blur(18px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
}
.topbar h1 { font-size: 22px; margin: 0; letter-spacing: -0.02em; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); }
.brand span { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; }
.brand img { border-radius: 8px; }
.icon-btn {
  color: var(--fg); text-decoration: none; font-size: 20px;
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 999px; background: var(--glass); border: 1px solid var(--stroke);
}

/* flödeslista */
.flows {
  display: grid; gap: 10px; padding: 6px 16px calc(32px + env(safe-area-inset-bottom));
}
.flow-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px; border-radius: 20px; text-decoration: none; color: var(--fg);
  background: var(--glass); border: 1px solid var(--stroke);
  backdrop-filter: blur(14px);
}
.thumb {
  flex: 0 0 auto; width: 64px; height: 64px; border-radius: 14px;
  background-color: #191922; background-size: cover; background-position: center;
  display: grid; place-items: center; overflow: hidden;
}
.thumb img { border-radius: 10px; opacity: 0.9; }
.row-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-name { font-size: 19px; font-weight: 650; letter-spacing: -0.02em; }
.row-meta { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-end { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.badge {
  min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--accent); color: #fff;
}
.chev { color: var(--muted); font-size: 22px; line-height: 1; }
.flow-card {
  position: relative; height: clamp(190px, 32vh, 340px); border-radius: 22px; overflow: hidden;
  background-color: #191922;
  background-image: linear-gradient(160deg, #232331, #12121a);
  background-size: cover; background-position: center;
  text-decoration: none; color: #fff;
  border: 1px solid var(--stroke);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}
.flow-card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.05) 55%);
}
.card-mark { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -64%); opacity: 0.35; }
.flow-card-inner {
  position: absolute; inset: auto 18px 18px 18px; z-index: 2;
  display: flex; flex-direction: column; gap: 4px;
}
.flow-name { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.badge {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(124, 92, 255, 0.45);
}
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 60px 0; color: var(--muted); }
.empty-state img { border-radius: 18px; opacity: 0.9; }
.flow-meta { font-size: 13px; color: rgba(255, 255, 255, 0.72); }

/* flödesvyn */
.feed {
  height: 100dvh; overflow-y: scroll; scroll-snap-type: y mandatory;
  scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }
.clip {
  position: relative; height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always;
  display: grid; place-items: center; background: #000;
}
.clip video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.overlay {
  position: absolute; left: 16px; bottom: calc(22px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px; z-index: 3;
}
.who { font-weight: 600; }
.src {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 4px 8px; border-radius: 999px; background: var(--glass); border: 1px solid var(--stroke);
  backdrop-filter: blur(10px);
}
.orig {
  font-size: 12px; color: rgba(255, 255, 255, 0.75); text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}
.actions {
  position: absolute; right: 14px; bottom: calc(26px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 14px; z-index: 3;
}
.act {
  width: 44px; height: 44px; border-radius: 999px; font-size: 20px;
  background: var(--glass); border: 1px solid var(--stroke); color: #fff;
  backdrop-filter: blur(12px);
}
.act.on { color: #ffd166; }
.rate { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.slider { writing-mode: vertical-lr; direction: rtl; height: 92px; accent-color: var(--accent); }
.score { font-size: 12px; color: rgba(255, 255, 255, 0.8); }
.pending {
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  color: var(--muted); font-size: 15px;
}
.pending a { color: var(--accent); }
.back {
  position: fixed; top: max(14px, env(safe-area-inset-top)); left: 16px; z-index: 30;
  width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center;
  color: #fff; text-decoration: none; font-size: 26px; line-height: 1;
  background: var(--glass); border: 1px solid var(--stroke); backdrop-filter: blur(12px);
}
.filter-btn {
  position: fixed; top: max(14px, env(safe-area-inset-top)); right: 16px; z-index: 30;
  color: #fff; font-size: 12px; padding: 10px 14px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--stroke); backdrop-filter: blur(12px);
}

/* auth + inställningar */
.auth, .settings, .empty { padding: 40px 22px; max-width: 520px; margin: 0 auto; }
.auth h1 { font-size: 34px; letter-spacing: -0.03em; margin: 0 0 6px; }
.hint { color: var(--muted); font-size: 14px; }
input, select, button { font: inherit; }
input[type="email"], input[type="text"], .auth input, #join-name, #join-email {
  width: 100%; padding: 14px 16px; margin: 8px 0; border-radius: 14px;
  background: var(--glass); border: 1px solid var(--stroke); color: var(--fg);
}
.primary {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 0;
  background: var(--accent); color: #fff; font-weight: 600;
}
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--stroke);
}
.setting-row select {
  background: var(--glass); color: var(--fg); border: 1px solid var(--stroke);
  border-radius: 10px; padding: 8px 10px;
}
