:root {
  --bg-deep: #0e0805;
  --bg: #14100a;
  --bg-card: #1c150d;
  --bg-card-2: #221911;
  --parchment: #d9c39a;
  --parchment-dim: #b39e75;
  --gold: #c8952a;
  --gold-light: #e8b84b;
  --gold-deep: #8a6418;
  --red: #8b1a1a;
  --red-bright: #cc2222;
  --red-deep: #4a0d0d;
  --stone: #5c4a32;
  --stone-dark: #3a2d1d;
  --text: #d4b896;
  --text-dim: #8a7060;
  --text-mute: #5e4d39;
  --border: #4a3520;
  --border-dim: #2e2014;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  background-color: var(--bg-deep);
  /* Layered atmospheric background: vignette + parchment grain + forge embers */
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(200,149,42,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(139,26,26,0.06) 0%, transparent 60%),
    radial-gradient(circle at 20% 30%, rgba(232,184,75,0.03) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(139,26,26,0.04) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'EB Garamond', serif;
  font-size: 17px;
  line-height: 1.65;
  min-height: 100%;
  padding-bottom: env(safe-area-inset-bottom, 0);
  position: relative;
  overflow-x: hidden;
}

/* Subtle grain overlay across whole page — adds parchment texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.05 0 0 0 0 0.04 0 0 0 0 0.02 0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Faint corner forge-glow */
body::after {
  content: '';
  position: fixed;
  bottom: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 30%;
  background: radial-gradient(ellipse, rgba(204,34,34,0.08), transparent 70%);
  pointer-events: none;
  z-index: 0;
  filter: blur(40px);
}

main, header, footer, .filters { position: relative; z-index: 2; }

/* ── Header ───────────────────────────────────── */
header {
  text-align: center;
  padding: 2.4rem 1rem 1.8rem;
  position: relative;
  z-index: 2;
}

.crest {
  width: clamp(90px, 18vw, 110px);
  height: auto;
  display: block;
  margin: 0 auto 0.8rem;
  filter:
    drop-shadow(0 2px 4px rgba(0,0,0,0.6))
    drop-shadow(0 0 14px rgba(200,149,42,0.35));
}

.title {
  font-family: 'UnifrakturMaguntia', cursive;
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  color: var(--gold);
  text-shadow:
    0 0 1px var(--gold-light),
    0 0 25px rgba(200,149,42,0.35),
    0 2px 0 #2a1d0a,
    0 4px 8px rgba(0,0,0,0.6);
  letter-spacing: 0.04em;
  line-height: 1.1;
  position: relative;
  display: inline-block;
}

/* Hammer ornaments around title */
.title::before, .title::after {
  content: '';
  position: absolute;
  top: 50%;
  width: clamp(30px, 8vw, 60px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-deep), var(--gold));
  transform: translateY(-50%);
}
.title::before { right: 100%; margin-right: 1rem; }
.title::after { left: 100%; margin-left: 1rem; background: linear-gradient(90deg, var(--gold), var(--gold-deep), transparent); }

.subtitle {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  color: var(--parchment-dim);
  letter-spacing: 0.45em;
  text-transform: uppercase;
  margin-top: 0.6rem;
  padding-left: 0.45em; /* compensate letter-spacing */
}

.user-greeting {
  font-family: 'EB Garamond', serif;
  font-size: 0.95rem;
  color: var(--gold-light);
  margin-top: 0.8rem;
  font-style: italic;
  min-height: 1.2em;
  opacity: 0.85;
}
.user-greeting:not(:empty)::before { content: '⚒ '; opacity: 0.6; }
.user-greeting:not(:empty)::after  { content: ' ⚒'; opacity: 0.6; }

/* ── Stats bar — engraved tablet ──────────────── */
.stats-bar {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0;
  margin-top: 1.5rem;
  padding: 0.6rem 1.4rem;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  background:
    linear-gradient(180deg, rgba(28,21,13,0.9), rgba(20,16,10,0.9));
  border: 1px solid var(--border);
  border-radius: 1px;
  box-shadow:
    inset 0 1px 0 rgba(200,149,42,0.15),
    inset 0 -1px 0 rgba(0,0,0,0.5),
    0 4px 12px rgba(0,0,0,0.5);
  position: relative;
}
.stats-bar:not(:empty)::before,
.stats-bar:not(:empty)::after {
  content: '◆';
  color: var(--gold-deep);
  font-size: 0.6rem;
  align-self: center;
  margin: 0 0.8rem;
}
.stats-bar span {
  padding: 0 1.1rem;
  border-right: 1px solid var(--border-dim);
  white-space: nowrap;
}
.stats-bar span:last-of-type { border-right: none; }
.stats-bar span strong {
  color: var(--gold-light);
  font-weight: 700;
  margin-left: 0.3em;
  text-shadow: 0 0 8px rgba(232,184,75,0.4);
}

