/* ============================================================
   Delusion Index — Components
   ------------------------------------------------------------
   All reusable UI components, grouped by role.
   Read top to bottom: buttons → chips → card → meter → stamp →
   vote row → countdown → empty → modal → notifications →
   toast → detail extras.
   ============================================================ */

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-body);
  font-weight: 700;
  border: none;
  cursor: pointer;
  border-radius: var(--r-pill);
  font-size: var(--t-xs);
  padding: 11px 18px;
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(.96); }

.btn-grad {
  color: #fff;
  background: var(--grad-delulu);
  box-shadow: 0 8px 20px rgba(255, 79, 163, .40);
}
.btn-grad:hover {
  filter: brightness(1.05);
  box-shadow: 0 12px 26px rgba(255, 79, 163, .5);
}

.btn-ghost {
  background: rgba(255, 255, 255, .7);
  color: var(--pink-deep);
  border: 1.5px solid rgba(212, 38, 126, .35);
}
.btn-ghost:hover { background: #fff; border-color: var(--pink); }

.btn-block { width: 100%; padding: 15px; font-size: var(--t-sm); }

/* ---------- Filter chips ---------- */
.chip {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--t-xs);
  padding: 8px 16px;
  border-radius: var(--r-pill);
  cursor: pointer;
  white-space: nowrap;
  border: 1.5px solid rgba(212, 38, 126, .2);
  background: rgba(255, 255, 255, .6);
  color: var(--ink-soft);
  transition: .18s;
}
.chip:hover { border-color: var(--pink); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Delusion card ---------- */
.card {
  position: relative;
  background: var(--surface);
  border-radius: var(--r-card);
  padding: var(--s-6);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(255, 79, 163, .08);
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px);
  animation: rise .55s cubic-bezier(.2, .7, .3, 1) forwards;
}
@keyframes rise { to { opacity: 1; transform: none; } }

/* Gradient top stripe — pink/coral/gold for live, slate for closed */
.card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--grad-delulu);
  opacity: .9;
}
.card.closed::after { background: linear-gradient(90deg, var(--slate), #b9c4d2); }

.card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.poster {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--ink);
}
.poster .pin {
  width: 28px;
  height: 28px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, #ffe0ef, #ffeccc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: var(--t-xs);
  color: var(--pink-deep);
}
.poster .handle { color: var(--ink-soft); font-weight: 500; }

.card h3 {
  font-family: var(--font-display);
  font-size: clamp(21px, 5.2vw, 27px);
  line-height: 1.12;
  letter-spacing: -.4px;
  cursor: pointer;
}
.card h3:hover { color: var(--pink-deep); }

.card .body {
  color: var(--ink-soft);
  font-size: 15.5px;
  margin-top: var(--s-2);
}

/* ---------- The Delulu Meter ---------- */
.meter-wrap { margin: var(--s-5) 0 6px; }

.meter {
  position: relative;
  height: 18px;
  border-radius: var(--r-pill);
  background: linear-gradient(#fbe7ef, #f6dde8);
  box-shadow: inset 0 2px 5px rgba(212, 38, 126, .16);
  overflow: visible;
}

/* Pulsing aura behind the fill — intensifies with score */
.meter .aura {
  position: absolute;
  top: 50%;
  left: 0;
  width: 0;
  height: 120px;
  transform: translateY(-50%);
  background: var(--grad-aura);
  opacity: 0;
  transition: opacity .5s, width .9s cubic-bezier(.2, .7, .3, 1);
  pointer-events: none;
  border-radius: 50%;
}

.meter-fill {
  position: relative;
  height: 100%;
  width: 0;
  border-radius: var(--r-pill);
  background: var(--grad-delulu);
  transition: width .9s cubic-bezier(.2, .7, .3, 1), box-shadow .5s;
  box-shadow: 0 0 0 rgba(255, 201, 60, 0);
}
/* Inner gloss highlight */
.meter-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--r-pill);
  background: linear-gradient(180deg, rgba(255, 255, 255, .5), transparent 55%);
}

