.brand-style-panel,
.brand-style-panel * {
  box-sizing: border-box;
  min-width: 0;
}

.brand-style-panel {
  width: 100%;
  max-width: 100%;
  margin: 24px 0 0;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 20px;
  background: rgba(25, 21, 45, 0.82);
  color: #f8f7ff;
}

.brand-style-panel__header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.brand-style-panel .brand-style-panel__title {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.brand-style-panel__badge {
  padding: 4px 7px;
  border: 1px solid rgba(165, 134, 255, 0.25);
  border-radius: 999px;
  color: #c9b5ff;
  font-size: 10px;
  line-height: 1.2;
}

.brand-style-panel__hint {
  margin: 7px 0 14px;
  color: #b6b0c7;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.brand-style-panel__groups {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.brand-style-panel__group {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  background: rgba(8, 6, 17, 0.22);
  transition: border-color 140ms ease;
}

.brand-style-panel__group.is-enabled {
  border-color: rgba(164, 126, 255, 0.6);
}

.brand-style-panel__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  margin-bottom: 10px;
  color: #eee8ff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
}

.brand-style-panel__toggle input {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #9b75ff;
  cursor: pointer;
}

.brand-style-panel__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.brand-style-panel__fields--colors {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.brand-style-panel__label {
  display: block;
  margin-bottom: 7px;
  color: #c1bbd1;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
}

.brand-style-panel__color-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.brand-style-panel__color {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.brand-style-panel__color::-webkit-color-swatch-wrapper {
  padding: 0;
}

.brand-style-panel__color::-webkit-color-swatch {
  border: 0;
  border-radius: 6px;
}

.brand-style-panel__color::-moz-color-swatch {
  border: 0;
  border-radius: 6px;
}

.brand-style-panel__hex {
  color: #b6b0c7;
  font-size: 10px;
  line-height: 1.4;
}

/* Each option is the actual preview; there is no separate font-name menu. */
.brand-style-panel__font-options {
  position: relative;
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 3px 3px 10px;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 3px;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
  scrollbar-width: thin;
  scrollbar-color: #aaa transparent;
}
.brand-style-panel__font-card {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  width: max-content;
  min-width: 84px;
  align-items: center;
  min-height: 48px;
  padding: 7px 12px;
  border: 1px solid #777;
  border-radius: 12px;
  background: #ffffff0a;
  color: inherit;
  scroll-snap-align: start;
  cursor: pointer;
}
.brand-style-panel__font-card.is-selected { border: 2px solid currentColor; padding: 6px 22px 6px 11px; background: #ffffff12; }
.brand-style-panel__font-card.is-selected::after { position: absolute; top: 5px; right: 9px; content: "✓"; font: 12px/1.2 system-ui; }
.brand-style-panel__font-radio { position: absolute; left: 12px; top: 12px; width: 1px; height: 1px; opacity: 0; margin: 0; }
/* Previews at half their former size; body text keeps a legible 12 px. */
.brand-style-panel__font-sample { display: block; font-size: 14px; font-weight: 400; line-height: 1.25; white-space: nowrap; overflow-wrap: normal; }
.brand-style-panel__font-card--body .brand-style-panel__font-sample { font-size: 12px; line-height: 1.35; }
.brand-style-panel__label { margin-top: 0; }
.brand-style-panel input:focus-visible,
.brand-style-panel__font-card:focus-within,
.canvas-brand-style:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.canvas-brand-style {
  position: absolute;
  z-index: 30;
  top: 200px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  min-width: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(15, 12, 25, 0.7);
  color: #fff;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.18);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.canvas-brand-style.is-active,
.canvas-brand-style[aria-pressed="true"] {
  border-color: #c9b5ff;
  background: rgba(113, 67, 235, 0.92);
}

.canvas-brand-style:disabled {
  opacity: 0.45;
  cursor: default;
}

.canvas-brand-style svg {
  width: 23px;
  height: 23px;
  pointer-events: none;
}

.canvas-brand-style > span { font-size: 18px; font-weight: 800; line-height: 1; align-self: end; }
.canvas-brand-style > small { font-size: 9px; font-weight: 700; line-height: 1.2; align-self: start; }

.canvas-brand-style[hidden],
html.is-text-editing .canvas-brand-style {
  display: none;
}

@media (max-width: 720px) {
  .brand-style-panel__groups {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 380px) {
  .brand-style-panel {
    padding: 12px;
  }

  .brand-style-panel__group {
    padding: 10px;
  }

  .brand-style-panel__fields {
    gap: 8px;
  }
}
