*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #141922;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Helvetica Neue", sans-serif;
  color: rgba(255, 255, 255, 0.94);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#gl-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  cursor: grab;
}

#gl-canvas.is-dragging {
  cursor: grabbing;
}

#hud-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

/* All liquid glass visuals (SDF rounded edge, refraction, RGB dispersion, specular)
   live inside WebGL liquidGlass.js — DOM containers stay completely transparent! */
.glass-surface {
  pointer-events: auto;
  background: transparent;
  border: none;
  text-shadow: 0 1px 12px rgba(8, 12, 22, 0.65), 0 0 2px rgba(8, 12, 22, 0.45);
}

/* --- Panel 0: Draggable Liquid Glass Specimen Lens --- */
.glass-lens {
  position: fixed;
  top: 26px;
  left: 26px;
  width: 286px;
  padding: 16px 18px 14px;
  border-radius: 28px;
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.16s ease;
}

.glass-lens.is-dragging {
  cursor: grabbing;
}

.lens-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.84);
}

.lens-grip {
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.92);
}

.lens-phase-row {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.lens-phase-row strong {
  font-family: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.1;
  color: #ffffff;
}

.lens-phase-row span {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.78);
}

.lens-metrics {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.86);
}

.lens-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.65);
}

.lens-footer {
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.78);
}

/* --- Subtle Interaction Hint Badge --- */
.hint-badge {
  position: fixed;
  top: 28px;
  right: 28px;
  padding: 7px 14px;
  border-radius: 99px;
  background: rgba(16, 22, 32, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.hint-badge.is-faded {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

/* --- Panel 1: Bottom Liquid Glass Clock & Controls Dock --- */
.glass-dock {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  width: min(710px, calc(100vw - 28px));
  padding: 12px 16px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.dock-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 7px 13px;
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.dock-btn:hover {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.42);
}

.dock-btn:active {
  transform: scale(0.95);
}

.dock-btn.is-active {
  background: rgba(255, 255, 255, 0.88);
  color: #18222e;
  border-color: #ffffff;
  text-shadow: none;
}

.dock-btn-round {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  flex-shrink: 0;
}

.clock-readout {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 60px;
  flex-shrink: 0;
}

#clock-time {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

#clock-phase {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.78);
  margin-top: 2px;
}

.timeline-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.28);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.9);
  transition: transform 0.14s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.18);
}

.timeline-presets {
  display: flex;
  justify-content: space-between;
  padding: 0 2px;
}

.preset-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.74);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
}

.preset-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
}

.dock-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

/* --- Panel 2: Expandable Liquid Glass Atlas & Shader Lab --- */
.glass-lab {
  position: fixed;
  top: 26px;
  right: 26px;
  width: 312px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  padding: 16px 16px 15px;
  border-radius: 26px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 0.26s ease, transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.glass-lab.is-hidden {
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;
}

.lab-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.lab-title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.lab-sub {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.74);
  margin-top: 2px;
}

.icon-btn {
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 11px;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.26);
}

.atlas-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.tab-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.20);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.84);
  font-size: 11px;
  padding: 5px 6px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.tab-btn.is-active {
  background: rgba(255, 255, 255, 0.88);
  color: #16202b;
  border-color: #ffffff;
  font-weight: 600;
  text-shadow: none;
}

.atlas-preview-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(12, 16, 24, 0.56);
  display: flex;
  flex-direction: column;
  align-items: center;
}

#atlas-preview {
  width: 100%;
  max-height: 215px;
  object-fit: contain;
  display: block;
}

.atlas-caption {
  width: 100%;
  padding: 5px 8px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 9.5px;
  color: rgba(255, 255, 255, 0.80);
  background: rgba(10, 14, 22, 0.45);
  text-align: center;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.88);
}

.slider-label em {
  font-style: normal;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: rgba(255, 255, 255, 0.76);
}

@media (max-width: 680px) {
  .glass-lens {
    top: 14px;
    left: 14px;
    width: 224px;
    padding: 12px 14px;
    border-radius: 22px;
  }
  .hint-badge {
    display: none;
  }
  .glass-dock {
    bottom: 14px;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 24px;
  }
  .clock-readout {
    min-width: 50px;
  }
  .glass-lab {
    top: 14px;
    right: 14px;
    width: calc(100vw - 28px);
  }
}
