/* ===== CSS Variables ===== */
:root {
  --bg: #fdf6ec;
  --text-primary: #2c2416;
  --text-muted: #9a8878;
  --text-faint: #c4b49e;
  --accent: #8b6840;
  --accent-light: #c4976a;
  --border: #e8d8c4;
  --footer-bg: #f0e6d6;
  --font-serif: 'Noto Serif SC', serif;
  --font-display: 'Playfair Display', serif;
}

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

html { scroll-behavior: smooth; height: 100%; }

body {
  background-color: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-serif);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== Main Screen ===== */
#main-screen {
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(196,151,106,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 30%, rgba(139,104,64,0.04) 0%, transparent 50%);
}

.tv-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 2rem;
}

/*
  关键修复：
  .tv-shadow-wrap  承载 drop-shadow，它本身会创建层叠上下文，
                   但它的子元素 .tv-container 不带 filter，
                   .tv-container 内的 z-index 因此可以正常工作。
  .tv-container    position:relative，不带 filter，
                   其子元素 z-index 在同一层叠上下文内互相比较：
                   .tv-screen-overlay z-index:1  播放层（下）
                   .tv-picture        z-index:2  电视外框（上，屏幕透明）
*/
.tv-shadow-wrap {
  display: inline-block;
  /* drop-shadow 放这里，不影响内部 z-index */
  filter: drop-shadow(0 20px 60px rgba(100, 70, 30, 0.18));
}

.tv-container {
  position: relative;
  display: inline-block;
  /* 严禁在此添加 filter/transform/opacity<1/will-change，否则重建层叠上下文 */
}

/* ===== TV Screen Overlay（播放层，z-index:1） ===== */
.tv-screen-overlay {
  position: absolute;
  top: var(--screen-top, 14%);
  left: var(--screen-left, 13%);
  width: var(--screen-width, 62%);
  height: var(--screen-height, 52%);
  z-index: 1;        /* 在电视图片(z:2)下方，从透明屏幕区域透出 */
  overflow: hidden;
  border-radius: 4px;
  background: #000;
}

/* ===== TV Image（电视外框，z-index:2） ===== */
.tv-picture {
  position: relative;
  display: block;
  z-index: 2;        /* 覆盖在播放层上方，屏幕区域必须是透明通道 */
  pointer-events: none;
  user-select: none;
}

.tv-image {
  display: block;
  max-width: 880px;  /* PC 端最大宽度，按需修改 */
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
}

/* ===== Idle Screen ===== */
.idle-screen {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.idle-gif {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.static-noise {
  position: absolute;
  inset: 0;
  background: #111;
}

/* ===== TV Video Player ===== */
.tv-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

.tv-video::-webkit-media-controls { display: none !important; }
.tv-video::-webkit-media-controls-enclosure { display: none !important; }

/* ===== Scroll Hint ===== */
.scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  cursor: pointer;
  z-index: 10;
  opacity: 0.45;
  transition: opacity 0.4s ease;
}

.scroll-hint:hover { opacity: 0.75; }

.scroll-hint i {
  color: var(--accent);
  font-size: 0.85rem;
  line-height: 1;
  animation: chevronPulse 1.8s ease-in-out infinite;
}

.scroll-hint i:first-child { animation-delay: 0s; }
.scroll-hint i:last-child  { animation-delay: 0.28s; }

@keyframes chevronPulse {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50%       { opacity: 1;   transform: translateY(3px); }
}

.scroll-hint.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ===== Footer ===== */
#site-footer {
  background-color: var(--footer-bg);
  border-top: 1px solid var(--border);
  padding: 2.8rem 2rem 2.4rem;
  text-align: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
}

#site-footer.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.footer-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}

.footer-inner::before {
  content: '';
  display: block;
  width: 40px;
  height: 1px;
  background: var(--border);
  margin-bottom: 0.4rem;
}

.footer-nav {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-nav a {
  font-family: var(--font-serif);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-decoration: none;
  position: relative;
  transition: color 0.25s ease;
}

.footer-nav a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 1px;
  background: var(--accent-light);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.3s ease;
}

.footer-nav a:hover { color: var(--accent); }
.footer-nav a:hover::after { transform: scaleX(1); }

.footer-nav .sep {
  color: var(--text-faint);
  font-size: 0.65rem;
  user-select: none;
}

.footer-copy {
  font-size: 0.68rem;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  line-height: 1.6;
}

.footer-sub {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.65rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  opacity: 0.7;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .tv-image { max-width: 500px; }
  .scroll-hint { bottom: 1.5rem; }
  #site-footer { padding: 2.2rem 1.5rem 2rem; }
}

@media (max-width: 480px) {
  .tv-image { max-width: 290px; }
  .footer-nav { gap: 0.4rem; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }