/* ============================================================
   Bokklubben – varm, lugn läsfåtöljskänsla
   ============================================================ */

:root {
  --paper: #f5ede0;
  --paper-2: #ede1cd;
  --card: #fffaf2;
  --ink: #33281f;
  --ink-soft: #6e5c4b;
  --line: #e3d4bc;
  --oak: #a86b3c;
  --oak-dark: #7a4a26;
  --sage: #7d8c63;
  --sage-dark: #4f5e39;
  --terracotta: #b8603b;
  --honey: #d39b3f;
  --glow: #ffe2a8;
  --primary: var(--sage-dark);
  --primary-ink: #fffaf0;
  --star: #d39b3f;
  --star-empty: #e6d7bf;
  --danger: #a4412a;
  --shadow: 0 1px 2px rgba(74, 48, 25, 0.06), 0 6px 20px rgba(74, 48, 25, 0.08);
  --shadow-lg: 0 2px 4px rgba(74, 48, 25, 0.08), 0 18px 40px rgba(74, 48, 25, 0.16);
  --radius: 20px;
  --radius-sm: 14px;
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --tabbar-h: 72px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1d1612;
    --paper-2: #261d17;
    --card: #2a2019;
    --ink: #f3e8d8;
    --ink-soft: #c2ad95;
    --line: #3d3027;
    --primary: #a9b98a;
    --primary-ink: #1d1612;
    --star-empty: #4a3b2f;
    --glow: #5a4220;
    --danger: #e58c6f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 18px 40px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.5 var(--sans);
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

#view {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}
h1 { font-size: 30px; }
h2 { font-size: 23px; }
.h3 { font-size: 19px; margin-bottom: 10px; }

p { margin: 0 0 10px; }
a { color: inherit; }
button { font: inherit; color: inherit; }

.muted { color: var(--ink-soft); }
.small { font-size: 14.5px; }
.center { text-align: center; }

.eyebrow {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--oak);
  margin: 0 0 4px;
}

.page.enter {
  animation: page-in 0.32s ease-out both;
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
}

svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Knappar ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  font-weight: 650;
  font-size: 17px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease, box-shadow 0.2s;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }
