* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; -webkit-tap-highlight-color: transparent; }
body { background: #000; font-family: Roboto, Arial, sans-serif; overflow: hidden; height: 100vh; height: 100dvh; }
.yt-container { position: relative; width: 100%; height: 100%; background: #000; }
video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.center-btn {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 80px; height: 80px; background: rgba(0,0,0,0.6); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  opacity: 0; transition: opacity 0.2s; z-index: 20; pointer-events: none;
}
.yt-container.show-ui .center-btn { opacity: 1; pointer-events: auto; }
.yt-container.ended .center-btn { opacity: 1; pointer-events: auto; }
.controls {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
  opacity: 0; transition: opacity 0.25s ease;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  padding: 0 16px 12px; pointer-events: none;
}
.yt-container.show-ui .controls { opacity: 1; pointer-events: auto; }
.yt-container.ended .controls { opacity: 1; pointer-events: auto; }
.progress-area {
  position: relative; height: 20px; display: flex; align-items: center; cursor: pointer; margin-bottom: 2px;
}
.progress-bg {
  position: relative; width: 100%; height: 4px; background: rgba(255,255,255,0.25); border-radius: 2px;
}
.progress-loaded { position: absolute; top: 0; left: 0; height: 100%; background: rgba(255,255,255,0.5); border-radius: 2px; }
.progress-current { position: absolute; top: 0; left: 0; height: 100%; background: #f00; border-radius: 2px; }
.scrubber {
  position: absolute; top: 50%; transform: translate(-50%, -50%) scale(0);
  width: 14px; height: 14px; background: #f00; border-radius: 50%;
  transition: transform 0.1s; pointer-events: none;
}
.progress-area:hover .scrubber { transform: translate(-50%, -50%) scale(1); }
.progress-area:hover .progress-bg { height: 6px; }
.time-tooltip {
  position: absolute; bottom: 30px; background: transparent;
  color: #fff; font-size: 13px; pointer-events: none;
  opacity: 0; white-space: nowrap;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  z-index: 25; padding: 0;
}
.time-tooltip img {
  width: 192px; height: 108px; object-fit: cover; border-radius: 4px;
  border: 2px solid #fff; background: transparent;
}
.time-tooltip span {
  background: rgba(0,0,0,0.75); color: #fff; padding: 2px 6px;
  border-radius: 4px; font-size: 13px; line-height: 1.2;
}
.progress-area:hover .time-tooltip { opacity: 1; }
.buttons { display: flex; justify-content: space-between; align-items: center; height: 48px; }
.left, .right { display: flex; align-items: center; gap: 4px; }
.yt-btn {
  background: none; border: none; width: 44px; height: 44px; color: #fff;
  cursor: pointer; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  text-decoration: none;
}
.yt-btn:hover { background: rgba(255,255,255,0.15); }
.yt-btn svg { width: 24px; height: 24px; fill: #fff; pointer-events: none; }
.volume-container { display: flex; align-items: center; }
.volume-slider {
  width: 0; overflow: hidden; margin-left: 0; cursor: pointer; accent-color: #fff;
  transition: width 0.2s, margin-left 0.2s;
}
.volume-container:hover .volume-slider { width: 70px; margin-left: 5px; margin-right: 10px; }
.time-display { color: #ddd; font-size: 13.5px; margin-left: 0; font-feature-settings: "tnum"; white-space: nowrap; }
.seek-feedback {
  position: absolute; top: 50%; transform: translateY(-50%);
  color: #fff; font-size: 28px; font-weight: bold;
  background: rgba(0,0,0,0.75); padding: 12px 24px; border-radius: 8px;
  z-index: 30; pointer-events: none; opacity: 0; transition: opacity 0.15s;
}
.seek-feedback.show { opacity: 1; }
#thumbnailVideo {
  position: absolute; top: -9999px; left: -9999px; width: 160px; height: 90px;
  opacity: 0; pointer-events: none;
}
#thumbStatus {
  position: absolute; bottom: 80px; left: 16px; color: yellow;
  background: rgba(0,0,0,0.7); font-size: 14px; padding: 4px 8px;
  border-radius: 4px; z-index: 50; display: none;
}

#downloadBtn, #castBtn { display: none !important; }

.speed-wrapper { position: relative; display: inline-flex; align-items: center; }
.speed-popup {
  position: absolute;
  bottom: calc(100% + 24px);
  right: -40px;
  background: rgba(30,30,30,0.8); color: #fff;
  border-radius: 8px; padding: 16px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
  z-index: 40; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  width: 260px;
}
.speed-popup.visible { opacity: 1; pointer-events: auto; }
.speed-label {
  font-size: 20px; font-weight: bold; text-align: center;
}
.speed-slider-row {
  display: flex; align-items: center; gap: 8px; width: 100%;
}
.speed-slider-btn {
  background: none; border: none; color: #fff; cursor: pointer;
  width: 32px; height: 32px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 18px;
}
.speed-slider-btn:hover { background: rgba(255,255,255,0.15); }
.speed-slider {
  flex: 1; appearance: none; height: 4px; background: rgba(255,255,255,0.2);
  border-radius: 2px; outline: none; cursor: pointer;
}
.speed-slider::-webkit-slider-thumb {
  appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; cursor: pointer;
}
.speed-presets {
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
}
.speed-preset-btn {
  background: rgba(255,255,255,0.1); color: #fff; border: none;
  padding: 6px 14px; border-radius: 20px; cursor: pointer; font-size: 13px;
}
.speed-preset-btn:hover { background: rgba(255,255,255,0.25); }

#timeModePanel {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0,0,0,0.75);
  color: #ff0;
  padding: 12px 16px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 16px;
  z-index: 100;
  display: none;
  pointer-events: none;
  text-align: right;
  line-height: 1.6;
  text-shadow: 0 0 12px #ff0, 0 0 24px #ff0;
  border: 1px solid rgba(255,255,0,0.3);
  box-shadow: 0 0 20px rgba(255,255,0,0.2);
  min-width: 200px;
  backdrop-filter: blur(4px);
}
#timeModePanel .mode-title {
  font-weight: bold;
  font-size: 18px;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(255,255,0,0.2);
  padding-bottom: 4px;
  margin-bottom: 4px;
}
#timeModePanel .time-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
#timeModePanel .time-label {
  opacity: 0.7;
}
#timeModePanel .time-value {
  font-weight: bold;
}
#messageOverlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 200;
  pointer-events: none;
  background: rgba(0,0,0,0.6);
}
#messageOverlay.active {
  display: flex;
}
#messageContent {
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 24px 32px;
  border-radius: 12px;
  text-align: center;
  max-width: 90%;
  pointer-events: auto;
  border: 2px solid #ff0;
  box-shadow: 0 0 40px rgba(255,255,0,0.3);
}
#messageContent .msg-text {
  font-size: 18px;
  word-break: break-all;
  margin-bottom: 12px;
  line-height: 1.4;
}
#messageContent .msg-hint {
  font-size: 14px;
  color: #aaa;
  margin-top: 8px;
}

@media (max-width: 600px) {
  .yt-btn { width: 40px; height: 40px; }
  .yt-btn svg { width: 24px; height: 24px; }
  .time-display { font-size: 12px; margin-left: 2px; }
  .controls { padding: 0 10px 10px; }
  .buttons { height: 44px; }
  .center-btn { width: 64px; height: 64px; }
  .volume-slider { width: 0; }
  .volume-container:hover .volume-slider { width: 60px; }
  .progress-area { height: 30px; }
  #rewindBtn, #forwardBtn { display: none; }
  #downloadBtn { display: none !important; }
  .right .yt-btn:not(#fullscreenBtn):not(#speedBtn):not(#downloadBtn) { display: none; }
  #thumbStatus { bottom: 70px; font-size: 12px; }
  .speed-popup { width: 240px; }
  .time-tooltip img {
    width: 120px !important;
    height: 68px !important;
  }
  #timeModePanel {
    top: 12px;
    right: 12px;
    font-size: 14px;
    padding: 8px 12px;
    min-width: 160px;
  }
  #timeModePanel .mode-title { font-size: 16px; }
  #messageContent { padding: 18px 20px; }
  #messageContent .msg-text { font-size: 16px; }
}