/* ===== 基础重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

/* ===== 顶部导航 ===== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 24px;
}

.logo {
  font-size: 1.2rem;
  font-weight: 600;
  color: #333;
}

.topbar nav a {
  text-decoration: none;
  color: #666;
  margin-left: 20px;
  font-size: 0.9rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.3s, color 0.3s;
}

.topbar nav a:hover { background: #e8e8ed; }
.topbar nav a.active { color: #007aff; font-weight: 500; }

/* ===== 卡片 ===== */
.card {
  background: #fff;
  border-radius: 14px;
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  animation: card-flicker 6s infinite;
}

.card h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #1d1d1f;
}

/* ===== 网格布局 (首页) ===== */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .grid-2col { grid-template-columns: 1fr; }
}

/* ===== 天气卡片 ===== */
.weather-temp { font-size: 2rem; font-weight: 700; }
.weather-desc { color: #666; font-size: 0.9rem; }
.weather-update { color: #999; font-size: 0.8rem; margin-top: 8px; }

/* ===== 倒计时 ===== */
.countdown-num {
  font-size: 1.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}

/* ===== 名言卡片 ===== */
.quote-text {
  font-style: italic;
  color: #555;
  min-height: 3em;
}
.quote-author { color: #999; font-size: 0.85rem; margin-top: 4px; }

/* ===== 计算器 ===== */
.input-num {
  width: 70px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  text-align: center;
}
.op-sign { margin: 0 6px; font-size: 1.2rem; }
.calc-result { margin-left: 10px; font-size: 1.2rem; font-weight: 600; }

/* ===== 按钮 ===== */
.btn-small {
  background: #007aff;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.3s, transform 0.3s;
}
.btn-small:hover { background: #0056b3; }
.btn-small:active { transform: scale(0.95); }

/* ===== 工具列表 (page2) ===== */
.tool-list {
  list-style: none;
}
.tool-list li {
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}
.tool-list li:last-child { border-bottom: none; }
.tool-list a {
  text-decoration: none;
  color: #007aff;
  font-size: 0.95rem;
}
.tool-list a:hover { text-decoration: underline; }

/* ===== 便签板 ===== */
.input-note {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
}
.note-hint { color: #999; font-size: 0.8rem; margin-top: 6px; }
.note-saved { color: #34c759; font-size: 0.85rem; margin-top: 6px; }

/* ===== 更新日志 (page3) ===== */
.changelog p {
  padding: 4px 0;
  font-size: 0.9rem;
  color: #555;
}
.changelog .date {
  color: #999;
  margin-right: 10px;
  font-family: monospace;
}

/* ===== 联系 ===== */
.contact-email { color: #007aff; }
.contact-hint { color: #999; font-size: 0.8rem; margin-top: 4px; }

/* ===== 页脚 ===== */
.footer {
  text-align: center;
  color: #999;
  font-size: 0.8rem;
  padding: 20px 0;
  border-top: 1px solid #e0e0e0;
  margin-top: 24px;
}

/* =============================================
   恐怖效果
   ============================================= */

/* 名言出现时的抖动 */
.glitch-moment {
  animation: subtle-shake 0.5s ease-in-out;
}
@keyframes subtle-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-2px); }
  40% { transform: translateX(2px); }
  60% { transform: translateX(-1px); }
  80% { transform: translateX(1px); }
}

/* 卡片闪烁 — 更频繁更卡 */
@keyframes card-flicker {
  0%, 85%, 100% { opacity: 1; }
  86% { opacity: 0.6; }
  88% { opacity: 0.9; }
  90% { opacity: 0.4; }
  92% { opacity: 0.8; }
  94% { opacity: 0.3; }
  96% { opacity: 0.7; }
  98% { opacity: 0.2; }
}

#countdownDisplay { transition: color 0.3s; }
#weatherTemp { transition: color 0.3s; }

/* 眼睛脉冲 */
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.5; }
}

/* 弹窗边框脉冲 */
@keyframes box-pulse {
  0%, 100% { box-shadow: 0 0 60px rgba(139,0,0,0.4); }
  50% { box-shadow: 0 0 120px rgba(139,0,0,0.9); }
}

/* 允许按钮脉冲 */
@keyframes btn-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(139,0,0,0); }
  50% { box-shadow: 0 0 40px rgba(139,0,0,0.8); }
}

/* 鼠标暗影 */
.hover-shadow {
  position: fixed;
  pointer-events: none;
  z-index: 9995;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139,0,0,0.08) 0%, transparent 70%);
  animation: shadow-fade 2s ease-out forwards;
}
@keyframes shadow-fade {
  0% { opacity: 1; transform: scale(0.5); }
  100% { opacity: 0; transform: scale(2); }
}

