/* ════════════════════════════════════════════════════════════════
   22-Cards — וייב קוד ניוז · חפיסת קלפים
   Tinder-style swipe stack. ONE card visible at a time.
   Signature: Vanilla Pointer Events with 100px threshold.
   Palette: pure white/cream background, vibrant accents per card,
            soft shadows, slight rotation per card.
   ════════════════════════════════════════════════════════════════ */

/* ─── Design Tokens ─── */
:root {
  /* Backgrounds */
  --bg-1: #f6f3ec;       /* warm cream */
  --bg-2: #ece6d8;       /* sand */
  --bg-3: #ffffff;       /* pure white for card */

  /* Card category accents */
  --cat-opinion:  #8b5cf6;  /* purple */
  --cat-deep:     #2563eb;  /* blue   */
  --cat-guide:    #16a34a;  /* green  */
  --cat-tools:    #eab308;  /* yellow */
  --cat-bench:    #dc2626;  /* red    */
  --cat-default:  #0f172a;  /* ink    */

  /* Functional */
  --save-green:   #25D366;
  --save-green-d: #128C7E;
  --skip-red:     #ef4444;
  --read-blue:    #3b82f6;

  /* Text */
  --ink:        #0f172a;
  --ink-soft:   #475569;
  --ink-dim:    #94a3b8;
  --ink-mute:   #cbd5e1;

  /* Lines */
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.18);

  /* Shadows */
  --shadow-card:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 8px 24px rgba(15, 23, 42, 0.10),
    0 24px 48px -16px rgba(15, 23, 42, 0.16);
  --shadow-card-top:
    0 2px 4px rgba(15, 23, 42, 0.08),
    0 14px 36px rgba(15, 23, 42, 0.16),
    0 36px 64px -18px rgba(15, 23, 42, 0.22);

  /* Fonts */
  --font-display: 'Inter', 'Heebo', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-body:    'Heebo', 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  /* Sizes */
  --card-radius: 28px;
  --card-max:    420px;
  --card-w:      min(420px, calc(100vw - 32px));
  --card-h:      min(620px, calc(100vh - 200px));
  --threshold:   100px; /* px drag distance to commit a swipe */
  --threshold-rotate: 18deg;
  --header-h:    64px;
  --action-h:    84px;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
html { background: var(--bg-1); }
body {
  background:
    radial-gradient(ellipse at 12% 0%, rgba(139, 92, 246, 0.10) 0%, transparent 38%),
    radial-gradient(ellipse at 88% 12%, rgba(37, 99, 235, 0.08) 0%, transparent 42%),
    radial-gradient(ellipse at 50% 100%, rgba(22, 163, 74, 0.07) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
}

/* RTL tweaks: card stack centered, drawer on the left */
body[dir="rtl"] {}

/* ─── Page Header (subtle brand strip) ─── */
.page-header {
  flex-shrink: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px) saturate(160%);
  -webkit-backdrop-filter: blur(8px) saturate(160%);
  z-index: 50;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 900;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--ink-dim);
  text-transform: uppercase;
  font-weight: 500;
}
.page-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-title::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cat-deep);
}
.page-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  text-transform: uppercase;
  font-weight: 500;
}
.saved-toggle {
  background: white;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.saved-toggle:hover { background: var(--ink); color: white; border-color: var(--ink); }
.saved-toggle-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--save-green);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 0 5px;
}

/* ─── Main Stage (where cards live) ─── */
.stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px;
}

/* ─── The Stack (3 cards visible max) ─── */
.stack {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
}

/* ─── The Card ─── */
.card {
  position: absolute;
  inset: 0;
  background: var(--bg-3);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: grab;
  will-change: transform, opacity;
  touch-action: none;
  /* pointer-events managed in JS to ensure only top card is interactive */
}
.card--active {
  cursor: grab;
  box-shadow: var(--shadow-card-top);
  z-index: 10;
}
.card--active.dragging {
  cursor: grabbing;
  transition: none !important;
}
.card--next,
.card--next2 {
  pointer-events: none;
}
.card--leaving {
  pointer-events: none;
}