.btn-block { display: flex; width: 100%; margin: 10px 0; }
.btn-lg { min-height: 60px; font-size: 18px; }
.btn-sm { min-height: 40px; padding: 8px 14px; font-size: 15px; }
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: 0 6px 16px rgba(79, 94, 57, 0.28); }
.btn-soft { background: var(--paper-2); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-done { background: color-mix(in srgb, var(--sage) 18%, transparent); color: var(--sage-dark); }
.btn-reveal {
  color: #3a2410;
  background: linear-gradient(135deg, #f3c56f, #d39b3f 55%, #c0773a);
  box-shadow: 0 8px 22px rgba(211, 155, 63, 0.4);
}
.btn-danger { background: var(--danger); color: #fff; }
.danger-text { color: var(--danger); }
@media (prefers-color-scheme: dark) {
  .btn-done { color: #c5d3a7; }
}
.btn svg { width: 20px; height: 20px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: -8px -8px -8px auto;
  border: 0;
  background: none;
  color: var(--ink-soft);
  border-radius: 50%;
  cursor: pointer;
}
.icon-btn svg { width: 19px; height: 19px; }

.text-btn {
  background: none;
  border: 0;
  padding: 6px 0;
  color: var(--oak);
  font-weight: 650;
  cursor: pointer;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  margin: 0 0 6px -8px;
  padding: 0 10px 0 4px;
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
}

/* ---------- Kort & listor ---------- */

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin: 12px 0;
  box-shadow: var(--shadow);
}

.section-title {
  font-size: 21px;
  margin: 28px 0 10px;
}

.page-head { margin: 6px 0 16px; }
.page-head p { margin-top: 6px; }

.list { display: grid; gap: 10px; }
.list-row, .result-row, .chosen {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  text-decoration: none;
  min-height: 72px;
}
.list-row-main { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.list-row-main strong { font-family: var(--serif); font-weight: 600; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--paper-2);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}
.chip svg { width: 15px; height: 15px; }
.chip-done { background: color-mix(in srgb, var(--sage) 22%, transparent); color: var(--sage-dark); }
.chip-todo { color: var(--ink-soft); }
@media (prefers-color-scheme: dark) { .chip-done { color: #c5d3a7; } }

.link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
}
.link-card svg { transform: rotate(180deg); color: var(--ink-soft); }

.empty { text-align: center; padding: 32px 20px; }
.empty h2 { margin-bottom: 8px; }

.hint { color: var(--ink-soft); font-size: 15px; }

/* ---------- Omslag ---------- */

.cover {
  position: relative;
  flex: none;
  border-radius: 4px 8px 8px 4px;
  overflow: hidden;
  background: var(--paper-2);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1), 0 6px 14px rgba(60, 35, 15, 0.22);
}
.cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0, rgba(255, 255, 255, 0.12) 3%, transparent 7%);
  pointer-events: none;
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-xs { width: 44px; height: 66px; }
.cover-s { width: 76px; height: 114px; }
.cover-m { width: 96px; height: 144px; }
.cover-l { width: 160px; height: 240px; }

.cover-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8%;
  padding: 12% 10%;
  background:
    radial-gradient(120% 80% at 30% 0%, rgba(255, 255, 255, 0.16), transparent 60%),
    var(--bg);
  color: var(--fg);
  text-align: center;
}
.cf-title { font-family: var(--serif); font-weight: 600; line-height: 1.1; font-size: calc(15px * var(--k, 1)); }
.cf-rule { width: 30%; height: 1px; background: currentColor; opacity: 0.6; }
.cf-author { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.85; }
.cover-xs .cf-title { font-size: calc(7px * var(--k, 1)); }
.cover-xs .cf-author, .cover-xs .cf-rule { display: none; }
.cover-s .cf-title { font-size: calc(11px * var(--k, 1)); }
.cover-s .cf-author { font-size: 7.5px; }
.cover-l .cf-title { font-size: calc(24px * var(--k, 1)); }
.cover-l .cf-author { font-size: 12px; }

/* ---------- Inloggning ---------- */

.login {
  margin: calc(-12px - env(safe-area-inset-top)) -16px 0;
}
.login-hero {
  height: 44vh;
  min-height: 260px;
  background:
    linear-gradient(180deg, rgba(40, 26, 15, 0.1) 0%, rgba(40, 26, 15, 0.15) 50%, var(--paper) 100%),
    url('../img/fatolj.jpg') center 60% / cover;
  display: flex;
  align-items: flex-end;
  padding: 0 24px 40px;
}
.login-title h1 {
  font-size: 44px;
  color: #fffaf0;
  text-shadow: 0 2px 18px rgba(30, 18, 8, 0.55);
}
.login-title .eyebrow { color: #ffe9c2; text-shadow: 0 1px 8px rgba(30, 18, 8, 0.6); }
.login-card {
  position: relative;
  margin: -24px 16px 0;
  padding: 24px 20px 20px;
  background: var(--card);
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
}
.login-card h2 { margin-bottom: 14px; }
.name-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.name-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 8px 14px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  font-weight: 650;
  font-size: 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.name-btn:last-child:nth-child(odd) { grid-column: span 2; justify-content: center; }
.name-btn:active { transform: scale(0.97); }
.name-btn.on { border-color: var(--primary); background: color-mix(in srgb, var(--sage) 14%, var(--card)); }

.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-weight: 650; font-size: 15px; margin-bottom: 6px; }
input, textarea, select {
  width: 100%;
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  min-height: 52px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--sage) 22%, transparent);
}
textarea { resize: vertical; line-height: 1.55; }
.error { color: var(--danger); font-weight: 600; min-height: 1.5em; margin: 0; font-size: 15px; }

