* {
  box-sizing: border-box;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  color: var(--dd-text);
  font-family: "Nunito", system-ui, sans-serif;
  background: var(--dd-bg-gradient);
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: 0;
  width: 36vw;
  height: 36vw;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  animation: dd-float 11s infinite alternate ease-in-out;
}

body::before {
  top: -12%;
  left: -10%;
  background: var(--dd-orb-a);
}

body::after {
  right: -12%;
  bottom: -18%;
  background: var(--dd-orb-b);
  animation-delay: -5s;
}

@keyframes dd-float {
  to {
    transform: translate(24px, 40px);
  }
}

a {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 3px;
}

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 252px 1fr;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  transition: grid-template-columns 0.22s ease;
}

.app.sidebar-collapsed {
  grid-template-columns: 0 1fr;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--dd-border);
  background: var(--dd-panel);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--dd-shadow);
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.app.sidebar-collapsed .sidebar {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.sidebar-inner {
  flex: 1;
  min-height: 0;
  min-width: 240px;
  padding: 16px 14px 14px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-spacer {
  flex: 1 1 auto;
  min-height: 12px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.brand-logo-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.brand-logo-wrap::before {
  content: "";
  position: absolute;
  inset: -3px;
  z-index: -1;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-purple), var(--brand-blue), var(--brand-accent));
  animation: dd-spin 5s linear infinite;
}

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

.brand-logo {
  width: 100%;
  height: 100%;
  border: 3px solid var(--dd-bg);
  border-radius: 50%;
  object-fit: cover;
}

.brand-text strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.brand-text span {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dd-muted);
}

.sidebar-note,
.hint {
  color: var(--dd-muted);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.5;
}

.sidebar-section--redeem {
  margin-bottom: 10px;
  padding-bottom: 8px;
}

.sidebar-section--redeem + .sidebar-section {
  margin-top: 14px;
}

.sidebar-section {
  margin-top: 26px;
  padding: 12px 12px 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.sidebar-section:hover {
  border-color: var(--dd-border);
  background: var(--dd-panel-soft);
}

.sidebar-section h2 {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dd-muted);
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.redeem-form-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.redeem-form-stack input,
.redeem-form-stack #btn-redeem {
  width: 100%;
  box-sizing: border-box;
}

.sidebar-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.sidebar-heading-row h2 {
  margin: 0;
}

.sidebar-tip {
  flex-shrink: 0;
}

.sidebar-tip-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--dd-border);
  border-radius: 50%;
  background: var(--dd-input-bg);
  color: var(--dd-muted);
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.sidebar-tip-trigger::-webkit-details-marker {
  display: none;
}

.sidebar-tip-trigger:hover,
.sidebar-tip[open] .sidebar-tip-trigger {
  color: var(--brand-accent);
  border-color: rgba(129, 106, 191, 0.55);
  background: rgba(129, 106, 191, 0.12);
}

.sidebar-tip-trigger .ph {
  font-size: 0.95rem;
}

.sidebar-tip-body {
  margin: 8px 0 0;
  padding: 8px 10px;
  font-size: 0.78rem;
  line-height: 1.45;
  border-radius: 10px;
  background: var(--dd-panel-soft);
  border: 1px solid var(--dd-border);
}

.sidebar-manage-link {
  margin-top: 10px;
}

input,
select,
textarea,
button {
  font: inherit;
}

input[type="text"],
input[type="number"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--dd-border);
  border-radius: 12px;
  background: var(--dd-input-bg);
  color: var(--dd-text);
}

select {
  color-scheme: dark;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23b1a3f8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

html[data-theme="light"] select {
  color-scheme: light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23816ABF' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
}

select option,
select optgroup {
  background: var(--dd-panel-solid);
  color: var(--dd-text);
}

button {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 800;
  color: #fff;
  background: var(--dd-btn-primary);
  box-shadow: var(--dd-btn-primary-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease, border-color 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

button:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  filter: none !important;
}

button.secondary,
.icon-btn {
  background: var(--dd-btn-secondary-bg);
  color: var(--dd-text-soft);
  border: 1px solid var(--dd-border);
  box-shadow: none;
}

button.primary {
  background: var(--dd-btn-primary);
  box-shadow: var(--dd-btn-primary-shadow);
}

.icon-btn {
  min-width: 44px;
  padding: 10px 12px;
  font-size: 1.1rem;
  line-height: 1;
}

.main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 20px 28px 24px;
}

.view {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--dd-scrollbar-thumb) var(--dd-scrollbar-track);
}

.view--editor {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 22px;
  padding: 12px 16px;
  border: 1px solid var(--dd-border);
  border-radius: 22px;
  background: var(--dd-panel);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--dd-shadow);
}

.topbar h1 {
  flex: 1;
  margin: 0;
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  background: var(--dd-title-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.save-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--dd-muted);
  flex-shrink: 0;
  margin-left: -4px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.save-dot.is-unsaved {
  background: #ffb347;
  box-shadow: 0 0 0 2px rgba(255, 179, 71, 0.25), 0 0 12px rgba(255, 179, 71, 0.45);
  animation: save-dot-pulse 1.4s ease-in-out infinite;
}

.save-dot.is-saving {
  background: #6eb5ff;
  animation: save-dot-pulse 0.8s ease-in-out infinite;
}

.save-dot.is-saved {
  background: #9fff7a;
  box-shadow: 0 0 0 2px rgba(159, 255, 122, 0.2);
}

.save-dot.is-error {
  background: #ff6b6b;
}

@keyframes save-dot-pulse {
  50% {
    opacity: 0.65;
    transform: scale(0.92);
  }
}

.save-status {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--dd-muted);
}

.save-status.warn {
  color: #ffb347;
}

.save-status.ok {
  color: #9fff7a;
}

html[data-theme="light"] .save-status.ok {
  color: #2d8a3e;
}

.btn-danger {
  color: #ff8a8a !important;
  border-color: rgba(255, 100, 100, 0.35) !important;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-actions .icon-text-btn.primary {
  min-height: 36px;
}

.hidden {
  display: none !important;
}

.sidebar-code-hint {
  margin-top: 10px;
  line-height: 1.45;
}

.sidebar-code-hint strong {
  display: block;
  color: var(--brand-purple, #816abf);
  font-weight: 900;
}

.sidebar-code-hint span {
  display: block;
  margin-top: 2px;
  font-size: 0.82rem;
}

.sidebar-support-heading {
  margin: 0 0 10px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dd-muted);
}

.sidebar-support-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.support-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
  color: #fff !important;
  border: 2px solid transparent;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    filter 0.15s ease;
}

.support-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

.support-btn i {
  font-size: 1.15rem;
}