/* ── Rune border ─────────────────────────────────
   Flex layout: two gradient lines + a fixed-size centered medallion.
   Decorative diamond runes sit at the inner ends, as small fixed SVG accents,
   so they never stretch with viewport width. */
.rune-border {
  height: 22px;
  margin: 0.6rem auto;
  max-width: 880px;
  width: calc(100% - 2rem);
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Left line: gradient that fades from transparent at left edge to gold near medallion */
.rune-border::before,
.rune-border::after {
  content: '';
  flex: 1;
  height: 1.5px;
  filter: drop-shadow(0 0 6px rgba(200,149,42,0.35));
}
.rune-border::before {
  background: linear-gradient(90deg, transparent 0%, var(--gold-deep) 35%, var(--gold) 100%);
}
.rune-border::after {
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-deep) 65%, transparent 100%);
}

/* Inline elements between lines and medallion (added in HTML for stability) */
.rune-border .rune-mark {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  background: var(--gold);
  transform: rotate(45deg);
  margin: 0 6px;
  filter: drop-shadow(0 0 4px rgba(200,149,42,0.5));
}

/* Inline SVG medallion — fixed dimensions, never distorts */
.rune-border .medallion {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  display: block;
  margin: 0 4px;
  filter: drop-shadow(0 1px 0 #000) drop-shadow(0 0 6px rgba(200,149,42,0.5));
}

/* ── Filters — toggled iron tabs ──────────────── */
.filters {
  display: flex;
  gap: 0;
  justify-content: center;
  padding: 1.8rem 1rem 1rem;
}

.filter-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.55rem 1.4rem;
  background: linear-gradient(180deg, var(--bg-card), var(--bg));
  border: 1px solid var(--border);
  border-right-width: 0;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}
.filter-btn:first-child { border-radius: 2px 0 0 2px; }
.filter-btn:last-child  { border-right-width: 1px; border-radius: 0 2px 2px 0; }
.filter-btn:hover { color: var(--gold-light); }
.filter-btn.active {
  background: linear-gradient(180deg, rgba(200,149,42,0.18), rgba(200,149,42,0.06));
  border-color: var(--gold);
  color: var(--gold-light);
  box-shadow:
    inset 0 1px 0 rgba(232,184,75,0.3),
    0 0 12px rgba(200,149,42,0.25);
  z-index: 2;
}

/* ── Grudge cards — pages of an ancient tome ─── */
main { max-width: 880px; margin: 0 auto; padding: 0 1rem 3rem; }

.grudges-list { display: flex; flex-direction: column; gap: 1.6rem; margin-top: 0.5rem; }

.grudge-card {
  background:
    linear-gradient(180deg, var(--bg-card-2) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border);
  padding: 1.5rem 1.7rem 1.4rem 2.2rem;
  position: relative;
  transition: all 0.3s ease;
  box-shadow:
    inset 0 1px 0 rgba(200,149,42,0.08),
    inset 0 -1px 0 rgba(0,0,0,0.4),
    0 4px 16px rgba(0,0,0,0.4);
}

/* Parchment fiber texture inside the card */
.grudge-card::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n2'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.6' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.8 0 0 0 0 0.65 0 0 0 0 0.4 0 0 0 0.3 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n2)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* Left spine: forged metal strip with rivets */
.grudge-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 6px; height: 100%;
  background:
    radial-gradient(circle at 50% 12%, rgba(232,184,75,0.5) 0 1.5px, transparent 2px),
    radial-gradient(circle at 50% 50%, rgba(232,184,75,0.5) 0 1.5px, transparent 2px),
    radial-gradient(circle at 50% 88%, rgba(232,184,75,0.5) 0 1.5px, transparent 2px),
    linear-gradient(180deg, var(--stone-dark), var(--stone), var(--stone-dark));
  box-shadow: 1px 0 0 rgba(0,0,0,0.5);
}

.grudge-card:hover {
  border-color: var(--stone);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(200,149,42,0.12),
    inset 0 -1px 0 rgba(0,0,0,0.4),
    0 8px 24px rgba(0,0,0,0.5);
}