/* ---------- Startsida ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 14px;
}
.greeting { font-size: 26px; }
.avatar-link { text-decoration: none; }

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  padding: 26px 22px 22px;
  color: #fff8ec;
  background:
    radial-gradient(90% 70% at 85% 10%, rgba(255, 214, 140, 0.55), transparent 60%),
    linear-gradient(180deg, rgba(58, 36, 18, 0.35), rgba(46, 28, 14, 0.82)),
    url('../img/hylla.jpg') center 35% / cover;
  box-shadow: var(--shadow-lg);
}
.hero .eyebrow { color: #ffe1a8; }
.countdown { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.count-big {
  font-family: var(--serif);
  font-size: 96px;
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.03em;
  text-shadow: 0 4px 30px rgba(255, 190, 90, 0.35);
}
.count-small { font-family: var(--serif); font-size: 26px; font-style: italic; }
.meta {
  padding-top: 14px;
  border-top: 1px solid rgba(255, 240, 215, 0.3);
}
.meta p { margin: 0; }
.meta-date { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.meta-sub { font-size: 16px; font-weight: 600; opacity: 0.92; }
.empty-hero .hero-title { font-size: 34px; margin: 4px 0 8px; }
.empty-hero .btn-primary { background: #fff4df; color: var(--oak-dark); margin-top: 12px; }

.book-list { display: grid; gap: 14px; }
.book-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.book-card .btn-block { margin: 12px 0 0; }
.book-card-top { display: flex; gap: 16px; text-decoration: none; }
.book-card-info { display: flex; flex-direction: column; padding-top: 2px; min-width: 0; }
.book-card-info h3 { font-size: 21px; margin-bottom: 4px; }
.book-card-info p { margin: 0 0 2px; }
.more { margin-top: auto; color: var(--oak); font-weight: 650; font-size: 15px; }

.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.avatars { display: flex; }
.avatars .avatar { margin-right: -6px; box-shadow: 0 0 0 2px var(--card); }
.progress-text { margin-left: 12px; font-size: 15px; }

.avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex: none;
  transition: background 0.3s;
}
.avatar.pending { background: transparent; color: var(--ink-soft); outline: 1.5px dashed var(--line); outline-offset: -1.5px; }
.avatar.lg { width: 44px; height: 44px; font-size: 18px; }
.avatar.xl { width: 84px; height: 84px; font-size: 36px; font-family: var(--serif); }

.admin-box {
  margin-top: 28px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1.5px dashed var(--line);
}
.all-done { font-family: var(--serif); font-size: 19px; font-style: italic; }

/* ---------- Mina tankar ---------- */

.book-head { display: flex; gap: 16px; align-items: flex-end; margin-bottom: 18px; }
.book-head a { text-decoration: none; }
.book-head h1 { font-size: 26px; margin-bottom: 4px; }
.book-head p { margin: 0; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--paper-2);
  border-radius: 999px;
}
.seg-wrap {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 -16px 16px;
  padding: calc(env(safe-area-inset-top) + 8px) 16px 8px;
  background: var(--paper);
}
.segmented button {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-weight: 650;
  cursor: pointer;
  color: var(--ink-soft);
}
.segmented button[aria-selected='true'] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--paper);
  font-size: 13px;
}
.segmented .count { display: inline-grid; }

.note-form { padding: 14px; }
.note-form textarea { border: 0; background: transparent; padding: 4px; min-height: 80px; box-shadow: none; }
.note-form-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; }
.page-field { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--ink-soft); font-size: 15px; }
.page-field input { width: 84px; min-height: 44px; padding: 8px 10px; text-align: center; }

.notes-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.note {
  position: relative;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 12px 16px 6px 20px;
  box-shadow: var(--shadow);
}
.note::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--honey);
}
.note-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.note p { white-space: pre-wrap; }
.page-badge {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  color: var(--oak);
}

