* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: #02020b;
  color: #e2e8f0;
  font-family: "Outfit", sans-serif;
  overflow: hidden;
}

#main-layout {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
}

/* --- Centered Canvas Area --- */
#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
}

/* --- Floating Toggle --- */
#ui-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  width: 44px;
  height: 44px;
  background: rgba(10, 10, 20, 0.9);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 50%;
  color: #fbbf24;
  font-size: 20px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
}
#ui-toggle:hover {
  scale: 1.1;
  border-color: #fbbf24;
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.2);
}
/* --- Floating Skip Toggle --- */
#skip-toggle {
  position: fixed;
  top: 20px;
  right: 75px; /* Placed just to the left of the menu button */
  z-index: 100;
  width: 44px;
  height: 44px;
  background: rgba(10, 10, 20, 0.9);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 50%;
  color: #fbbf24;
  font-size: 18px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
}

#skip-toggle:hover {
  scale: 1.1;
  border-color: #fbbf24;
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.2);
}

/* --- Sidebar Drawer --- */
#sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100vh;
  background: rgba(10, 10, 20, 0.95);
  backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 90;
  display: flex;
  flex-direction: column;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -20px 0 50px rgba(0, 0, 0, 0.8);
}
#sidebar.hidden {
  transform: translateX(100%);
}

.sidebar-scroll-content {
  flex: 1;
  overflow-y: auto;
  padding: 30px 25px;
}
.sidebar-scroll-content::-webkit-scrollbar {
  width: 4px;
}
.sidebar-scroll-content::-webkit-scrollbar-thumb {
  background: rgba(251, 191, 36, 0.2);
  border-radius: 2px;
}

.sidebar-header h2 {
  margin: 0;
  font-family: "Cinzel", serif;
  color: #fbbf24;
  letter-spacing: 2px;
}
.sidebar-header p {
  margin: 5px 0 20px;
  font-size: 11px;
  opacity: 0.5;
  text-transform: uppercase;
}

/* --- Slider & Input Styling --- */
.control-grid {
  display: grid;
  gap: 14px;
}
label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: #94a3b8;
}
label span {
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

input[type="range"] {
  appearance: none;
  background: rgba(255, 255, 255, 0.05);
  height: 3px;
  border-radius: 2px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  background: #fbbf24;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}

.toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 20px 0;
  padding: 15px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.toggles label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #cbd5e1;
}
.toggles input[type="checkbox"] {
  accent-color: #fbbf24;
}

/* --- Improved Preset Buttons & Import Group --- */
.preset-io {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#ctrl-export-json {
  background: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
  padding: 10px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-family: "Outfit", sans-serif;
  font-size: 12px;
  font-weight: 600;
  transition: 0.2s;
  width: 100%;
}

#ctrl-export-json:hover {
  background: rgba(251, 191, 36, 0.2);
  border-color: #fbbf24;
}

.import-group {
  display: flex;
  gap: 8px;
  width: 100%;
}

#ctrl-import-json {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 8px;
  font-family: monospace;
  font-size: 11px;
  border-radius: 4px;
  outline: none;
  min-width: 0;
}

#ctrl-import-json:focus {
  border-color: rgba(251, 191, 36, 0.5);
}

#ctrl-import-btn {
  background: #fbbf24;
  border: none;
  border-radius: 4px;
  padding: 0 15px;
  cursor: pointer;
  font-weight: bold;
  font-size: 11px;
  color: #000;
  font-family: "Outfit", sans-serif;
  transition: 0.2s;
}

#ctrl-import-btn:hover {
  background: #fcd34d;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

/* --- Pinned Player --- */
#player-container {
  flex-shrink: 0;
  padding: 25px;
  background: #06060c;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#controller {
  display: flex;
  align-items: center;
  gap: 15px;
}

#ctrl-play {
  background: #fbbf24;
  border: none;
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.3);
  transition: transform 0.1s;
}
#ctrl-play:active {
  transform: scale(0.95);
}

.scrub-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.time-info {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  opacity: 0.5;
  margin-bottom: 6px;
  font-family: monospace;
  color: #94a3b8;
}

.player-btns {
  display: flex;
  align-items: center;
  gap: 15px;
}

#ctrl-upload-label {
  cursor: pointer;
  color: #fbbf24;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}
#ctrl-upload-label:hover {
  color: #fff;
  filter: drop-shadow(0 0 5px #fbbf24);
}

#ctrl-file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

#ctrl-yt-btn {
  background: #ff0000;
  border: none;
  width: 34px;
  height: 24px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition:
    transform 0.2s,
    background 0.2s;
  box-shadow: 0 2px 10px rgba(255, 0, 0, 0.2);
}
#ctrl-yt-btn:hover {
  background: #ee0000;
  transform: scale(1.05);
}
#ctrl-yt-btn svg {
  width: 35px;
  height: 35px;
  fill: white;
}

#yt-panel {
  margin-top: 15px;
  display: none;
}
#yt-panel.open {
  display: block;
}
.yt-input-group {
  display: flex;
  gap: 8px;
}

#ctrl-yt-url {
  flex: 1;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 8px;
  border-radius: 4px;
  font-size: 12px;
  outline: none;
}
#ctrl-yt-url:focus {
  border-color: #fbbf24;
}

#ctrl-yt-load-btn {
  background: #fbbf24;
  border: none;
  border-radius: 4px;
  padding: 0 15px;
  cursor: pointer;
  font-weight: bold;
  font-size: 11px;
  color: #000;
}
#ctrl-yt-load-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#ctrl-yt-status {
  display: block;
  margin-top: 8px;
  font-size: 10px;
  font-style: italic;
  opacity: 0.7;
  color: #fbbf24;
}
