.ornament-controls {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 80;
  font-family: var(--font-text);
  color: #1c3027;
  color-scheme: light;
  font-size: 16px;
  line-height: 1.4;
}
.ornament-controls * {
  box-sizing: border-box;
}
.ornament-controls summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid #a78d64;
  background: #eee1d0;
  box-shadow: 0 4px 22px #1c30271f;
  cursor: pointer;
  font-size: 15px;
}
.ornament-controls summary::-webkit-details-marker {
  display: none;
}
.ornament-controls summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-left: 1px solid currentColor;
  border-top: 1px solid currentColor;
  transform: rotate(45deg) translateY(2px);
}
.ornament-controls details[open] summary::after {
  transform: rotate(225deg) translateY(2px);
}
.ornament-panel {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  width: min(350px, calc(100vw - 36px));
  max-height: calc(100dvh - 100px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  border: 1px solid #a78d64;
  background: #eee1d0;
  box-shadow: 0 12px 40px #10241d2e;
  scrollbar-color: #747a6e #eee1d0;
}
.ornament-panel h2 {
  font-size: 21px;
  line-height: 1.2;
  margin: 0 0 20px;
  color: inherit;
}
.ornament-panel label {
  display: block;
  font-size: 14px;
  margin-bottom: 8px;
  color: inherit;
}
.ornament-select {
  position: relative;
}
.ornament-select::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  right: 16px;
  top: 17px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg);
  pointer-events: none;
}
.ornament-panel select {
  width: 100%;
  height: 46px;
  appearance: none;
  border-radius: 0;
  border: 1px solid #1c302757;
  background: transparent;
  color: inherit;
  padding: 8px 36px 8px 12px;
  font: inherit;
  font-size: 16px;
}
.ornament-step {
  display: flex;
  gap: 8px;
  margin: 10px 0 22px;
}
.ornament-step button {
  flex: 1;
  min-height: 44px;
  border: 1px solid #1c30273b;
  background: transparent;
  color: inherit;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.ornament-step button:hover {
  background: #1c30270d;
  border-color: #1c3027;
}
.ornament-range-label {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
}
.ornament-panel input[type="range"] {
  display: block;
  width: 100%;
  height: 36px;
  padding: 0;
  margin: 0;
  accent-color: #8e713f;
  background: transparent;
  border: none;
}
.ornament-panel .ornament-hint {
  margin: 4px 0 18px;
  font-size: 13px;
  line-height: 1.45;
  color: #526055;
}
.ornament-panel a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: inherit;
  font-size: 14px;
  text-underline-offset: 5px;
}
.ornament-controls :focus-visible {
  outline: 2px solid #1c3027;
  outline-offset: 4px;
}
@media (max-width: 600px) {
  .ornament-controls {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }
  .ornament-panel {
    width: min(350px, calc(100vw - 24px));
    padding: 18px;
    max-height: calc(100dvh - 88px);
  }
  .ornament-controls summary {
    min-height: 46px;
    font-size: 14px;
  }
}
@media print {
  .ornament-controls {
    display: none;
  }
}
.ornament-palette {
  margin-block: 18px;
}
.ornament-palette fieldset {
  padding: 0;
  border: 0;
  margin: 0 0 16px;
  min-width: 0;
}
.ornament-palette legend {
  font-size: 14px;
  margin-bottom: 8px;
}
.ornament-colors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.ornament-colors button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 66px;
  padding: 8px 3px;
  color: #1c3027;
  background: transparent;
  border: 1px solid #1c302733;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.ornament-colors button span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid #1c302744;
}
.ornament-colors button[aria-pressed="true"] {
  border-color: #1c3027;
  box-shadow: inset 0 0 0 1px #1c3027;
  background: #1c302709;
}
