/*
 * Memeth PWA — "Bold Immersive" UI.
 * Same palette as before (near-black base, purple accents, gold highlights);
 * what changed is depth, glow, full-bleed imagery, big low-friction reactions,
 * and motion. Every class the views' JS relies on is preserved — this is a
 * restyle, not a rewrite of behavior.
 */
:root {
  --bg: #0f0f17;
  --bg-elev: #1a1a26;
  --bg-elev2: #232333;
  --border: #2e2e40;
  --hairline: rgba(255, 255, 255, 0.06);
  --text: #ececf3;
  --text-dim: #9a9ab0;
  --accent: #8b5cf6;
  --accent-2: #a78bfa;
  --accent-ink: #c4b5fd;
  --gold: #fbbf24;
  --danger: #ef4444;
  --ok: #22c55e;

  /* Bold-immersive depth + glow (derived from the existing accent/gold). */
  --glow-accent: 0 0 0 1px rgba(139, 92, 246, 0.35), 0 8px 30px rgba(139, 92, 246, 0.35);
  --glow-accent-soft: 0 6px 22px rgba(139, 92, 246, 0.28);
  --glow-gold: 0 0 0 1px rgba(251, 191, 36, 0.4), 0 6px 22px rgba(251, 191, 36, 0.32);
  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --elev-2: 0 8px 24px rgba(0, 0, 0, 0.45);
  --elev-3: 0 18px 50px rgba(0, 0, 0, 0.55);
  --grad-accent: linear-gradient(135deg, #8b5cf6, #a78bfa);
  --grad-gold: linear-gradient(135deg, #f59e0b, #fbbf24);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --tabbar-h: 60px;
  --topbar-h: 50px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

/* Ambient immersive backdrop: a faint purple aura up top + gold whisper, fixed
   so content scrolls over depth rather than a flat fill. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(139, 92, 246, 0.18), transparent 60%),
    radial-gradient(90% 50% at 100% 0%, rgba(251, 191, 36, 0.06), transparent 55%),
    var(--bg);
  pointer-events: none;
}

button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- Top bar ---------- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 16px;
  padding-right: 16px;
  background: linear-gradient(180deg, rgba(20, 16, 38, 0.92), rgba(15, 15, 23, 0.78));
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--hairline);
}
.brand {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.2px;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  box-shadow: var(--glow-accent-soft);
}
.karma-chip {
  background: rgba(139, 92, 246, 0.14);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-ink);
  box-shadow: var(--glow-accent-soft);
}
.karma-chip { display: inline-flex; align-items: center; gap: 5px; }
.karma-chip::before {
  content: "";
  width: 13px;
  height: 13px;
  flex: none;
  background: currentColor;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 2 4 13h6l-1 9 9-12h-6l1-8z"/></svg>') center/contain no-repeat;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 2 4 13h6l-1 9 9-12h-6l1-8z"/></svg>') center/contain no-repeat;
}

/* ---------- Main view ---------- */
#view {
  flex: 1;
  padding: 12px 10px calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}
.boot, .empty {
  color: var(--text-dim);
  text-align: center;
  padding: 48px 18px;
  font-size: 15px;
  line-height: 1.6;
}

/* ---------- Tab bar ---------- */
#tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  background: linear-gradient(0deg, rgba(20, 16, 38, 0.96), rgba(15, 15, 23, 0.82));
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border-top: 1px solid var(--hairline);
}
.tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  min-height: 44px;
  position: relative;
  transition: color 0.2s ease, transform 0.12s ease;
}
.tab .tab-ico {
  font-size: 20px;
  line-height: 1;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease;
}
.tab.active { color: var(--accent-ink); }
.tab.active .tab-ico {
  transform: translateY(-1px) scale(1.16);
  filter: drop-shadow(0 4px 10px rgba(139, 92, 246, 0.6));
}
/* Active indicator pill above the icon. */
.tab.active::before {
  content: "";
  position: absolute;
  top: 5px;
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: var(--grad-accent);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.8);
}
.tab:active { transform: scale(0.92); }
.tab .badge {
  position: absolute;
  top: 6px;
  right: 50%;
  transform: translateX(16px);
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  min-width: 16px;
  height: 16px;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 0 0 2px var(--bg), 0 2px 8px rgba(239, 68, 68, 0.6);
}

