:root {
  color-scheme: light;
  --midnight: #0e0f28;
  --electric: #2a3ef4;
  --ink: #0e0f28;
  --line: #e5e7eb;
  --paper: #ffffff;
  --soft: #f8f8f8;
  --muted: #666978;
  --bg: var(--paper);
  --panel: var(--paper);
  --text: var(--ink);
}

* {
  box-sizing: border-box;
}

.preview-name {
  display: inline-flex;
  align-items: center;
  height: 52px;
  color: #fff;
  font-family: "Suisse Intl Mono", "Suisse Int'l Mono", "Suisse Mono", "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  position: fixed;
  left: 154px;
  top: 12px;
  z-index: 80;
}

body {
  margin: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  font-family: Yellix, Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.3s ease;
}

body.app-initializing {
  opacity: 0;
}

body.mainmenu-hidden .toolbar,
body.mainmenu-hidden #header-toggle {
  display: none;
}

body.mainmenu-hidden {
  grid-template-rows: 1fr;
}

body.mainmenu-hidden .preview-root {
  min-height: 100vh;
}

body.app-initializing .display-scale {
  opacity: 0;
  transform: scale(0.965);
}

body.app-initializing .preview-nav-controls,
body.app-initializing .preview-error {
  opacity: 0;
}

body.hide-mainmenu-toggle #header-toggle {
  display: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: Yellix, Inter, system-ui, sans-serif;
}

button {
  font-family: "Suisse Intl Mono", "Suisse Int'l Mono", "Suisse Mono", "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-weight: 400;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.toolbar {
  padding: 6px 12px;
  background: var(--midnight);
  border-bottom: 0;
  color: #fff;
  position: relative;
  z-index: 50;
  overflow: visible;
  max-height: 200px;
  opacity: 1;
  transform: translateY(0);
  transition: max-height 0.28s ease, padding 0.28s ease, opacity 0.2s ease, transform 0.28s ease;
}

body:not(.header-collapsed):not(.app-initializing) .toolbar {
  animation: toolbar-slide-down 0.24s ease;
}

body.header-collapsed .toolbar {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  overflow: hidden;
}

.toolbar-inner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding-left: 148px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 0 4px;
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 80;
}

.brand-link img {
  display: block;
  width: 130px;
  height: auto;
  max-width: 100%;
}

body.logo-dark .brand-link img {
  filter: brightness(0) saturate(100%);
}

.toolbar form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: end;
  flex: 1 1 auto;
  min-width: 0;
}

label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

#preview-form > label:first-child {
  flex: 1 1 360px;
  min-width: 260px;
}

#preview-form > label:first-child input {
  width: 100%;
  border-color: #2a2d4a;
  background: #11142e;
  color: #f3f5ff;
}

#preview-form > label:first-child input::placeholder {
  color: #9aa2c8;
}

.toolbar input:not([type=checkbox]):not([type=color]):not([type=hidden]):not(:disabled):is(:hover, :focus) {
  outline: none;
  border-color: var(--electric);
  box-shadow: 0 0 0 1px var(--electric);
}

input,
select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font-family: Yellix, Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 13px;
  cursor: text;
}

button,
textarea {
  cursor: pointer;
}

select,
input[type=checkbox],
input[type=color] {
  cursor: default;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
}

.control-section {
  padding: 8px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.toggle-group {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #9ca3af;
  flex: 0 0 auto;
  width: fit-content;
  max-width: 100%;
  position: relative;
}

.toggle-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0;
  width: fit-content;
  max-width: 100%;
  border: 1px solid #2a2d4a;
  border-radius: 2px;
  overflow: hidden;
  background: #11142e;
}

.toggle-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-right: 1px solid #2a2d4a;
  border-radius: 0;
  background: #11142e;
  color: #d7dcff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, border-width 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

#background-group .toggle-row {
  border: 0;
  border-radius: 999px;
  background: transparent;
  overflow: visible;
}

#bg-color-button {
  border: 1px solid #2a2d4a;
  border-radius: 999px;
}

#bg-color-button[aria-expanded=true] {
  border: 2px solid #ffffff;
}

.toggle-button-image {
  border: 2px solid #ffffff;
}

.toggle-button-image .swatch {
  border-color: rgba(255, 255, 255, 0.9);
}

