@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,wght@1,400;1,600&family=IBM+Plex+Mono:wght@400;600&display=swap');

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(ellipse at 50% 20%, #1a1a22 0%, #0a0a0d 60%, #000 100%);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  color: #fff;
  overflow: hidden;
}

.stage {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
  position: relative;
}

.mute-toggle {
  position: fixed;
  top: 14px; right: 14px;
  z-index: 100;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

/* ---------- PHONE FRAME ---------- */
.phone {
  position: relative;
  width: 390px;
  max-width: 100%;
  height: min(844px, 92dvh);
  background: #0b0b0f;
  border-radius: 54px;
  padding: 12px;
  box-shadow:
    0 0 0 3px #2a2a30,
    0 0 0 5px #050506,
    0 40px 120px rgba(0,0,0,0.9),
    inset 0 0 20px rgba(0,0,0,0.6);
  transition: filter 0.6s, transform 0.15s;
}
.phone-notch {
  position: absolute;
  top: 20px; left: 50%; transform: translateX(-50%);
  width: 118px; height: 34px;
  background: #000;
  border-radius: 20px;
  z-index: 30;
}
.phone-btn { position: absolute; background: #26262c; border-radius: 3px; }
.pb-1 { left: -3px; top: 150px; width: 3px; height: 30px; }
.pb-2 { left: -3px; top: 200px; width: 3px; height: 55px; }
.pb-3 { left: -3px; top: 270px; width: 3px; height: 55px; }
.pb-r { right: -3px; top: 220px; width: 3px; height: 80px; }

.phone-screen {
  position: relative;
  width: 100%; height: 100%;
  background: #fff;
  border-radius: 44px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.screen-content { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }

/* fear filters */
.phone.fear-2 .phone-screen { animation: subtleShiver 6s infinite; }
.phone.fear-3 .phone-screen { animation: flicker 5s infinite, subtleShiver 4s infinite; }
.phone.fear-4 .phone-screen { animation: flicker 3s infinite, subtleShiver 3s infinite; }
.phone.fear-5 .phone-screen { animation: flicker 1.6s infinite, subtleShiver 2s infinite; }
@keyframes flicker {
  0%,97%,100% { filter: none; }
  97.5% { filter: brightness(0.6) contrast(1.4) hue-rotate(-8deg); }
  98% { filter: brightness(1.3); }
  98.5% { filter: brightness(0.4); }
}
@keyframes subtleShiver {
  0%,100% { transform: translate(0,0); }
  50% { transform: translate(0.4px, -0.4px); }
}

/* ---------- STATUS BAR ---------- */
.ios-statusbar {
  height: 52px;
  padding: 0 28px 0 32px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-bottom: 4px;
  font-size: 15px;
  font-weight: 600;
  color: #000;
  flex-shrink: 0;
}
.sb-time { font-weight: 700; letter-spacing: 0.3px; }
.sb-right { display: flex; align-items: center; gap: 6px; }
.sb-signal { display: flex; align-items: flex-end; gap: 2px; }
.sb-bar { width: 3px; background: #000; border-radius: 1px; transition: opacity 0.4s; }
.sb-wifi, .sb-noservice { font-size: 13px; font-weight: 700; }
.sb-noservice { color: #ff3b30; font-size: 11px; }
.sb-battery { display: flex; align-items: center; }
.bat-shell {
  width: 24px; height: 12px;
  border: 1.5px solid rgba(0,0,0,0.5);
  border-radius: 3px;
  padding: 1px;
}
.bat-fill { height: 100%; border-radius: 1px; transition: width 0.8s, background 0.8s; }
.bat-nub { width: 2px; height: 5px; background: rgba(0,0,0,0.4); border-radius: 0 2px 2px 0; margin-left: 1px; }

/* ---------- CHAT HEADER ---------- */
.chat-view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 14px 10px;
  background: rgba(245,245,247,0.9);
  backdrop-filter: blur(20px);
  border-bottom: 0.5px solid rgba(0,0,0,0.08);
  flex-shrink: 0;
}
.ch-back { color: #007aff; font-size: 30px; font-weight: 300; width: 30px; }
.ch-facetime { color: #007aff; font-size: 22px; width: 30px; text-align: right; }
.ch-center { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ch-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  overflow: hidden; background: #ddd;
}
.ch-avatar img { width: 100%; height: 100%; object-fit: cover; }
.glitch-avatar { animation: avatarGlitch 4s infinite; }
.glitch-avatar img { filter: contrast(1.3) saturate(0.4); }
@keyframes avatarGlitch {
  0%,92%,100% { filter: none; transform: none; }
  93% { filter: invert(1) hue-rotate(90deg); transform: translateX(1px); }
  94% { filter: none; transform: translateX(-1px); }
  95% { filter: contrast(2) brightness(0.5); }
}
.ch-name { font-size: 12px; font-weight: 600; color: #000; }
.ch-chev { color: #8e8e93; font-weight: 400; }

/* ---------- MESSAGES ---------- */
.messages-scroll {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 12px 12px 6px;
  background: #fff;
  scroll-behavior: smooth;
}
.sys-line {
  text-align: center;
  font-size: 11px;
  color: #8e8e93;
  font-weight: 600;
  margin: 10px 0 6px;
}
.bubble-row { display: flex; margin: 3px 0; }
.row-them { justify-content: flex-start; }
.row-me { justify-content: flex-end; }
.bubble-wrap { display: flex; flex-direction: column; max-width: 74%; }
.row-me .bubble-wrap { align-items: flex-end; }

.bubble {
  padding: 9px 14px;
  border-radius: 20px;
  font-size: 16.5px;
  line-height: 1.32;
  word-wrap: break-word;
  position: relative;
}
.b-them {
  background: #e9e9eb;
  color: #000;
  border-bottom-left-radius: 6px;
}
.b-me {
  background: linear-gradient(180deg, #26a0ff, #0b84fe);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.b-sms {
  background: linear-gradient(180deg, #4bd964, #34c759);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.row-them .b-sms {
  background: #d6f5dc; color: #0b3d1a; border-bottom-left-radius: 6px; border-bottom-right-radius: 20px;
}
.b-img { padding: 3px; overflow: hidden; }
.msg-img { display: block; width: 210px; max-width: 60vw; border-radius: 16px; }
.img-scary-overlay {
  position: absolute; inset: 3px; border-radius: 16px;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.35) 100%);
  pointer-events: none;
}
.msg-status {
  font-size: 10.5px; color: #8e8e93; font-weight: 600;
  margin: 2px 4px 4px; text-align: right;
}
.status-fail { color: #ff3b30; }

.typing { padding: 12px 16px; display: flex; gap: 4px; }
.typing .dot {
  width: 8px; height: 8px; background: #9b9b9f; border-radius: 50%;
  animation: typingDot 1.2s infinite;
}
.typing .dot:nth-child(2) { animation-delay: 0.2s; }
.typing .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
  0%,60%,100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.pop-in { animation: popIn 0.32s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes popIn {
  0% { opacity: 0; transform: scale(0.85) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---------- INPUT AREA ---------- */
.input-area {
  background: rgba(248,248,250,0.95);
  backdrop-filter: blur(20px);
  border-top: 0.5px solid rgba(0,0,0,0.08);
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  flex-shrink: 0;
}
.suggestions { display: flex; flex-direction: column; gap: 7px; margin-bottom: 9px; }
.sugg-chip {
  background: #fff;
  border: 1.5px solid #d1d1d6;
  color: #007aff;
  border-radius: 18px;
  padding: 11px 15px;
  font-size: 15.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  animation: chipIn 0.4s ease both;
  transition: transform 0.12s, background 0.12s;
}
.sugg-chip:active { transform: scale(0.97); background: #f0f0f5; }
@keyframes chipIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.input-bar {
  display: flex; align-items: center; gap: 8px;
}
.input-plus {
  width: 34px; height: 34px; border-radius: 50%;
  background: #e5e5ea; color: #8e8e93;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 300; flex-shrink: 0;
}
.input-field {
  flex: 1; height: 36px;
  border: 1px solid #d1d1d6; border-radius: 18px;
  display: flex; align-items: center;
  padding: 0 14px;
  background: #fff;
}
.input-hint { font-size: 15px; color: #007aff; }
.input-hint.dim { color: #b0b0b5; }
.input-mic { color: #8e8e93; font-size: 18px; flex-shrink: 0; padding-right: 4px; }

/* ---------- HORROR OVERLAYS ---------- */
.red-flash {
  position: absolute; inset: 0; z-index: 50;
  background: radial-gradient(ellipse at center, rgba(255,0,0,0.55), rgba(120,0,0,0.85));
  pointer-events: none;
  animation: flashOut 0.14s ease;
}
@keyframes flashOut { from { opacity: 1; } to { opacity: 0; } }
.vignette-horror {
  position: absolute; inset: 0; z-index: 40; pointer-events: none;
  box-shadow: inset 0 0 120px 40px rgba(60,0,0,0.35);
  animation: vignettePulse 3.5s infinite;
}
@keyframes vignettePulse {
  0%,100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* ---------- TITLE SCREEN ---------- */
.title-screen {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 50% 30%, #14141c 0%, #050507 70%, #000 100%);
  color: #eee; text-align: center; padding: 30px 26px;
  position: relative;
}
.title-flicker {
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-weight: 400;
  font-size: 34px;
  letter-spacing: 4px;
  color: #d8d8d8;
  text-shadow: 0 0 18px rgba(255,60,60,0.35);
  animation: titleFlick 4s infinite;
}
.title-big { font-size: 72px; font-weight: 600; letter-spacing: 8px; margin-top: -4px; color:#fff; }
@keyframes titleFlick {
  0%,94%,100% { opacity: 1; }
  95% { opacity: 0.3; }
  96% { opacity: 1; }
  97% { opacity: 0.5; }
}
.title-ghost { font-size: 54px; margin: 22px 0 30px; filter: drop-shadow(0 0 20px rgba(255,255,255,0.2)); animation: floaty 4s ease-in-out infinite; }
@keyframes floaty { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
.title-warn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px; color: #c7c7cf; line-height: 1.6; margin: 4px 0;
}
.title-warn.small { font-size: 12px; color: #8a8a92; margin-top: 12px; }
.title-cw { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: #55555c; margin: 20px 0 26px; }
.title-start {
  background: linear-gradient(180deg, #ff453a, #c41e14);
  color: #fff; border: none;
  padding: 15px 40px; border-radius: 30px;
  font-size: 17px; font-weight: 700; letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 0 30px rgba(255,60,60,0.4);
  animation: startPulse 2s infinite;
}
@keyframes startPulse {
  0%,100% { box-shadow: 0 0 24px rgba(255,60,60,0.35); transform: scale(1); }
  50% { box-shadow: 0 0 44px rgba(255,60,60,0.6); transform: scale(1.03); }
}

/* ---------- CALL SCREEN ---------- */
.call-screen {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  background: linear-gradient(180deg, #2a2a30, #0a0a0d);
  color: #fff; padding: 40px 20px 40px; text-align: center;
  position: relative;
}
.call-top { margin-top: 20px; }
.call-name { font-size: 32px; font-weight: 500; letter-spacing: 1px; }
.call-sub { font-size: 15px; color: #b0b0b5; margin-top: 6px; }
.call-avatar {
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, #3a3a42, #1a1a1f);
  display: flex; align-items: center; justify-content: center;
  font-size: 52px; margin: 32px 0;
  box-shadow: 0 0 40px rgba(255,60,60,0.3);
  animation: callPulse 2s infinite;
}
@keyframes callPulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.05)} }
.call-transcript {
  flex: 1; width: 100%; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px; padding: 0 6px;
}
.call-line {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px; color: #e5e5ea; line-height: 1.5;
  background: rgba(255,255,255,0.06);
  border-radius: 12px; padding: 10px 14px;
}
.call-controls { margin-top: auto; padding-top: 20px; }
.call-end {
  width: 70px; height: 70px; border-radius: 50%;
  background: #ff3b30; color: #fff; border: none;
  font-size: 30px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(255,59,48,0.5);
}

/* ---------- ENDING SCREEN ---------- */
.ending-screen {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 35%, #14141c, #000);
  padding: 30px 28px; text-align: center; color: #eee;
}
.ending-emoji { font-size: 64px; margin-bottom: 10px; filter: drop-shadow(0 0 20px var(--acc)); }
.ending-title {
  font-family: 'Newsreader', serif; font-style: italic; font-weight: 600;
  font-size: 40px; letter-spacing: 3px; color: var(--acc);
  text-shadow: 0 0 24px var(--acc); margin-bottom: 18px;
}
.ending-text {
  font-family: 'IBM Plex Mono', monospace; font-size: 13.5px;
  color: #c7c7cf; line-height: 1.7; white-space: pre-line; max-width: 320px;
}
.ending-tally {
  margin-top: 22px; width: 100%; max-width: 260px;
  border-top: 1px solid rgba(255,255,255,0.1); padding-top: 14px;
}
.tally-row {
  display: flex; justify-content: space-between;
  font-family: 'IBM Plex Mono', monospace; font-size: 12px;
  color: #9a9aa2; padding: 4px 0;
}
.tally-count { color: #fff; }
.tally-loading { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: #66666e; }
.restart-btn {
  margin-top: 26px;
  background: transparent; color: #fff;
  border: 1.5px solid rgba(255,255,255,0.3);
  padding: 13px 36px; border-radius: 28px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background 0.2s;
}
.restart-btn:active { background: rgba(255,255,255,0.1); }

/* ---------- FOOTER ---------- */
.footer {
  margin-top: 12px; font-size: 12px;
  font-family: 'IBM Plex Mono', monospace;
}
.footer a { color: #55555c; text-decoration: none; }
.footer a:hover { color: #999; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 430px) {
  .stage { padding: 0; }
  .phone {
    width: 100%; height: 100dvh; max-width: none;
    border-radius: 0; padding: 0;
    box-shadow: none;
  }
  .phone-screen { border-radius: 0; }
  .phone-notch { display: none; }
  .phone-btn { display: none; }
  .footer { position: fixed; bottom: 4px; left: 50%; transform: translateX(-50%); z-index: 60; }
  .mute-toggle { top: 8px; right: 8px; width: 34px; height: 34px; font-size: 15px; }
}
</parameter>
</invoke>