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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#player-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

#freeze-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 10;
  pointer-events: none;
}

#status-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  background: rgba(0, 0, 0, 0.7);
}

#status-overlay.hidden {
  display: none;
}

#status-text {
  color: #fff;
  font-size: 24px;
  text-align: center;
  padding: 20px;
}

#danmaku-overlay {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  overflow: hidden;
}

.danmaku-item {
  position: absolute;
  right: -20px;
  white-space: nowrap;
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.75);
  animation: danmaku-move 8s linear forwards;
  will-change: transform;
}

.danmaku-item-own {
  color: #ff4d4f;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
}

#danmaku-entry {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 26;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

#danmaku-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border: none;
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(24, 144, 255, 0.92);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
}

.danmaku-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 13px;
}

.danmaku-toggle-text {
  white-space: nowrap;
}

#danmaku-panel {
  width: min(560px, 100%);
}

#danmaku-panel.hidden {
  display: none;
}

#danmaku-form {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(8, 14, 24, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.28);
}

#danmaku-input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
  background: rgba(255, 255, 255, 0.96);
}

#danmaku-send-btn {
  min-width: 72px;
  min-height: 44px;
  border: none;
  border-radius: 12px;
  padding: 0 18px;
  background: #1890ff;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

#danmaku-send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#danmaku-feedback {
  min-height: 20px;
  margin-top: 8px;
  padding: 0 8px;
  color: #fff;
  font-size: 13px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

#danmaku-feedback.error {
  color: #ffb3b3;
}

#danmaku-feedback.success {
  color: #d9f7be;
}

@keyframes danmaku-move {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(-100vw - 240px));
  }
}

@media (max-width: 640px) {
  .danmaku-item {
    font-size: 18px;
  }

  #danmaku-entry {
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    gap: 8px;
  }

  #danmaku-toggle-btn {
    min-height: 42px;
    padding: 0 12px;
    font-size: 13px;
  }

  .danmaku-toggle-icon {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }

  #danmaku-panel {
    width: 100%;
  }

  #danmaku-form {
    gap: 8px;
    padding: 8px;
  }

  #danmaku-send-btn {
    min-width: 64px;
  }

  #danmaku-input,
  #danmaku-send-btn {
    font-size: 14px;
  }
}
