main {
  max-width: none;
}

.studio {
  width: calc(100% - 32px);
  max-width: 1800px;
  margin: 18px auto 0;
  padding: 14px;
  border-radius: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 14px;
  overflow: hidden;
  background: #183a31;
  color: #fff;
  direction: ltr;
}

.export-main {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  direction: rtl;
  order: 1;
}

.sheet-grid {
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  direction: rtl;
}

.ad-sidebar {
  position: relative;
  width: min(100%, 300px);
  max-width: 300px;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 9 / 16;
  align-self: center;
  margin-inline: auto;
  padding: 22px;
  border: 1px dashed rgba(211, 189, 120, .65);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .025));
  text-align: center;
  direction: rtl;
  order: 2;
}

.ad-sidebar--right {
  display: none;
  order: 3;
}

.ad-sidebar > * {
  width: 100%;
  text-align: center;
}

.ad-sidebar span {
  color: #d3bd78;
  font-size: 10px;
  letter-spacing: .06em;
}

.ad-sidebar strong {
  margin: 12px 0 3px;
  font-size: 20px;
}

.ad-sidebar small {
  color: #b7c7c2;
  font-size: 10px;
}

.ad-placeholder {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ad-placeholder[hidden],
.ad-creative[hidden] {
  display: none;
}

.ad-creative {
  position: absolute;
  inset: 0;
  height: 100%;
  display: block;
  background: #0b1512;
  text-decoration: none;
}

.ad-creative img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.ad-manage {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  width: auto !important;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 9px;
  background: rgba(8, 18, 15, .9);
  color: #fff;
  font: inherit;
  font-size: 10px;
  backdrop-filter: blur(8px);
}

.canvas-wrap {
  min-width: 0;
  max-width: 100%;
  padding: 11px;
  border-radius: 18px;
  overflow: hidden;
  background: #24493f;
  direction: rtl;
}

.canvas-frame {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: 12px;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(circle at 50% 34%, rgba(211, 189, 120, .12), transparent 36%), linear-gradient(145deg, #12231f, #07100e 72%);
}

.canvas-wrap canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  transition: opacity .22s ease;
}

.canvas-wrap:not(.is-ready) canvas {
  visibility: hidden;
  opacity: 0;
}

.canvas-wrap.is-ready canvas {
  visibility: visible;
  opacity: 1;
}

.canvas-wrap > button,
.download-all-panel button {
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  background: #fff;
  color: #17211f;
  font: inherit;
  font-weight: 720;
}

.canvas-wrap > button {
  width: 100%;
  margin-top: 9px;
  display: block;
}

.canvas-wrap > button:disabled,
.download-all-panel button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.download-all-panel {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.download-all-panel button {
  width: min(420px, 100%);
  min-height: 50px;
  background: #d3bd78;
  line-height: 1.65;
}

.download-all-panel button span {
  margin-left: 8px;
  display: inline-block;
  font-size: 20px;
  line-height: 1;
}

.canvas-loading {
  position: absolute;
  z-index: 2;
  inset: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(145deg, rgba(15, 31, 27, .98), rgba(5, 13, 11, .99));
  color: #f7f4eb;
  text-align: center;
}

.canvas-wrap.is-ready .canvas-loading {
  display: none;
}

.canvas-loading strong {
  font-size: 18px;
}

.canvas-loading small {
  color: #b7c7c2;
  font-size: 11px;
}

.canvas-loading i {
  position: relative;
  width: min(210px, 65%);
  height: 4px;
  margin-top: 16px;
  border-radius: 999px;
  display: block;
  overflow: hidden;
  background: rgba(255, 255, 255, .09);
}

.canvas-loading i::after {
  position: absolute;
  inset: 0 auto 0 -45%;
  width: 45%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, #d3bd78, transparent);
  animation: export-loading 1.25s ease-in-out infinite;
  content: "";
}

.canvas-wrap.is-error .canvas-loading i {
  display: none;
}

.canvas-wrap.is-error .loading-mark {
  opacity: .62;
}

@keyframes export-loading {
  to {
    left: 100%;
  }
}

.header-actions,
.mod-tools {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.mod-tools[hidden] {
  display: none;
}

.mod-tools {
  color: var(--green);
  font-size: 11px;
}

.mod-tools button,
.theme-toggle {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
}

.mod-tools button:disabled {
  cursor: wait;
  opacity: .55;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
}

.theme-toggle span {
  color: var(--gold);
  font-size: 16px;
}

.site-presence {
  min-width: 0;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  color: var(--ink);
}

.site-presence > i {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green2);
}

.site-presence > span {
  display: grid;
  line-height: 1.35;
}

.site-presence strong,
.site-presence small {
  white-space: nowrap;
}

.site-presence strong {
  font-size: 11px;
}

.site-presence strong b {
  color: var(--green);
  font-size: 14px;
}

.site-presence small {
  color: var(--muted);
  font-size: 9px;
}

.site-presence .view-total {
  padding-right: 12px;
  border-right: 1px solid var(--line);
}

.site-presence .view-total strong b {
  color: var(--gold);
}

.ad-dialog {
  width: min(480px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: auto;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .35);
  direction: rtl;
}

.ad-dialog::backdrop {
  background: rgba(4, 10, 8, .68);
  backdrop-filter: blur(3px);
}

.ad-dialog form {
  padding: 24px;
  display: grid;
  gap: 17px;
}

.ad-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ad-dialog-head > div {
  display: grid;
}

.ad-dialog-head span {
  color: var(--muted);
  font-size: 10px;
}

.ad-dialog-head strong {
  font-size: 22px;
}

.ad-dialog-head button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--cream);
  color: var(--ink);
  font-size: 22px;
}