/* Severity escalation: scaling intensity */
.grudge-card.severity-2::before { background: linear-gradient(180deg, var(--stone-dark), #6b5a3a, var(--stone-dark)); }
.grudge-card.severity-3::before {
  background:
    radial-gradient(circle at 50% 12%, rgba(232,184,75,0.7) 0 1.5px, transparent 2px),
    radial-gradient(circle at 50% 50%, rgba(232,184,75,0.7) 0 1.5px, transparent 2px),
    radial-gradient(circle at 50% 88%, rgba(232,184,75,0.7) 0 1.5px, transparent 2px),
    linear-gradient(180deg, var(--gold-deep), var(--gold), var(--gold-deep));
}
.grudge-card.severity-4 {
  border-color: rgba(200,149,42,0.5);
}
.grudge-card.severity-4::before {
  background:
    radial-gradient(circle at 50% 12%, rgba(255,220,150,0.8) 0 1.5px, transparent 2px),
    radial-gradient(circle at 50% 50%, rgba(255,220,150,0.8) 0 1.5px, transparent 2px),
    radial-gradient(circle at 50% 88%, rgba(255,220,150,0.8) 0 1.5px, transparent 2px),
    linear-gradient(180deg, #5a3a10, var(--gold-light), #5a3a10);
  box-shadow: 0 0 10px rgba(232,184,75,0.4);
}

/* Severity 5 — blood oath. Heavier, scorched, with wax seal */
.grudge-card.severity-5 {
  border-color: var(--red);
  background:
    linear-gradient(180deg, #251010 0%, #1a0a0a 100%);
  box-shadow:
    inset 0 1px 0 rgba(204,34,34,0.2),
    inset 0 -1px 0 rgba(0,0,0,0.6),
    0 4px 16px rgba(0,0,0,0.5),
    0 0 30px rgba(139,26,26,0.15);
}
.grudge-card.severity-5::before {
  background:
    radial-gradient(circle at 50% 12%, rgba(255,180,180,0.5) 0 1.5px, transparent 2px),
    radial-gradient(circle at 50% 50%, rgba(255,180,180,0.5) 0 1.5px, transparent 2px),
    radial-gradient(circle at 50% 88%, rgba(255,180,180,0.5) 0 1.5px, transparent 2px),
    linear-gradient(180deg, var(--red-deep), var(--red-bright), var(--red-deep));
  box-shadow: 0 0 12px rgba(204,34,34,0.5);
}
.grudge-card.severity-5 .grudge-offender { color: #e8c0c0; }

/* Avenged — fade children individually so the stamp stays vivid */
.grudge-card.avenged .grudge-epic {
  text-decoration: line-through;
  text-decoration-color: rgba(139,26,26,0.5);
  text-decoration-thickness: 1px;
}
.grudge-card.avenged .avenged-stamp { text-decoration: none; opacity: 1; }
.grudge-card.avenged { opacity: 1; }
.grudge-card.avenged .grudge-epic,
.grudge-card.avenged .grudge-offender,
.grudge-card.avenged .grudge-meta,
.grudge-card.avenged .grudge-id,
.grudge-card.avenged .grudge-severity { opacity: 0.45; }

.avenged-stamp {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--red-bright);
  letter-spacing: 0.18em;
  white-space: nowrap;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--red);
  border-radius: 1px;
  background: rgba(139,26,26,0.15);
  transform: rotate(-3deg);
  display: inline-block;
  text-shadow: 0 0 8px rgba(204,34,34,0.4);
  box-shadow: inset 0 0 8px rgba(139,26,26,0.2);
}

.grudge-header {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  margin-bottom: 0.7rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px dashed rgba(74,53,32,0.5);
}

.grudge-id {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  color: var(--text-mute);
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
}

.grudge-offender {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.06em;
  text-shadow: 0 1px 0 rgba(0,0,0,0.6);
}

.grudge-severity {
  font-size: 0.95rem;
  margin-left: auto;
  color: var(--gold);
  letter-spacing: -0.05em;
  filter: drop-shadow(0 0 4px rgba(200,149,42,0.4));
}
.grudge-card.severity-5 .grudge-severity {
  color: var(--red-bright);
  filter: drop-shadow(0 0 6px rgba(204,34,34,0.6));
}

.grudge-epic {
  font-style: italic;
  font-size: 1.05rem;
  color: var(--parchment);
  margin-bottom: 1rem;
  position: relative;
  padding-left: 1.2rem;
}
.grudge-epic::before {
  content: '❝';
  position: absolute;
  left: -0.1rem;
  top: -0.3rem;
  font-size: 1.8rem;
  color: var(--gold-deep);
  font-style: normal;
  font-family: 'EB Garamond', serif;
  line-height: 1;
}

.grudge-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.grudge-meta {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  color: var(--text-mute);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.avenge-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.4rem 1rem;
  background: linear-gradient(180deg, rgba(139,26,26,0.2), rgba(74,13,13,0.3));
  border: 1px solid var(--red);
  color: #e8a0a0;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  box-shadow:
    inset 0 1px 0 rgba(204,34,34,0.2),
    0 2px 6px rgba(0,0,0,0.4);
}
.avenge-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(204,34,34,0.35), rgba(139,26,26,0.4));
  border-color: var(--red-bright);
  color: #fff0f0;
  text-shadow: 0 0 8px rgba(204,34,34,0.5);
}
.avenge-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Infinite-scroll sentinel ─────────────────── */
.grudges-sentinel { min-height: 1px; }
.grudges-sentinel:empty { padding: 0.5rem 0; }
.grudges-sentinel .loading,
.grudges-sentinel .empty { padding: 1.5rem 0; }

/* ── Loading / empty states ───────────────────── */
.loading, .empty {
  text-align: center;
  color: var(--text-mute);
  font-style: italic;
  padding: 3.5rem 0;
  font-size: 1.05rem;
  position: relative;
}
.loading::before, .empty::before {
  content: '⚒';
  display: block;
  font-size: 1.8rem;
  color: var(--gold-deep);
  margin-bottom: 0.6rem;
  font-style: normal;
  opacity: 0.6;
}
.loading::before { animation: swing 2s ease-in-out infinite; }
@keyframes swing {
  0%, 100% { transform: rotate(-15deg); }
  50% { transform: rotate(15deg); }
}

/* ── Footer ───────────────────────────────────── */
footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem 1rem 6rem;
  font-size: 0.85rem;
  color: var(--text-mute);
  font-style: italic;
  position: relative;
  z-index: 2;
}
footer p { max-width: 36ch; margin: 0 auto; }
footer::before {
  content: '✦';
  display: block;
  color: var(--gold-deep);
  font-size: 0.8rem;
  margin-bottom: 0.6rem;
}