/* Drifting sparkle motes — JS injects more of these as the score climbs */
.meter-sparkles { position: absolute; inset: -14px 0; pointer-events: none; }
.meter-sparkles span {
  position: absolute;
  font-size: var(--t-xs);
  color: var(--gold);
  filter: drop-shadow(0 0 4px rgba(255, 201, 60, .9));
  animation: drift 3s ease-in-out infinite;
}
@keyframes drift {
  0%, 100% { transform: translateY(0)    scale(.85); opacity: .4; }
  50%      { transform: translateY(-7px) scale(1.15); opacity: 1; }
}

/* Awaiting / zero-votes neutral state — NEVER show 50% */
.meter.awaiting {
  background: repeating-linear-gradient(110deg,
    #f3e7df, #f3e7df 10px, #efe0d6 10px, #efe0d6 20px);
}
.meter.awaiting .meter-fill { display: none; }

.meter-cap {
  font-family: var(--font-accent);
  font-size: 21px;
  line-height: 1;
  margin-top: 11px;
  color: var(--pink-deep);
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  flex-wrap: wrap;
}
.meter-cap .pct { font-weight: 700; }
.meter.awaiting + .meter-cap { color: var(--ink-soft); }

.verdict-tag {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: rgba(255, 79, 163, .12);
  color: var(--pink-deep);
}
.verdict-tag.cool {
  background: rgba(138, 155, 176, .18);
  color: #5c6b80;
}

/* ---------- Vote row ---------- */
.vote-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}
.vbtn {
  flex: 1;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--t-sm);
  border-radius: var(--r-pill);
  padding: 13px;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s, filter .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.vbtn:active { transform: scale(.96); }

.vbtn.delulu {
  color: #fff;
  border: none;
  background: var(--grad-delulu);
  box-shadow: 0 8px 18px rgba(255, 79, 163, .34);
}
.vbtn.delulu:hover { filter: brightness(1.05); }

.vbtn.notdelulu {
  background: #fff;
  color: #5c6b80;
  border: 1.6px solid var(--slate);
}
.vbtn.notdelulu:hover { background: #f4f6f9; }

.vbtn[disabled] { opacity: .5; cursor: not-allowed; filter: grayscale(.2); }
.vbtn.voted { outline: 3px solid rgba(255, 201, 60, .7); outline-offset: 2px; }
.vbtn.notdelulu.voted { outline-color: rgba(138, 155, 176, .6); }
.vbtn .chk { display: none; }
.vbtn.voted .chk { display: inline; }

.vcount {
  font-family: var(--font-body);
  font-size: var(--t-xs);
  color: var(--ink-soft);
  text-align: center;
  margin-top: var(--s-3);
  font-weight: 500;
}
.vcount b { color: var(--ink); }

/* Closed-voting final result banner */
.result-banner {
  margin-top: var(--s-4);
  padding: 13px var(--s-4);
  border-radius: var(--r-input);
  text-align: center;
  background: linear-gradient(135deg, rgba(255, 79, 163, .1), rgba(255, 201, 60, .14));
  border: 1px dashed rgba(212, 38, 126, .3);
}
.result-banner.cool {
  background: rgba(138, 155, 176, .12);
  border-color: rgba(138, 155, 176, .4);
}
.result-banner .rt {
  font-family: var(--font-accent);
  font-size: var(--t-lg);
  color: var(--pink-deep);
  line-height: 1;
}
.result-banner.cool .rt { color: #5c6b80; }
.result-banner .rs {
  font-size: var(--t-xs);
  color: var(--ink-soft);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 3px;
}

/* ---------- Vote slam stamp ---------- */
.stamp {
  position: absolute;
  top: 38%;
  left: 50%;
  z-index: 5;
  pointer-events: none;
  font-family: var(--font-accent);
  font-weight: 700;
  font-size: 58px;
  letter-spacing: 1px;
  padding: var(--s-2) 22px;
  border-radius: var(--r-input);
  opacity: 0;
  border: 4px solid var(--pink-deep);
  color: var(--pink-deep);
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(255, 255, 255, .5);
}
.stamp.cool { border-color: var(--slate); color: #5c6b80; }
.stamp.go { animation: slam .9s cubic-bezier(.2, .8, .3, 1) forwards; }
@keyframes slam {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(2.6) rotate(-18deg); }
  18%  { opacity: 1; transform: translate(-50%, -50%) scale(.92) rotate(-11deg); }
  30%  {             transform: translate(-50%, -50%) scale(1.04) rotate(-13deg); }
  42%  {             transform: translate(-50%, -50%) scale(1)    rotate(-12deg); }
  78%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1)    rotate(-12deg); }
}