/* 信号丢失 — 闪得更快更卡 */
.signal-loss {
  position: fixed;
  bottom: 20px;
  right: 20px;
  color: #8b0000;
  font-size: 0.6rem;
  font-family: monospace;
  opacity: 0;
  z-index: 9994;
  pointer-events: none;
  animation: signal-blink 4s infinite;
  letter-spacing: 2px;
}
@keyframes signal-blink {
  0%, 80%, 100% { opacity: 0; }
  82% { opacity: 0.8; }
  84% { opacity: 0; }
  86% { opacity: 0.6; }
  88% { opacity: 0; }
  90% { opacity: 0.9; }
  92% { opacity: 0; }
}

/* 顶部红色横线 */
body > .top-line {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: rgba(139,0,0,0.3);
  z-index: 9999;
  pointer-events: none;
  animation: top-line 25s infinite;
}
@keyframes top-line {
  0%, 98%, 100% { opacity: 0; }
  98.5% { opacity: 1; }
  99% { opacity: 0.3; }
}

/* 鼠标残影轨迹 */
.mouse-trail {
  position: fixed;
  pointer-events: none;
  z-index: 9993;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(139,0,0,0.2);
  animation: trail-fade 1.5s ease-out forwards;
}
@keyframes trail-fade {
  0% { opacity: 0.6; transform: scale(1); }
  100% { opacity: 0; transform: scale(0); }
}

/* 闲置变暗 */
body.idle {
  transition: filter 2s ease;
  filter: brightness(0.95);
}

/* 倒计时扭曲 */
@keyframes text-distort {
  0%, 100% { transform: scaleX(1); letter-spacing: 2px; }
  25% { transform: scaleX(1.05); letter-spacing: 4px; }
  50% { transform: scaleX(0.95); letter-spacing: 1px; }
  75% { transform: scaleX(1.02); letter-spacing: 3px; }
}
.countdown-num.distort {
  animation: text-distort 0.3s ease-in-out;
  color: #8b0000;
}

@keyframes flash-out {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* 鬼图出现/消失 */
@keyframes face-appear {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(0.3); }
  100% { opacity: 0.7; transform: translate(-50%,-50%) scale(1); }
}
@keyframes face-disappear {
  0% { opacity: 0.7; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.5); }
}

/* 底部小字淡入淡出 */
@keyframes fade-in-out {
  0% { opacity: 0; }
  15% { opacity: 0.8; }
  85% { opacity: 0.8; }
  100% { opacity: 0; }
}

/* 页面闪烁 */
body.flash-all {
  animation: body-flash 0.15s ease-out 3;
}
@keyframes body-flash {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.8) saturate(0); }
}

/* 屏幕裂痕 */
body.crack::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    linear-gradient(135deg, transparent 48%, rgba(139,0,0,0.15) 49%, rgba(139,0,0,0.1) 50%, transparent 51%),
    linear-gradient(225deg, transparent 48%, rgba(139,0,0,0.12) 49%, rgba(139,0,0,0.08) 50%, transparent 51%);
  pointer-events: none;
  z-index: 99998;
  animation: crack-fade 1s ease-out forwards;
}
@keyframes crack-fade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* 文字抖动 */
@keyframes text-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px) rotate(-0.5deg); }
  50% { transform: translateX(3px) rotate(0.5deg); }
  75% { transform: translateX(-2px) rotate(-0.3deg); }
}