.review-form textarea { min-height: 200px; }
.prompts { margin: 0 0 12px; }
.prompts summary {
  cursor: pointer;
  color: var(--oak);
  font-weight: 650;
  padding: 6px 0;
  list-style: none;
}
.prompts summary::-webkit-details-marker { display: none; }
.prompts summary::before { content: '✦ '; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0 4px; }
.chip-btn {
  border: 1.5px solid var(--line);
  background: var(--paper);
  border-radius: 14px;
  padding: 9px 12px;
  font-size: 15px;
  text-align: left;
  line-height: 1.3;
  cursor: pointer;
}
.chip-btn:active { background: var(--paper-2); }
.review-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }

.star-input { display: flex; gap: 4px; margin: 0 -4px; }
.star-btn {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
  touch-action: manipulation;
}
.star-btn svg { width: 44px; height: 44px; fill: var(--star-empty); stroke: none; transition: fill 0.15s, transform 0.2s cubic-bezier(0.3, 1.6, 0.5, 1); }
.star-btn.on svg { fill: var(--star); transform: scale(1.06); }
.star-btn:active svg { transform: scale(0.85); }
.star-word { font-family: var(--serif); font-style: italic; color: var(--ink-soft); margin: 2px 0 18px; min-height: 1.5em; }

.privacy { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-soft); font-size: 14.5px; margin: 16px 4px 4px; }
.privacy svg { width: 18px; height: 18px; margin-top: 2px; }
.status-line { display: flex; align-items: center; gap: 6px; font-weight: 650; margin: 10px 4px 0; color: var(--ink-soft); }
.status-line.ok { color: var(--sage-dark); }
@media (prefers-color-scheme: dark) { .status-line.ok { color: #c5d3a7; } }
.status-line svg { width: 18px; height: 18px; }

/* ---------- Stjärnor (visning) ---------- */

.stars { position: relative; display: inline-block; line-height: 0; vertical-align: middle; }
.stars-base, .stars-fill { display: flex; white-space: nowrap; }
.stars-fill { position: absolute; inset: 0 auto 0 0; overflow: hidden; }
.stars svg { width: 18px; height: 18px; stroke: none; }
.stars-base svg { fill: var(--star-empty); }
.stars-fill svg { fill: var(--star); }
.stars.sm svg { width: 15px; height: 15px; }
.stars.xl svg { width: 40px; height: 40px; }

/* ---------- Om boken ---------- */

.book-hero { text-align: center; display: flex; flex-direction: column; align-items: center; margin: 4px 0 18px; }
.book-hero .cover { margin-bottom: 18px; }
.book-hero h1 { font-size: 28px; margin-bottom: 4px; }
.book-hero .author { font-size: 18px; color: var(--ink-soft); margin-bottom: 4px; }
.desc { white-space: pre-line; }
.desc.clamped { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.link-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.link-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 56px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--card);
  box-shadow: var(--shadow);
  font-weight: 650;
  text-decoration: none;
}
.link-btn svg { width: 17px; height: 17px; color: var(--ink-soft); }

/* ---------- Låst / resultat ---------- */

.locked { text-align: center; padding: 10px 10px 4px; }
.locked h1 { font-size: 26px; margin-bottom: 8px; }
.lock-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 8px auto 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, var(--glow), var(--paper-2));
  color: var(--oak-dark);
}
@media (prefers-color-scheme: dark) { .lock-icon { color: var(--honey); } }
.lock-icon svg { width: 30px; height: 30px; }
.mini-head { display: flex; align-items: center; gap: 12px; font-family: var(--serif); font-size: 18px; }

.result { margin: 22px 0 34px; }
.result-head { display: flex; align-items: flex-end; gap: 14px; text-decoration: none; margin-bottom: 14px; }
.result-head h2 { font-size: 24px; margin-bottom: 2px; }
.result-head p { margin: 0; }

