.custom-theme-control {
  position: relative;
  z-index: 220;
  margin-left: -1px;
}

.custom-theme-trigger {
  width: var(--footer-theme-control-height-current, var(--footer-theme-control-height, 2.85rem));
  height: var(--footer-theme-control-height-current, var(--footer-theme-control-height, 2.85rem));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 1px solid var(--sec-bdr);
  border-radius: 0 var(--rad) var(--rad) 0;
  background-color: var(--surface-control-bg);
  color: rgba(255, 255, 255, 0.92);
  transition:
    background-color var(--smooth-duration) var(--smooth-ease),
    border-color var(--smooth-duration) var(--smooth-ease),
    color var(--smooth-duration) var(--smooth-ease),
    box-shadow var(--smooth-duration) var(--smooth-ease);
}

.custom-theme-trigger:hover {
  background-color: var(--surface-control-bg-hover);
  border-color: var(--prim);
}

.custom-theme-trigger.is-active {
  border-color: var(--prim);
  box-shadow: var(--prim-glow-shadow);
}

.custom-theme-trigger i {
  font-size: 0.95rem;
}

.custom-theme-modal {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: grid;
  place-items: center;
  padding: 0.8rem;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms var(--smooth-ease);
}

.custom-theme-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.custom-theme-modal.is-closing {
  pointer-events: none;
}

.custom-theme-modal[hidden] {
  display: none;
}

.custom-theme-popover {
  width: min(31.5rem, calc(100vw - 1.6rem));
  display: block;
  border: 1px solid var(--crd-bdr);
  background-color: var(--crd-bg);
  backdrop-filter: blur(var(--promo-card-blur));
  box-shadow: var(--shd);
  transform: translateY(16px) scale(0.97);
  opacity: 0;
  transition:
    transform 240ms var(--smooth-ease),
    opacity 240ms var(--smooth-ease),
    box-shadow 240ms var(--smooth-ease);
}

.custom-theme-modal.is-open .custom-theme-popover {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.custom-theme-gradient {
  position: absolute;
  inset: 0;
  background: var(--promo-grid-fill);
  pointer-events: none;
}

.custom-theme-glow {
  position: absolute;
  right: calc(var(--promo-glow-offset) * 0.65);
  bottom: calc(var(--promo-glow-offset) * 0.65);
  width: calc(var(--promo-glow-size) * 0.72);
  height: calc(var(--promo-glow-size) * 0.72);
  border-radius: 50%;
  background: var(--promo-glow-fill);
  filter: blur(calc(var(--promo-glow-blur) * 0.82));
  pointer-events: none;
}

.custom-theme-content {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.8rem;
  padding: 1.2rem 1.25rem;
}

.custom-theme-content-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.custom-theme-accent-bar {
  width: 0.42rem;
  height: 1.8rem;
  margin-top: 0.12rem;
  flex: 0 0 auto;
  background: var(--promo-accent-fill);
}

.custom-theme-main {
  flex: 1 1 auto;
  min-width: 0;
}

.custom-theme-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
}

.custom-theme-heading {
  min-width: 0;
}

.custom-theme-eyebrow {
  margin: 0 0 0.22rem;
  color: var(--promo-title-accent);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.custom-theme-title {
  margin: 0;
  color: var(--fg);
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.04;
}

.custom-theme-description {
  margin: 0.28rem 0 0;
  color: var(--promo-description);
  font-size: 0.8rem;
  line-height: 1.36;
}

.custom-theme-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(203, 213, 225, 0.86);
  transition:
    color var(--smooth-duration) var(--smooth-ease),
    transform var(--smooth-duration) var(--smooth-ease);
}

.custom-theme-close:hover {
  color: rgba(255, 255, 255, 0.96);
}

.custom-theme-close:active {
  transform: scale(0.96);
}

.custom-theme-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8.65rem;
  gap: 0.7rem;
  align-items: start;
}

.custom-theme-field,
.custom-theme-icon-panel {
  display: grid;
  gap: 0.38rem;
}

.custom-theme-field-label {
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.custom-theme-name-input {
  width: 100%;
  height: 2.55rem;
  padding: 0 0.82rem;
  border: 1px solid var(--sec-bdr);
  border-radius: var(--rad);
  background: rgba(0, 0, 0, 0.48);
  color: var(--fg);
  font: 600 0.84rem/1 "Open Sans", sans-serif;
  transition:
    border-color var(--smooth-duration) var(--smooth-ease),
    background-color var(--smooth-duration) var(--smooth-ease),
    box-shadow var(--smooth-duration) var(--smooth-ease);
}

.custom-theme-name-input:focus {
  outline: none;
  border-color: var(--prim);
  background: rgba(0, 0, 0, 0.62);
  box-shadow: 0 0 0 1px rgba(var(--prim-rgb), 0.22);
}

.custom-theme-name-input::placeholder {
  color: rgba(148, 163, 184, 0.72);
}

.custom-theme-icon-button {
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.55rem;
  border: 1px solid var(--sec-bdr);
  border-radius: var(--rad);
  background: rgba(0, 0, 0, 0.44);
  color: var(--fg);
  transition:
    border-color var(--smooth-duration) var(--smooth-ease),
    background-color var(--smooth-duration) var(--smooth-ease),
    box-shadow var(--smooth-duration) var(--smooth-ease),
    transform var(--smooth-duration) var(--smooth-ease);
}

.custom-theme-icon-button:hover {
  border-color: var(--sec-hvr-bdr);
  background: rgba(0, 0, 0, 0.6);
}

.custom-theme-icon-button:active {
  transform: scale(0.98);
}

.custom-theme-icon-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: calc(var(--rad) + 0.15rem);
  background:
    linear-gradient(135deg, rgba(var(--prim-rgb), 0.14), rgba(0, 0, 0, 0.18)),
    rgba(0, 0, 0, 0.55);
}