/* ── Donate (Telegram Stars) button ─────────────────────────────── */
.donate-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin: 1.6rem auto 0;
  padding: 0.7rem 1.4rem 0.7rem 1rem;
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-light);
  font-style: normal;
  background:
    linear-gradient(180deg, #2a1f10 0%, #1a120a 100%);
  border: 1px solid var(--gold);
  cursor: pointer;
  transition: all 0.25s ease;
  text-shadow: 0 1px 0 #000, 0 0 8px rgba(232,184,75,0.35);
  box-shadow:
    inset 0 1px 0 rgba(232,184,75,0.25),
    inset 0 -1px 0 rgba(0,0,0,0.5),
    0 0 18px rgba(200,149,42,0.25),
    0 4px 14px rgba(0,0,0,0.5);
  position: relative;
}
.donate-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #3a2c18 0%, #251a0e 100%);
  box-shadow:
    inset 0 1px 0 rgba(232,184,75,0.35),
    inset 0 -1px 0 rgba(0,0,0,0.5),
    0 0 28px rgba(200,149,42,0.5),
    0 6px 18px rgba(0,0,0,0.6);
  transform: translateY(-1px);
}
.donate-btn:active { transform: translateY(0); }
.donate-btn:disabled { opacity: 0.6; cursor: progress; }

.donate-star {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  filter:
    drop-shadow(0 0 6px rgba(255,217,107,0.6))
    drop-shadow(0 1px 0 rgba(0,0,0,0.6));
  animation: starTwinkle 3.5s ease-in-out infinite;
}
@keyframes starTwinkle {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(255,217,107,0.6)) drop-shadow(0 1px 0 rgba(0,0,0,0.6)); transform: rotate(0deg); }
  50%      { filter: drop-shadow(0 0 12px rgba(255,217,107,0.9)) drop-shadow(0 1px 0 rgba(0,0,0,0.6)); transform: rotate(8deg); }
}

.donate-stars-label {
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  color: var(--text-mute);
  border-left: 1px solid var(--border);
  padding-left: 0.65rem;
  margin-left: 0.2rem;
  white-space: nowrap;
}

