/* ===== Food Buddy – greasy dark theme ===== */
:root {
  --bg: #120d07;         /* djup, varm nästan-svart */
  --bg-2: #1b140c;
  --card: #241b10;
  --card-2: #32271a;
  --accent: #ff8a1e;     /* friterad orange */
  --accent-2: #ff3b2e;   /* tomatsås-röd */
  --gold: #ffd23f;
  --good: #39d98a;
  --text: #f7efe3;
  --muted: #a78f70;
  --line: rgba(255, 255, 255, 0.07);  /* hårfina avdelare */
  --radius: 20px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);  /* mjukare djup */
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Baloo 2", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(1200px 500px at 50% -10%, #3a2912 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

/* ===== Topbar ===== */
.topbar {
  text-align: center;
  padding: 18px 16px 6px;
}
.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  /* Gradient sparas ENBART till logotypen. */
  background: linear-gradient(90deg, var(--accent), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-emoji { -webkit-text-fill-color: initial; margin-left: 6px; }
.brand-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}

/* ===== Screen / views ===== */
.screen {
  flex: 1;
  display: flex;
  padding: 8px 18px 18px;
}
.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
}
.prompt {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.muted { color: var(--muted); font-size: 14px; margin: 0; }

/* ===== Slot / roulette ===== */
.slot {
  width: 180px;
  height: 180px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--card-2), var(--card));
  box-shadow: var(--shadow), inset 0 0 0 4px rgba(255, 138, 30, 0.25);
}
.slot-emoji { font-size: 96px; line-height: 1; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.5)); }
.slot.spinning .slot-emoji { animation: shake 0.18s linear infinite; }
.slot.pop .slot-emoji { animation: pop 0.4s cubic-bezier(0.2, 1.5, 0.4, 1); }
.slot-name { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 800; }
.slot-tagline { margin: 0; font-size: 15px; color: var(--text); max-width: 320px; }
.excuse { margin: 0; font-size: 14px; color: var(--muted); }
.excuse em { color: var(--gold); font-style: italic; }

/* ===== Devour ===== */
.plate {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 40%, #fff8ee 0%, #efe2cf 60%, #d8c4a6 100%);
  box-shadow: var(--shadow), inset 0 -8px 18px rgba(0, 0, 0, 0.15);
}
.food-emoji {
  font-size: 108px;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: transform 0.09s ease-out;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,0.35));
}
.food-emoji:active { transform: scale(0.86) rotate(-4deg) !important; }
.food-emoji.done { animation: pop 0.4s ease; }
.chomp-line { margin: 0; font-size: 18px; font-weight: 700; color: var(--gold); min-height: 22px; }
.finish { margin: 0; font-size: 20px; font-weight: 800; color: var(--accent); }

/* ===== Progress bars ===== */
.bar {
  width: 100%;
  max-width: 320px;
  height: 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}
.bar.slim { height: 12px; }
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.25s ease;
}
.bar-fill.gold { background: linear-gradient(90deg, var(--accent), var(--gold)); }

