* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: #000;
  color: #cfc9c2;
  font-family: 'EB Garamond', Georgia, serif;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(circle at 50% 30%, rgba(60,0,0,0.18), transparent 55%),
    radial-gradient(circle at 50% 90%, rgba(30,0,40,0.15), transparent 60%),
    #030303;
  cursor: crosshair;
}

/* Grain + vignette overlays */
#noise {
  position: fixed; inset: 0; z-index: 9998; pointer-events: none;
  opacity: 0.05; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainShift 0.6s steps(2) infinite;
}
@keyframes grainShift {
  0% { transform: translate(0,0); }
  50% { transform: translate(-2%, 1%); }
  100% { transform: translate(1%, -1%); }
}
#vignette {
  position: fixed; inset: 0; z-index: 9997; pointer-events: none;
  box-shadow: inset 0 0 220px 90px rgba(0,0,0,0.95);
  background: radial-gradient(circle at 50% 45%, transparent 40%, rgba(0,0,0,0.85) 100%);
}

.app-shell { position: relative; z-index: 1; padding-bottom: 60px; }

/* ---- Whispers ---- */
.whisper-layer { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
.whisper {
  position: absolute; color: rgba(180,170,165,0.16);
  font-style: italic; font-size: 1.4rem; white-space: nowrap;
  animation-name: whisperFloat; animation-timing-function: ease-in-out;
  animation-fill-mode: both;
  text-shadow: 0 0 12px rgba(140,0,0,0.2);
}
@keyframes whisperFloat {
  0% { opacity: 0; transform: translateY(14px) scale(0.95); }
  25% { opacity: 0.9; }
  70% { opacity: 0.5; }
  100% { opacity: 0; transform: translateY(-26px) scale(1.05); }
}

/* ---- Cursor ghost trail ---- */
.ghost-dot {
  position: fixed; width: 10px; height: 10px; border-radius: 50%;
  pointer-events: none; z-index: 9996; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(160,20,20,0.55), transparent 70%);
  animation: ghostFade 0.9s forwards;
}
@keyframes ghostFade {
  0% { opacity: 0.7; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-55%) scale(2.4); }
}

/* ---- Header ---- */
.candle { font-size: 2rem; animation: candleSway 3s ease-in-out infinite; filter: drop-shadow(0 0 12px rgba(255,120,0,0.5)); }
@keyframes candleSway { 0%,100% { transform: rotate(-3deg); opacity: 0.85; } 50% { transform: rotate(3deg); opacity: 1; } }

.title {
  font-family: 'UnifrakturMaguntia', 'Creepster', cursive;
  font-size: clamp(2.2rem, 7vw, 4.5rem);
  color: #d8cfc7; margin: 0.4rem 0 0.6rem;
  letter-spacing: 1px; line-height: 1.05;
  text-shadow: 0 0 8px rgba(150,0,0,0.6), 0 0 28px rgba(90,0,0,0.4), 0 0 2px rgba(255,255,255,0.15);
}
.flicker { animation: flicker 5s infinite; }
@keyframes flicker {
  0%,19%,21%,23%,25%,54%,56%,100% { opacity: 1; text-shadow: 0 0 8px rgba(150,0,0,0.6), 0 0 28px rgba(90,0,0,0.4); }
  20%,24%,55% { opacity: 0.35; text-shadow: none; }
  22% { opacity: 0.7; }
}
.subtitle {
  font-style: italic; color: rgba(160,150,145,0.55);
  font-size: clamp(0.95rem, 3vw, 1.25rem); margin: 0;
}

/* ---- Form ---- */
.form-wrap { max-width: 640px; margin: 0 auto; padding: 0 18px; }
.parchment {
  position: relative;
  background: linear-gradient(160deg, rgba(14,10,10,0.9), rgba(6,6,7,0.95));
  border: 1px solid rgba(140,0,0,0.35);
  border-radius: 4px;
  padding: 34px 28px 30px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.6);
}
.breathe { animation: breathe 6s ease-in-out infinite; }
@keyframes breathe {
  0%,100% { box-shadow: 0 0 24px rgba(120,0,0,0.18), inset 0 0 30px rgba(0,0,0,0.6); }
  50% { box-shadow: 0 0 48px rgba(160,0,0,0.32), inset 0 0 40px rgba(0,0,0,0.7); }
}

.field-label {
  display: block; text-transform: uppercase; letter-spacing: 3px;
  font-size: 0.68rem; color: rgba(150,140,135,0.6);
  margin-bottom: 7px; font-family: 'EB Garamond', serif;
}