.support-btn--etsy {
  background: linear-gradient(135deg, #f1641e, #e85d04);
  border-color: rgba(255, 255, 255, 0.12);
}

.support-btn--discord {
  background: linear-gradient(135deg, #5865f2, #4752c4);
  border-color: rgba(255, 255, 255, 0.12);
}

.support-btn--kofi {
  background: linear-gradient(135deg, #585299, #463d7a);
  border-color: rgba(255, 255, 255, 0.12);
}

.library-toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 22px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid var(--dd-border);
  background: var(--dd-panel);
  box-shadow: var(--dd-shadow);
}

.library-toolbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.library-toolbar-logo {
  width: 40px;
  height: 40px;
}

.library-toolbar-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.library-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 200px;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--dd-border);
  background: var(--dd-input-bg);
}

.library-sort-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  width: auto;
  max-width: min(100%, 15rem);
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--dd-border);
  background: var(--dd-input-bg);
}

.library-search-wrap i,
.library-sort-wrap i {
  color: var(--dd-muted);
  font-size: 1.05rem;
  flex-shrink: 0;
}

.library-search-input,
.library-sort-select {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--dd-text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  outline: none;
}

select.dd-custom-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.dd-custom-select {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
}

.library-sort-wrap .dd-custom-select {
  flex: 1 1 auto;
  min-width: 5.5rem;
}

.dd-custom-select-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  max-width: 100%;
  border: none;
  background: transparent;
  color: var(--dd-text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  padding: 0;
  line-height: 1.2;
  white-space: nowrap;
}

.dd-custom-select-btn::after {
  content: "";
  display: inline-block;
  flex-shrink: 0;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--dd-muted);
  border-bottom: 2px solid var(--dd-muted);
  transform: translateY(-1px) rotate(45deg);
  transition: transform 0.15s ease;
}

.dd-custom-select.is-open .dd-custom-select-btn::after {
  transform: translateY(1px) rotate(-135deg);
}

.dd-custom-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: min(100vw - 24px, 20rem);
  z-index: 90;
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: 14px;
  border: 1px solid var(--dd-border);
  background: var(--dd-panel-solid);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
}

html[data-theme="light"] .dd-custom-select-menu {
  box-shadow: 0 14px 32px rgba(24, 42, 86, 0.14);
}

.dd-custom-select-menu.hidden {
  display: none;
}

.dd-custom-select-menu li {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--dd-text);
  cursor: pointer;
  white-space: nowrap;
}

.dd-custom-select-menu li:hover {
  background: var(--dd-chip-bg);
}

.dd-custom-select-menu li.is-selected {
  background: linear-gradient(135deg, rgba(129, 106, 191, 0.35), rgba(24, 42, 86, 0.35));
  color: var(--dd-text);
}

.library-sort-wrap:has(.dd-custom-select.is-open) {
  border-color: rgba(129, 106, 191, 0.55);
  box-shadow: 0 0 0 1px rgba(129, 106, 191, 0.25);
}

.field .dd-custom-select,
.card-body .dd-custom-select {
  width: 100%;
}

.field .dd-custom-select-btn,
.card-body .dd-custom-select-btn,
.field-drawer-controls-row .dd-custom-select-btn {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 32px 9px 12px;
  background: var(--dd-input-bg);
  border: 1px solid var(--dd-border);
  border-radius: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field-drawer-controls-row .dd-custom-select {
  grid-column: 1 / -1;
  width: 100%;
}

.library-collection-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.collection-tab {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--dd-border);
  background: var(--dd-chip-bg);
  color: var(--dd-text);
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.collection-tab:hover {
  border-color: rgba(129, 106, 191, 0.5);
}

.collection-tab.is-active {
  background: linear-gradient(135deg, var(--brand-purple), var(--brand-blue));
  border-color: transparent;
  color: #fff;
}

.card-collection-badge {
  display: inline-block;
  margin-bottom: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--dd-chip-bg);
  color: var(--dd-muted);
}

.studio-dialog {
  position: fixed;
  inset: 0;
  z-index: 6000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 5, 12, 0.72);
  backdrop-filter: blur(8px);
}

.studio-dialog.hidden {
  display: none !important;
}

.studio-dialog-panel {
  width: min(100%, 400px);
  padding: 22px 24px;
  border-radius: 18px;
  border: 1px solid var(--dd-border);
  background: var(--dd-panel-solid);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.45);
}

.studio-dialog-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 900;
}

.studio-dialog-hint {
  margin: 0 0 14px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--dd-muted);
  line-height: 1.45;
}

.studio-dialog-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dd-muted);
}

.studio-dialog-input {
  width: 100%;
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--dd-border);
  background: var(--dd-input-bg);
  color: var(--dd-text);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
}

.studio-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.card {
  background: var(--dd-panel);
  border-radius: 22px;
  border: 1px solid var(--dd-border);
  box-shadow: var(--dd-shadow);
  overflow: hidden;
  backdrop-filter: blur(20px);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(129, 106, 191, 0.46);
  box-shadow: 0 16px 34px rgba(10, 8, 24, 0.42);
}

.card-preview {
  height: 140px;
  background-color: var(--dd-canvas-bg);
  background-image: radial-gradient(circle at 12px 12px, var(--dd-preview-dots) 1px, transparent 1px);
  background-size: 18px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  overflow: hidden;
}

.card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-preview--empty {
  font-size: 2.2rem;
}

.btn-delete {
  width: 100%;
  margin-top: 10px;
  font-size: 0.78rem !important;
  opacity: 0.85;
}

.card-body {
  padding: 16px 18px 18px;
}

.card-title {
  margin: 0 0 12px;
  font-weight: 900;
  font-size: 1.05rem;
}

.card-actions {
  display: flex;
  gap: 8px;
}

.card-actions button {
  flex: 1;
  font-size: 0.82rem;
}

.card select {
  margin-top: 8px;
}

.editor-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--dd-border);
  border-radius: 22px;
  background: var(--dd-workspace-bg);
  overflow: hidden;
}

.view--editor .editor-stage {
  border-radius: 16px;
}

.editor-top--minimal {
  min-height: 0;
  padding: 6px 14px 4px;
  border: none;
  background: transparent;
  justify-content: flex-end;
}

.editor-top--minimal .canvas-scale-hint {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--dd-muted);
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(129, 106, 191, 0.1);
  border: 1px solid rgba(129, 106, 191, 0.2);
}

.editor-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--dd-border);
  background: var(--dd-panel);
  z-index: 20;
}

.canvas-area {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.editor-hint {
  margin: 0;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--dd-muted);
  border-bottom: 1px solid var(--dd-border);
  background: var(--dd-panel);
}