/* ===== 恐怖度升级系统 ===== */

body[data-terror="1"] .container,
body[data-terror="2"] .container {
  filter: sepia(0.05) hue-rotate(-5deg);
  transition: filter 3s ease;
}

body[data-terror="3"] .card,
body[data-terror="4"] .card {
  border: 1px solid rgba(139,0,0,0.15);
  box-shadow: 0 1px 8px rgba(139,0,0,0.08);
  transition: all 3s ease;
}
body[data-terror="3"],
body[data-terror="4"] {
  background: #f0f0f2;
}

body[data-terror="5"],
body[data-terror="6"] {
  background: #ece0e0;
  filter: sepia(0.08);
}
body[data-terror="5"] .card,
body[data-terror="6"] .card {
  border-color: rgba(139,0,0,0.25);
  box-shadow: 0 1px 12px rgba(139,0,0,0.12);
}

body[data-terror="7"],
body[data-terror="8"] {
  background: #e8d8d8;
  filter: sepia(0.12) brightness(0.96);
}
body[data-terror="7"] .card,
body[data-terror="8"] .card {
  border-color: rgba(139,0,0,0.35);
  background: #faf5f5;
}
body[data-terror="7"] p,
body[data-terror="8"] p { color: #444; }

body[data-terror="9"],
body[data-terror="10"] {
  background: #e0d0d0;
  filter: sepia(0.18) brightness(0.92) contrast(1.05);
}
body[data-terror="9"] .card,
body[data-terror="10"] .card {
  border-color: rgba(139,0,0,0.5);
  background: #f8f0f0;
  box-shadow: 0 1px 20px rgba(139,0,0,0.15);
}
body[data-terror="9"] .topbar,
body[data-terror="10"] .topbar {
  border-bottom-color: rgba(139,0,0,0.3);
}

/* ===== 新增高能恐怖效果 ===== */

/* 全黑闪烁 */
@keyframes blackout-fade {
  0% { opacity: 0; }
  15% { opacity: 1; }
  50% { opacity: 1; }
  85% { opacity: 0.8; }
  100% { opacity: 0; }
}

/* 滚动时一闪而过的扭曲人脸 */
@keyframes scroll-face {
  0% { opacity: 0; transform: scale(0.3) rotate(0deg); }
  30% { opacity: 0.9; transform: scale(1.2) rotate(15deg); }
  60% { opacity: 0.6; transform: scale(0.8) rotate(-10deg); }
  100% { opacity: 0; transform: scale(0.1) rotate(30deg); }
}

/* 页面边缘闪烁红光 — 更频繁更亮 */
body {
  position: relative;
}
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 9997;
  box-shadow: none;
  animation: red-flash 5s infinite;
}
@keyframes red-flash {
  0%, 95%, 100% { box-shadow: none; }
  95.5% { box-shadow: inset 0 0 150px rgba(255,0,0,0.5); }
  96% { box-shadow: inset 0 0 80px rgba(255,0,0,0.2); }
  97% { box-shadow: inset 0 0 120px rgba(255,0,0,0.4); }
  98% { box-shadow: inset 0 0 60px rgba(255,0,0,0.15); }
}

/* 屏幕扫描线 */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 9996;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.04) 2px,
    rgba(0,0,0,0.04) 4px
  );
  animation: scanlines 0.08s infinite;
}
@keyframes scanlines {
  0% { opacity: 0.3; }
  50% { opacity: 0.7; }
  100% { opacity: 0.3; }
}

/* ===== 终极恐怖: 流血效果 ===== */
@keyframes bleed-drop {
  0% { opacity: 0.8; height: 0; }
  30% { opacity: 0.9; }
  100% { opacity: 0; height: 80px; }
}

/* ===== 终极恐怖: 盯着你的脸 ===== */
#stalking-face {
  animation: face-breathe 2s ease-in-out infinite;
}
@keyframes face-breathe {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 20px #8b0000); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 40px #ff0000); }
}