.creepy-input {
  width: 100%; background: rgba(0,0,0,0.55);
  border: 1px solid rgba(120,20,20,0.35);
  color: #e6ded6; padding: 11px 13px; border-radius: 3px;
  font-family: 'EB Garamond', serif; font-size: 1.05rem;
  outline: none; transition: box-shadow 0.3s, border-color 0.3s;
}
.creepy-input::placeholder { color: rgba(150,120,120,0.4); font-style: italic; }
.creepy-input:focus {
  border-color: rgba(200,30,30,0.8);
  box-shadow: 0 0 14px rgba(180,0,0,0.5), inset 0 0 8px rgba(90,0,0,0.4);
}
.creepy-textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
.creepy-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a33' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.creepy-select option { background: #0a0808; color: #ddd; }
/* dark date picker */
.creepy-input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.5) sepia(1) hue-rotate(-20deg) saturate(4);
  cursor: pointer;
}

.omen {
  margin-top: 8px; font-style: italic; font-size: 0.9rem;
  color: rgba(220,120,120,0.85); text-shadow: 0 0 8px rgba(180,0,0,0.4);
  animation: omenPulse 2.5s ease-in-out infinite;
}
@keyframes omenPulse { 0%,100% { opacity: 0.6; } 50% { opacity: 1; } }

.error-nudge {
  color: #e05555; font-style: italic; margin-bottom: 14px;
  text-align: center; animation: tremor 0.4s;
  text-shadow: 0 0 10px rgba(200,0,0,0.6);
}
@keyframes tremor {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

.summon-btn {
  width: 100%; margin-top: 6px; padding: 14px;
  background: linear-gradient(180deg, rgba(30,4,4,0.9), rgba(10,0,0,0.95));
  border: 1px solid rgba(160,20,20,0.6); color: #d8b0a8;
  font-family: 'UnifrakturMaguntia', cursive; font-size: 1.5rem;
  letter-spacing: 1px; border-radius: 3px; cursor: pointer;
  transition: all 0.35s; text-shadow: 0 0 8px rgba(180,0,0,0.5);
}
.summon-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(120,0,0,0.7), rgba(40,0,0,0.9));
  box-shadow: 0 0 30px rgba(200,0,0,0.6); color: #fff;
  animation: flicker 3s infinite;
}
.summon-btn:disabled { opacity: 0.6; cursor: wait; }

/* ---- Ritual overlay ---- */
.ritual-overlay {
  position: fixed; inset: 0; z-index: 9995;
  background: rgba(0,0,0,0.9); display: flex; align-items: center; justify-content: center;
  animation: dimIn 0.4s;
}
@keyframes dimIn { from { opacity: 0; } to { opacity: 1; } }
.ritual-flicker {
  font-family: 'UnifrakturMaguntia', cursive; font-size: clamp(1.6rem, 6vw, 3rem);
  color: #c00; text-shadow: 0 0 20px rgba(200,0,0,0.8);
  animation: flicker 0.6s infinite;
}