.field-drawer {
  position: absolute;
  top: 12px;
  left: 12px;
  bottom: auto;
  max-height: calc(100% - 24px);
  width: min(380px, calc(100% - 24px));
  min-width: 280px;
  min-height: 220px;
  z-index: 50;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-columns: 1fr;
  border: 1px solid var(--dd-border);
  border-radius: 16px;
  background: var(--dd-drawer-bg, var(--dd-panel-solid));
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.38);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-12px) scale(0.98);
  transition:
    opacity 0.24s ease,
    visibility 0.24s ease,
    transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
  overflow: hidden;
  isolation: isolate;
}

.field-drawer-resize-handle {
  position: absolute;
  right: 2px;
  bottom: 2px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 8px;
  color: var(--dd-muted);
  background: transparent;
  cursor: nwse-resize;
  box-shadow: none;
}

.field-drawer-resize-handle:hover {
  color: var(--dd-text);
  background: var(--dd-chip-bg);
}

.field-drawer-resize-handle .ph {
  font-size: 1rem;
  transform: rotate(90deg);
}

body.is-settings-resizing {
  user-select: none;
  cursor: nwse-resize;
}

.field-drawer:not(:has(.dev-fields-drawer-panel)) {
  grid-template-rows: auto auto minmax(0, 1fr);
}

html[data-theme="dark"] .field-drawer {
  --dd-drawer-bg: #0c0c14;
}

html[data-theme="light"] .field-drawer {
  --dd-drawer-bg: #ffffff;
}

.field-drawer-controls {
  grid-row: 2;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 14px 12px;
  border-bottom: 1px solid var(--dd-border);
  background: var(--dd-drawer-bg, var(--dd-panel-solid));
}

.field-group-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}

.field-group-filter-label {
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dd-muted);
}

.field-group-select {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 32px 9px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--dd-text);
  background: var(--dd-input-bg);
  border: 1px solid var(--dd-border);
  border-radius: 10px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--dd-muted) 50%),
    linear-gradient(135deg, var(--dd-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.field-group-select:focus {
  outline: 2px solid var(--brand-purple);
  outline-offset: 1px;
}

.field-drawer-body {
  grid-row: 3;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-anchor: none;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--dd-drawer-bg, var(--dd-panel-solid));
  position: relative;
  z-index: 1;
}

.field-drawer.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0) scale(1);
}

.field-drawer-header {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 8px 10px 6px;
  flex-shrink: 0;
  background: var(--dd-drawer-bg, var(--dd-panel-solid));
}

.field-drawer-header h2 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 900;
  flex: 1;
  min-width: 0;
}

.field-drawer-header .icon-btn {
  flex-shrink: 0;
}

.field-drawer-footer {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--dd-border);
}

.field-drawer-footer .primary {
  width: 100%;
}

.dev-fields-drawer-panel {
  grid-row: 4;
}

.fields-form {
  flex: none;
  overflow: visible;
  padding: 10px 12px 20px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.view--editor .editor-hint {
  display: none;
}

.fields-form:has(.field--gen) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  margin-bottom: 0;
  min-width: 0;
}

.field:not(.field--gen) {
  grid-column: 1 / -1;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--dd-text-soft);
}

.field .info {
  margin: 4px 0 0;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--dd-muted);
}

.field--section {
  margin: 14px 0 6px;
  padding: 0;
}

.field-section-heading {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-accent, #b1a3f8);
  background: var(--dd-chip-bg);
  border: 1px solid var(--dd-border);
}

.field--readonly .field-readonly-value {
  display: block;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--dd-muted);
  background: var(--dd-panel-soft);
  border: 1px solid var(--dd-border);
}

.field-url-in,
.field-font-in {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--dd-text);
  background: var(--dd-input-bg);
  border: 1px solid var(--dd-border);
  border-radius: 10px;
}

.field-image-preview {
  display: block;
  margin-top: 8px;
  max-width: 120px;
  max-height: 120px;
  border-radius: 8px;
  border: 1px solid var(--dd-border);
  object-fit: contain;
  background: rgba(0, 0, 0, 0.2);
}

.field-image-preview.hidden {
  display: none;
}

/* Toggle checkboxes (generations, options) */
.field--checkbox .field-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--dd-border);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.field--checkbox .field-toggle-row:hover {
  border-color: rgba(129, 106, 191, 0.55);
  background: rgba(129, 106, 191, 0.08);
}

.field--gen .field-toggle-row {
  padding: 8px 10px;
}

.field--checkbox > input[type="checkbox"] {
  position: fixed;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.field-toggle-track {
  flex-shrink: 0;
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.field-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
}

.field-toggle-row.is-checked .field-toggle-track {
  background: linear-gradient(135deg, var(--brand-purple), #5b4a9e);
  border-color: rgba(129, 106, 191, 0.85);
}

.field-toggle-row.is-checked .field-toggle-thumb {
  transform: translateX(20px);
}

.field-toggle-row:focus-visible {
  outline: 2px solid var(--brand-purple);
  outline-offset: 2px;
}

.field-toggle-label {
  flex: 1;
  min-width: 0;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--dd-text);
}

.field--gen .field-toggle-label {
  font-size: 0.8rem;
}

/* Modern colour field (replaces bare native color input) */
.field--color {
  position: relative;
}

.field--color .color-field-host {
  width: 100%;
}

.customer-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 12, 0.92);
  backdrop-filter: blur(12px);
}

.customer-gate.hidden {
  display: none;
}

.customer-gate-card {
  max-width: 500px;
  padding: 36px 32px 32px;
  text-align: center;
  border-radius: 24px;
  background: var(--dd-panel);
  border: 1px solid var(--dd-border);
  box-shadow:
    var(--dd-shadow),
    0 0 0 1px rgba(177, 163, 248, 0.12),
    0 24px 60px rgba(129, 106, 191, 0.18);
  position: relative;
  overflow: hidden;
}

.customer-gate-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(177, 163, 248, 0.45),
    rgba(119, 221, 255, 0.2),
    rgba(129, 106, 191, 0.35)
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.customer-gate-card .studio-brand-lockup--hero {
  margin-bottom: 4px;
}

.customer-gate-lead {
  margin: 8px 0 22px;
  font-size: 0.95rem;
}

.sidebar-footer-links {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-shop-btn {
  display: block;
  text-align: center;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--etsy-orange, #f1641e);
  color: #fff !important;
  font-weight: 800;
  text-decoration: none;
}

.footer-help-link {
  display: block;
  text-align: center;
  font-weight: 700;
  text-decoration: none;
  color: var(--dd-accent, #816abf);
}

.sidebar-logout,
#btn-customer-logout,
#btn-logout {
  width: 100%;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.sidebar-logout:hover,
#btn-customer-logout:hover,
#btn-logout:hover {
  color: #fff;
  background: #c93d4a;
  border-color: #b8323f;
  box-shadow: 0 4px 14px rgba(201, 61, 74, 0.35);
}

.sidebar-logout:hover {
  transform: none;
}

.emulate-empty {
  padding: 12px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--dd-muted);
  list-style: none;
}