/* ---------- Countdown pill ---------- */
.countdown {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: rgba(255, 138, 91, .14);
  color: #c8551f;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.countdown.closed-pill {
  background: rgba(138, 155, 176, .18);
  color: #5c6b80;
}
.countdown .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: blink 1.4s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: .25; } }

/* ---------- Empty states ---------- */
.empty {
  text-align: center;
  padding: 56px var(--s-6);
  background: rgba(255, 255, 255, .55);
  border-radius: var(--r-card);
  border: 1.5px dashed rgba(212, 38, 126, .28);
}
.empty .em   { font-size: 46px; margin-bottom: 6px; }
.empty h4    { font-family: var(--font-display); font-size: var(--t-lg); margin-bottom: var(--s-2); }
.empty p     { color: var(--ink-soft); font-size: var(--t-sm); max-width: 340px; margin: 0 auto 18px; }

/* ---------- Modal + scrim ---------- */
.scrim {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(43, 23, 51, .45);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: var(--s-6);
  overflow-y: auto;
}
.scrim.open { display: flex; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: var(--r-modal);
  padding: 28px;
  margin: auto;
  box-shadow: var(--shadow-pop);
  position: relative;
  animation: pop .35s cubic-bezier(.2, .8, .3, 1);
}
@keyframes pop {
  from { opacity: 0; transform: translateY(20px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.modal .x {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: var(--r-pill);
  border: none;
  cursor: pointer;
  background: rgba(212, 38, 126, .08);
  color: var(--pink-deep);
  font-size: var(--t-md);
  line-height: 1;
  font-family: var(--font-body);
}
.modal .x:hover { background: rgba(212, 38, 126, .16); }

.modal .mk { font-family: var(--font-accent); font-size: var(--t-md); color: var(--coral); }
.modal h2  { font-family: var(--font-display); font-size: 30px; line-height: 1.05; margin: 2px 0 6px; }
.modal .sub { color: var(--ink-soft); font-size: 14px; margin-bottom: var(--s-5); }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: var(--t-xs);
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ink);
}
.field input,
.field textarea,
.field select {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--t-sm);
  color: var(--ink);
  border: 1.6px solid rgba(212, 38, 126, .18);
  border-radius: var(--r-input);
  padding: 12px 14px;
  background: #fffaf6;
  transition: .18s;
  resize: vertical;
}
.field input::placeholder,
.field textarea::placeholder { color: #bca9b6; }
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(255, 79, 163, .12);
  background: #fff;
}
.field .hint {
  font-family: var(--font-accent);
  font-size: var(--t-sm);
  color: var(--ink-soft);
  margin-top: 4px;
}

.tabs {
  display: flex;
  gap: 6px;
  background: rgba(212, 38, 126, .07);
  padding: 5px;
  border-radius: var(--r-pill);
  margin-bottom: var(--s-5);
}
.tabs button {
  flex: 1;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  padding: 9px;
  border-radius: var(--r-pill);
  color: var(--ink-soft);
  transition: .18s;
}
.tabs button.on {
  background: #fff;
  color: var(--pink-deep);
  box-shadow: 0 4px 12px rgba(255, 79, 163, .18);
}

