/* Rave Mandala widget — brand-themed, theme-aware.
   Layout only lives here; canvas colors are read from the brand tokens in JS. */

.hd-mandala-figure {
  margin: 1.75rem 0;
}

.hd-mandala-widget {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.25rem;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-alt);
  padding: 1.1rem;
  font-family: "DM Sans", system-ui, sans-serif;
}

/* --- Controls panel ----------------------------------------------------- */
.hd-mandala-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hd-mandala-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.hd-mandala-group label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-mid);
}

.hd-mandala-value {
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.hd-mandala-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
}

.hd-mandala-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.hd-mandala-input::placeholder {
  color: var(--text-soft);
}

/* Range sliders */
.hd-mandala-controls input[type="range"] {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--border);
  height: 5px;
  border-radius: 3px;
  cursor: pointer;
  outline: none;
}

.hd-mandala-controls input[type="range"]:focus-visible {
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.hd-mandala-controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border: 2px solid var(--surface);
  border-radius: 50%;
  cursor: pointer;
}

.hd-mandala-controls input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--accent);
  border: 2px solid var(--surface);
  border-radius: 50%;
  cursor: pointer;
}

.hd-mandala-result {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--accent);
  min-height: 1.2em;
}

/* --- Stage / canvas ----------------------------------------------------- */
.hd-mandala-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: 100%;
}

.hd-mandala-canvas {
  display: block;
  max-width: 100%;
}

.hd-mandala-expand,
.hd-mandala-close {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-mid);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.hd-mandala-expand:hover,
.hd-mandala-close:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* --- Fullscreen overlay ------------------------------------------------- */
.hd-mandala-widget.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  grid-template-columns: 300px 1fr;
  border: none;
  border-radius: 0;
  background: var(--bg);
  padding: 1.5rem;
  overflow: auto;
}

.hd-mandala-widget.is-fullscreen .hd-mandala-stage {
  height: 100%;
}

.hd-mandala-close {
  top: 1rem;
  right: 1rem;
}

/* Brand lockup: hidden in the preview, pinned bottom-right in fullscreen. */
.hd-mandala-logo {
  display: none;
}

.hd-mandala-widget.is-fullscreen .hd-mandala-logo {
  display: block;
  position: absolute;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 2;
  opacity: 0.9;
  pointer-events: none;
}

body.hd-mandala-noscroll {
  overflow: hidden;
}

/* --- Responsive: stack on narrow screens -------------------------------- */
@media (max-width: 640px) {
  .hd-mandala-widget,
  .hd-mandala-widget.is-fullscreen {
    grid-template-columns: 1fr;
  }
}