.canvas-size {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--dd-muted);
}

.canvas-size input {
  width: 72px;
  padding: 6px 8px;
  font-size: 0.82rem;
}

.canvas-scale-hint {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--dd-muted);
}

.canvas-viewport {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  background-color: var(--dd-workspace-bg);
}

.canvas-scaler-slot {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
}

.canvas-scaler {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.canvas-stage .canvas-resolution-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 7;
  padding: 4px 8px;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--dd-text-soft);
  background: rgba(10, 10, 18, 0.78);
  border: 1px solid var(--dd-border);
  border-radius: 6px;
  pointer-events: none;
}

html[data-theme="light"] .canvas-stage .canvas-resolution-badge {
  background: rgba(255, 255, 255, 0.9);
}

.settings-layout-panel {
  padding: 12px 14px 10px;
  margin-bottom: 0;
  border-bottom: none;
}

.settings-layout-panel--compact {
  padding: 0;
}

.settings-section-title {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dd-muted);
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--dd-border);
}

.settings-section-title--inline {
  margin: 0;
  padding: 0;
  border: none;
  flex-shrink: 0;
  min-width: 2.4rem;
}

.settings-section-hint {
  margin: 0 0 10px;
  font-size: 0.78rem;
}

.layout-size-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.layout-size-in {
  width: 100%;
  max-width: 96px;
  padding: 8px 10px;
  font-size: 0.86rem;
  font-weight: 800;
}

.field-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.field-slider-row input[type="range"] {
  flex: 1;
  min-width: 0;
}

.field-slider-row .field-slider-value {
  flex-shrink: 0;
  width: 88px;
  max-width: 88px;
  margin: 0;
  text-align: center;
}

#fields-form input[type="range"] {
  width: 100%;
  height: 6px;
  margin: 2px 0 8px;
  border-radius: 999px;
  appearance: none;
  background: linear-gradient(90deg, rgba(129, 106, 191, 0.86), rgba(24, 42, 86, 0.86));
  box-shadow: inset 0 0 0 1px var(--dd-border);
}

#fields-form input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand-purple);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

#fields-form input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand-purple);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

#fields-form input[type="number"] {
  max-width: 110px;
  padding: 7px 9px;
  border-radius: 10px;
}

.field--slider input[type="range"] {
  margin: 0;
}

.layout-size-x {
  font-weight: 800;
  color: var(--dd-muted);
}

.canvas-stage {
  position: relative;
  flex-shrink: 0;
  background-color: var(--dd-canvas-bg);
  isolation: isolate;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

html[data-theme="light"] .canvas-stage {
  box-shadow: 0 8px 28px rgba(24, 42, 86, 0.12);
}

/* Dot grid only on the canvas stage (resolution box), not the whole workspace viewport */
.canvas-stage.canvas-grid-on::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
  background-image: radial-gradient(
    circle at center,
    var(--canvas-dots-color, var(--dd-canvas-dots)) 1.25px,
    transparent 1.25px
  );
  background-size: 18px 18px;
  background-position: 0 0;
}

.canvas-chrome {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border: 2px solid rgba(129, 106, 191, 0.45);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.editor-top .canvas-scale-hint {
  margin-left: auto;
  white-space: nowrap;
}

.widget-frame {
  position: absolute;
  z-index: 6;
  overflow: hidden;
  border: 2px solid rgba(129, 106, 191, 0.9);
  border-radius: 2px;
  background: transparent;
  box-shadow: 0 0 0 1px rgba(177, 163, 248, 0.25);
  cursor: grab;
}

.widget-frame:active {
  cursor: grabbing;
}

html[data-theme="light"] .widget-frame {
  border-color: rgba(129, 106, 191, 0.85);
  box-shadow: 0 0 0 1px rgba(129, 106, 191, 0.2);
}

.widget-frame .preview-frame,
.widget-frame .editor-preview-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
}

.editor-preview-frame {
  pointer-events: none;
}

.widget-resize-handle {
  position: absolute;
  right: -5px;
  bottom: -5px;
  z-index: 8;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--brand-purple);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: nwse-resize;
  pointer-events: auto;
}

body.is-canvas-resizing,
body.is-widget-dragging {
  user-select: none;
}

body.is-canvas-resizing {
  cursor: nwse-resize;
}

body.is-widget-dragging {
  cursor: grabbing;
}

body.is-panel-dragging {
  user-select: none;
}

body.is-panel-dragging .studio-float-grip {
  cursor: grabbing;
}

.studio-float-grip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-height: 36px;
  padding: 0;
  border: none;
  border-radius: 10px;
  color: var(--dd-muted);
  background: transparent;
  cursor: grab;
  box-shadow: none;
}

.studio-float-grip:hover {
  color: var(--dd-text);
  background: var(--dd-chip-bg);
}

.studio-float-grip .ph {
  font-size: 1.1rem;
}

.field-drawer-header {
  cursor: default;
}

.field-drawer-header h2 {
  flex: 1;
  min-width: 0;
}

.canvas-dock {
  position: absolute;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 24px);
  padding: 6px 8px 6px 4px;
  border: 1px solid var(--dd-border);
  border-radius: 16px;
  background: rgba(12, 12, 20, 0.9);
  backdrop-filter: blur(18px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.42);
  overflow: visible;
  transition:
    padding 0.38s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.28s ease,
    border-radius 0.38s ease;
}

.canvas-dock--collapsed {
  padding-right: 6px;
  border-radius: 14px;
}

.canvas-dock-body {
  display: grid;
  grid-template-rows: 1fr;
  min-width: 0;
  overflow: hidden;
  transition:
    grid-template-rows 0.38s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s ease,
    max-width 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.canvas-dock--collapsed .canvas-dock-body {
  grid-template-rows: 0fr;
  opacity: 0;
  max-width: 0;
  pointer-events: none;
}

.canvas-dock-body > .canvas-dock-pill {
  min-height: 0;
  overflow: hidden;
}

.canvas-dock-body > .canvas-dock-grid {
  min-height: 0;
  overflow: hidden;
}

.canvas-dock-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px 4px;
  max-width: min(96vw, 920px);
}

.dock-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  min-width: 0;
}

.dock-group + .dock-group {
  border-left: 1px solid var(--dd-border);
  padding-left: 8px;
  border-radius: 0;
  background: transparent;
}

.dock-group--chat {
  flex: 1 1 140px;
  min-width: 120px;
  max-width: 220px;
  background: rgba(129, 106, 191, 0.08);
  border-radius: 10px;
  border-left: none !important;
  padding: 4px 8px;
}

.dock-group-label {
  font-size: var(--dd-text-2xs);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dd-muted);
  padding: 0 2px;
  line-height: 1.1;
  user-select: none;
}

.dock-group-btns {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
}