.deadline-opts { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.deadline-opts button {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  padding: var(--s-2) 13px;
  border-radius: var(--r-pill);
  cursor: pointer;
  border: 1.5px solid rgba(212, 38, 126, .2);
  background: #fffaf6;
  color: var(--ink-soft);
  transition: .16s;
}
.deadline-opts button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.modal-foot { margin-top: var(--s-2); }

.tiny {
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 14px;
}

.login-prompt {
  background: rgba(255, 201, 60, .16);
  border: 1px dashed rgba(255, 138, 91, .5);
  border-radius: 12px;
  padding: 11px 14px;
  margin-bottom: 18px;
  font-family: var(--font-accent);
  font-size: var(--t-md);
  color: #c8551f;
  text-align: center;
}

/* ---------- Notification panel ---------- */
.notif-panel {
  position: fixed;
  z-index: var(--z-panel);
  top: 70px;
  right: max(18px, calc(50% - var(--maxw) / 2 + 18px));
  width: min(360px, calc(100vw - 32px));
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-pop);
  border: 1px solid rgba(255, 79, 163, .12);
  display: none;
  overflow: hidden;
  animation: pop .28s cubic-bezier(.2, .8, .3, 1);
}
.notif-panel.open { display: block; }

.notif-head {
  display: flex;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(212, 38, 126, .1);
}
.notif-head h4 { font-family: var(--font-display); font-size: 19px; }
.notif-head button {
  margin-left: auto;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--pink-deep);
  font-weight: 700;
  font-size: 12.5px;
  font-family: var(--font-body);
}

.notif-list { max-height: 60vh; overflow-y: auto; }

.notif {
  display: flex;
  gap: var(--s-3);
  padding: 14px 18px;
  border-bottom: 1px solid rgba(212, 38, 126, .07);
  align-items: flex-start;
  position: relative;
  transition: background .2s;
}
.notif.unread {
  background: linear-gradient(90deg, rgba(255, 79, 163, .07), rgba(255, 201, 60, .05));
}
.notif .nd {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
  background: rgba(138, 155, 176, .4);
}
.notif.unread .nd {
  background: var(--pink);
  box-shadow: 0 0 0 4px rgba(255, 79, 163, .18);
}
.notif .nt    { font-size: 14px; line-height: 1.35; }
.notif .nt b  { font-weight: 700; }
.notif .ntime { font-family: var(--font-accent); font-size: var(--t-sm); color: var(--ink-soft); margin-top: 2px; }

.notif-empty   { padding: 46px var(--s-6); text-align: center; }
.notif-empty .em { font-size: 38px; }
.notif-empty p   { font-family: var(--font-accent); font-size: 21px; color: var(--ink-soft); margin-top: 6px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(80px);
  z-index: var(--z-toast);
  background: var(--ink);
  color: #fff;
  padding: 13px 22px;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow-pop);
  opacity: 0;
  transition: transform .4s cubic-bezier(.2, .8, .3, 1), opacity .3s;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ---------- Detail card + comments ---------- */
.detail-card {
  background: var(--surface);
  border-radius: var(--r-card);
  padding: 30px 26px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.detail-card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--grad-delulu);
}
.detail-card.closed::after { background: linear-gradient(90deg, var(--slate), #b9c4d2); }

.detail-card h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 7vw, 40px);
  line-height: 1.06;
  letter-spacing: -.6px;
  margin: 14px 0 12px;
}
.detail-card .body  { font-size: 17px; color: var(--ink-soft); line-height: 1.6; }
.detail-card .meter { height: 24px; }
.detail-card .meter-cap { font-size: 26px; }
.detail-card .vbtn  { padding: 15px; font-size: 16px; }

