:root {
  color: #edf4ff;
  background: #010208;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  --panel-bg: rgba(4, 8, 18, 0.58);
  --panel-border: rgba(142, 179, 230, 0.18);
  --cyan: #82dfff;
  --gold: #dcb871;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background:
    radial-gradient(circle at 52% 42%, rgba(38, 58, 112, 0.12), transparent 30%),
    radial-gradient(circle at 20% 76%, rgba(34, 94, 106, 0.08), transparent 24%),
    #010208;
}

body::after {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 2;
  background:
    radial-gradient(circle at center, transparent 42%, rgba(0, 0, 0, 0.42) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 46%, rgba(0, 0, 0, 0.12));
  mix-blend-mode: soft-light;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

canvas:active {
  cursor: grabbing;
}

.hud {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 4;
}

.panel {
  pointer-events: auto;
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  width: min(326px, calc(100vw - 32px));
  padding: 15px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(12, 18, 34, 0.74), var(--panel-bg)),
    radial-gradient(circle at 0 0, rgba(130, 223, 255, 0.1), transparent 36%);
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.44), 0 0 42px rgba(70, 140, 200, 0.08);
  backdrop-filter: blur(20px) saturate(1.2);
}

.panel__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
  color: rgba(245, 249, 255, 0.92);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.panel__title::after {
  content: "";
  width: 62px;
  height: 1px;
  background: linear-gradient(90deg, rgba(130, 223, 255, 0.8), transparent);
}

.control {
  display: grid;
  gap: 7px;
  margin-top: 11px;
}

.control label,
.toggle span {
  color: rgba(222, 235, 255, 0.72);
  font-size: 12px;
}

.control__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.value {
  color: rgba(255, 255, 255, 0.92);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

input[type="range"] {
  width: 100%;
  height: 3px;
  accent-color: var(--cyan);
}

input[type="color"] {
  width: 42px;
  height: 26px;
  padding: 2px;
  border: 1px solid rgba(180, 214, 255, 0.22);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
}

select {
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(160, 190, 255, 0.2);
  border-radius: 6px;
  color: #f4f7ff;
  background: rgba(4, 8, 19, 0.9);
  outline: none;
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 13px;
}

.switch {
  position: relative;
  width: 44px;
  height: 23px;
}

.switch input {
  opacity: 0;
}

.switch i {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.2s ease;
}

.switch i::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #f7fbff;
  box-shadow: 0 0 12px rgba(130, 223, 255, 0.38);
  transition: transform 0.2s ease;
}

.switch input:checked + i {
  background: linear-gradient(90deg, #45799a, #b99a5c);
}

.switch input:checked + i::before {
  transform: translateX(21px);
}

.shape-badge {
  position: absolute;
  left: max(20px, env(safe-area-inset-left));
  bottom: max(20px, env(safe-area-inset-bottom));
  min-width: 160px;
  padding: 10px 13px;
  border-left: 1px solid rgba(220, 184, 113, 0.76);
  background: linear-gradient(90deg, rgba(4, 8, 18, 0.62), rgba(4, 8, 18, 0.04));
  color: rgba(224, 236, 255, 0.62);
  font-size: 11px;
  letter-spacing: 0.06em;
  backdrop-filter: blur(12px);
}

.shape-badge strong {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.94);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
}

.loading {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at center, rgba(22, 34, 68, 0.88), #010208 58%);
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

.loading.is-hidden {
  visibility: hidden;
  opacity: 0;
}

.loader {
  width: 74px;
  height: 74px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(130, 223, 255, 0.86);
  border-right-color: rgba(220, 184, 113, 0.7);
  border-radius: 50%;
  animation: spin 1.25s linear infinite;
  box-shadow: 0 0 44px rgba(80, 160, 220, 0.22);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 700px) {
  .panel {
    width: min(292px, calc(100vw - 24px));
    padding: 12px;
  }

  .panel__title {
    margin-bottom: 8px;
  }

  .control {
    margin-top: 9px;
  }

  .shape-badge {
    min-width: 140px;
    padding: 10px 12px;
  }

  .shape-badge strong {
    font-size: 16px;
  }
}