.dock-group-btns--zoom {
  gap: 1px;
}

.dock-icon-btn--sm {
  width: 30px;
  height: 30px;
}

.dock-icon-btn--sm .ph {
  font-size: 0.95rem;
}

.canvas-dock .dock-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.canvas-dock .dock-icon-btn .ph {
  font-size: 1rem;
}

.dd-dock-popover {
  position: fixed;
  z-index: 80;
  transform: translateX(-50%);
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--dd-border);
  background: var(--dd-panel-solid);
  box-shadow: var(--dd-shadow);
  min-width: 200px;
}

.dd-dock-popover-title {
  margin: 0 0 8px;
  font-size: var(--dd-text-xs);
  font-weight: 800;
  color: var(--dd-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dock-canvas-size-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.canvas-size-in {
  width: 72px;
  padding: 6px 8px;
  font-size: var(--dd-text-sm);
  border-radius: 8px;
  border: 1px solid var(--dd-border);
  background: var(--dd-input-bg);
  color: var(--dd-text);
}

.dock-pill-x {
  font-size: var(--dd-text-xs);
  color: var(--dd-muted);
}

.sidebar-nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav-item--expandable .sidebar-nav-arrow--chevron .ph {
  transition: transform 0.22s ease;
}

.sidebar-nav-item--expandable.is-expanded .sidebar-nav-arrow--chevron .ph {
  transform: rotate(180deg);
}

.sidebar-nav-submenu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 2px 0 2px 10px;
  padding: 8px 8px 6px;
  border-left: 2px solid rgba(129, 106, 191, 0.28);
  border-radius: 0 10px 10px 0;
  background: rgba(129, 106, 191, 0.05);
  animation: sidebar-nav-in 0.22s ease backwards;
}

.sidebar-submenu-hint {
  margin: 0;
  line-height: 1.35;
}

.sidebar-submenu-hint.hidden {
  display: none;
}

.sidebar-submenu-platform .platform-row--compact {
  margin: 0;
}

.sidebar-submenu-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: var(--dd-text-sm);
  font-weight: 700;
  color: var(--dd-text-soft);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-submenu-link:hover {
  background: rgba(129, 106, 191, 0.15);
  color: var(--dd-text);
}

.account-profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 14px;
  border: 1px solid var(--dd-border);
  background: var(--dd-chip-bg);
}

.account-profile-avatar {
  font-size: 2rem;
  color: var(--brand-accent);
  line-height: 1;
}

.account-profile-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.account-profile-text strong {
  font-size: var(--dd-text-md);
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-profile-text span {
  font-size: var(--dd-text-xs);
  color: var(--dd-muted);
}

.account-panel-lead {
  margin: 0 0 12px;
}

.account-panel-logout {
  width: 100%;
  margin-top: 12px;
}

/* —— Compact sidebar support icons —— */
.sidebar-support-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 4px 2px;
  flex-shrink: 0;
}

.sidebar-support-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--dd-border);
  background: var(--dd-chip-bg);
  color: var(--dd-text-soft);
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.sidebar-support-icon .ph {
  font-size: 1.05rem;
}

.sidebar-support-icon:hover {
  transform: translateY(-1px);
  color: #fff;
}

.sidebar-support-icon--etsy:hover {
  background: var(--etsy-orange, #f1641e);
  border-color: #e05a18;
}

.sidebar-support-icon--discord:hover {
  background: #5865f2;
  border-color: #4752c4;
}

.sidebar-support-icon--kofi:hover {
  background: rgba(129, 106, 191, 0.55);
  border-color: rgba(129, 106, 191, 0.8);
}

/* —— Account page (main content) —— */
.view--account {
  padding: 0 4px 24px;
}

.account-page {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.account-page-header {
  margin-top: 4px;
}

.account-profile-card--hero {
  padding: 20px 22px;
  margin-bottom: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(129, 106, 191, 0.14), rgba(24, 42, 86, 0.22));
  border: 1px solid rgba(129, 106, 191, 0.35);
}

.account-profile-card--hero .account-profile-avatar {
  font-size: 3rem;
}

.account-profile-card--hero .account-profile-text strong {
  font-size: var(--dd-text-xl);
}

.account-page-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  align-items: start;
}

.account-card {
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid var(--dd-border);
  background: var(--dd-panel);
  box-shadow: var(--dd-shadow);
}

.account-card-title {
  margin: 0 0 8px;
  font-size: var(--dd-text-xs);
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--dd-muted);
}

.account-card-lead {
  margin: 0 0 14px;
  font-size: var(--dd-text-sm);
  line-height: 1.45;
}

.redeem-form-stack--page {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}

.redeem-form-stack--page input {
  flex: 1 1 180px;
  min-width: 0;
}

.redeem-form-stack--page .primary {
  flex: 0 0 auto;
  white-space: nowrap;
}

.account-quick-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.account-quick-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--dd-text);
  font-size: var(--dd-text-sm);
  font-weight: 700;
  transition: background 0.15s ease;
}

.account-quick-link:hover {
  background: var(--dd-chip-bg);
}

.account-quick-link > .ph:first-child {
  font-size: 1.1rem;
  color: var(--brand-accent);
}

.account-quick-chevron {
  margin-left: auto;
  opacity: 0.45;
  font-size: 0.85rem;
}

.account-page-footer {
  padding-top: 4px;
}

.account-signout-btn {
  min-width: 180px;
}

.account-signout-btn:hover {
  color: #fff;
  background: #c93d4a;
  border-color: #b8323f;
}

@media (max-width: 760px) {
  .account-page-grid {
    grid-template-columns: 1fr;
  }
}

.dock-toggle-collapse {
  flex-shrink: 0;
}

.dock-toggle-collapse .ph {
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.preview-chat-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: min(220px, 42vw);
}

.preview-chat-input {
  width: 120px;
  min-width: 72px;
  max-width: 160px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-family: inherit;
  border-radius: 8px;
  border: 1px solid var(--dd-border);
  background: var(--dd-surface-2);
  color: var(--dd-text);
}

.preview-chat-input::placeholder {
  color: var(--dd-muted);
}

.preview-chat-input:focus {
  outline: 2px solid var(--dd-accent);
  outline-offset: 1px;
}

.dock-pill-section--lead {
  gap: 2px;
  padding-left: 4px;
}

.dock-icon-btn.is-active,
.dock-icon-btn[aria-pressed="true"] {
  background: var(--dd-chip-active);
  color: #fff;
}

html[data-theme="light"] .canvas-dock {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 36px rgba(24, 42, 86, 0.14);
}

.canvas-dock--anchored {
  left: 50%;
  bottom: 16px;
  top: auto;
  transform: translateX(-50%);
}

.canvas-dock-pill {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: thin;
  scrollbar-color: var(--dd-scrollbar-thumb) transparent;
}

