* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;          /* 阻止浏览器默认手势 */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  background: #fff;
}
canvas {
  display: block;
}

/* 顶部标题 */
#header {
  position: fixed;
  top: 10px;
  left: 10px;
  pointer-events: none;
  z-index: 10;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  font-weight: normal;
  color: #333;
}

/* 右上角访问量 */
#visitCount {
  position: fixed;
  top: 10px;
  right: 10px;
  pointer-events: none;
  z-index: 10;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  font-weight: normal;
  color: #666;
}

/* 底部操作提示 */
#hint {
  position: fixed;
  bottom: 20px;
  left: 0;
  width: 100%;
  text-align: center;
  pointer-events: none;
  z-index: 10;
}
#hint span {
  display: inline-block;
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0.5px;
  transition: opacity 0.3s;
}

/* ===== 弹幕样式 ===== */
#danmakuContainer {
  position: fixed;
  top: 46px;
  left: 0;
  width: 100%;
  height: 105px;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}

.danmaku-item {
  position: absolute;
  white-space: nowrap;
  font-size: 18px;
  font-weight: bold;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #fff;
  text-shadow:
    1px 1px 2px rgba(0,0,0,0.8),
    -1px -1px 2px rgba(0,0,0,0.8),
    1px -1px 2px rgba(0,0,0,0.8),
    -1px 1px 2px rgba(0,0,0,0.8);
  animation: danmakuScroll linear forwards;
  will-change: transform;
  /* 动画延迟期间隐藏，避免左侧残留 */
  opacity: 0;
  animation-fill-mode: forwards;
}

@keyframes danmakuScroll {
  0%   { opacity: 1; transform: translateX(100vw); }
  99%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-100%); }
}

#danmakuInput {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 15;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(8px);
  border-radius: 24px;
  padding: 6px 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  touch-action: auto;  /* 允许输入框正常触摸 */
}

#dmText {
  width: 200px;
  max-width: 55vw;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #333;
  padding: 4px 0;
}
#dmText::placeholder {
  color: #999;
}

#dmSend {
  background: #ff5722;
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 5px 14px;
  font-size: 13px;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
#dmSend:active {
  background: #e64a19;
}