/* ---- Invitation card ---- */
.invite-section {
  max-width: 620px; margin: 46px auto 0; padding: 0 18px;
  animation: revealCard 1.1s ease-out both;
}
@keyframes revealCard {
  from { opacity: 0; transform: scale(0.9) translateY(30px); filter: blur(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}
.invite-card {
  position: relative; overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(50,0,0,0.4), transparent 60%),
    linear-gradient(180deg, #0b0808, #050404);
  border: 1px solid rgba(150,20,20,0.4);
  padding: 44px 30px; border-radius: 4px;
  box-shadow: 0 0 50px rgba(120,0,0,0.35);
}
.fog {
  position: absolute; inset: -40%; pointer-events: none;
  background: radial-gradient(ellipse at 30% 40%, rgba(120,120,140,0.06), transparent 50%),
              radial-gradient(ellipse at 70% 60%, rgba(80,0,60,0.06), transparent 50%);
  animation: fogDrift 20s linear infinite; z-index: 0;
}
@keyframes fogDrift {
  0% { transform: translate(0,0) rotate(0deg); }
  100% { transform: translate(6%, -4%) rotate(8deg); }
}
.corner {
  position: absolute; width: 28px; height: 28px; z-index: 2;
  border-color: rgba(180,30,30,0.6); border-style: solid; border-width: 0;
}
.corner.tl { top: 10px; left: 10px; border-top-width: 2px; border-left-width: 2px; }
.corner.tr { top: 10px; right: 10px; border-top-width: 2px; border-right-width: 2px; }
.corner.bl { bottom: 10px; left: 10px; border-bottom-width: 2px; border-left-width: 2px; }
.corner.br { bottom: 10px; right: 10px; border-bottom-width: 2px; border-right-width: 2px; }

.invite-inner { position: relative; z-index: 1; text-align: center; }
.invite-occasion {
  font-family: 'UnifrakturMaguntia', cursive; font-size: 1.4rem;
  color: #b02a2a; letter-spacing: 2px; text-shadow: 0 0 12px rgba(150,0,0,0.5);
}
.invite-sub {
  text-transform: uppercase; letter-spacing: 5px; font-size: 0.6rem;
  color: rgba(150,140,135,0.5); margin: 10px 0 4px;
}
.invite-name {
  font-family: 'UnifrakturMaguntia', cursive; font-size: clamp(2rem, 8vw, 3.2rem);
  color: #e8ddd3; margin: 6px 0 4px; line-height: 1.1;
  text-shadow: 0 0 14px rgba(200,180,180,0.25), 0 0 30px rgba(120,0,0,0.35);
}
.invite-divider { color: rgba(160,30,30,0.6); margin: 14px 0 18px; letter-spacing: 4px; }
.invite-detail { font-size: 1.1rem; color: #cfc4ba; margin: 8px 0; }
.invite-detail .dk {
  text-transform: uppercase; letter-spacing: 3px; font-size: 0.62rem;
  color: rgba(160,60,60,0.7); display: inline-block; min-width: 60px;
}
.invite-message {
  font-style: italic; color: rgba(190,180,175,0.85); margin: 20px auto;
  max-width: 460px; line-height: 1.6; font-size: 1.1rem;
}
.invite-close {
  font-family: 'Creepster', cursive; letter-spacing: 2px;
  color: #c23a3a; font-size: 1.3rem; margin-top: 22px;
  text-shadow: 0 0 12px rgba(180,0,0,0.5);
}
.invite-rsvp {
  margin-top: 18px; font-size: 0.82rem; font-style: italic;
  color: rgba(150,140,135,0.55);
}

.invite-actions {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px;
  margin-top: 26px;
}
.ghost-btn {
  background: rgba(10,6,6,0.8); border: 1px solid rgba(120,20,20,0.4);
  color: #c9b8b2; padding: 10px 16px; border-radius: 3px; cursor: pointer;
  font-family: 'EB Garamond', serif; font-size: 0.95rem; letter-spacing: 0.5px;
  transition: all 0.3s;
}
.ghost-btn:hover:not(:disabled) {
  border-color: rgba(200,30,30,0.7); color: #fff;
  box-shadow: 0 0 18px rgba(160,0,0,0.4);
}
.ghost-btn:disabled { opacity: 0.5; cursor: wait; }

/* ---- Grimoire ---- */
.grimoire { max-width: 640px; margin: 46px auto 0; padding: 0 18px; }
.grimoire-head {
  width: 100%; text-align: left; background: none; border: none;
  border-top: 1px solid rgba(120,20,20,0.25); padding: 16px 4px;
  color: rgba(180,120,120,0.75); cursor: pointer;
  font-family: 'UnifrakturMaguntia', cursive; font-size: 1.3rem; letter-spacing: 1px;
}
.grimoire-head:hover { color: #d05050; }
.grimoire-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; }
.grimoire-item {
  display: flex; align-items: stretch;
  background: rgba(12,8,8,0.7); border: 1px solid rgba(90,20,20,0.3);
  border-radius: 3px; transition: border-color 0.3s;
}
.grimoire-item:hover { border-color: rgba(160,30,30,0.5); }
.gi-main { flex: 1; padding: 12px 14px; cursor: pointer; }
.gi-name { font-size: 1.15rem; color: #ded3c9; font-family: 'UnifrakturMaguntia', cursive; }
.gi-occ { font-size: 0.8rem; color: rgba(150,140,135,0.55); font-style: italic; }
.gi-del {
  background: none; border: none; border-left: 1px solid rgba(90,20,20,0.3);
  color: rgba(160,60,60,0.6); padding: 0 16px; cursor: pointer; font-size: 1rem;
}
.gi-del:hover { color: #e05050; background: rgba(60,0,0,0.4); }

/* ---- Sound toggle ---- */
.sound-toggle {
  position: fixed; top: 14px; right: 14px; z-index: 9990;
  background: rgba(8,6,6,0.8); border: 1px solid rgba(120,20,20,0.4);
  color: rgba(180,150,150,0.7); padding: 6px 12px; border-radius: 3px;
  cursor: pointer; font-family: 'EB Garamond', serif; font-size: 0.8rem;
  letter-spacing: 1px; transition: all 0.3s;
}
.sound-toggle:hover { border-color: rgba(200,30,30,0.7); color: #eee; }

/* ---- Footer ---- */
.footer { text-align: center; margin-top: 60px; padding: 30px 18px 10px; }
.footer-tag {
  font-style: italic; color: rgba(140,130,125,0.4);
  font-size: 0.95rem; letter-spacing: 1px; margin-bottom: 10px;
}
.remix-link {
  color: rgba(160,40,40,0.6); text-decoration: none; font-size: 0.8rem;
  letter-spacing: 2px; border-bottom: 1px dotted rgba(160,40,40,0.4);
  transition: color 0.3s;
}
.remix-link:hover { color: #d05050; }

@media (max-width: 500px) {
  .invite-card { padding: 34px 20px; }
  .invite-actions { flex-direction: column; }
  .ghost-btn { width: 100%; }
}