.custom-theme-icon-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.custom-theme-icon-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.5rem;
}

.custom-theme-icon-meta {
  display: grid;
  gap: 0.08rem;
  text-align: center;
}

.custom-theme-icon-title {
  color: var(--fg);
  font-size: 0.74rem;
  font-weight: 700;
}

.custom-theme-icon-subtitle {
  color: var(--promo-description);
  font-size: 0.64rem;
  line-height: 1.2;
}

.custom-theme-error {
  min-height: 0.8rem;
  margin: -0.04rem 0 0;
  color: #fca5a5;
  font-size: 0.7rem;
}

.custom-theme-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.custom-theme-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 6rem;
  min-height: 2.35rem;
  padding: 0.62rem 1rem;
  border-radius: var(--rad);
  font-size: 0.78rem;
  font-weight: 700;
  overflow: hidden;
  transition:
    background var(--smooth-duration) var(--smooth-ease),
    color var(--smooth-duration) var(--smooth-ease),
    border-color var(--smooth-duration) var(--smooth-ease),
    box-shadow var(--smooth-duration) var(--smooth-ease),
    transform var(--smooth-duration) var(--smooth-ease);
}

.custom-theme-btn::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: var(--promo-button-shine);
  opacity: 0;
  transform: scale(0.5);
  transition: transform 0.5s ease, opacity 0.5s ease;
}

.custom-theme-btn:hover::after {
  opacity: 1;
  transform: scale(1);
}

.custom-theme-btn:active {
  transform: scale(0.98);
}

.custom-theme-btn:disabled {
  opacity: 0.68;
  cursor: wait;
}

.custom-theme-btn.is-primary {
  border: 1px solid var(--sec-hvr-bdr);
  background: var(--promo-button-fill);
  color: var(--promo-button-text);
  box-shadow: var(--promo-button-shadow);
}

.custom-theme-btn.is-primary:hover {
  box-shadow: var(--promo-button-hover-shadow);
}

.custom-theme-btn.is-secondary {
  border: 1px solid var(--sec-bdr);
  background: transparent;
  color: var(--promo-muted-button-text);
  box-shadow: none;
}

.custom-theme-btn-icon,
.custom-theme-btn-label {
  position: relative;
  z-index: 1;
}

.custom-theme-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  margin-right: 0.34rem;
  border-radius: var(--promo-button-icon-radius);
  font-size: 0.66rem;
  line-height: 1;
}

.custom-theme-btn.is-primary .custom-theme-btn-icon {
  background-color: var(--promo-button-icon-fill);
  color: var(--promo-button-icon-color);
}

.custom-theme-btn.is-secondary .custom-theme-btn-icon {
  background-color: transparent;
  color: var(--promo-muted-button-icon);
}

@media (max-width: 768px) {
  .custom-theme-modal {
    padding: 0.6rem;
  }

  .custom-theme-popover {
    width: min(100vw - 1.2rem, 29rem);
  }

  .custom-theme-content {
    gap: 0.72rem;
    padding: 1rem;
  }

  .custom-theme-content-row {
    gap: 0.85rem;
  }

  .custom-theme-title {
    font-size: 1.14rem;
  }

  .custom-theme-description {
    font-size: 0.76rem;
  }

  .custom-theme-meta {
    grid-template-columns: 1fr;
  }

  .custom-theme-icon-panel {
    justify-items: start;
  }

  .custom-theme-icon-button {
    width: 100%;
    grid-template-columns: 92px minmax(0, 1fr);
    justify-items: start;
    align-items: center;
    text-align: left;
  }

  .custom-theme-icon-meta {
    text-align: left;
  }
}

@media (max-width: 520px) {
  .custom-theme-content-row {
    flex-direction: column;
    gap: 0.68rem;
  }

  .custom-theme-accent-bar {
    width: 1.8rem;
    height: 0.42rem;
    margin-top: 0;
  }

  .custom-theme-head {
    gap: 0.45rem;
  }

  .custom-theme-icon-button {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .custom-theme-icon-meta {
    text-align: center;
  }

  .custom-theme-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.38rem;
  }

  .custom-theme-btn {
    width: 100%;
    min-width: 0;
    min-height: 2.2rem;
    padding-left: 0.66rem;
    padding-right: 0.66rem;
  }

  .custom-theme-btn-icon {
    margin-right: 0.26rem;
  }
}