.dock-pill-section {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
}

.dock-pill-section + .dock-pill-section {
  border-left: 1px solid var(--dd-border);
}

.dock-pill-section.emulate-wrap,
.emulate-wrap {
  position: relative;
}

.dock-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 10px;
  color: var(--dd-text-soft);
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.dock-icon-btn .ph {
  font-size: 1.15rem;
}

.dock-icon-btn:hover {
  transform: none;
  background: var(--dd-chip-bg);
  color: var(--dd-text);
}

.dock-icon-btn[aria-pressed="true"] {
  background: var(--dd-chip-active);
  color: #fff;
}

.dock-icon-btn--apply:hover {
  background: rgba(129, 106, 191, 0.35);
  color: #fff;
}

.dock-zoom-readout {
  min-width: 44px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 900;
  color: var(--brand-accent);
  user-select: none;
}

.dock-pill-section--bg {
  gap: 2px;
}

.dock-icon-btn--color {
  cursor: pointer;
}

.dock-color-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.dock-pill-section--size {
  gap: 6px;
  padding-right: 10px;
}

.dock-pill-meta-icon {
  font-size: 1rem;
  color: var(--dd-muted);
}

.dock-pill-x {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--dd-muted);
}

.dock-pill-section--size .canvas-size-in {
  width: 4.25rem;
  min-width: 52px;
  padding: 4px 6px;
  font-size: 0.7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
  border-radius: 8px;
  border: 1px solid var(--dd-border);
  background: var(--dd-input-bg);
  box-sizing: border-box;
}

.dock-pill-section--size .canvas-size-in::-webkit-outer-spin-button,
.dock-pill-section--size .canvas-size-in::-webkit-inner-spin-button {
  margin: 0;
}

.emulate-menu {
  z-index: 500;
  min-width: 240px;
  max-width: min(92vw, 320px);
  max-height: min(70vh, 420px);
  margin: 0;
  padding: 8px;
  list-style: none;
  overflow: auto;
  border: 1px solid var(--dd-border);
  border-radius: 14px;
  background: var(--dd-panel-solid);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}

.emulate-menu--portal {
  position: fixed;
  transform: translateX(-50%);
  transform-origin: 50% 100%;
}

.emulate-menu--portal.emulate-menu--anim-in {
  animation: emulateGenieIn 0.34s cubic-bezier(0.22, 1.28, 0.36, 1) forwards;
}

.emulate-menu--portal.emulate-menu--anim-out {
  animation: emulateGenieOut 0.24s cubic-bezier(0.4, 0, 0.6, 1) forwards;
  pointer-events: none;
}

@keyframes emulateGenieIn {
  from {
    opacity: 0;
    transform: translateX(-50%) scale(0.18, 0.32);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) scale(1, 1);
    filter: blur(0);
  }
}

@keyframes emulateGenieOut {
  from {
    opacity: 1;
    transform: translateX(-50%) scale(1, 1);
    filter: blur(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) scale(0.15, 0.28);
    filter: blur(2px);
  }
}

.emulate-section {
  list-style: none;
  margin: 0;
  padding: 0;
}

.emulate-section + .emulate-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--dd-border);
}

.emulate-section-title {
  padding: 4px 8px 6px;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dd-muted);
}

.emulate-section-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.emulate-section-list li button,
.emulate-menu > li > button {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--dd-text);
  background: transparent;
  border: none;
  box-shadow: none;
}

.emulate-section-list li button:hover {
  transform: none;
  background: var(--dd-chip-bg);
}

.preview-frame {
  display: block;
  border: none;
  background: transparent;
}

.connection-id {
  display: block;
  margin: 8px 0 12px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px dashed var(--dd-border);
  background: var(--dd-panel-soft);
  font-family: ui-monospace, monospace;
  font-size: 0.7rem;
  word-break: break-all;
  color: var(--dd-text-soft);
}

.platform-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.platform-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.platform-status {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--dd-muted);
}

.platform-status.on {
  color: #9fff7a;
}

.platform-status.warn {
  color: #ffb347;
}

html[data-theme="light"] .platform-status.on {
  color: #2d8a3e;
}

html[data-theme="light"] .platform-status.warn {
  color: #b45309;
}

.platform-btn {
  width: 100%;
  font-size: 0.82rem;
  padding: 8px 12px;
}

.platform-btn.is-on {
  background: rgba(83, 252, 24, 0.12);
  color: #9fff7a;
  border-color: rgba(83, 252, 24, 0.35);
  box-shadow: none;
}

html[data-theme="light"] .platform-btn.is-on {
  color: #2d8a3e;
  background: rgba(45, 138, 62, 0.1);
  border-color: rgba(45, 138, 62, 0.35);
}

.platform-btn.needs-reconnect {
  background: rgba(255, 179, 71, 0.14);
  color: #ffb347;
  border-color: rgba(255, 179, 71, 0.45);
}

html[data-theme="light"] .platform-btn.needs-reconnect {
  color: #b45309;
  background: rgba(180, 83, 9, 0.1);
  border-color: rgba(180, 83, 9, 0.35);
}

.platform-hint {
  margin: 0;
}

.sidebar-section a {
  color: var(--brand-accent);
  font-weight: 700;
  text-decoration: none;
}

.sidebar-section a:hover {
  text-decoration: underline;
}

.redeem-msg {
  display: block;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 700;
  min-height: 0;
}

.redeem-msg:empty {
  display: none;
  margin: 0;
  padding: 0;
  border: none;
}

.sidebar-section--redeem .sidebar-code-hint {
  margin-top: 8px;
  margin-bottom: 0;
}

.redeem-msg--ok {
  color: #9fff7a;
  background: rgba(159, 255, 122, 0.1);
  border: 1px solid rgba(159, 255, 122, 0.35);
}

html[data-theme="light"] .redeem-msg--ok {
  color: #2d8a3e;
  background: rgba(45, 138, 62, 0.1);
  border-color: rgba(45, 138, 62, 0.3);
}

.redeem-msg--err {
  color: #ffb8b8;
  background: rgba(255, 100, 100, 0.12);
  border: 1px solid rgba(255, 100, 100, 0.35);
}

.redeem-msg--hint {
  color: var(--dd-muted);
  background: var(--dd-panel-soft);
  border: 1px solid var(--dd-border);
}

.dd-toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 24px));
  pointer-events: none;
}

.dd-toast {
  pointer-events: auto;
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--dd-border);
  background: var(--dd-panel-solid);
  color: var(--dd-text);
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: var(--dd-shadow);
  opacity: 0;
  transform: translateY(8px);
  animation: dd-toast-in 180ms ease forwards;
}

.dd-toast--ok {
  border-color: rgba(159, 255, 122, 0.35);
  background: rgba(34, 58, 34, 0.86);
}