/* ── FAB — forged seal button ─────────────────── */
.fab {
  position: fixed;
  bottom: calc(1.6rem + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.85rem 2rem;
  background:
    linear-gradient(180deg, #2a1f10, #1a120a);
  border: 1px solid var(--gold);
  color: var(--gold-light);
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(232,184,75,0.3),
    inset 0 -1px 0 rgba(0,0,0,0.6),
    0 0 25px rgba(200,149,42,0.35),
    0 6px 20px rgba(0,0,0,0.6);
  transition: all 0.2s;
  z-index: 100;
  white-space: nowrap;
  text-shadow: 0 1px 0 #000, 0 0 8px rgba(232,184,75,0.4);
}
.fab:hover {
  background: linear-gradient(180deg, #3a2c18, #251a0e);
  box-shadow:
    inset 0 1px 0 rgba(232,184,75,0.4),
    inset 0 -1px 0 rgba(0,0,0,0.6),
    0 0 35px rgba(200,149,42,0.55),
    0 8px 24px rgba(0,0,0,0.6);
  transform: translateX(-50%) translateY(-1px);
}
.fab:active { transform: translateX(-50%) translateY(0); }
.fab.hidden { display: none; }

/* ── Bottom sheet ─────────────────────────────── */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
}
.sheet-overlay.hidden { display: none; }

.sheet {
  width: 100%;
  max-height: 92vh;
  background:
    linear-gradient(180deg, #221710 0%, #1a120a 100%);
  border-top: 1px solid var(--gold);
  border-radius: 0;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow:
    0 -8px 32px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(232,184,75,0.2);
}
.sheet.open { transform: translateY(0); }

.sheet-handle {
  width: 3rem;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--gold-deep), transparent);
  border-radius: 2px;
  margin: 0.8rem auto 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.3rem 0.7rem;
  border-bottom: 1px solid var(--border);
}

.sheet-title {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(200,149,42,0.3);
}
.sheet-title::before { content: '⚒ '; }

.sheet-close {
  background: none;
  border: 1px solid var(--border);
  width: 28px;
  height: 28px;
  color: var(--text-dim);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sheet-close:hover { color: var(--red-bright); border-color: var(--red); }

.sheet-body { padding: 1.3rem; display: flex; flex-direction: column; gap: 0.9rem; }

.sheet-footer {
  padding: 0.9rem 1.3rem 1.3rem;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}

/* ── Form elements ────────────────────────────── */
.field-label {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--gold);
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(0,0,0,0.6);
}
.field-label::before { content: '✦  '; color: var(--gold-deep); }

.field-input, .field-textarea {
  width: 100%;
  background:
    linear-gradient(180deg, var(--bg-deep), var(--bg));
  border: 1px solid var(--border);
  color: var(--parchment);
  font-family: 'EB Garamond', serif;
  font-size: 1.05rem;
  padding: 0.7rem 0.9rem;
  outline: none;
  resize: none;
  transition: all 0.2s;
  box-shadow:
    inset 0 1px 3px rgba(0,0,0,0.5),
    inset 0 0 0 1px rgba(0,0,0,0.3);
}
.field-textarea { font-style: italic; line-height: 1.6; }
.field-input:focus, .field-textarea:focus {
  border-color: var(--gold);
  box-shadow:
    inset 0 1px 3px rgba(0,0,0,0.5),
    0 0 0 1px rgba(200,149,42,0.2),
    0 0 12px rgba(200,149,42,0.15);
}
.field-input::placeholder, .field-textarea::placeholder {
  color: var(--text-mute);
  font-style: italic;
}

.mode-toggle { display: flex; gap: 0; }

.mode-btn {
  flex: 1;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.5rem 0;
  background: linear-gradient(180deg, var(--bg-card), var(--bg));
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}
.mode-btn:first-child { border-right-width: 0; }
.mode-btn.active {
  background: linear-gradient(180deg, rgba(200,149,42,0.18), rgba(200,149,42,0.06));
  border-color: var(--gold);
  color: var(--gold-light);
  box-shadow: inset 0 1px 0 rgba(232,184,75,0.2);
  z-index: 2;
}
.mode-btn:hover:not(.active) { color: var(--gold); }

.record-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.85rem 1.4rem;
  background: linear-gradient(180deg, var(--bg-card), var(--bg));
  border: 1px solid var(--stone);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  box-shadow: inset 0 1px 0 rgba(200,149,42,0.08);
}
.record-btn:hover { border-color: var(--gold); color: var(--gold-light); }
.record-btn.recording {
  border-color: var(--red-bright);
  color: var(--red-bright);
  background: linear-gradient(180deg, rgba(139,26,26,0.2), rgba(74,13,13,0.3));
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: inset 0 0 0 rgba(204,34,34,0), 0 0 0 rgba(204,34,34,0); }
  50% { box-shadow: inset 0 0 12px rgba(204,34,34,0.3), 0 0 16px rgba(204,34,34,0.4); }
}