.toggle-row > .toggle-button:last-child {
  border-right: 0;
}

.text-toggle-button {
  width: auto;
  min-width: 0;
  padding: 0 12px;
  font-size: 10px;
  white-space: nowrap;
}

.toggle-button.is-active {
  background: #2a3ef4;
  color: #fff;
}

.toggle-button:not(.is-active):is(:hover, :focus-visible) {
  border-color: #3a3f66;
  background: #171a39;
  color: #ffffff;
}

.toggle-button:focus-visible {
  outline: 0;
  box-shadow: inset 0 0 0 1px rgba(191, 219, 254, 0.55);
}

.orientation-shape {
  border: 2px solid currentColor;
  border-radius: 2px;
}

.orientation-shape-landscape {
  width: 20px;
  height: 13px;
}

.orientation-shape-portrait {
  width: 13px;
  height: 20px;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.native-color-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
  inset: auto;
}

.bg-presets-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 80;
  min-width: 520px;
  padding: 6px;
  border: 1px solid #2a2d4a;
  border-radius: 3px;
  background: #11142e;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 380px;
}

.bg-preset-column {
  display: grid;
  gap: 4px;
  align-content: start;
  max-height: 366px;
  overflow: auto;
}

.bg-preset-column-colors {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.bg-preset-column-images {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.bg-preset-button {
  height: 30px;
  border: 1px solid #2a2d4a;
  border-radius: 2px;
  background: #11142e;
  color: #d7dcff;
  text-align: left;
  padding: 0 8px;
}

.bg-preset-button-color {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  height: 66px;
  padding: 6px;
  text-align: center;
}

.bg-preset-button-color span:last-child {
  font-size: 9px;
  width: 100%;
  text-align: center;
}

.gradient-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 8px;
  margin: 2px 0 4px;
  grid-column: 1/-1;
}

.custom-controls {
  display: grid;
  justify-content: center;
  margin: 2px 0 4px;
  grid-column: 1/-1;
}

.custom-color-field {
  display: grid;
  gap: 4px;
  justify-items: center;
}

.gradient-color-field {
  display: grid;
  gap: 4px;
  justify-items: center;
}

.gradient-controls input[type=color],
.custom-controls input[type=color] {
  width: 30px;
  height: 30px;
  border: 1px solid #2a2d4a;
  border-radius: 6px;
  background: transparent;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.gradient-controls input[type=color]::-webkit-color-swatch-wrapper,
.custom-controls input[type=color]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.gradient-controls input[type=color]::-webkit-color-swatch,
.custom-controls input[type=color]::-webkit-color-swatch {
  border: 0;
  border-radius: 5px;
}

.gradient-controls input[type=text],
.custom-controls input[type=text] {
  width: 72px;
  height: 22px;
  border: 1px solid #2a2d4a;
  border-radius: 2px;
  background: #0c1026;
  color: #d7dcff;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0 6px;
}

.bg-color-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  flex: 0 0 auto;
}

.bg-color-dot-white {
  background: #ffffff;
}

.bg-color-dot-black {
  background: #000000;
}

.bg-color-dot-dgt {
  background: #0e0f28;
}

.bg-color-dot-dgt-2 {
  background: #272736;
}

.bg-color-dot-gradient {
  background: linear-gradient(135deg, #06071c 0%, #272636 100%);
}

.bg-color-dot-custom {
  background: linear-gradient(135deg, #2a3ef4 0%, #fd83a4 50%, #e0f88c 100%);
}

.bg-preset-button-image {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-content: center;
  gap: 5px;
  height: 66px;
  padding: 6px;
  text-align: center;
}

.bg-thumb {
  width: 68px;
  height: 38px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  flex: 0 0 auto;
}

.bg-preset-button-image span:last-child {
  font-size: 9px;
  width: 100%;
  text-align: center;
}

.bg-preset-button:hover {
  background: #171a39;
}

.bg-preset-button.is-active {
  border-color: #2a3ef4;
  background: #2a3ef4;
  color: #fff;
}

.toolbar-actions {
  display: grid;
  align-items: end;
  flex: 0 0 auto;
}

.icon-button {
  height: 36px;
  width: 36px;
  border: 1px solid #2a2d4a;
  border-radius: 999px;
  background: #11142e;
  color: #e5e7eb;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background-color 0.16s ease, border-color 0.16s ease, border-width 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}
.icon-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.icon-button[aria-expanded=false]:is(:hover, :focus-visible) {
  border: 1px solid #2a2d4a;
  background: #171a39;
  color: #ffffff;
}

.icon-button[aria-expanded=true] {
  border: 2px solid #ffffff;
  background: #171a39;
  color: #ffffff;
}

.header-toggle-button {
  width: 44px;
  height: 32px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  display: grid;
  place-items: center;
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 90;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}

.header-toggle-button:hover {
  opacity: 0.9;
}

body.header-collapsed #header-toggle {
  color: var(--header-toggle-collapsed-color, #ffffff);
}

body:not(.header-collapsed) #header-toggle {
  color: #ffffff;
}

.header-toggle-icon {
  position: relative;
  width: 16px;
  height: 12px;
}

.header-toggle-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 0.22s ease, opacity 0.18s ease, top 0.22s ease;
}

.header-toggle-line:nth-child(1) {
  top: 0;
}

.header-toggle-line:nth-child(2) {
  top: 5px;
}

.header-toggle-line:nth-child(3) {
  top: 10px;
}

body:not(.header-collapsed) .header-toggle-line:nth-child(1) {
  top: 5px;
  transform: rotate(45deg);
}

body:not(.header-collapsed) .header-toggle-line:nth-child(2) {
  opacity: 0;
}

body:not(.header-collapsed) .header-toggle-line:nth-child(3) {
  top: 5px;
  transform: rotate(-45deg);
}

.copy-control-group {
  position: relative;
}

.controls-settings-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 80;
  width: 244px;
  padding: 10px;
  border: 1px solid #2a2d4a;
  border-radius: 3px;
  background: #11142e;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
  display: grid;
  gap: 6px;
}

.share-modal-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #e6e9ff;
  font-size: 22px;
  line-height: 1;
  font-family: Yellix, Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  margin-bottom: 2px;
}