.dd-toast--err {
  border-color: rgba(255, 100, 100, 0.4);
  background: rgba(70, 24, 28, 0.9);
}

.dd-toast--hint {
  border-color: rgba(129, 106, 191, 0.35);
}

@keyframes dd-toast-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* —— Animated sidebar navigation —— */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 12px 0 6px;
  flex-shrink: 0;
}

.sidebar-nav--footer {
  margin-top: 0;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.sidebar-nav-divider {
  height: 1px;
  margin: 8px 4px 4px;
  background: linear-gradient(90deg, transparent, var(--dd-border), transparent);
  opacity: 0.9;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--dd-text);
  font-family: inherit;
  font-size: var(--dd-text-sm);
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
  animation: sidebar-nav-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.sidebar-nav-item--compact {
  padding: 7px 10px;
  font-size: var(--dd-text-xs);
  font-weight: 700;
  opacity: 0.88;
}

.sidebar-nav-item:nth-child(1) { animation-delay: 0.04s; }
.sidebar-nav-item:nth-child(2) { animation-delay: 0.08s; }
.sidebar-nav-item:nth-child(3) { animation-delay: 0.12s; }
.sidebar-nav-item:nth-child(4) { animation-delay: 0.16s; }

@keyframes sidebar-nav-in {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.sidebar-nav-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(129, 106, 191, 0.18), rgba(24, 42, 86, 0.12));
  opacity: 0;
  transition: opacity 0.22s ease;
}

.sidebar-nav-item:hover {
  border-color: rgba(129, 106, 191, 0.35);
  background: rgba(129, 106, 191, 0.07);
  transform: translateX(2px);
}

.sidebar-nav-item:hover::before {
  opacity: 1;
}

.sidebar-nav-item.is-active {
  border-color: rgba(120, 180, 255, 0.45);
  background: rgba(24, 42, 86, 0.38);
  box-shadow: 0 0 0 1px rgba(120, 180, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transform: translateX(2px);
}

.sidebar-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: transform 0.18s ease;
}

.sidebar-nav-icon .ph {
  font-size: 1rem;
}

.sidebar-nav-item.is-active .sidebar-nav-icon {
  background: linear-gradient(135deg, rgba(129, 106, 191, 0.45), rgba(24, 42, 86, 0.55));
}

.sidebar-nav-label {
  flex: 1;
  position: relative;
  z-index: 1;
}

.sidebar-nav-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateX(-4px);
  font-size: 0.75rem;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  position: relative;
  z-index: 1;
}

.sidebar-nav-item:hover .sidebar-nav-arrow,
.sidebar-nav-item.is-active .sidebar-nav-arrow {
  opacity: 1;
  transform: translateX(0);
}

.sidebar-section--account {
  margin-top: 8px;
  animation: sidebar-nav-in 0.35s ease backwards;
}

/* —— Overlay library cards —— */
.card--overlay {
  position: relative;
  overflow: visible;
}

.card-preview-btn {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
  text-align: left;
}

.card-preview-btn .card-preview {
  transition: transform 0.22s ease, filter 0.22s ease;
}

.card-preview-btn:hover .card-preview {
  transform: scale(1.02);
}

.card-preview-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(12, 10, 22, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.card-preview-badge .ph {
  font-size: 0.85rem;
  margin-left: 2px;
}

.card--overlay:hover .card-preview-badge {
  opacity: 1;
  transform: scale(1);
}

.widget-preview-panel {
  max-width: min(920px, 96vw);
}

.widget-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.widget-preview-header .studio-dialog-title {
  margin: 0;
}

.widget-preview-frame-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: min(62vh, 520px);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--dd-border);
  background: var(--dd-canvas-bg);
}

.widget-preview-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}

.layer-btn--del:hover {
  background: rgba(220, 80, 80, 0.22);
  color: #ffb4b4;
}

.card-folder-tab {
  position: absolute;
  top: 0;
  left: 14px;
  z-index: 2;
  padding: 5px 12px 4px;
  border-radius: 10px 10px 0 0;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-purple), var(--brand-blue));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
}

.card-footer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.card-footer-row .btn-delete {
  flex: 1;
  margin-top: 0;
}

.card-kebab {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* —— Media storage —— */
.media-toolbar .library-toolbar-controls {
  align-items: center;
}

.media-storage-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.media-storage-track {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--dd-border);
}

.media-storage-seg {
  display: block;
  height: 100%;
  min-width: 0;
  transition: width 0.35s ease;
}

.media-storage-seg--image {
  background: linear-gradient(90deg, #816abf, #9b7fd4);
}

.media-storage-seg--sound {
  background: linear-gradient(90deg, #e879a8, #f0a0c0);
}

.media-storage-seg--other {
  background: linear-gradient(90deg, #f0c96a, #e8b84a);
}

.media-storage-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--dd-muted);
}

.media-storage-legend {
  display: inline-flex;
  gap: 12px;
}

.media-storage-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.media-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.media-dot--image {
  background: #9b7fd4;
}

.media-dot--sound {
  background: #e879a8;
}

.media-kind-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.card--media {
  position: relative;
}

.card-preview--media img {
  object-fit: cover;
}

.card-preview--sound {
  font-size: 2.4rem;
  color: var(--brand-purple);
  background: linear-gradient(145deg, rgba(129, 106, 191, 0.2), rgba(24, 42, 86, 0.35));
}

.card-media-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.card--media:hover .card-media-overlay {
  opacity: 1;
  pointer-events: auto;
}

.card-media-play {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  transition: transform 0.2s ease;
}

.card-media-play:hover {
  transform: scale(1.08);
}

.card-title--media {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px !important;
}

.card-media-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--dd-muted);
}

.card--overlay .card-media-menu {
  z-index: 12;
}

.card-media-menu {
  position: absolute;
  right: 12px;
  bottom: 52px;
  z-index: 5;
  min-width: 140px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--dd-border);
  background: var(--dd-panel-solid);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
}

.card-media-menu button {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--dd-text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.card-media-menu button:hover {
  background: var(--dd-chip-bg);
}

.media-pagination {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 18px;
}

.media-page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--dd-border);
  background: var(--dd-chip-bg);
  color: var(--dd-text);
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
}

.media-page-btn.is-active {
  background: linear-gradient(135deg, var(--brand-purple), var(--brand-blue));
  border-color: transparent;
  color: #fff;
}

.studio-dialog-panel--wide {
  width: min(100%, 560px);
}

.media-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  max-height: min(50vh, 360px);
  overflow: auto;
  margin-bottom: 14px;
  padding: 4px;
}

.media-picker-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--dd-border);
  background: var(--dd-input-bg);
  color: var(--dd-text);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.media-picker-item:hover {
  border-color: rgba(129, 106, 191, 0.55);
  transform: translateY(-1px);
}

