:root {
  --bg: #0e1117;
  --bg-elevated: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #f78166;
  --accent-dim: #c9634b;
  --success: #3fb950;
  --danger: #f85149;
  --radius: 12px;
  --font: "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

html,
body {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.background-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: var(--radius);
  overflow: hidden;
}

.background-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 700ms ease-in-out;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1rem 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.scene-zone {
  position: relative;
  flex: 1 1 auto;
  min-height: 22rem;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  border-radius: 0;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

header {
  margin-bottom: 0rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 5;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

h1 {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.app-logo {
  width: 4rem;
  height: 4rem;
  display: block;
  object-fit: contain;
}

h1 span {
  color: var(--accent);
}

.menu-toggle {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0.55rem;
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
}

.menu-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 999px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(10px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-10px) rotate(-45deg);
}

.sandwich-menu {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.5rem;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateY(-6px);
  transition: max-height 0.25s ease, opacity 0.2s ease, transform 0.2s ease;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.sandwich-menu::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.sandwich-menu.is-open {
  max-height: min(60rem, calc(100vh - 5rem));
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  overflow-y: auto;
}

.menu-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  padding: 0.65rem 0.7rem 0.75rem;
  display: grid;
  gap: 0.55rem;
}

.menu-group__title {
  margin: 0 0.1rem 0.1rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--accent);
}

.menu-spotify-auth {
  margin-top: 0.3rem;
  padding: 0.6rem 0.55rem 0.45rem;
  border: 1px solid var(--accent-dim);
  border-radius: 12px;
  background: linear-gradient(180deg, #131722 0%, #0f1420 100%);
}

.menu-spotify-auth__top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: nowrap;
}

.menu-spotify-auth__label {
  margin: 0;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  flex: 0 0 auto;
}

.menu-spotify-auth__actions {
  display: flex;
  gap: 0.42rem;
  flex-wrap: wrap;
  flex: 1 1 auto;
  margin-left: auto;
  justify-content: flex-end;
}

.menu-spotify-auth .js-spotify-connect,
.menu-spotify-auth .js-spotify-disconnect {
  padding: 0.46rem 0.72rem;
}

.menu-spotify-auth .js-spotify-connect {
  flex: 0 1 auto;
  min-width: 0;
}

.menu-spotify-auth .js-spotify-disconnect {
  flex: 0 1 auto;
  background: #f85149;
  border-color: #f85149;
  color: #0e1117;
  font-weight: 600;
}

.menu-spotify-auth .js-spotify-disconnect:hover:not(:disabled) {
  background: #d33f38;
  border-color: #d33f38;
}

.menu-spotify-auth__status-wrap {
  margin-top: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.42rem;
}

.menu-spotify-auth__status {
  margin: 0;
  padding: 0.15rem 0.2rem;
  min-height: 1.2rem;
  color: #a8b3c5;
}

@media (max-width: 560px) {
  .menu-spotify-auth__actions {
    width: 100%;
    margin-left: auto;
    justify-content: flex-end;
  }
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 0.5rem 0.9rem;
  transition: background 0.15s, border-color 0.15s;
}

button:hover:not(:disabled) {
  border-color: var(--text-muted);
  background: var(--bg);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0e1117;
  font-weight: 600;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
}

.hue-arc {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  margin: calc(-1 * min(39vmin, 10rem)) auto 1.75rem;
  padding: 0 0.75rem;
}

.hue-arc__disk {
  --disk-max: min(20rem, calc(100vw - 1.5rem));
  --disk: min(78vmin, var(--disk-max));
  width: var(--disk);
  height: var(--disk);
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 2px solid var(--border);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 12px 40px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
  transition: transform 1250ms cubic-bezier(0.42, 0, 0.58, 1);
  transform: rotate(0deg);
  transform-origin: center;
}

.hue-arc__disk.is-spin-locked {
  pointer-events: none;
  cursor: default;
}

.hue-arc__disk.is-spin-locked .hue-arc__half {
  cursor: default;
}

.hue-arc__half {
  flex: 1 1 50%;
  min-height: 0;
  width: 100%;
  margin: 0;
  padding: 0.75rem 0.5rem;
  border: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  font-weight: 600;
  font-size: clamp(0.85rem, 3.5vmin, 1.05rem);
  letter-spacing: 0.02em;
  color: var(--text);
  cursor: pointer;
  transition: filter 0.15s ease, color 0.15s ease, transform 0.08s ease;
  -webkit-tap-highlight-color: transparent;
  backface-visibility: hidden;
  will-change: transform, filter;
}

.hue-arc__half span {
  font-size: clamp(0.7rem, 2.8vmin, 0.8125rem);
  font-weight: 500;
  color: var(--text-muted);
}

/* Icônes PNG sur toute la zone du demi-bouton (alpha au-dessus du dégradé) */
.hue-arc__half.hue-arc__top,
.hue-arc__half.hue-arc__bottom {
  padding: 0;
  position: relative;
  gap: 0;
}

.hue-arc__sun,
.hue-arc__moon {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.hue-arc__sun {
  transform: scaleY(-1);
  transform-origin: center;
}

.hue-arc__top {
  background: linear-gradient(165deg, #1c2128 0%, #161b22 100%);
  border-bottom: 2px solid var(--border);
}

.hue-arc__bottom {
  background: linear-gradient(195deg, #161b22 0%, #12161c 100%);
}

.hue-arc__half:hover {
  filter: brightness(1.08);
  color: var(--accent);
}

.hue-arc__half:hover span {
  color: var(--text-muted);
}

.hue-arc__half:active {
  transform: scale(0.98);
}

.hue-arc__half:focus {
  outline: none;
}

.hue-arc__half:focus-visible {
  box-shadow: inset 0 0 0 3px var(--accent);
  position: relative;
  z-index: 1;
}

.hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.hint code {
  font-size: 0.78em;
  background: var(--bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.hint a {
  color: var(--accent);
}

label {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.35rem;
}

.row-actions--flush {
  margin-top: 0.45rem;
}

.status-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.65rem 1rem;
  font-size: 0.8125rem;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.status-bar.is-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.spotify-now-playing {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.45rem 0.8rem;
  font-size: 0.8125rem;
  background: linear-gradient(
    180deg,
    rgba(18, 18, 18, 0.76) 0%,
    rgba(18, 18, 18, 0.9) 100%
  );
  border-top: 1px solid var(--border);
  color: #fff;
  min-height: 3rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: bottom 0.2s ease;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.spotify-now-playing.with-status {
  bottom: 2.75rem;
}

.spotify-now-playing__cover-wrap {
  width: 2.1rem;
  height: 2.1rem;
  flex: 0 0 auto;
}

.spotify-now-playing__cover,
.spotify-now-playing__fallback {
  width: 100%;
  height: 100%;
  border-radius: 4px;
}

.spotify-now-playing__cover {
  object-fit: cover;
  border: 1px solid #2a2a2a;
}

.spotify-now-playing__fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #1db954, #0f8f3f);
  color: #0b0b0b;
  font-weight: 700;
}

.spotify-now-playing__meta {
  min-width: 0;
  flex: 1 1 auto;
}

.spotify-now-playing__title,
.spotify-now-playing__artist {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spotify-now-playing__title {
  color: #fff;
  font-weight: 600;
  line-height: 1.15;
}

.spotify-now-playing__artist {
  color: #b3b3b3;
  font-size: 0.75rem;
  line-height: 1.25;
}

.spotify-now-playing__progress-wrap {
  margin-top: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.38rem;
}

.spotify-now-playing__time {
  flex: 0 0 auto;
  min-width: 2.15rem;
  color: #9f9f9f;
  font-size: 0.66rem;
  line-height: 1;
}

.spotify-now-playing__time:last-child {
  text-align: right;
}

.spotify-now-playing__progress-track {
  position: relative;
  height: 4px;
  flex: 1 1 auto;
  border-radius: 999px;
  background: #3a3a3a;
  overflow: hidden;
}

.spotify-now-playing__progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #1db954;
  transition: width 0.35s linear;
}

.spotify-now-playing__state {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: rgba(29, 185, 84, 0.18);
  color: #1ed760;
}

.spotify-now-playing[data-state="pause"] .spotify-now-playing__state,
.spotify-now-playing[data-state="en veille"] .spotify-now-playing__state {
  background: rgba(179, 179, 179, 0.2);
  color: #d9d9d9;
}

.spotify-now-playing[data-state="hors ligne"] .spotify-now-playing__state,
.spotify-now-playing[data-state="erreur"] .spotify-now-playing__state {
  background: rgba(248, 81, 73, 0.2);
  color: #ff8f87;
}

.status-bar[data-kind="ok"] {
  color: var(--success);
}

.status-bar[data-kind="err"] {
  color: var(--danger);
}

.hue-link-bridge,
.hue-targets {
  padding: 0.9rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.hue-link-bridge .hint {
  margin: 0 0 0.6rem;
}

.hue-bridge-popup[hidden] {
  display: none !important;
}

.hue-bridge-popup {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.hue-bridge-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.hue-bridge-popup__dialog {
  position: relative;
  width: min(560px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
  padding: 1rem 1rem 0.9rem;
}

.hue-bridge-popup__dialog h3 {
  margin: 0 0 0.55rem;
  color: var(--accent);
  font-size: 1.05rem;
}

.hue-bridge-popup__dialog p {
  margin: 0 0 0.85rem;
  color: var(--text);
  line-height: 1.45;
}

.hue-targets h3 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  color: var(--accent);
  letter-spacing: 0.01em;
}

.hue-targets label {
  display: block;
  margin: 0.6rem 0 0.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hue-targets select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
}

#hueLightPick {
  margin-bottom: 0.55rem;
}

.hue-targets .row-actions--flush {
  margin-top: 0.65rem;
}

.hue-targets select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hue-targets input[type="color"] {
  width: 3.2rem;
  height: 2.4rem;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 8px;
  cursor: pointer;
}