.record-status {
  font-size: 0.9rem;
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
  min-height: 1.4em;
  margin-top: 0.5rem;
}

.severity-row {
  display: flex;
  gap: 0.4rem;
}

.sev-btn {
  flex: 1;
  font-size: 0.85rem;
  padding: 0.7rem 0;
  background: linear-gradient(180deg, var(--bg-card), var(--bg));
  border: 1px solid var(--border);
  color: var(--text-mute);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  letter-spacing: -0.05em;
  box-shadow: inset 0 1px 0 rgba(200,149,42,0.05);
}
.sev-btn:hover { color: var(--gold); border-color: var(--stone); }
.sev-btn.active {
  background: linear-gradient(180deg, rgba(200,149,42,0.2), rgba(200,149,42,0.08));
  border-color: var(--gold);
  color: var(--gold-light);
  box-shadow:
    inset 0 1px 0 rgba(232,184,75,0.3),
    0 0 12px rgba(200,149,42,0.3);
  text-shadow: 0 0 6px rgba(232,184,75,0.5);
}
.sev-btn[data-sev="5"].active {
  background: linear-gradient(180deg, rgba(204,34,34,0.25), rgba(139,26,26,0.1));
  border-color: var(--red-bright);
  color: #ff8080;
  box-shadow:
    inset 0 1px 0 rgba(204,34,34,0.3),
    0 0 14px rgba(204,34,34,0.4);
  text-shadow: 0 0 8px rgba(204,34,34,0.6);
}

.submit-btn {
  width: 100%;
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.95rem;
  background:
    linear-gradient(180deg, rgba(200,149,42,0.25), rgba(138,100,24,0.15));
  border: 1px solid var(--gold);
  color: var(--gold-light);
  cursor: pointer;
  transition: all 0.2s;
  text-shadow: 0 1px 0 #000, 0 0 8px rgba(232,184,75,0.3);
  box-shadow:
    inset 0 1px 0 rgba(232,184,75,0.3),
    inset 0 -1px 0 rgba(0,0,0,0.4),
    0 4px 16px rgba(0,0,0,0.4),
    0 0 20px rgba(200,149,42,0.2);
}
.submit-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(232,184,75,0.35), rgba(200,149,42,0.2));
  box-shadow:
    inset 0 1px 0 rgba(232,184,75,0.4),
    inset 0 -1px 0 rgba(0,0,0,0.4),
    0 4px 16px rgba(0,0,0,0.4),
    0 0 30px rgba(200,149,42,0.4);
}
.submit-btn:disabled { opacity: 0.5; cursor: default; }

.hidden { display: none !important; }

/* ── Donate (Telegram Stars) ──────────────────── */
.donate-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.2rem;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.55rem 1.1rem 0.55rem 0.9rem;
  background: linear-gradient(180deg, rgba(200,149,42,0.18), rgba(138,100,24,0.1));
  border: 1px solid var(--gold-deep);
  color: var(--gold-light);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow:
    inset 0 1px 0 rgba(232,184,75,0.25),
    0 2px 8px rgba(0,0,0,0.4);
  text-shadow: 0 1px 0 #000;
}
.donate-btn:hover {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(232,184,75,0.28), rgba(200,149,42,0.15));
  box-shadow:
    inset 0 1px 0 rgba(232,184,75,0.35),
    0 0 16px rgba(200,149,42,0.35),
    0 4px 12px rgba(0,0,0,0.5);
  transform: translateY(-1px);
}
.donate-btn:active { transform: translateY(0); }

/* Telegram Stars logo — inline SVG class */
.tg-star {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 4px rgba(255,210,80,0.5));
}

/* Tribute modal — themed differently from grudge sheet */
.tribute-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.tribute-overlay.open { opacity: 1; }
.tribute-overlay.hidden { display: none; }