/* Background tint per category — soft, not neon */
.card[data-cat="opinion"]  { --accent: var(--cat-opinion); }
.card[data-cat="deep"]     { --accent: var(--cat-deep);    }
.card[data-cat="guide"]    { --accent: var(--cat-guide);   }
.card[data-cat="tools"]    { --accent: var(--cat-tools);   }
.card[data-cat="bench"]    { --accent: var(--cat-bench);   }
.card[data-cat="news"]     { --accent: var(--cat-deep);    }
.card[data-cat="chat"]     { --accent: var(--cat-default); }

.card-accent-bar {
  flex-shrink: 0;
  height: 6px;
  background: var(--accent);
  width: 100%;
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 22px 24px 18px;
  overflow: hidden;
  position: relative;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 14px;
}
.card-meta-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.card-meta-urgency {
  margin-inline-start: auto;
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.card-meta-urgency.breaking {
  background: var(--cat-bench);
  color: white;
}
.card-meta-urgency.high {
  background: var(--cat-tools);
  color: var(--ink);
}
.card-meta-urgency.normal {
  background: var(--ink-mute);
  color: var(--ink-soft);
}

.card-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 12px;
  text-wrap: balance;
}

.card-excerpt {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 14px;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-dek {
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0 0 14px;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
  text-transform: uppercase;
  font-weight: 500;
  flex-wrap: wrap;
}
.card-foot-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 10.5px;
  font-family: var(--font-display);
  letter-spacing: 0;
  text-transform: none;
}
.card-foot-author { color: var(--ink-soft); font-weight: 600; }
.card-foot-sep { color: var(--ink-mute); }

/* ─── Card affordance badges (LIKE / NOPE / READ) ─── */
.card-affordance {
  position: absolute;
  top: 28px;
  padding: 8px 16px;
  border: 4px solid;
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 24px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  transition: none;
}
.card-affordance-save {
  inset-inline-end: 24px;
  color: var(--save-green);
  border-color: var(--save-green);
  transform: rotate(12deg);
}
.card-affordance-skip {
  inset-inline-start: 24px;
  color: var(--skip-red);
  border-color: var(--skip-red);
  transform: rotate(-12deg);
}
.card-affordance-read {
  top: auto;
  bottom: 60px;
  inset-inline-start: 50%;
  transform: translateX(-50%) rotate(0deg);
  color: var(--read-blue);
  border-color: var(--read-blue);
  font-size: 20px;
}

/* ─── Card glow tints during drag ─── */
.card-tint {
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  border-radius: var(--card-radius);
  mix-blend-mode: multiply;
}

/* ─── Index pill (for chat cards) ─── */
.card-index {
  position: absolute;
  top: 16px;
  inset-inline-end: 16px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  text-transform: uppercase;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.85);
  padding: 3px 8px;
  border-radius: 4px;
  z-index: 4;
  pointer-events: none;
}