/* ===== Buttons ===== */
.big-btn {
  margin-top: 6px;
  padding: 16px 28px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.3px;
  color: #2a1602;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  border: none;
  border-radius: 999px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.big-btn:active { transform: translateY(2px) scale(0.98); }
.big-btn:disabled { filter: grayscale(0.4) brightness(0.9); cursor: default; }

.ghost-btn {
  margin-top: 4px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: 1px solid rgba(183, 154, 120, 0.35);
  border-radius: 999px;
  cursor: pointer;
}
.ghost-btn:active { transform: scale(0.98); }

/* ===== Stats ===== */
.rank-card {
  width: 100%;
  background: linear-gradient(160deg, var(--card-2), var(--card));
  border-radius: var(--radius);
  padding: 22px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.rank-emoji { font-size: 72px; line-height: 1; }
.rank-label { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: 2px; color: var(--muted); }
.rank-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--gold);
}
.stat-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.stat-box {
  background: var(--card);
  border-radius: 18px;
  padding: 18px 12px;
  box-shadow: var(--shadow);
}
.stat-num { font-size: 36px; font-weight: 900; color: var(--accent); }
.stat-cap { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ===== Bottom nav ===== */
.bottom-nav {
  display: flex;
  border-top: 1px solid rgba(183, 154, 120, 0.18);
  background: var(--bg-2);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}
.nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  cursor: pointer;
  border-radius: 14px;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-btn .nav-icon { font-size: 24px; line-height: 1; }
.nav-btn .nav-label { font-size: 12px; font-weight: 700; }
.nav-btn.active { color: var(--text); background: rgba(255, 138, 30, 0.12); }
.nav-btn.active .nav-icon { transform: translateY(-1px) scale(1.1); }

/* ===== Topbar-extras (klassiker-länkar) ===== */
.topbar-extras {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.extras-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
}
.chip {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  background: var(--card);
  border: 1px solid rgba(255, 138, 30, 0.25);
  border-radius: 999px;
  padding: 5px 12px;
  transition: transform 0.08s ease, background 0.15s ease;
}
.chip:active { transform: scale(0.96); background: var(--card-2); }

/* ===== Placeholder-sidor (feature-terminalerna fyller i) ===== */
.placeholder { justify-content: center; }
.placeholder-emoji {
  font-size: 92px;
  line-height: 1;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
}
.todo-pill {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #2a1602;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  border-radius: 999px;
  padding: 4px 12px;
}

/* Länkar som ser ut som knappar (yew-router renderar <a>). */
a.big-btn {
  display: inline-block;
  text-decoration: none;
  text-align: center;
}

/* ===== Animations ===== */
@keyframes shake {
  0% { transform: translate(1px, -1px) rotate(-3deg); }
  50% { transform: translate(-1px, 1px) rotate(3deg); }
  100% { transform: translate(1px, -1px) rotate(-3deg); }
}
@keyframes pop {
  0% { transform: scale(0.4); }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ===== Auth (login/register) ===== */
/* "Välj nytt lösenord"-overlay efter en återställningslänk (ligger ovanpå allt) */
.recovery-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.recovery-card {
  max-width: 400px;
  margin: 0;
}
.auth-card {
  width: 100%;
  background: linear-gradient(160deg, var(--card-2), var(--card));
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-title { margin: 0; font-size: 24px; font-weight: 900; }
.auth-who { margin: 0; color: var(--muted); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-input {
  padding: 14px 16px;
  font-size: 16px;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid rgba(183, 154, 120, 0.3);
  border-radius: 14px;
  outline: none;
}
.auth-input:focus { border-color: var(--accent); }
.auth-input::placeholder { color: var(--muted); }
.auth-submit {
  margin-top: 2px;
  padding: 15px 22px;
  font-size: 17px;
  font-weight: 900;
  color: #2a1602;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  border: none;
  border-radius: 999px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.auth-submit:active { transform: translateY(2px) scale(0.98); }
.auth-submit:disabled { filter: grayscale(0.4) brightness(0.9); cursor: default; }
.auth-toggle {
  align-self: center;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}
.auth-error { margin: 0; color: var(--accent-2); font-size: 14px; font-weight: 700; }
.auth-notice { margin: 0; color: var(--gold); font-size: 14px; font-weight: 700; }
.auth-warning {
  margin: 0;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 59, 46, 0.12);
  border: 1px solid rgba(255, 59, 46, 0.4);
  border-radius: 12px;
}

/* ===== Sidor som ska börja uppifrån (karta, längre formulär) ===== */
.view-top { justify-content: flex-start; }

/* ===== Karta (Leaflet) ===== */
.map-canvas {
  width: 100%;
  height: 62vh;
  min-height: 320px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 0; /* håll kart-panorering under bottom-nav/toast */
  background: var(--card);
}
/* Leaflet-popup i mörkt tema */
.leaflet-popup-content { font-family: inherit; }

/* ===== Bottom-nav: får plats med 7 flikar ===== */
.bottom-nav .nav-btn { padding: 6px 0; }
.bottom-nav .nav-icon { font-size: 20px; }
.bottom-nav .nav-label { font-size: 10px; letter-spacing: -0.2px; }

/* =====================================================================
   REDESIGN – foto-först designsystem (Beer Buddy-anda)
   Nya komponentklasser. Sidorna (feed/eat/diary/profil) bygger på dessa.
   ===================================================================== */

/* Sid-layout: top-justerad & scrollande (ersätter centrerade .view för
   innehållstunga sidor). */
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
  text-align: left;
  width: 100%;
}
.page-pad { padding: 4px 2px 8px; }
.section-title {
  margin: 6px 2px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--faint, #7d6b54);
  font-weight: 800;
}

/* Avatar */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 18px; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  flex: none;
  overflow: hidden; /* foto klipps till cirkeln */
}
.avatar.lg { width: 64px; height: 64px; font-size: 28px; }
.avatar.has-img { background: none; }
/* Egen bild fyller hela cirkeln (täcker, beskärs vid behov). */
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }

/* ＋-knapp på avataren (öppnar profilbild-väljaren) */
.avatar-wrap { position: relative; flex: none; }
.avatar-edit {
  position: absolute; right: -3px; bottom: -3px;
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--bg-2);
  background: linear-gradient(135deg, var(--gold), var(--accent));
  color: #241400; font-weight: 900; font-size: 17px; line-height: 1;
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.avatar-edit:active { transform: scale(0.92); }
/* liten pennknapp bredvid namnet */
.edit-mini {
  background: none; border: none; cursor: pointer;
  font-size: 14px; margin-left: 8px; padding: 2px; opacity: 0.75;
}
.edit-mini:active { transform: scale(0.92); }

/* Valbar chip (matval m.m.) – bygger på .chip */
.chip.sel { border-color: var(--accent); color: var(--gold); background: var(--card-2); }

/* ---- Foto-först feed-kort ---- */
.fcard {
  background: var(--card);
  border: 1px solid rgba(183,154,120,0.14);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.fcard-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.fcard-meta { flex: 1; min-width: 0; }
.fcard-name { font-weight: 800; font-size: 14px; }
.fcard-sub { color: var(--muted); font-size: 11.5px; }
.fcard-photo {
  height: 230px;
  display: grid; place-items: center;
  font-size: 84px;
  background: radial-gradient(circle at 40% 35%, var(--card-2), #201608);
  overflow: hidden;
}
/* När ett riktigt foto finns: visa HELA bilden (ingen beskärning). Höjden följer
   bildens proportioner; mörk letterbox bara om den är extremt hög. Klassen sätts i
   Rust (feed/card.rs) – inte via :has(img), som tyst no-opar i en del webvyer
   (in-app-browsers, installerad PWA) och då klipper bilden till containerns topp. */
.fcard-photo.has-photo {
  height: auto;
  display: block;
  overflow: visible;
  background: #0c0a07;
}
.fcard-photo.has-photo img {
  width: 100%; height: auto; display: block;
  max-height: 80vh; object-fit: contain;
}
.fcard-cap { padding: 10px 12px 2px; font-size: 14px; }
.fcard-cap b { font-weight: 800; }
.fcard-stars { color: var(--gold); letter-spacing: 1px; }
.fcard-react { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px 14px; }
.react-pill {
  padding: 6px 11px; border-radius: 999px;
  background: var(--card-2); border: 1px solid rgba(183,154,120,0.2);
  font-size: 13px; font-weight: 700; color: var(--text);
  cursor: pointer; transition: transform .08s ease, border-color .15s ease;
}
.react-pill:active { transform: scale(0.95); }
.react-pill.on { border-color: var(--accent); color: var(--gold); }

/* ---- Kamera-först logga ---- */
.cap-shot {
  height: 220px; border-radius: var(--radius);
  border: 2px dashed rgba(183,154,120,0.3);
  display: grid; place-items: center; text-align: center;
  color: var(--muted); background: var(--card); cursor: pointer; overflow: hidden;
}
.cap-shot .cam { font-size: 52px; }
/* Med valt foto: släpp den fasta höjden och visa HELA bilden (ingen beskärning).
   Klassen sätts i Rust (eat/mod.rs, meal_editor.rs). */
.cap-shot.has-photo {
  height: auto;
  display: block;
  overflow: visible;
  border-style: solid;
  border-color: rgba(183,154,120,0.2);
  background: #000;
}
.cap-shot.has-photo img {
  width: 100%; height: auto; display: block;
  max-height: 70vh; object-fit: contain;
  border-radius: var(--radius);
}
.field-lbl {
  margin: 6px 2px 4px; font-size: 12px; color: var(--faint, #7d6b54);
  text-transform: uppercase; letter-spacing: 1.5px; font-weight: 800;
}
.field-box {
  width: 100%; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid rgba(183,154,120,0.2); background: var(--card);
  color: var(--text); box-sizing: border-box; font-family: inherit; font-size: 15px;
}
.field-box::placeholder { color: var(--muted); }
.star-row { font-size: 28px; color: var(--gold); letter-spacing: 2px; cursor: pointer; }
.star-row .off { color: rgba(183,154,120,0.3); }

/* ---- Profil ---- */
.profile-head { display: flex; align-items: center; gap: 14px; padding: 8px 2px; }
.profile-name { font-family: var(--font-display); font-size: 20px; font-weight: 800; }
.profile-handle { color: var(--muted); font-size: 13px; }
.profile-stats { display: flex; gap: 10px; }
.pstat {
  flex: 1; text-align: center; background: var(--card);
  border-radius: 16px; padding: 14px 8px; box-shadow: var(--shadow);
}
.pstat b { display: block; font-size: 22px; font-weight: 900; color: var(--accent); }
.pstat small { color: var(--muted); font-size: 11px; }

/* ---- Fotogrid (diary/profil) ---- */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.photo-cell {
  aspect-ratio: 1; display: grid; place-items: center; font-size: 34px;
  background: radial-gradient(circle at 40% 35%, var(--card-2), #201608);
  border-radius: 8px; overflow: hidden; position: relative;
}
.photo-cell img { width: 100%; height: 100%; object-fit: cover; }
.photo-cell .pc-rating {
  position: absolute; bottom: 4px; right: 6px; font-size: 11px; color: var(--gold);
  text-shadow: 0 1px 2px #000;
}

/* ---- Bottom-nav med central FAB ---- */
.nav-fab {
  width: 54px; height: 54px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--gold), var(--accent));
  display: grid; place-items: center; font-size: 30px; color: #241400; font-weight: 900;
  box-shadow: 0 6px 16px rgba(255,138,30,0.5); margin-top: -20px;
  text-decoration: none; border: 3px solid var(--bg-2);
}
.nav-fab:active { transform: scale(0.94); }

/* ===== Live-toast ("kompis smashar just nu") ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(78px + env(safe-area-inset-bottom)); /* ovanför bottom-nav */
  transform: translateX(-50%);
  z-index: 1000;
  max-width: 88%;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 800;
  color: #2a1602;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  border-radius: 999px;
  box-shadow: var(--shadow);
  animation: toast-in 0.28s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes toast-in {
  0% { opacity: 0; transform: translate(-50%, 14px) scale(0.9); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* =====================================================================
   FAS-UPPGRADERING – ytor, sticky chrome, feedback, skeletons, rörelse
   ===================================================================== */

/* Hårfina kanter ger definition (Instagram-aktigt) */
.rank-card, .stat-box, .pstat, .auth-card { border: 1px solid var(--line); }

/* Sticky topbar + fast bottom-nav så navigationen alltid är nåbar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(var(--bg) 60%, rgba(18, 13, 7, 0.7));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-width: 480px; margin: 0 auto; z-index: 60;
  background: rgba(27, 20, 12, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
/* Plats så innehållet inte göms bakom den fasta navet. */
.screen { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }

/* Knapp-feedback: mjuka övergångar + tydligt press-läge */
.big-btn, .ghost-btn, .chip, .react-pill, .nav-fab, .nav-btn, .auth-submit {
  transition: transform 0.08s ease, filter 0.15s ease, background 0.15s ease;
}
.big-btn:active, .auth-submit:active { transform: translateY(1px) scale(0.985); filter: brightness(1.06); }
.chip:active, .react-pill:active { transform: scale(0.94); }

/* ===== Skeletons (laddning – känns snabbare än en spinner) ===== */
.skeleton { position: relative; overflow: hidden; background: var(--card); border-radius: var(--radius); }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  transform: translateX(-100%); animation: shimmer 1.2s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.sk-stack { display: flex; flex-direction: column; gap: 14px; width: 100%; }
.sk-card { height: 300px; }
.sk-row { height: 60px; }
.sk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.sk-cell { aspect-ratio: 1; border-radius: 8px; }

/* ===== Mikro-animationer ===== */
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fcard { animation: fade-up 0.3s ease both; }

/* SVG-ikoner i navet (ärver färg via currentColor) */
.nav-icon { display: inline-flex; }
.nav-icon svg { width: 24px; height: 24px; display: block; }
.nav-fab svg { width: 28px; height: 28px; }

/* Återanvändbar kort-yta (ersätter upprepade inline-styles) */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

/* Mjuk sid-övergång vid varje flikbyte */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.screen > * { animation: fade-in 0.2s ease both; }

/* ===== Profilkort-modal (tryck på någon) ===== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fade-in 0.15s ease both;
}
.modal-card {
  position: relative; width: 100%; max-width: 320px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px 20px; display: flex; flex-direction: column;
  align-items: center; gap: 8px; text-align: center;
  animation: pop 0.25s cubic-bezier(0.2, 1.3, 0.4, 1);
}
.modal-close {
  position: absolute; top: 8px; right: 12px;
  background: none; border: none; color: var(--muted);
  font-size: 18px; cursor: pointer; padding: 4px;
}
/* Klickbara namn/rader */
.tappable { cursor: pointer; }

/* Uppdatera-knapp i topbaren */
.topbar-refresh {
  position: absolute; top: 14px; right: 14px;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--line);
  color: var(--text); font-size: 19px; line-height: 1;
  cursor: pointer; display: grid; place-items: center;
  transition: transform 0.3s ease, background 0.15s ease;
}
.topbar-refresh:active { transform: rotate(180deg); background: var(--card-2); }

/* Segment-växel (Fetto-ligan: Käk/Värvare, All-time/Månad) */
.segment { display: flex; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.seg-btn { flex: 1; padding: 8px 10px; border: none; background: none; color: var(--muted); font-weight: 800; font-size: 13px; border-radius: 999px; cursor: pointer; transition: background 0.15s ease, color 0.15s ease; }
.seg-btn.on { background: linear-gradient(90deg, var(--gold), var(--accent)); color: #241400; }

/* Radera-knapp (diary-rutor + egna flödeskort) */
.cell-del {
  position: absolute; top: 6px; right: 6px;
  width: 30px; height: 30px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 14px; line-height: 1;
  background: rgba(255, 59, 46, 0.92); color: #fff;
  display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
.cell-del:active { transform: scale(0.9); }
/* I flödeskortets huvud ligger den i raden (inte absolut). */
.fcard-del { position: static; margin-left: auto; flex: none; }

/* ===== Kommentarer på flödeskort ===== */
.fcard-comments { border-top: 1px solid var(--line); padding: 8px 12px 12px; }
.cmt-toggle { background: none; border: none; color: var(--muted); font-weight: 700; font-size: 13px; cursor: pointer; padding: 4px 0; }
.cmt { font-size: 13.5px; padding: 4px 0; color: var(--text); }
.cmt b { font-weight: 800; }
.cmt-input { display: flex; gap: 8px; margin-top: 8px; }
.cmt-input .field-box { flex: 1; }