.tribute {
  width: 100%;
  max-width: 420px;
  background:
    radial-gradient(ellipse at top, rgba(200,149,42,0.15), transparent 60%),
    linear-gradient(180deg, #221710 0%, #1a120a 100%);
  border: 1px solid var(--gold);
  padding: 1.6rem 1.4rem 1.4rem;
  position: relative;
  transform: scale(0.92);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow:
    inset 0 1px 0 rgba(232,184,75,0.3),
    0 0 40px rgba(200,149,42,0.2),
    0 12px 40px rgba(0,0,0,0.7);
}
.tribute-overlay.open .tribute { transform: scale(1); }

.tribute-close {
  position: absolute;
  top: 0.6rem; right: 0.6rem;
  background: none;
  border: 1px solid var(--border);
  width: 28px; height: 28px;
  color: var(--text-dim);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.tribute-close:hover { color: var(--gold-light); border-color: var(--gold); }

.tribute-title {
  font-family: 'UnifrakturMaguntia', cursive;
  font-size: 2rem;
  color: var(--gold-light);
  text-align: center;
  text-shadow: 0 0 18px rgba(232,184,75,0.4), 0 2px 0 #000;
  letter-spacing: 0.03em;
  line-height: 1.1;
}
.tribute-subtitle {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  text-align: center;
  color: var(--parchment-dim);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-top: 0.3rem;
}
.tribute-text {
  margin-top: 1rem;
  font-style: italic;
  color: var(--parchment);
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.55;
  padding: 0 0.5rem;
}
.tribute-text::before, .tribute-text::after {
  content: '✦';
  color: var(--gold-deep);
  margin: 0 0.4rem;
  font-style: normal;
}

.tribute-amounts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin-top: 1.2rem;
}
.tribute-amount {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.85rem 0.6rem;
  background: linear-gradient(180deg, var(--bg-card), var(--bg));
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: inset 0 1px 0 rgba(200,149,42,0.08);
}
.tribute-amount .tg-star { width: 18px; height: 18px; }
.tribute-amount:hover {
  border-color: var(--gold);
  color: var(--gold-light);
  background: linear-gradient(180deg, rgba(200,149,42,0.15), rgba(200,149,42,0.05));
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(232,184,75,0.2),
    0 4px 12px rgba(0,0,0,0.4),
    0 0 16px rgba(200,149,42,0.2);
}
.tribute-amount:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}
.tribute-amount.featured {
  border-color: var(--gold-deep);
  position: relative;
}
.tribute-amount.featured::after {
  content: 'Щедрый дар';
  position: absolute;
  top: -8px;
  right: 6px;
  font-family: 'Cinzel', serif;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 1px 6px;
  background: var(--gold-deep);
  color: #1a0f04;
  border-radius: 1px;
}

.tribute-status {
  margin-top: 0.8rem;
  text-align: center;
  font-style: italic;
  color: var(--text-dim);
  font-size: 0.85rem;
  min-height: 1.2em;
}
.tribute-status.success { color: var(--gold-light); }
.tribute-status.error { color: #e88080; }
@keyframes pageReveal {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.grudge-card { animation: pageReveal 0.4s ease-out backwards; }
.grudge-card:nth-child(1) { animation-delay: 0.05s; }
.grudge-card:nth-child(2) { animation-delay: 0.10s; }
.grudge-card:nth-child(3) { animation-delay: 0.15s; }
.grudge-card:nth-child(4) { animation-delay: 0.20s; }
.grudge-card:nth-child(5) { animation-delay: 0.25s; }
.grudge-card:nth-child(n+6) { animation-delay: 0.30s; }

/* ── Donate picker (stars amount) ───────────────────────────────────── */
.donate-picker {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.donate-picker.hidden { display: none; }

.donate-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.donate-picker-card {
  position: relative;
  background: linear-gradient(180deg, #221710 0%, #1a120a 100%);
  border: 1px solid var(--gold);
  padding: 1.4rem 1.2rem 1.1rem;
  width: 100%;
  max-width: 380px;
  box-shadow:
    inset 0 1px 0 rgba(232,184,75,0.25),
    0 12px 40px rgba(0,0,0,0.7),
    0 0 40px rgba(200,149,42,0.2);
}

.donate-picker-title {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-light);
  text-align: center;
  margin-bottom: 1rem;
  text-shadow: 0 0 8px rgba(200,149,42,0.4);
}

.donate-picker-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}

.donate-tier {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(180deg, var(--bg-card-2), var(--bg-card));
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'EB Garamond', serif;
  text-align: left;
  width: 100%;
}
.donate-tier:hover {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(200,149,42,0.15), rgba(200,149,42,0.05));
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.4), 0 0 16px rgba(200,149,42,0.2);
}

.donate-tier-icon {
  font-size: 1.4rem;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 6px rgba(255,217,107,0.4));
}
.donate-tier-label {
  flex: 1;
  font-style: italic;
  font-size: 1.02rem;
  color: var(--parchment);
}
.donate-tier-stars {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold-light);
  text-shadow: 0 0 6px rgba(232,184,75,0.4);
  white-space: nowrap;
}