/* ─── CHAT CARD layout ─── */
.chat-card {
  background: var(--bg-3);
  position: relative;
}
.chat-card .chat-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  background: var(--wa-bg);
  border-radius: 0 0 var(--card-radius) var(--card-radius);
  overflow: hidden;
}
.chat-card .chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--wa-green-d);
  color: white;
  flex-shrink: 0;
}
.chat-card .chat-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 17px;
  color: var(--ink);
  flex-shrink: 0;
}
.chat-card .chat-head-info { flex: 1; min-width: 0; }
.chat-card .chat-head-name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
}
.chat-card .chat-head-status {
  font-size: 11px;
  opacity: 0.92;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.chat-card .chat-head-status .dot {
  width: 6px; height: 6px;
  background: #4dff8a;
  border-radius: 50%;
  display: inline-block;
  animation: typing-pulse 1.4s infinite ease-in-out;
}
@keyframes typing-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}
.chat-card .chat-head-actions {
  font-size: 18px;
  letter-spacing: 1px;
  opacity: 0.9;
  cursor: default;
}
.chat-card .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Cpath d='M8 6c0-1 .8-2 2-2h2c1 0 2 1 2 2v2c0 1-1 2-2 2h-2c-1 0-2-1-2-2V6zm16 16c0-1 .8-2 2-2h2c1 0 2 1 2 2v2c0 1-1 2-2 2h-2c-1 0-2-1-2-2v-2z' fill='%23d4d0c4' opacity='0.30'/%3E%3C/svg%3E");
}
.chat-card .msg-date-sep {
  text-align: center;
  font-size: 10.5px;
  color: var(--ink-soft);
  margin: 6px 0;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.chat-card .bubble {
  max-width: 80%;
  align-self: flex-start;
  padding: 7px 10px 5px;
  border-radius: 8px 8px 8px 2px;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
  position: relative;
  font-size: 12.5px;
  line-height: 1.4;
}
.chat-card .bubble-text { color: var(--ink); }
.chat-card .bubble-time {
  display: block;
  text-align: left;
  font-size: 9.5px;
  color: var(--ink-dim);
  margin-top: 3px;
  letter-spacing: 0.02em;
  font-family: var(--font-mono);
}
.chat-card .bubble-top {
  display: flex;
  gap: 6px;
  margin-bottom: 3px;
  align-items: center;
  flex-wrap: wrap;
}
.chat-card .bubble-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--wa-green);
  color: white;
}
.chat-card .urgent-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 3px;
  background: #ffe0e0;
  color: #c0392b;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.chat-card .bubble.urgent {
  background: #fff8e0;
  border-color: #ffd770;
}
.chat-card .typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 9px 12px;
  background: white;
  border-radius: 8px 8px 8px 2px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}
.chat-card .typing-dot {
  width: 6px; height: 6px;
  background: var(--ink-dim);
  border-radius: 50%;
  animation: typing-bounce 1.2s infinite ease-in-out;
}
.chat-card .typing-dot:nth-child(2) { animation-delay: 0.18s; }
.chat-card .typing-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-3px); opacity: 1; }
}
.chat-card .chat-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #f0f0ec;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.chat-card .chat-input-field {
  flex: 1;
  background: white;
  border-radius: 18px;
  padding: 7px 14px;
  font-size: 12px;
  color: var(--ink-soft);
  border: 1px solid rgba(0, 0, 0, 0.05);
}
.chat-card .chat-send {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--wa-green);
  color: white;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 0;
  font-size: 13px;
  font-family: var(--font-body);
}
.chat-card .skin-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #e8e8e2;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}
.chat-card .skin-label {
  font-size: 9.5px;
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-inline-start: auto;
  font-weight: 600;
}
.chat-card .skin-btn {
  width: 26px; height: 26px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: white;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 11.5px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .15s;
  display: grid;
  place-items: center;
}
.chat-card .skin-btn:hover { border-color: rgba(0, 0, 0, 0.28); }
.chat-card .skin-btn.active {
  background: var(--wa-green);
  color: white;
  border-color: var(--wa-green);
}

/* Skins */
.chat-card .chat-inner.skin-wa { background: var(--wa-bg); }
.chat-card .chat-inner.skin-wa .chat-header { background: var(--wa-green-d); }
.chat-card .chat-inner.skin-wa .bubble-tag { background: var(--wa-green); color: white; }
.chat-card .chat-inner.skin-wa .chat-send { background: var(--wa-green); }
.chat-card .chat-inner.skin-wa .skin-btn.active { background: var(--wa-green); border-color: var(--wa-green); color: white; }