.ad-dialog label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}

.ad-dialog input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  direction: ltr;
}

.ad-dialog label small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 400;
  text-align: right;
  direction: rtl;
}

.ad-dialog #adStatus,
.ad-dialog #brandStatus,
.ad-dialog #contentStatus {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.ad-dialog [role="status"][data-state="success"] {
  color: var(--green);
}

.ad-dialog [role="status"][data-state="error"] {
  color: var(--red);
}

.ad-dialog [role="status"][data-state="loading"] {
  color: var(--gold);
}

.content-dialog {
  width: min(780px, calc(100% - 28px));
}

.content-help {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 11px;
}

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

.content-fields label {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--cream);
}

.content-fields input {
  text-align: right;
  direction: rtl;
}

.content-fields label small {
  overflow: hidden;
  color: var(--muted);
  direction: ltr;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ad-dialog-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.ad-dialog-actions button {
  flex: 1;
  padding: 11px 14px;
  border: 0;
  border-radius: 9px;
  background: var(--green);
  color: #fff;
  font: inherit;
  font-weight: 700;
}

.ad-dialog-actions .danger {
  background: var(--red);
}

.ad-dialog-actions button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

@media(max-width:700px) {
  .content-fields {
    grid-template-columns: 1fr;
  }

  .content-dialog .ad-dialog-actions {
    flex-direction: column-reverse;
  }
}

.brand-previews,
.theme-logo-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.brand-preview {
  position: relative;
  min-height: 190px;
  padding: 30px 12px 12px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.brand-preview > small {
  position: absolute;
  top: 10px;
  right: 12px;
  color: #68726f;
  font-size: 9px;
}

.brand-preview--light {
  background: #f7f7f2;
}

.brand-preview--dark {
  background: #0d1211;
}

.brand-preview--dark > small {
  color: #b7c7c2;
}

.brand-preview img {
  width: var(--brand-login-size, 96px);
  height: var(--brand-login-size, 96px);
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .25));
}

.theme-logo-actions button {
  padding: 11px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f7f7f2;
  color: #17211f;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
}

.theme-logo-actions button:last-child {
  background: #0d1211;
  color: #fff;
}

.theme-logo-actions button:disabled {
  cursor: wait;
  opacity: .55;
}

.brand-dialog label {
  grid-template-columns: 1fr auto;
}

.brand-dialog label output {
  color: var(--green);
  font-weight: 800;
}

.brand-dialog input[type="range"] {
  grid-column: 1 / -1;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  accent-color: var(--green);
  direction: ltr;
}

.brand-scale-note {
  margin-top: -10px;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

@media (min-width: 821px) and (max-width: 1499px) {
  .studio {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    align-items: start;
  }

  .studio > .ad-sidebar:not(.ad-sidebar--right) {
    width: calc(100% - 22px);
    max-width: none;
    align-self: start;
    margin: 11px auto 0;
    order: 1;
  }

  .export-main {
    order: 2;
  }
}

@media (min-width: 1500px) {
  .studio {
    padding: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: start;
    gap: 14px;
    border: 1px solid rgba(211, 189, 120, .42);
  }

  .ad-sidebar {
    width: calc(100% - 22px);
    max-width: none;
    min-height: 0;
    aspect-ratio: 9 / 16;
    align-self: start;
    margin: 11px auto 0;
    border-radius: 20px;
  }

  .studio > .ad-sidebar:not(.ad-sidebar--right) {
    grid-column: 1;
    order: 1;
  }

  .ad-sidebar--right {
    grid-column: 4;
    display: flex;
  }

  .export-main {
    grid-column: 2 / span 2;
    order: 2;
    padding: 0;
    border: 0;
    background: transparent;
  }
}

@media (max-width: 820px) {
  .sheet-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ad-sidebar {
    width: calc(100% - 16px);
    max-width: 500px;
  }
}

@media (max-width: 700px) {
  header {
    height: auto;
    min-height: 0;
    padding: 10px 14px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .header-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .theme-toggle b,
  .site-presence small,
  .mod-tools > span {
    display: none;
  }

  .site-presence {
    padding: 7px 9px;
  }

  .mod-tools {
    justify-content: center;
    flex-wrap: wrap;
  }

  .studio {
    width: calc(100% - 20px);
    margin-top: 8px;
    padding: 9px;
    border-radius: 21px;
  }

  .canvas-wrap {
    padding: 8px;
  }
}

@media (max-width: 430px) {
  .site-presence .view-total {
    padding-right: 8px;
  }

  .brand-previews,
  .theme-logo-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .canvas-loading i::after {
    left: 28%;
    animation: none;
  }

  .canvas-wrap canvas {
    transition: none;
  }
}