.avg-card {
  text-align: center;
  padding: 22px 16px 16px;
  border-radius: var(--radius);
  background:
    radial-gradient(80% 90% at 50% 0%, color-mix(in srgb, var(--glow) 70%, transparent), transparent 70%),
    var(--card);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.avg-card.glow { animation: glow 1.8s ease-out; }
@keyframes glow {
  0% { box-shadow: 0 0 0 0 rgba(255, 196, 100, 0.7), var(--shadow); }
  100% { box-shadow: 0 0 0 26px rgba(255, 196, 100, 0), var(--shadow); }
}
.avg-num { font-family: var(--serif); font-size: 64px; font-weight: 600; line-height: 1; margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.avg-card .muted { margin: 8px 0 0; }
.reveal-btn {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 110px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: var(--serif);
  font-size: 22px;
  font-style: italic;
  cursor: pointer;
}
.reveal-btn span:last-child { position: relative; }
.reveal-glow {
  position: absolute;
  inset: 20% 30%;
  border-radius: 50%;
  background: var(--glow);
  filter: blur(26px);
  animation: breathe 2.6s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: 0.45; transform: scale(1.2); } }

.reviews { display: grid; gap: 12px; }
.review { perspective: 1200px; cursor: default; }
.review-inner { display: grid; transition: transform 0.7s cubic-bezier(0.3, 1.2, 0.4, 1); transform-style: preserve-3d; }
.review-back, .review-front {
  grid-area: 1 / 1;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius);
  padding: 16px 18px;
}
.review-front { background: var(--card); box-shadow: var(--shadow); }
.review-front p { margin: 10px 0 2px; white-space: pre-wrap; }
.review-head { display: flex; align-items: center; gap: 10px; }
.review-head .stars { margin-left: auto; }
.review-back {
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 130px;
  color: #fff6e6;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 10px, transparent 10px 20px),
    linear-gradient(160deg, var(--sage-dark), #3b4729);
  box-shadow: var(--shadow);
}
.review-back .muted { color: #e5ddc6; }
.review-back .avatar { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5); }
.review.face-down { cursor: pointer; }
.review-front { transition: max-height 0.6s ease; max-height: 2000px; overflow: hidden; }
.review.face-down .review-front { max-height: 130px; }
.review.face-down .review-inner { transform: rotateY(180deg); }

.archive-list { display: grid; gap: 12px; }
.archive-item { display: block; text-decoration: none; margin: 0; }
.archive-book { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.archive-score { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-family: var(--serif); font-weight: 600; }

/* ---------- Admin-formulär ---------- */

.chosen-list { display: grid; gap: 10px; }
.chosen { box-shadow: none; background: var(--paper); padding: 8px 12px; }
.search-box {
  position: relative;
  margin-top: 4px;
}
.search-box svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); }
.search-box input { padding-left: 48px; background: var(--card); }
.search-results { display: grid; gap: 8px; margin: 10px 0; }
.result-row { width: 100%; border: 0; text-align: left; cursor: pointer; }
.result-row .add { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--paper-2); }
.manual { margin: 12px 0 18px; }
.manual summary { cursor: pointer; color: var(--oak); font-weight: 650; padding: 8px 0 12px; }

/* ---------- Profil ---------- */

.profile { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 8px 0 16px; }
.demo-card { border: 1.5px dashed var(--honey); box-shadow: none; }

/* ---------- Flikrad ---------- */

#tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-top: 1px solid var(--line);
}
#tabbar[hidden] { display: none; }
#tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 58px;
  border-radius: 16px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 650;
}
#tabbar a svg { width: 26px; height: 26px; }
#tabbar a.active { color: var(--primary); }
#tabbar a.active svg { fill: color-mix(in srgb, var(--primary) 18%, transparent); }

/* ---------- Toast & ark ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 18px);
  transform: translate(-50%, 20px);
  opacity: 0;
  z-index: 50;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 650;
  box-shadow: var(--shadow-lg);
  transition: opacity 0.25s, transform 0.25s;
  width: max-content;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(30, 20, 12, 0);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: background 0.25s;
}
.sheet-backdrop.show { background: rgba(30, 20, 12, 0.45); }
.sheet {
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border-radius: 28px 28px 0 0;
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 16px);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.sheet-backdrop.show .sheet { transform: none; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 16px; }
.sheet h2 { margin-bottom: 8px; }
.sheet p { color: var(--ink-soft); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