.donate-picker-close {
  width: 100%;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.6rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}
.donate-picker-close:hover { color: var(--text); border-color: var(--stone); }

/* ── Thank-you popup (after successful donation) ──────────────────── */
.thanks-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.thanks-overlay.open { opacity: 1; }

.thanks-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(200,149,42,0.18) 0%, rgba(0,0,0,0.85) 60%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.thanks-scroll {
  position: relative;
  width: 100%;
  max-width: 420px;
  background:
    radial-gradient(ellipse at top, rgba(232,184,75,0.08), transparent 60%),
    linear-gradient(180deg, #2a1f10 0%, #1a120a 100%);
  border: 1px solid var(--gold);
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(232,184,75,0.35),
    inset 0 -1px 0 rgba(0,0,0,0.6),
    0 20px 60px rgba(0,0,0,0.8),
    0 0 60px rgba(200,149,42,0.35);
  transform: scale(0.85) translateY(20px);
  transition: transform 0.45s cubic-bezier(0.16, 1.2, 0.5, 1);
}
.thanks-overlay.open .thanks-scroll { transform: scale(1) translateY(0); }

.thanks-scroll::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n3'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.9 0 0 0 0 0.7 0 0 0 0 0.4 0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n3)'/%3E%3C/svg%3E");
}
.thanks-scroll::after {
  content: '';
  position: absolute;
  top: 8px; left: 8px; right: 8px; bottom: 8px;
  border: 1px solid rgba(200,149,42,0.25);
  pointer-events: none;
}

.thanks-seal {
  width: 76px;
  height: 76px;
  margin: 0 auto 1rem;
  filter:
    drop-shadow(0 0 20px rgba(255,217,107,0.5))
    drop-shadow(0 4px 8px rgba(0,0,0,0.6));
  animation: sealAppear 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s backwards,
             sealGlow 3s ease-in-out 0.85s infinite;
}
@keyframes sealAppear {
  0%   { transform: scale(0.3) rotate(-180deg); opacity: 0; }
  100% { transform: scale(1)   rotate(0deg);    opacity: 1; }
}
@keyframes sealGlow {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(255,217,107,0.5)) drop-shadow(0 4px 8px rgba(0,0,0,0.6)); }
  50%      { filter: drop-shadow(0 0 32px rgba(255,217,107,0.85)) drop-shadow(0 4px 8px rgba(0,0,0,0.6)); }
}

.thanks-title {
  font-family: 'UnifrakturMaguntia', cursive;
  font-size: 2.2rem;
  color: var(--gold-light);
  font-weight: 400;
  letter-spacing: 0.02em;
  margin-bottom: 0.2rem;
  text-shadow: 0 0 18px rgba(232,184,75,0.4), 0 2px 0 #1a1209;
}

.thanks-tier {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 1.2rem;
  font-style: normal;
}
.thanks-tier::before,
.thanks-tier::after {
  content: '✦';
  color: var(--gold-deep);
  margin: 0 0.5em;
  font-size: 0.7em;
  letter-spacing: 0;
}

.thanks-body {
  font-family: 'EB Garamond', serif;
  font-size: 1.05rem;
  font-style: normal;
  color: var(--parchment);
  line-height: 1.6;
  margin-bottom: 1.6rem;
  padding: 0 0.5rem;
}
.thanks-body strong {
  color: var(--gold-light);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(232,184,75,0.5);
}
.thanks-body em {
  font-style: italic;
  color: var(--text-dim);
  font-size: 0.92rem;
  display: inline-block;
  margin-top: 0.6rem;
}

.thanks-close-btn {
  width: 100%;
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.85rem;
  background: linear-gradient(180deg, rgba(200,149,42,0.25), rgba(138,100,24,0.12));
  border: 1px solid var(--gold);
  color: var(--gold-light);
  cursor: pointer;
  transition: all 0.2s;
  text-shadow: 0 1px 0 #000, 0 0 8px rgba(232,184,75,0.4);
  box-shadow:
    inset 0 1px 0 rgba(232,184,75,0.3),
    inset 0 -1px 0 rgba(0,0,0,0.4);
}
.thanks-close-btn:hover {
  background: linear-gradient(180deg, rgba(232,184,75,0.35), rgba(200,149,42,0.18));
  box-shadow:
    inset 0 1px 0 rgba(232,184,75,0.4),
    0 0 20px rgba(200,149,42,0.35);
}