:root {
  --panel: rgba(18, 32, 54, 0.42);
  --panel-border: rgba(255, 255, 255, 0.12);
  --ink: #eaf4ff;
  --ink-soft: #9fb8d4;
  --accent: #7fb7e6;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: #0b1830;
  -webkit-font-smoothing: antialiased;
}

#app {
  position: fixed;
  inset: 0;
}

#app canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- HUD ---------- */
.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 22px 26px 24px;
}

.panel {
  pointer-events: auto;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 14px 18px;
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: 0 8px 30px rgba(4, 12, 26, 0.35);
  user-select: none;
}

/* Top / bottom bars */
.bar {
  display: flex;
  width: 100%;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.top-bar {
  justify-content: space-between;
  align-items: flex-start;
}

.bottom-bar {
  justify-content: center;
  align-items: flex-end;
}

h1 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
}

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

.subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

/* Time panel */
.time-panel {
  min-width: 240px;
}

.clock {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.clock #clock {
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: 600;
}

.clock #phase {
  font-size: 13px;
  color: var(--ink-soft);
  text-transform: capitalize;
}

input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffb35c, #ffe9a3 45%, #9fdcff 60%, #315a86);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

/* Ambience panel */
.controls-panel {
  display: flex;
  align-items: center;
  gap: 18px;
}

.controls-panel .label {
  margin-bottom: 0;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-soft);
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: relative;
  width: 38px;
  height: 21px;
  border-radius: 999px;
  background: #2a3f5e;
  transition: background 0.25s ease;
  flex: none;
}

.slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.toggle input:checked + .slider {
  background: var(--accent);
}

.toggle input:checked + .slider::before {
  transform: translateX(17px);
}

button#drop-anchor {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.08s ease;
}

button#drop-anchor:hover {
  background: rgba(255, 255, 255, 0.16);
}

button#drop-anchor:active {
  transform: scale(0.97);
}

/* Click ripple feedback */
.ripple-hint {
  position: fixed;
  pointer-events: none;
  z-index: 4;
  width: 60px;
  height: 60px;
  margin-left: -30px;
  margin-top: -30px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.55);
  transform: scale(0.2);
  opacity: 0;
}

.ripple-hint.ping {
  animation: ripple-ping 0.9s cubic-bezier(0.2, 0.6, 0.3, 1) forwards;
}

@keyframes ripple-ping {
  0% {
    transform: scale(0.2);
    opacity: 0.9;
  }
  100% {
    transform: scale(3.4);
    opacity: 0;
  }
}