/* ===== 终极恐怖: 追眼动画 ===== */
@keyframes eye-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 15px #ff0000); }
  50% { transform: scale(1.3); filter: drop-shadow(0 0 30px #ff0000); }
}

/* ===== 终极恐怖: 卡片变脸闪烁 ===== */
@keyframes card-flash {
  0%, 100% { background: transparent; }
  50% { background: rgba(139,0,0,0.08); }
}

/* ===== 终极恐怖: 页面震动 ===== */
body.shake-page {
  animation: page-shake 0.3s ease-in-out 3;
}
@keyframes page-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

/* ===== 终极恐怖: 文字流血 ===== */
@keyframes text-bleed {
  0% { color: inherit; }
  50% { color: #8b0000; text-shadow: 0 0 10px rgba(139,0,0,0.5); }
  100% { color: inherit; }
}

/* ===== 终极恐怖: 人脸弹出 ===== */
@keyframes face-grow {
  0% { transform: translate(-50%,-50%) scale(0); opacity: 0; }
  50% { transform: translate(-50%,-50%) scale(1.2); opacity: 0.9; }
  100% { transform: translate(-50%,-50%) scale(1); opacity: 0.8; }
}

/* ===== 更恐怖的追加效果 ===== */

/* 页面边缘渗血 */
@keyframes blood-drip {
  0% { opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.4; }
  100% { opacity: 0; }
}

/* 突然全屏红色闪烁 */
@keyframes red-flash-intense {
  0% { opacity: 0; }
  5% { opacity: 0.9; }
  15% { opacity: 0.3; }
  100% { opacity: 0; }
}

/* 文字扭曲 */
@keyframes text-warp {
  0% { transform: scaleX(1) skewX(0deg); filter: blur(0); }
  20% { transform: scaleX(1.3) skewX(-5deg); filter: blur(1px); }
  40% { transform: scaleX(0.7) skewX(5deg); filter: blur(2px); }
  60% { transform: scaleX(1.1) skewX(-2deg); filter: blur(0); }
  80% { transform: scaleX(0.9) skewX(3deg); filter: blur(1px); }
  100% { transform: scaleX(1) skewX(0deg); filter: blur(0); }
}

/* 屏幕撕裂 */
@keyframes screen-tear {
  0% { clip-path: inset(0); }
  25% { clip-path: inset(30% 0 0 0); }
  50% { clip-path: inset(0 0 40% 0); }
  75% { clip-path: inset(20% 0 20% 0); }
  100% { clip-path: inset(0); }
}

/* 鬼影闪烁 */
@keyframes ghost-flicker {
  0%, 100% { opacity: 0; transform: scale(0.8); }
  10% { opacity: 0.7; transform: scale(1.1); }
  20% { opacity: 0; transform: scale(0.9); }
  30% { opacity: 0.5; transform: scale(1.2); }
  50% { opacity: 0; transform: scale(0.7); }
  70% { opacity: 0.8; transform: scale(1); }
  85% { opacity: 0; }
}

/* 页面震动+倾斜 */
@keyframes violent-shake {
  0% { transform: translate(0, 0) rotate(0deg); }
  10% { transform: translate(-8px, 4px) rotate(-1deg); }
  20% { transform: translate(6px, -6px) rotate(1deg); }
  30% { transform: translate(-4px, 8px) rotate(-0.5deg); }
  40% { transform: translate(10px, -2px) rotate(0.5deg); }
  50% { transform: translate(-6px, 6px) rotate(-1deg); }
  60% { transform: translate(4px, -8px) rotate(1deg); }
  70% { transform: translate(-10px, 4px) rotate(-0.5deg); }
  80% { transform: translate(8px, -4px) rotate(0.5deg); }
  90% { transform: translate(-2px, 2px) rotate(0deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

body.violent-shake {
  animation: violent-shake 0.6s ease-in-out;
}

/* 屏幕噪点 */
body.noise-overlay::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 999999;
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="4" height="4"><rect width="4" height="4" fill="none"/><circle cx="1" cy="1" r="0.5" fill="rgba(0,0,0,0.3)"/><circle cx="3" cy="3" r="0.5" fill="rgba(0,0,0,0.2)"/></svg>');
  background-repeat: repeat;
  opacity: 0;
  animation: noise-fade 0.5s ease-out forwards;
}
@keyframes noise-fade {
  0% { opacity: 0.8; }
  100% { opacity: 0; }
}

/* 底部警告条闪烁 */
@keyframes warn-blink {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

/* ===== 谜题系统 ===== */

/* 导航栏谜题入口解锁状态 */
#puzzleLink.unlocked {
  color: #ffd700 !important;
  opacity: 1 !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  font-weight: 600;
  text-shadow: 0 0 8px rgba(255,215,0,0.3);
}

/* 谜题卡片 */
.puzzle-card {
  text-align: center;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  color: #e0e0e0;
  border: 1px solid #ffd700;
  box-shadow: 0 0 40px rgba(255,215,0,0.1);
}
.puzzle-card h2 {
  color: #ffd700;
  font-size: 1.4rem;
}
.puzzle-icon {
  font-size: 4rem;
  margin: 16px 0;
  animation: pulse 2s ease-in-out infinite;
}
.puzzle-congrats {
  font-size: 1.2rem;
  color: #ffd700;
  margin-bottom: 12px;
}
.puzzle-story {
  color: #aaa;
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 16px;
}
.puzzle-code {
  background: rgba(255,215,0,0.08);
  border: 1px solid rgba(255,215,0,0.2);
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
}
.puzzle-code-label {
  color: #888;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 4px;
}
.puzzle-code-value {
  color: #ffd700;
  font-size: 1.6rem;
  font-family: monospace;
  letter-spacing: 6px;
  text-shadow: 0 0 20px rgba(255,215,0,0.4);
}
.puzzle-message {
  color: #8b0000;
  font-size: 0.9rem;
  line-height: 2;
  margin-top: 16px;
  font-family: monospace;
}
.puzzle-final {
  font-size: 1.1rem;
  color: #ff4444;
  text-shadow: 0 0 20px rgba(255,0,0,0.3);
  animation: pulse 1.5s ease-in-out infinite;
}

/* 碎片收集列表 */
.clue-list {
  list-style: none;
  padding: 0;
}
.clue-list li {
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.95rem;
  color: #555;
}
.clue-list li:last-child { border-bottom: none; }

/* 卡片突然变红 */
.card.blood-card {
  background: #1a0000 !important;
  border: 2px solid #8b0000 !important;
  box-shadow: 0 0 40px rgba(139,0,0,0.6) !important;
  transition: all 0.1s;
}
.card.blood-card h2,
.card.blood-card p,
.card.blood-card span {
  color: #cc0000 !important;
}

/* 页面整体变暗+红色调 */
body.hell-mode {
  filter: brightness(0.6) saturate(0.3) hue-rotate(-20deg) !important;
  transition: filter 3s;
}

/* 突然出现的巨大眼睛 */
@keyframes giant-eye {
  0% { transform: translate(-50%,-50%) scale(0); opacity: 0; }
  20% { transform: translate(-50%,-50%) scale(3); opacity: 0.9; }
  40% { transform: translate(-50%,-50%) scale(2.5); opacity: 0.7; }
  60% { transform: translate(-50%,-50%) scale(3.5); opacity: 0.8; }
  80% { transform: translate(-50%,-50%) scale(2); opacity: 0.5; }
  100% { transform: translate(-50%,-50%) scale(0); opacity: 0; }
}

/* 数字倒计时扭曲 */
@keyframes num-glitch {
  0% { transform: translate(0); opacity: 1; }
  25% { transform: translate(-5px, 3px); opacity: 0.5; color: #ff0000; }
  50% { transform: translate(5px, -3px); opacity: 0.8; color: #00ff00; }
  75% { transform: translate(-3px, 5px); opacity: 0.3; color: #ff0000; }
  100% { transform: translate(0); opacity: 1; }
}