.media-picker-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
}

.media-picker-item .ph {
  font-size: 1.8rem;
  align-self: center;
  padding: 16px 0 8px;
  color: var(--brand-purple);
}

.media-picker-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-picker-toolbar {
  margin-bottom: 12px;
}

/* —— Field asset upload row —— */
.field-asset-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.field-asset-row .field-url-in {
  flex: 1;
  min-width: 0;
}

.field-asset-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 8px 10px !important;
  font-size: 0.75rem !important;
  white-space: nowrap;
}

.field-asset-btn .ph {
  font-size: 1rem;
}

.field-asset-preview {
  margin-top: 8px;
}

.field-sound-preview {
  width: 100%;
  max-width: 280px;
  height: 36px;
}

.field-sound-preview.hidden {
  display: none;
}

/* —— Visual media fields (no URL bar) —— */
.field--media-asset {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--dd-border);
  background: var(--dd-panel-soft);
}

.field-media-label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dd-muted);
}

.field-media-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 120px;
  padding: 14px;
  border: 2px dashed rgba(129, 106, 191, 0.45);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.15);
  color: var(--dd-text);
  font-family: inherit;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.15s ease;
}

.field-media-card:hover {
  border-color: rgba(129, 106, 191, 0.85);
  background: rgba(129, 106, 191, 0.1);
  transform: translateY(-1px);
}

.field-media-card--filled {
  border-style: solid;
  padding: 0;
  min-height: 140px;
}

.field-media-card-icon {
  font-size: 2rem;
  color: var(--brand-purple);
}

.field-media-card-icon--sound {
  font-size: 2.2rem;
}

.field-media-card-title {
  font-size: 0.9rem;
  font-weight: 800;
}

.field-media-card-sub {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--dd-muted);
}

.field-media-card-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}

.field-media-card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(8, 8, 18, 0.55);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.field-media-card--filled:hover .field-media-card-overlay {
  opacity: 1;
}

.field-media-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.field-media-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid var(--dd-border);
  background: var(--dd-input-bg);
  color: var(--dd-text);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}

.field-media-action:hover {
  border-color: rgba(129, 106, 191, 0.55);
}

.field-media-action--muted {
  color: var(--dd-muted);
}

.field-media-advanced {
  margin-top: 10px;
  font-size: 0.75rem;
}

.field-media-advanced summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--dd-muted);
  list-style: none;
}

.field-media-advanced summary::-webkit-details-marker {
  display: none;
}

.field-media-url-advanced {
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--dd-border);
  background: var(--dd-input-bg);
  color: var(--dd-text);
  font-family: inherit;
  font-size: 0.8rem;
}

.field-media-info {
  margin-top: 8px;
  margin-bottom: 0;
}

/* —— Layers panel —— */
.layers-panel {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 12;
  width: min(220px, 42vw);
  padding: 8px 8px 6px;
  border-radius: 14px;
  border: 1px solid var(--dd-border);
  background: var(--dd-panel-solid);
  box-shadow: var(--dd-shadow);
}

.layers-panel-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.layers-panel-title {
  flex: 1;
  font-size: var(--dd-text-2xs);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dd-muted);
}

.layer-header-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--dd-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.layer-header-btn:hover {
  background: var(--dd-chip-bg);
  color: var(--dd-text);
}

.layers-panel-body {
  overflow: hidden;
  transition: max-height 0.28s ease, opacity 0.22s ease;
  max-height: 320px;
}

.layers-panel--collapsed .layers-panel-body {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.layers-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 6px;
  padding: 7px 10px;
  border: 1px dashed rgba(129, 106, 191, 0.45);
  border-radius: 10px;
  background: transparent;
  color: var(--dd-text-soft);
  font-family: inherit;
  font-size: var(--dd-text-xs);
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.layers-add-btn:hover {
  background: rgba(129, 106, 191, 0.12);
  border-color: var(--brand-accent);
  color: var(--dd-text);
}

.layers-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.layer-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 6px;
  border-radius: 9px;
  background: var(--dd-chip-bg);
}

.layer-row.is-selected {
  outline: 1px solid rgba(129, 106, 191, 0.55);
}

.layer-name-btn {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-family: inherit;
  font-size: var(--dd-text-sm);
  font-weight: 800;
  color: var(--dd-text);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.layer-name-btn:hover {
  background: rgba(129, 106, 191, 0.15);
}

.layer-name {
  flex: 1;
  min-width: 0;
  font-size: var(--dd-text-sm);
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--dd-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.layer-btn .ph {
  font-size: 0.9rem;
}

.layer-btn:hover {
  background: rgba(129, 106, 191, 0.2);
}

.widget-frame--no-chrome {
  outline: none !important;
  box-shadow: none !important;
}

.widget-frame--no-chrome::before,
.widget-frame--no-chrome::after {
  display: none !important;
}

.widget-frame--hidden {
  opacity: 0.15;
  pointer-events: none;
}

.widget-frame--locked {
  cursor: not-allowed !important;
}

.canvas-stage--widget-only {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.canvas-stage--widget-only .widget-frame {
  position: relative !important;
  left: auto !important;
  top: auto !important;
}

.editor-expand-mode .sidebar,
.editor-expand-mode .topbar,
.editor-expand-mode .field-drawer,
.editor-expand-mode .layers-panel,
.editor-expand-mode .canvas-dock {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.editor-expand-mode .main {
  padding: 0;
}

.editor-expand-mode .view--editor {
  min-height: 100vh;
}

.dock-icon-btn.is-active {
  background: rgba(129, 106, 191, 0.28);
  color: #fff;
}

.dock-pill-section--chat {
  min-width: 0;
}

@media (max-width: 900px) {
  .app,
  .app.sidebar-collapsed {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    max-height: none;
    overflow: visible;
  }

  .sidebar {
    max-height: min(48vh, 420px);
    border-right: none;
    border-bottom: 1px solid var(--dd-border);
  }

  .app.sidebar-collapsed .sidebar {
    display: none;
  }

  .main {
    overflow: visible;
    min-height: 50vh;
  }

  .view--editor {
    min-height: 70vh;
  }

  .field-drawer {
    width: calc(100% - 20px);
    max-height: min(82vh, 640px);
  }

  .field-drawer-controls-row {
    grid-template-columns: auto 1fr auto 1fr;
    grid-template-rows: auto auto;
  }

  .field-drawer-controls-row .field-group-select--compact {
    grid-column: 1 / -1;
  }

  .canvas-dock {
    max-width: calc(100vw - 16px);
    left: 50% !important;
    right: auto;
    transform: translateX(-50%);
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
  }

  .canvas-dock--anchored {
    transform: translateX(-50%);
  }
}

@media (max-height: 820px) {
  .main {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .view--editor {
    min-height: min(78vh, 720px);
  }
}
