* {
  box-sizing: border-box;
}

html {
  font-family: "YouTube Sans", "Roboto", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  background-color: #1a1e2f;
  background-image: url(../../img/logo.png);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

/* Player Container */
#player-container {
  width: 100%;
  height: 100%;
  position: relative;
  background: black;
  overflow: hidden;
}

#player-container canvas {
  display: block;
  outline: none;
  touch-action: manipulation;
}

.ytp-chrome-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 8px 12px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.8) 0%,
    rgba(0, 0, 0, 0.5) 50%,
    transparent 100%
  );
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 1, 1);
  pointer-events: none;
}

#player-container:hover .ytp-chrome-bottom,
.ytp-chrome-bottom:hover,
.ytp-chrome-bottom.show-controls {
  opacity: 1;
  pointer-events: all;
}

.ytp-progress-bar-container {
  height: 20px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0;
}

.ytp-progress-bar {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  outline: none;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: height 0.2s ease;
  position: relative;
  z-index: 10;
}

.ytp-progress-bar:hover {
  height: 6px;
}

.ytp-progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: #ff0000;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}

.ytp-progress-bar:hover::-webkit-slider-thumb {
  transform: scale(1.2);
}

.ytp-progress-bar::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #ff0000;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid white;
}

/* Controls Row */
.ytp-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.ytp-left-controls,
.ytp-right-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
.ytp-button {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.ytp-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.ytp-button:active {
  background-color: rgba(255, 255, 255, 0.3);
  transform: scale(0.9);
}

.ytp-button svg {
  fill: white;
  width: 24px;
  height: 24px;
}

/* Volume Controls */
.ytp-volume-area {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ytp-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 60px;
  height: 4px;
  background: rgba(255, 255, 255, 0.5);
  outline: none;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ytp-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease;
}

.ytp-volume-slider:hover::-webkit-slider-thumb {
  transform: scale(1.2);
}

.ytp-volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* Time & Playback Rate */
.ytp-time-display {
  color: white;
  font-size: 13px;
  font-weight: 500;
  padding: 0 6px;
  white-space: nowrap;
}

.ytp-playback-rate {
  color: white;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  min-width: 30px;
  text-align: center;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.ytp-playback-rate:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Settings Menu */
.ytp-settings-menu {
  position: absolute;
  bottom: 60px;
  right: 15px;
  z-index: 1001;
  background: rgba(28, 28, 28, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  min-width: 250px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  display: none;
}

.ytp-settings-menu.show {
  display: block;
}

.ytp-panel {
  padding: 8px 0;
}

.ytp-panel-hidden {
  display: none;
}

.ytp-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 15px;
  font-weight: 500;
}

.ytp-panel-back-button {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.15s ease;
}

.ytp-panel-back-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.ytp-menuitem {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  min-height: 40px;
}

.ytp-menuitem:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.ytp-menuitem-label {
  flex: 1;
  line-height: 1.4;
}

.ytp-menuitem-content {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  margin-right: 8px;
}

.ytp-menuitem-toggle-checkbox svg {
  fill: rgba(255, 255, 255, 0.8);
  width: 18px;
  height: 18px;
}

.ytp-menuitem-selected {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Disabled States */
.ytp-playback-rate.disabled,
.ytp-menuitem.disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  pointer-events: none;
}

.ytp-menuitem.disabled:hover {
  background-color: transparent !important;
}

/* Utility & Animations */
#web4dv-waiter {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 150px;
  height: 150px;
  margin-top: -75px;
  margin-left: -75px;
  opacity: 0.6;
  z-index: 2;
  display: none;
}

#web4dv-waiter img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.player-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  max-width: 350px;
  z-index: 1000;
  border: 1px solid rgba(255, 255, 255, 0.1);
  user-select: text;
}

.player-error h3 {
  margin-top: 0;
  color: #ea3a87;
  font-size: 1.1rem;
}

.player-error p {
  margin-bottom: 0;
  line-height: 1.5;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.8;
  }
  50% {
    opacity: 1;
  }
}

/* WebXR/AR Buttons */
#ARButton {
  position: absolute;
  bottom: 80px;
  left: 15px;
  z-index: 1001;
  padding: 10px 12px;
  border: 1px solid #fff;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.1);
  color: #fff;
  font: normal 12px sans-serif;
  text-align: center;
  opacity: 0.5;
  outline: none;
  cursor: pointer;
  transition: opacity 0.2s ease, background-color 0.2s ease;
}

#ARButton:hover {
  opacity: 1;
  background-color: rgba(0, 0, 0, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
  .ytp-chrome-bottom {
    padding: 5px 10px calc(5px + env(safe-area-inset-bottom, 0));
  }
  .ytp-button {
    width: 38px;
    height: 38px;
  }
  .ytp-button svg {
    width: 22px;
    height: 22px;
  }
  .ytp-volume-slider {
    display: none;
  }
  .ytp-time-display,
  .ytp-playback-rate {
    font-size: 12px;
    padding: 0 5px;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .ytp-left-controls,
  .ytp-right-controls {
    gap: 4px;
  }
  .ytp-button {
    width: 36px;
    height: 36px;
  }
  .ytp-button svg {
    width: 20px;
    height: 20px;
  }
  .ytp-time-display,
  .ytp-playback-rate {
    display: none;
  }
}