.share-modal-title svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.controls-title {
  margin: 2px 0 0;
  color: #b6bde3;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
}

.controls-option-mainmenu {
  margin-top: 2px;
}

.controls-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #e6e9ff;
}

.controls-field {
  display: grid;
  gap: 4px;
  margin-bottom: 2px;
  color: #b6bde3;
  font-size: 10px;
  text-transform: uppercase;
}

.controls-field input {
  height: 34px;
  border-color: #2a2d4a;
  background: #0c1026;
  color: #e6e9ff;
}

.controls-field select {
  height: 34px;
  border-color: #2a2d4a;
  background: #0c1026;
  color: #e6e9ff;
}

.controls-field input::placeholder {
  color: #8f97c2;
}

.controls-name-input {
  height: 34px;
  border: 1px solid #2a2d4a;
  border-radius: 2px;
  background: #0c1026;
  color: #e6e9ff;
  padding: 0 10px;
  width: 100%;
}

.controls-name-input::placeholder {
  color: #8f97c2;
}

.controls-option input[type=checkbox] {
  appearance: none;
  width: 14px;
  height: 14px;
  min-height: 14px;
  border: 1px solid #3a3f66;
  border-radius: 2px;
  background: #0c1026;
  display: grid;
  place-content: center;
  margin: 0;
  padding: 0;
}

.controls-option input[type=checkbox]::before {
  content: "";
  width: 8px;
  height: 8px;
  transform: scale(0);
  transform-origin: center;
  clip-path: polygon(14% 44%, 0 59%, 40% 100%, 100% 20%, 84% 6%, 40% 62%);
  background: #fff;
  transition: transform 0.12s ease-in-out;
}

.controls-option input[type=checkbox]:checked {
  border-color: var(--electric);
  background: var(--electric);
}

.controls-option input[type=checkbox]:checked::before {
  transform: scale(1);
}

.controls-option input[type=checkbox]:disabled {
  opacity: 0.4;
}

.copy-url-confirm {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1;
}

.copy-url-confirm svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.copy-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.copy-url-confirm-primary {
  border-color: var(--electric);
  background: var(--electric);
  color: #f8fafc;
}

.copy-url-confirm-primary:hover {
  background: #1d31dc;
  border-color: #1d31dc;
}

.copy-url-confirm-secondary {
  border-color: #3a3f66;
  background: transparent;
  color: #e6e9ff;
}