.chat-card .chat-inner.skin-tg { background: var(--tg-bg, #e7eef5); --tg-blue: #2AABEE; --tg-blue-d: #229ED9; }
.chat-card .chat-inner.skin-tg { background: #e7eef5; }
.chat-card .chat-inner.skin-tg .chat-header { background: var(--tg-blue-d, #229ED9); }
.chat-card .chat-inner.skin-tg .bubble-tag { background: var(--tg-blue, #2AABEE); color: white; }
.chat-card .chat-inner.skin-tg .chat-send { background: var(--tg-blue, #2AABEE); }
.chat-card .chat-inner.skin-tg .skin-btn.active { background: var(--tg-blue, #2AABEE); border-color: var(--tg-blue, #2AABEE); color: white; }
.chat-card .chat-inner.skin-tg .chat-input-field { font-family: 'Heebo', sans-serif; }

.chat-card .chat-inner.skin-ms { background: #f0eaf5; }
.chat-card .chat-inner.skin-ms .chat-header { background: linear-gradient(135deg, #0099FF, #A033FF); }
.chat-card .chat-inner.skin-ms .bubble-tag { background: linear-gradient(135deg, #0099FF, #A033FF); color: white; }
.chat-card .chat-inner.skin-ms .chat-send { background: linear-gradient(135deg, #0099FF, #A033FF); }
.chat-card .chat-inner.skin-ms .skin-btn.active { background: linear-gradient(135deg, #0099FF, #A033FF); border-color: #A033FF; color: white; }
.chat-card .chat-inner.skin-ms .chat-input-field { font-family: 'Heebo', sans-serif; }

/* ─── Action Bar ─── */
.action-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 14px 16px;
  height: var(--action-h);
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  /* Above the shared switcher (z-index 99999) so the buttons are clickable
     when the switcher wraps to overlap the bottom of the page. */
  z-index: 100000;
  position: relative;
}
.act-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  font-size: 22px;
  cursor: pointer;
  background: white;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.08),
    0 8px 18px rgba(15, 23, 42, 0.10);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.act-btn:hover { transform: translateY(-2px) scale(1.05); }
.act-btn:active { transform: translateY(0) scale(0.98); }
.act-btn.skip {
  color: var(--skip-red);
  border: 2px solid var(--skip-red);
  background: white;
}
.act-btn.save {
  width: 70px;
  height: 70px;
  font-size: 26px;
  color: white;
  background: var(--save-green);
  border: 3px solid var(--save-green-d);
}
.act-btn.read {
  color: var(--read-blue);
  border: 2px solid var(--read-blue);
  background: white;
}
.act-btn-sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ─── Hint strip (top of stage) ─── */
.stage-hint {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  text-transform: uppercase;
  font-weight: 600;
  text-align: center;
  z-index: 5;
  pointer-events: none;
  white-space: nowrap;
}
.stage-counter {
  position: absolute;
  top: 14px;
  inset-inline-end: 18px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-soft);
  letter-spacing: 0.1em;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.7);
  padding: 3px 8px;
  border-radius: 4px;
  z-index: 5;
  pointer-events: none;
}
.stage-counter-current {
  color: var(--ink);
  font-weight: 800;
  font-size: 12px;
}
.stage-counter-divider {
  margin: 0 4px;
  color: var(--ink-mute);
}

/* ─── Empty stack state ─── */
.stack-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--ink-soft);
  padding: 24px;
}
.stack-empty h2 {
  font-size: 28px;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.stack-empty p {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  margin: 0 0 18px;
  max-width: 320px;
  line-height: 1.5;
}
.stack-empty button {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  background: var(--ink);
  color: white;
  border: 0;
  padding: 12px 22px;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: transform 0.15s;
}
.stack-empty button:hover { transform: translateY(-2px); }

/* ─── Saved Drawer ─── */
.saved-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  inset-inline-start: 0;
  width: min(360px, 92vw);
  background: var(--bg-3);
  z-index: 200;
  transform: translateX(-100%); /* RTL: appears from left */
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 24px 0 60px -10px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
}
html[dir="rtl"] .saved-drawer { transform: translateX(100%); }
.saved-drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
}
.drawer-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 18px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.drawer-close {
  background: none;
  border: 0;
  font-size: 24px;
  color: var(--ink-soft);
  cursor: pointer;
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  transition: all 0.15s;
}
.drawer-close:hover { background: var(--ink); color: white; }

.drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.drawer-item {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.drawer-item:hover {
  border-color: var(--ink);
  transform: translateX(-2px);
}
html[dir="rtl"] .drawer-item:hover { transform: translateX(2px); }
.drawer-item-cat {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent, var(--ink-soft));
  font-weight: 700;
  margin-bottom: 6px;
}
.drawer-item-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 4px;
}
.drawer-item-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-dim);
  letter-spacing: 0.06em;
}
.drawer-empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 14px;
}

.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s;
}
.drawer-scrim.open {
  opacity: 1;
  pointer-events: auto;
}

/* ─── Article overlay (full-screen reader) ─── */
.article-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg-1);
  display: none;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.3s;
}
.article-overlay.open {
  display: flex;
  opacity: 1;
}

.article-overlay-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: white;
  z-index: 2;
}
.article-overlay-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}
.article-overlay-back {
  background: var(--ink);
  color: white;
  border: 0;
  padding: 8px 18px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.article-overlay-back:hover { background: var(--ink-soft); }
.article-overlay-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  color: var(--ink);
  max-width: 50%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.article-overlay-content {
  flex: 1;
  overflow-y: auto;
  padding: 40px 24px 60px;
  display: flex;
  justify-content: center;
}
.article-overlay-inner {
  max-width: 680px;
  width: 100%;
}
.article-overlay-cat {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: white;
  background: var(--accent, var(--ink));
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 16px;
}
.article-overlay-h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 38px;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 14px;
}
.article-overlay-dek {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 24px;
}
.article-overlay-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  text-transform: uppercase;
  font-weight: 500;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.article-overlay-meta strong { color: var(--ink); text-transform: none; font-family: var(--font-display); font-weight: 700; }
.article-overlay-tldr {
  background: var(--bg-2);
  border-inline-start: 4px solid var(--accent, var(--ink));
  padding: 14px 18px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 26px;
}
.article-overlay-tldr strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.article-overlay-p {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
  margin: 0 0 18px;
}
.article-overlay-takeaway {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 10px;
}
.article-overlay-takeaway::before {
  content: '→';
  color: var(--accent, var(--ink));
  font-weight: 800;
  font-family: var(--font-display);
  flex-shrink: 0;
  margin-top: 1px;
}
.article-overlay-source {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  background: var(--bg-1);
  padding: 4px 10px;
  border-radius: 4px;
  margin: 4px 6px 4px 0;
  border: 1px solid var(--line);
  text-decoration: none;
}
html[dir="rtl"] .article-overlay-source { margin: 4px 0 4px 6px; }
.article-overlay-source:hover { color: var(--ink); border-color: var(--ink); }

/* ─── Toast notification ─── */
.toast {
  position: fixed;
  bottom: calc(var(--action-h) + 24px);
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: var(--ink);
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  z-index: 250;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
  letter-spacing: 0.01em;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.32);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.save { background: var(--save-green-d); }
.toast.skip { background: var(--skip-red); }
.toast.read { background: var(--read-blue); }

/* ─── Mobile responsive ─── */
@media (max-width: 540px) {
  :root {
    --card-w: calc(100vw - 24px);
    --card-h: calc(100vh - 220px);
    --card-radius: 22px;
  }
  .page-header { padding: 0 14px; }
  .brand { font-size: 15px; }
  .page-title { font-size: 13px; }
  .page-meta { display: none; }
  .saved-toggle { padding: 5px 10px; font-size: 11.5px; }
  .card-body { padding: 18px 18px 14px; }
  .card-title { font-size: 22px; }
  .act-btn { width: 52px; height: 52px; font-size: 20px; }
  .act-btn.save { width: 62px; height: 62px; font-size: 24px; }
  .action-bar { gap: 12px; padding: 10px 12px; }
  .article-overlay-h1 { font-size: 28px; }
  .article-overlay-content { padding: 24px 16px 40px; }
  .article-overlay-p { font-size: 15.5px; }
  .stage-hint { font-size: 9px; }
}
@media (max-width: 380px) {
  .card-title { font-size: 19px; }
  .card-excerpt { font-size: 13.5px; -webkit-line-clamp: 4; }
  .act-btn { width: 46px; height: 46px; font-size: 18px; }
  .act-btn.save { width: 56px; height: 56px; font-size: 22px; }
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .typing-dot, .chat-head-status .dot { animation: none !important; }
}