/* ---------- Cards / shared ---------- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--elev-2);
  transition: transform 0.16s ease, box-shadow 0.2s ease;
}
.card:active { transform: scale(0.992); }
/* Full-bleed hero image — the meme is the star. */
.card-img {
  width: 100%;
  background: #000;
  display: block;
}
.card-body { padding: 13px 15px 15px; position: relative; }
.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.meta .author { color: var(--text); font-weight: 700; }
.meme-tip-btn {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 17px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 8px;
  opacity: 0.8;
  transition: transform 0.12s ease, opacity 0.15s ease;
}
.meme-tip-btn:active { transform: scale(0.85); opacity: 1; }

/* Floating, glowing vote — the signature bold-immersive reaction. The view
   moves the vote button here; it overlaps the image's bottom edge. */
.card { position: relative; }
.vote-float {
  position: absolute;
  top: 0;
  right: 14px;
  transform: translateY(-50%);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.95), rgba(124, 58, 237, 0.95));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  border: 1px solid rgba(196, 181, 253, 0.6);
  border-radius: 999px;
  padding: 10px 17px;
  font-size: 17px;
  font-weight: 800;
  min-height: 0;
  box-shadow: var(--glow-accent);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease,
    background 0.2s ease, color 0.2s ease;
}
.vote-float:active { transform: translateY(-50%) scale(0.9); }
.vote-float.voted {
  background: var(--grad-gold);
  border-color: rgba(251, 191, 36, 0.7);
  color: #1a1205;
  box-shadow: var(--glow-gold);
  animation: votePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes votePop {
  0% { transform: translateY(-50%) scale(1); }
  45% { transform: translateY(-50%) scale(1.22); }
  100% { transform: translateY(-50%) scale(1); }
}

/* ---------- Fullscreen lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) 8px env(safe-area-inset-bottom);
  animation: fadeIn 0.18s ease;
}
.lightbox-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: var(--elev-3); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Profile view ---------- */
.profile-head { display: flex; align-items: center; gap: 14px; margin: 8px 0 4px; }
.profile-name { font-size: 21px; font-weight: 800; display: flex; align-items: center; }
.profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.profile-cell {
  background: var(--bg-elev2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  padding: 0;
  overflow: hidden;
  aspect-ratio: 1;
  transition: transform 0.14s ease;
}
.profile-cell img { width: 100%; height: 100%; object-fit: cover; }
.profile-cell:active { transform: scale(0.96); }
.caption { font-size: 15px; line-height: 1.45; margin: 6px 0; word-break: break-word; }

.row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  background: var(--bg-elev2);
  color: var(--text);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 11px 15px;
  font-size: 14px;
  font-weight: 700;
  min-height: 42px;
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease, background 0.2s ease;
}
.btn:active { transform: scale(0.96); }
.btn.primary {
  background: var(--grad-accent);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--glow-accent-soft);
}
.btn.primary:active { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: #fff; background: rgba(239, 68, 68, 0.18); border-color: rgba(239, 68, 68, 0.5); }
.btn:disabled { opacity: 0.5; box-shadow: none; }
.btn-sm { padding: 7px 12px; font-size: 13px; min-height: 36px; border-radius: 10px; }

/* The in-row vote (used where not floated). */
.vote { display: flex; align-items: center; gap: 6px; font-weight: 800; }
.vote.voted { color: var(--gold); }

.pill {
  display: inline-block;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.28);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-ink);
  margin-right: 6px;
}

/* ---------- Segmented control (sliding feel) ---------- */
.segment {
  display: flex;
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 14px;
  box-shadow: var(--elev-1);
}
.segment button {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 9px 6px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.25s ease, box-shadow 0.25s ease, transform 0.12s ease;
}
.segment button:active { transform: scale(0.96); }
.segment button.active {
  background: var(--grad-accent);
  color: #fff;
  box-shadow: var(--glow-accent-soft);
}

/* ---------- Forms ---------- */
input, textarea, select {
  width: 100%;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 13px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.22);
}
label { display: block; font-size: 13px; color: var(--text-dim); margin: 14px 0 6px; font-weight: 600; }
textarea { resize: vertical; min-height: 64px; }

/* ---------- Comments ---------- */
.comment { padding: 9px 0; border-top: 1px solid var(--hairline); font-size: 14px; }
.comment .c-author { font-weight: 700; color: var(--accent-ink); font-size: 13px; }
.comment .c-text { margin-top: 2px; word-break: break-word; white-space: pre-wrap; line-height: 1.45; }
.comment.depth-1 { margin-left: 16px; }
.comment.depth-2 { margin-left: 32px; }
.comment.depth-3 { margin-left: 44px; }