.copy-actions .copy-url-confirm {
  width: 100%;
}

.copy-url-confirm-secondary:hover {
  background: #171a39;
}

.hidden {
  display: none;
}

.is-control-hidden {
  display: none !important;
}

.custom-size-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 80;
  width: 184px;
  padding: 8px;
  border: 1px solid #2a2d4a;
  border-radius: 3px;
  background: #11142e;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
}

.custom-size-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.custom-size-popover input {
  width: 100%;
  min-width: 0;
  border-color: #2a2d4a;
  background: #0c1026;
  color: #e6e9ff;
  padding: 0 6px;
  font-variant-numeric: tabular-nums;
}

.custom-size-popover input::placeholder {
  color: #8f97c2;
}

.custom-size-apply {
  height: 32px;
  width: 100%;
  border: 1px solid #2a2d4a;
  border-radius: 3px;
  background: #11142e;
  color: #d7dcff;
  cursor: pointer;
  font-size: 10px;
}

.custom-size-apply:hover {
  background: #171a39;
}

.preview-root {
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.preview-error {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 25;
  width: min(520px, 100% - 32px);
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: rgba(15, 17, 40, 0.78);
  color: #f3f5ff;
  display: block;
  text-align: center;
}

.preview-error.hidden {
  display: none;
}

.preview-error p {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
}

.scale-indicator {
  position: fixed;
  bottom: 8px;
  left: 10px;
  z-index: 10;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.preview-nav-controls {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 10px;
  z-index: 20;
  display: inline-flex;
  gap: 6px;
}

.preview-nav-button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--preview-nav-border, rgba(255, 255, 255, 0.22));
  border-radius: 3px;
  background: var(--preview-nav-bg, rgba(15, 17, 40, 0.2));
  color: var(--preview-nav-color, rgba(255, 255, 255, 0.42));
  display: grid;
  place-items: center;
  backdrop-filter: blur(2px);
}

.preview-nav-button:hover {
  background: rgba(15, 17, 40, 0.62);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.preview-nav-button:disabled {
  opacity: 0.34;
  pointer-events: none;
}

.preview-nav-button svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.preview-canvas {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

body.bg-image .preview-canvas {
  padding: 28px;
}

.display-scale {
  position: relative;
  overflow: visible;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

@keyframes toolbar-slide-down {
  from {
    transform: translateY(-8px);
    opacity: 0.7;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.display-shell {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
}

.device-frame {
  background: #000;
  pointer-events: auto;
}
.device-frame iframe {
  border: 0;
  display: block;
  background: #000;
  pointer-events: auto;
}

.display-shell.signage .device-frame {
  padding: 14px;
  border-radius: 14px;
  background: #111;
  border: 2px solid #2f2f2f;
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.58), 0 8px 18px rgba(0, 0, 0, 0.4);
}

.display-shell.signage iframe {
  width: 100%;
  height: 100%;
  border-radius: 4px;
}

.phone-shell {
  width: 100%;
  height: 100%;
}

.phone-screen {
  width: 100%;
  height: 100%;
}

.phone-button {
  display: none;
}

.display-shell.mobile .device-frame {
  background: transparent;
  position: relative;
}

.display-shell.mobile .phone-shell {
  width: 100%;
  height: 100%;
  border-radius: 50px;
  padding: 12px;
  background: radial-gradient(120% 90% at 50% 0%, #3a3a3a 0%, #171717 54%, #0a0a0a 100%);
  border: 1px solid #2d2d2d;
  box-shadow: 0 26px 52px rgba(0, 0, 0, 0.5), 0 10px 20px rgba(0, 0, 0, 0.38), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  position: relative;
}

.display-shell.mobile .phone-screen {
  border-radius: 40px;
  overflow: hidden;
  background: #000;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.display-shell.mobile iframe {
  width: 100%;
  height: 100%;
}

.display-shell.mobile .phone-button {
  display: block;
}

.phone-button {
  position: absolute;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, #474747 0%, #191919 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.phone-button-volume-up {
  left: -4px;
  top: 144px;
  height: 52px;
}

.phone-button-volume-down {
  left: -4px;
  top: 210px;
  height: 52px;
}

.phone-button-power {
  right: -4px;
  top: 182px;
  height: 82px;
}