.chatter { margin-top: 26px; }
.chatter h5  { font-family: var(--font-display); font-size: 20px; margin-bottom: 4px; }
.chatter .ann {
  font-family: var(--font-accent);
  font-size: var(--t-sm);
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.cmt {
  display: flex;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid rgba(212, 38, 126, .09);
}
.cmt .pin {
  width: 30px;
  height: 30px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, #ffe0ef, #ffeccc);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--pink-deep);
}
.cmt .cb b   { font-size: 13.5px; }
.cmt .cb .ct { font-size: 14.5px; color: var(--ink-soft); }

.cmt-form { display: flex; gap: var(--s-2); margin-top: 14px; }
.cmt-form input {
  flex: 1;
  border: 1.6px solid rgba(212, 38, 126, .18);
  border-radius: var(--r-pill);
  padding: 11px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  background: #fffaf6;
}
.cmt-form input:focus { outline: none; border-color: var(--pink); }

/* ============================================================
   MOBILE OVERRIDES (≤ 480px)
   Additive only — nothing above is restructured.
   ============================================================ */
@media (max-width: 480px) {

  /* --- Touch targets: eliminate 300ms tap delay on iOS --- */
  .btn, .vbtn, .chip, .action-btn, .bell, .avatar {
    touch-action: manipulation;
  }

  /* --- Cards: less padding, smaller title --- */
  .card {
    padding: var(--s-4); /* 16px vs 24px */
    border-radius: 16px;
  }

  .card h3 {
    font-size: clamp(18px, 5.2vw, 24px);
  }

  .card .body { font-size: 14.5px; }

  /* --- Vote buttons: taller touch target, don't shrink text too far --- */
  .vbtn {
    padding: 14px 10px;
    font-size: 14px;
  }

  /* --- Meter: slightly tighter sparkle zone --- */
  .meter-sparkles { inset: -10px 0; }

  /* --- Notification panel: full width on phones --- */
  .notif-panel {
    top: 60px;
    right: 8px;
    left:  8px;
    width: auto;
  }

  /* --- Modal: less padding, hugs edges --- */
  .scrim { padding: 12px; }

  .modal {
    padding: 20px 18px;
    border-radius: 18px;
  }

  .modal h2 { font-size: 24px; }

  /* --- Detail card: less padding --- */
  .detail-card { padding: 20px 16px; }

  .detail-card h2 {
    font-size: clamp(24px, 7vw, 36px);
  }

  /* --- Comment form: stack vertically on small screens --- */
  .cmt-form {
    flex-direction: column;
    gap: var(--s-2);
  }

  .cmt-form input {
    border-radius: var(--r-input);
  }

  .cmt-form .btn {
    width: 100%;
    padding: 13px;
    border-radius: var(--r-pill);
  }

  /* --- Buttons in modals: full width is comfortable on phones --- */
  .btn-block { padding: 15px; }

  /* --- Deadline option pills: wrap more tightly --- */
  .deadline-opts { gap: 6px; }
  .deadline-opts button { padding: 8px 11px; font-size: 12px; }

}

/* Notification panel: slightly wider threshold to keep it usable */
@media (max-width: 560px) {
  .notif-panel {
    right: 8px;
    left:  8px;
    width: auto;
  }
}

/* ============================================================
   AUTH AGREEMENT (AGE GATE & TERMS)
   ============================================================ */
.auth-agree {
  margin: var(--s-5) 0;
  text-align: left;
  font-size: 13.5px;
  color: var(--ink-soft);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.4;
  border-top: 1px dashed var(--border);
  padding-top: var(--s-4);
}

.auth-agree input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--pink-deep);
  flex-shrink: 0;
}

.auth-agree label {
  cursor: pointer;
  user-select: none;
}

.auth-agree a {
  color: var(--pink-deep);
  text-decoration: underline;
  font-weight: 500;
  transition: color 0.15s;
}

.auth-agree a:hover {
  color: var(--coral);
}

.error-shake {
  animation: shake-anim 0.4s ease-in-out;
  color: var(--pink-deep) !important;
}

@keyframes shake-anim {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