/* ---------- Editor ---------- */
.editor-stage {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: var(--r-md);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  box-shadow: var(--elev-2);
}
.editor-stage img { width: 100%; pointer-events: none; }
.txt-box {
  position: absolute;
  transform: translate(-50%, -50%);
  color: #fff;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
  cursor: grab;
  padding: 4px;
  line-height: 1.1;
  max-width: 90%;
  word-break: break-word;
}
.txt-box.sel { outline: 2px dashed var(--accent-2); }

/* Captioned-GIF display: Impact text laid over a live (animated) image. cqw
   units scale the text with the card width, matching the editor's sizing. */
.meme-media { position: relative; display: block; overflow: hidden; background: #000; container-type: inline-size; }
.meme-media .meme-media-img { width: 100%; display: block; }
.meme-text {
  position: absolute;
  transform: translate(-50%, -50%);
  color: #fff;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
  line-height: 1.1;
  max-width: 92%;
  word-break: break-word;
  pointer-events: none;
}

/* GIF reaction shown inside a comment. */
.comment-gif { margin-top: 6px; max-width: 220px; width: 100%; border-radius: 10px; display: block; }

/* GIF picker sheet. */
.gif-search {
  width: 100%; box-sizing: border-box; margin: 8px 0; padding: 10px 12px;
  border-radius: 10px; border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.06); color: inherit; font-size: 15px;
}
.gif-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-height: 52vh; overflow: auto; }
.gif-cell { padding: 0; border: 0; background: rgba(255, 255, 255, 0.06); border-radius: 8px; overflow: hidden; cursor: pointer; aspect-ratio: 1; }
.gif-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gif-attribution { margin-top: 8px; text-align: center; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim, #8a849c); }

/* ---------- Leaderboard (medals for top 3) ---------- */
.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
  transition: background 0.15s ease;
}
.lb-row:last-child { border-bottom: none; }
.lb-rank { width: 30px; font-weight: 800; color: var(--text-dim); text-align: center; font-size: 15px; }
/* Top-3 get a colored medal badge (no emoji). */
.lb-rank.medal {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #1a1205; flex: none;
}
.lb-rank.m1 { background: linear-gradient(135deg, #fde68a, #f59e0b); box-shadow: 0 0 12px rgba(251, 191, 36, 0.55); }
.lb-rank.m2 { background: linear-gradient(135deg, #e5e7eb, #9ca3af); }
.lb-rank.m3 { background: linear-gradient(135deg, #f3c699, #b45309); }
.lb-name { flex: 1; font-weight: 700; word-break: break-word; }
.lb-karma { color: var(--accent-ink); font-weight: 800; }

/* ---------- Presence (pulsing online) ---------- */
.presence-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-left: 7px;
  vertical-align: middle;
  flex-shrink: 0;
}
.presence-dot.on { background: var(--ok); box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3); animation: pulseOn 2s ease-in-out infinite; }
.presence-dot.off { background: #555; }
.lb-row .presence-dot { margin-left: auto; }
@keyframes pulseOn {
  0%, 100% { box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3); }
  50% { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12); }
}

/* ---------- DMs ---------- */
.thread-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 6px;
  border-bottom: 1px solid var(--hairline);
  transition: background 0.15s ease;
  border-radius: 12px;
}
.thread-row:active { background: var(--bg-elev); }
.thread-row .t-name { font-weight: 700; }
.thread-row .t-prev { color: var(--text-dim); font-size: 13px; }
.thread-row.unread .t-name { font-weight: 800; color: var(--text); }
.thread-row.unread .t-prev { color: var(--text); }
.unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grad-accent);
  margin-right: 7px;
  vertical-align: middle;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.7);
}
.dm-log { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; }
.bubble {
  max-width: 78%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
  white-space: pre-wrap;
  animation: bubbleIn 0.2s ease;
}
@keyframes bubbleIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.bubble.me { align-self: flex-end; background: var(--grad-accent); color: #fff; border-bottom-right-radius: 5px; box-shadow: var(--glow-accent-soft); }
.bubble.them { align-self: flex-start; background: var(--bg-elev2); border-bottom-left-radius: 5px; }
.dm-composer { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 8px 0 calc(var(--safe-bottom) + 8px); background: linear-gradient(0deg, var(--bg) 70%, transparent); }
.dm-status { font-size: 12px; line-height: 1.4; padding: 9px 11px; border-radius: 10px; margin-bottom: 8px; }
.dm-status.checking { color: var(--text-dim); background: var(--bg-elev); }
.dm-status.ok { color: var(--text-dim); background: var(--bg-elev); }
.dm-status.warn { color: #fff; background: rgba(239, 68, 68, 0.18); border: 1px solid var(--danger); }

/* ---------- Toast (spring up) ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 18px);
  transform: translateX(-50%) translateY(24px) scale(0.96);
  background: rgba(35, 35, 51, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: var(--text);
  padding: 11px 18px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  max-width: 88%;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 50;
  box-shadow: var(--elev-3);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
#toast.err { border-color: var(--danger); }

/* ---------- Avatars / clickable authors ---------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 2px 6px rgba(0, 0, 0, 0.35);
}
.author-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  color: var(--text);
  padding: 0;
  font: inherit;
}
.author-btn .author { color: var(--text); }

/* ---------- Bottom sheet (spring) ---------- */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  opacity: 0;
  transition: opacity 0.2s;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sheet-overlay.show { opacity: 1; }
.sheet-panel {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-elev);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  border-top: 1px solid var(--hairline);
  padding: 18px 16px calc(var(--safe-bottom) + 20px);
  max-height: 88vh;
  overflow-y: auto;
  transform: translateY(28px);
  transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.5, 1);
  box-shadow: var(--elev-3);
}
.sheet-panel::before {
  content: "";
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  margin: -6px auto 14px;
}
.sheet-overlay.show .sheet-panel { transform: translateY(0); }
.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sheet-name { font-size: 19px; font-weight: 800; }
.sheet-karma { color: var(--accent-ink); font-size: 13px; font-weight: 700; }
.sheet-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.sheet-actions .btn { width: 100%; }
.tip-box {
  background: var(--bg-elev2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 13px;
}
.tip-addr { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all; color: var(--text); }

/* ---------- Template picker grid ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tpl-cell {
  background: var(--bg-elev2);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  aspect-ratio: 1;
  transition: transform 0.14s ease;
}
.tpl-cell img { width: 100%; height: 100%; object-fit: cover; }
.tpl-cell:active { transform: scale(0.95); }

.section-title { font-size: 12px; color: var(--text-dim); margin: 20px 0 9px; text-transform: uppercase; letter-spacing: 0.7px; font-weight: 700; }
.spin { text-align: center; color: var(--text-dim); padding: 28px; }
.ptr {
  height: 0;
  overflow: hidden;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
  transition: height 0.15s ease, opacity 0.15s ease;
}
a { color: var(--accent-ink); }

/* ---------- Hunt (honeypot puzzles) ---------- */
.hunt-status { font-size: 13px; color: var(--text-dim); margin: 8px 0 0; min-height: 18px; }
.hunt-status.warn { color: var(--danger); }
.hunt-warn {
  font-size: 13px;
  line-height: 1.45;
  color: var(--gold);
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 10px;
  padding: 9px 11px;
  margin: 8px 0;
}
.hunt-row { margin-bottom: 8px; }

/* Compact comment upvote chip (floats to the right of the author line). */
.c-vote {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 0;
  padding: 1px 9px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
}
.c-vote.voted { color: var(--gold); border-color: rgba(251, 191, 36, 0.5); }
.c-vote:disabled { opacity: 1; }

/* ---------- Skeleton shimmer (replaces text-only spinners) ---------- */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--bg-elev);
  border-radius: var(--r-lg);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.06) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: shimmer 1.3s infinite;
}
.skeleton-card { height: 320px; margin-bottom: 16px; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- Meme of the Day hero ---------- */
.motd {
  box-shadow: var(--glow-gold), var(--elev-2);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

/* ---------- Extension cooperation banner (memeth.me only) ---------- */
.ext-banner {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  z-index: 55;
  width: calc(100% - 24px);
  max-width: 560px;
  background: linear-gradient(135deg, rgba(31, 24, 56, 0.98), rgba(26, 26, 38, 0.98));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(139, 92, 246, 0.5);
  border-radius: 16px;
  padding: 13px 15px;
  box-shadow: var(--glow-accent-soft), var(--elev-3);
  animation: extBannerIn 0.35s cubic-bezier(0.34, 1.4, 0.5, 1);
}
@keyframes extBannerIn { from { opacity: 0; transform: translateX(-50%) translateY(16px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.ext-banner-text { font-size: 13px; line-height: 1.5; color: var(--text); }
.ext-banner-text b { color: var(--accent-ink); }
.ext-banner-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
