:root {
  --page-bg: #F6F7F9;
  --surface: #FFFFFF;
  --surface-soft: #F5F6F8;
  --surface-hover: #EFF3F8;
  --text-primary: #000000;
  --text-secondary: #667085;
  --text-muted: #98A2B3;
  --primary: #2287FF;
  --primary-hover: #0F76EF;
  --primary-soft: #EEF6FF;
  --border: #E8E9EB;
  --border-strong: #D7DBE0;
  --danger: #FF3B30;
  --success: #13A36C;
  --shadow-soft: 0 14px 40px rgba(15, 23, 42, 0.08);
  --phone-height: min(calc(100vh - 142px), 780px);
  --phone-width: calc(var(--phone-height) * 9 / 19.5);
  --phone-radius: calc(var(--phone-width) * 0.145);
  --preview-text-color: #FFFFFF;
  --preview-grid-color: rgba(255, 255, 255, 0.24);
  --preview-icon-size: 56px;
  --preview-icon-radius: 16px;
  --dock-bg-color: #FFFFFF;
  --dock-opacity: 0.4;
  --dock-radius: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text-primary);
  background: var(--page-bg);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  min-width: 1080px;
  height: 100%;
  overflow: hidden;
}

body {
  color: var(--text-primary);
  background: var(--page-bg);
  font-size: 13px;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
select,
input[type="color"],
input[type="range"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid rgba(34, 135, 255, 0.45);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

svg {
  display: block;
}

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

.app-shell {
  display: flex;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.tool-rail {
  width: 76px;
  flex: 0 0 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 20;
}

.tool-brand {
  width: 40px;
  height: 40px;
  margin: 16px 0 18px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #FFFFFF;
  background: var(--text-primary);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.03em;
}

.tool-nav {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.tool-button {
  width: 60px;
  min-height: 58px;
  padding: 7px 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  transition: color 160ms ease, background 160ms ease;
}

.tool-button svg {
  width: 19px;
  height: 19px;
  stroke-width: 1.8;
}

.tool-button span {
  width: 100%;
  overflow: hidden;
  font-size: 10px;
  line-height: 1.15;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-button:hover {
  color: var(--text-primary);
  background: var(--surface-soft);
}

.tool-button.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.app-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  position: relative;
  z-index: 18;
  height: 66px;
  flex: 0 0 66px;
  padding: 0 18px 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.topbar-heading {
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-eyebrow {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.theme-name-wrap {
  min-width: 0;
}

.theme-name-input {
  width: 180px;
  min-width: 0;
  padding: 6px 8px;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 650;
}

.theme-name-input:hover {
  background: var(--surface-soft);
}

.theme-name-input:focus {
  background: var(--surface);
  border-color: var(--border-strong);
  outline: none;
}

.save-status {
  display: none;
  padding: 4px 8px;
  color: var(--text-secondary);
  background: var(--surface-soft);
  border-radius: 999px;
  font-size: 11px;
  white-space: nowrap;
}

.save-status.visible {
  display: inline-flex;
}

.save-status.success {
  color: var(--success);
  background: #ECFAF4;
}

.save-status.error {
  color: var(--danger);
  background: #FFF1F0;
}

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

.topbar-actions .icon-button.active {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: rgba(34, 135, 255, 0.28);
}

.icon-text-button,
.primary-button,
.icon-button,
.secondary-button {
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.icon-text-button {
  padding: 0 11px;
}

.icon-button {
  width: 34px;
  padding: 0;
}

.icon-text-button svg,
.primary-button svg,
.icon-button svg,
.secondary-button svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

.icon-text-button:hover,
.icon-button:hover,
.secondary-button:hover {
  background: var(--surface-soft);
  border-color: var(--border-strong);
}

.icon-text-button.active {
  color: var(--primary);
  border-color: rgba(34, 135, 255, 0.28);
  background: var(--primary-soft);
}

.primary-button {
  padding: 0 14px;
  border-color: var(--primary);
  color: #FFFFFF;
  background: var(--primary);
}

.primary-button:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.secondary-button {
  padding: 0 14px;
  color: var(--text-secondary);
  background: var(--surface);
}

.secondary-button:hover {
  color: var(--text-primary);
}

.primary-button:active,
.icon-text-button:active,
.icon-button:active,
.secondary-button:active {
  transform: translateY(1px);
}

.full-width {
  width: 100%;
}

.server-picker {
  height: 34px;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}

.server-picker[hidden] {
  display: none;
}

.server-picker select {
  width: 122px;
  height: 32px;
  padding: 0 24px 0 10px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 0;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.server-picker .icon-button {
  width: 31px;
  height: 32px;
  border-width: 0 0 0 1px;
  border-radius: 0;
}

#widget-iframe {
  width: 100%;
  height: 100%;
  flex: 1;
  border: 0;
  background: var(--surface);
}

.preview-layout {
  min-height: 0;
  flex: 1;
  display: flex;
  overflow: hidden;
}

.workspace {
  position: relative;
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--page-bg);
}

.workspace-heading {
  position: relative;
  z-index: 5;
  padding: 20px 24px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.workspace-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.14em;
}

.workspace-heading h1 {
  color: var(--text-primary);
  font-size: 19px;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: 0;
}

.workspace-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-top: 7px;
  color: var(--text-secondary);
  font-size: 11px;
}

.meta-divider {
  width: 1px;
  height: 11px;
  background: var(--border-strong);
}

.phone-stage {
  position: relative;
  min-height: 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px 24px;
}

.phone-shadow {
  position: absolute;
  top: calc(50% + var(--phone-height) * 0.43);
  left: 50%;
  width: calc(var(--phone-width) * 0.9);
  height: 32px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.16);
  filter: blur(18px);
  transform: translateX(-50%);
}

.phone-frame {
  position: relative;
  width: calc(var(--phone-width) + 14px);
  height: calc(var(--phone-height) + 14px);
  padding: 7px;
  border-radius: calc(var(--phone-radius) + 5px);
  background: linear-gradient(145deg, #3B3D42 0%, #0A0A0B 45%, #33353A 100%);
  box-shadow: var(--shadow-soft), 0 3px 0 rgba(255, 255, 255, 0.08) inset;
  overflow: hidden;
}

.phone-screen {
  position: relative;
  width: var(--phone-width);
  height: var(--phone-height);
  overflow: hidden;
  border-radius: var(--phone-radius);
  color: var(--preview-text-color);
  background: #101112;
  isolation: isolate;
}

.wallpaper {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.phone-screen.no-wallpaper::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  background:
    radial-gradient(circle at 78% 18%, rgba(34, 135, 255, 0.2), transparent 31%),
    radial-gradient(circle at 20% 76%, rgba(255, 122, 89, 0.16), transparent 35%),
    #171819;
}

.status-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 12;
  height: 7.5%;
  padding: 0 7.5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--preview-text-color);
  pointer-events: none;
}

.status-time {
  font-size: calc(var(--phone-width) * 0.045);
  line-height: 1;
  font-weight: 650;
}

.status-icons {
  display: flex;
  align-items: center;
  gap: calc(var(--phone-width) * 0.018);
}

.status-icons svg {
  width: calc(var(--phone-width) * 0.045);
  height: calc(var(--phone-width) * 0.045);
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.4;
}

.status-icons svg:nth-child(2) {
  fill: none;
}

.dynamic-island {
  position: absolute;
  top: 1.7%;
  left: 50%;
  z-index: 13;
  width: 29%;
  height: 3.9%;
  border-radius: 999px;
  background: #030303;
  transform: translateX(-50%);
  pointer-events: none;
}

.home-grid {
  position: absolute;
  top: 9.5%;
  left: 8%;
  right: 8%;
  height: 68.5%;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
  column-gap: calc(var(--phone-width) * 0.018);
  row-gap: calc(var(--phone-width) * 0.012);
}

.home-slot,
.dock-slot {
  min-width: 0;
  min-height: 0;
  pointer-events: none;
}

.home-slot {
  width: 100%;
  max-width: var(--preview-icon-size);
  aspect-ratio: 1;
  align-self: start;
  justify-self: center;
  border: 1px dashed var(--preview-grid-color);
  border-radius: var(--preview-icon-radius);
  background: rgba(255, 255, 255, 0.025);
  opacity: 1;
  transition: opacity 160ms ease, border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.dock-slot {
  width: var(--preview-icon-size);
  max-width: 82%;
  aspect-ratio: 1;
  justify-self: center;
  align-self: center;
  border: 1px dashed var(--preview-grid-color);
  border-radius: var(--preview-icon-radius);
}

.phone-screen.grid-hidden .home-slot,
.phone-screen.grid-hidden .dock-slot {
  opacity: 0;
}

.home-slot.drop-valid,
.dock-slot.drop-valid {
  border-color: var(--primary);
  background: rgba(34, 135, 255, 0.22);
  transform: scale(0.96);
}

.screen-item {
  position: relative;
  z-index: 5;
  min-width: 0;
  min-height: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.screen-item:active {
  cursor: grabbing;
}

.app-item {
  width: 100%;
  max-width: var(--preview-icon-size);
  align-self: start;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--phone-width) * 0.012);
}

.app-icon {
  width: var(--preview-icon-size);
  height: auto;
  max-width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--preview-icon-radius);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

.app-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.app-label {
  width: calc(var(--phone-width) * 0.19);
  overflow: hidden;
  color: var(--preview-text-color);
  font-size: calc(var(--phone-width) * 0.034);
  line-height: 1.1;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
  pointer-events: none;
}

.phone-screen.labels-hidden .app-label {
  visibility: hidden;
}

.widget-item {
  width: 100%;
  align-self: start;
  justify-self: stretch;
  border-radius: calc(var(--phone-width) * 0.05);
  overflow: hidden;
}

.widget-item[data-size-class="2x2"] {
  aspect-ratio: 1;
}

.widget-item[data-size-class="4x2"] {
  aspect-ratio: 2 / 1;
}

.widget-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.screen-item.drag-source {
  opacity: 0.28;
}

.phone-screen.grid-hidden .screen-item,
.phone-screen.grid-hidden .widget-item {
  outline: none;
}

.screen-item.drop-valid {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.screen-item.drop-displace {
  outline: 2px dashed rgba(34, 135, 255, 0.72);
  outline-offset: 3px;
}

.screen-item.selected {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
  border-radius: var(--preview-icon-radius);
}

.screen-label-input {
  width: calc(var(--phone-width) * 0.21);
  min-width: 0;
  height: 18px;
  padding: 0 3px;
  color: var(--preview-text-color);
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 4px;
  font-size: calc(var(--phone-width) * 0.032);
  line-height: 1;
  text-align: center;
  outline: none;
}

.item-delete {
  position: absolute;
  top: -5px;
  right: -5px;
  z-index: 20;
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  color: #FFFFFF;
  background: var(--danger);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.82);
  transition: opacity 140ms ease, transform 140ms ease;
}

.item-delete svg {
  width: 10px;
  height: 10px;
  stroke-width: 2.8;
}

.screen-item:hover .item-delete,
.screen-item.selected .item-delete {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.widget-item .item-delete {
  top: 6px;
  right: 6px;
}

.page-indicator {
  position: absolute;
  left: 50%;
  bottom: 14.5%;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: calc(var(--phone-width) * 0.018);
  transform: translateX(-50%);
  pointer-events: none;
}

.page-dot {
  width: calc(var(--phone-width) * 0.017);
  height: calc(var(--phone-width) * 0.017);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.42);
}

.page-dot.active {
  background: #FFFFFF;
}

.page-indicator.hidden {
  display: none;
}

.dock-area {
  position: absolute;
  left: 5.5%;
  right: 5.5%;
  bottom: 3.3%;
  z-index: 4;
  height: 11.8%;
}

.dock-area::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  background: var(--dock-bg-color);
  border-radius: var(--dock-radius);
  opacity: var(--dock-opacity);
  pointer-events: none;
}

.dock-area.dock-disabled::before {
  display: none;
}

.dock-grid {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 0 3%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  column-gap: calc(var(--phone-width) * 0.018);
}

.dock-grid .app-item {
  width: var(--preview-icon-size);
  max-width: 88%;
  justify-self: center;
  align-self: center;
}

.dock-grid .app-icon {
  width: 100%;
}

.dock-grid .app-label {
  display: none;
}

.drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.24);
  opacity: 0.9;
  pointer-events: none;
  will-change: transform;
}

.drag-ghost img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.drag-ghost.widget-ghost img {
  object-fit: contain;
}

.inspector {
  width: 320px;
  flex: 0 0 320px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 16;
}

.inspector-tabs {
  height: 53px;
  flex: 0 0 53px;
  padding: 0 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--border);
}

.inspector-tab {
  position: relative;
  min-width: 0;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.inspector-tab::after {
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 2px;
  content: "";
  background: transparent;
  border-radius: 2px 2px 0 0;
}

.inspector-tab svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.8;
}

.inspector-tab:hover {
  color: var(--text-primary);
}

.inspector-tab.active {
  color: var(--primary);
}

.inspector-tab.active::after {
  background: var(--primary);
}

.tab-count {
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: var(--surface-soft);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
}

.inspector-tab.active .tab-count {
  color: var(--primary);
  background: var(--primary-soft);
}

.inspector-body {
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.asset-selection-bar {
  flex: 0 0 auto;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 7px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.asset-selection-bar[hidden] {
  display: none;
}

.asset-selection-bar > span {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-selection-bar .mini-text-button {
  width: auto;
  white-space: nowrap;
}

.asset-selection-bar .mini-text-button.danger {
  color: var(--danger);
}

.asset-selection-bar .mini-text-button:disabled {
  color: var(--text-muted);
  opacity: 0.55;
}

.tab-panel {
  display: none;
  width: 100%;
  height: 100%;
  padding: 20px 18px 28px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #D5D9DF transparent;
}

.tab-panel.active {
  display: block;
}

.panel-heading {
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-heading h2 {
  margin-bottom: 4px;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.3;
  font-weight: 650;
}

.panel-heading p {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
}

.settings-heading {
  margin-bottom: 12px;
}

.round-add-button {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--primary);
  background: var(--surface);
}

.round-add-button:hover {
  border-color: rgba(34, 135, 255, 0.4);
  background: var(--primary-soft);
}

.round-add-button[aria-pressed="true"] {
  color: var(--primary);
  border-color: rgba(34, 135, 255, 0.42);
  background: var(--primary-soft);
}

.round-add-button svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

.asset-grid {
  display: grid;
  gap: 14px 8px;
}

.app-asset-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.widget-asset-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 10px;
}

.asset-card {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  border-radius: 8px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.asset-card.selection-mode {
  cursor: pointer;
}

.asset-card.selected-for-delete {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.asset-card.selected-for-delete .asset-thumb {
  border-color: rgba(34, 135, 255, 0.5);
  background: var(--primary-soft);
}

.asset-select-checkbox {
  position: absolute;
  top: 5px;
  left: 5px;
  z-index: 3;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: transparent;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.22);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.14);
  pointer-events: none;
}

.asset-select-checkbox svg {
  width: 13px;
  height: 13px;
  stroke-width: 3;
}

.asset-card.selected-for-delete .asset-select-checkbox {
  color: #FFFFFF;
  background: var(--primary);
  border-color: var(--primary);
}

.asset-card.selection-mode .asset-delete {
  display: none;
}

.asset-card.selection-mode .asset-label-input {
  pointer-events: none;
}

.asset-card.widget-card {
  align-items: stretch;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px;
  background: var(--surface-soft);
}

.asset-card:hover .asset-thumb,
.asset-card.widget-card:hover {
  border-color: rgba(34, 135, 255, 0.38);
  background: var(--primary-soft);
}

.asset-card:active {
  cursor: grabbing;
}

.asset-thumb {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  transition: border-color 150ms ease, background 150ms ease;
}

.widget-card .asset-thumb {
  width: 100%;
  height: auto;
  max-height: 168px;
  aspect-ratio: var(--asset-ratio, 1);
  border-radius: 6px;
  background: #FFFFFF;
}

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

.widget-card .asset-thumb img {
  object-fit: cover;
}

.asset-label-input {
  width: 100%;
  min-width: 0;
  padding: 2px 3px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-primary);
  background: transparent;
  font-size: 11px;
  line-height: 1.3;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: text;
  -webkit-user-select: text;
}

.asset-label-input:hover {
  border-color: var(--border);
  background: var(--surface);
}

.asset-label-input:focus {
  border-color: var(--primary);
  background: var(--surface);
  outline: none;
}

.widget-name {
  width: 100%;
  padding: 0 2px;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 550;
  line-height: 1.35;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.widget-card .asset-label-input {
  font-size: 10px;
}

.asset-delete {
  position: absolute;
  top: -6px;
  right: -4px;
  z-index: 2;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 2px solid #FFFFFF;
  border-radius: 50%;
  color: #FFFFFF;
  background: var(--danger);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.75);
  transition: opacity 140ms ease, transform 140ms ease;
}

.widget-card .asset-delete {
  top: 3px;
  right: 3px;
}

.asset-delete svg {
  width: 10px;
  height: 10px;
  stroke-width: 2.6;
}

.asset-card:hover .asset-delete,
.asset-card:focus-within .asset-delete {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.asset-add-card {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--text-muted);
  background: var(--surface);
}

.asset-add-card:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.asset-add-card svg {
  width: 21px;
  height: 21px;
  stroke-width: 1.8;
}

.empty-library {
  grid-column: 1 / -1;
  min-height: 170px;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
}

.empty-library svg {
  width: 26px;
  height: 26px;
  stroke-width: 1.4;
}

.empty-library strong {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
}

.empty-library span {
  max-width: 190px;
  font-size: 11px;
  line-height: 1.5;
}

.setting-group {
  border-top: 1px solid var(--border);
}

.setting-group:last-of-type {
  border-bottom: 1px solid var(--border);
}

.setting-group summary {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
}

.setting-group summary::-webkit-details-marker {
  display: none;
}

.setting-group summary > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.setting-group summary svg {
  width: 15px;
  height: 15px;
  color: var(--text-secondary);
  stroke-width: 1.8;
}

.setting-group summary .summary-chevron {
  transition: transform 160ms ease;
}

.setting-group[open] summary .summary-chevron {
  transform: rotate(180deg);
}

.setting-group-body {
  padding: 0 0 13px;
}

.setting-row {
  min-height: 42px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 6px;
  color: var(--text-primary);
}

.setting-row + .setting-row {
  margin-top: 4px;
}

.setting-row:hover {
  background: var(--surface-soft);
}

.setting-row > span:first-child {
  min-width: 0;
  font-size: 12px;
}

.wallpaper-setting {
  min-height: 54px;
}

.wallpaper-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wallpaper-thumbnail {
  width: 34px;
  height: 44px;
  flex: 0 0 34px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-soft);
}

.wallpaper-thumbnail.empty {
  display: grid;
  place-items: center;
  color: var(--text-muted);
}

.wallpaper-thumbnail.empty svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.7;
}

.mini-text-button {
  height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 10px;
}

.mini-text-button:hover:not(:disabled) {
  color: var(--danger);
  border-color: rgba(255, 59, 48, 0.28);
  background: #FFF5F4;
}

.mini-text-button svg {
  width: 12px;
  height: 12px;
}

.switch {
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 38px;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #D8DCE2;
  transition: background 160ms ease;
}

.switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  content: "";
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
  transition: transform 160ms ease;
}

.switch input:checked + .switch-track {
  background: var(--primary);
}

.switch input:checked + .switch-track::after {
  transform: translateX(16px);
}

.color-setting {
  align-items: center;
}

.color-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-control input[type="color"] {
  width: 25px;
  height: 25px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: transparent;
}

.color-control input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-control input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 50%;
}

.hex-input {
  width: 78px;
  height: 28px;
  padding: 0 6px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  text-align: center;
}

.hex-input:focus {
  border-color: var(--primary);
  outline: none;
}

.range-setting {
  align-items: center;
}

.range-control {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.range-control input[type="range"] {
  width: 116px;
  height: 4px;
  border-radius: 999px;
  outline: none;
  appearance: none;
  background: linear-gradient(to right, var(--primary) var(--range-progress, 50%), #D8DCE2 var(--range-progress, 50%));
}

.range-control input[type="range"]::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  border: 2px solid #FFFFFF;
  border-radius: 50%;
  appearance: none;
  background: var(--primary);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.24);
}

.range-control output {
  width: 38px;
  color: var(--text-secondary);
  font-size: 10px;
  text-align: right;
}

.compact-select {
  width: 126px;
  height: 30px;
  padding: 0 28px 0 9px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  font-size: 11px;
}

.filename-setting {
  align-items: flex-start;
}

.text-setting-input {
  width: 150px;
  height: 30px;
  min-width: 0;
  padding: 0 8px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 11px;
  outline: none;
}

.text-setting-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(34, 135, 255, 0.1);
}

.dock-sub-settings {
  display: none;
}

.dock-sub-settings.active {
  display: block;
}

.settings-footer {
  padding-top: 18px;
}

.floating-panel {
  position: fixed;
  z-index: 6000;
  width: 224px;
  padding: 7px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
}

.floating-panel[hidden] {
  display: none;
}

.item-action-menu {
  width: 214px;
}

.floating-panel-heading {
  min-width: 0;
  padding: 5px 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  border-bottom: 1px solid var(--border);
}

.floating-panel-heading > img {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  object-fit: cover;
  border-radius: 7px;
  background: var(--surface-soft);
}

.floating-panel-heading > div {
  min-width: 0;
  flex: 1;
}

.floating-panel-heading strong,
.floating-panel-heading span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floating-panel-heading strong {
  font-size: 12px;
  font-weight: 650;
}

.floating-panel-heading span {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 10px;
}

.floating-menu-list {
  padding-top: 6px;
}

.floating-menu-item {
  width: 100%;
  height: 36px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-primary);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 12px;
  text-align: left;
}

.floating-menu-item:hover,
.floating-menu-item:focus-visible {
  background: var(--surface-soft);
  outline: none;
}

.floating-menu-item.danger {
  color: var(--danger);
}

.floating-menu-item.danger:hover,
.floating-menu-item.danger:focus-visible {
  background: #FFF1F0;
}

.floating-menu-item svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.8;
}

.asset-picker {
  width: 304px;
  max-height: min(520px, calc(100vh - 24px));
  overflow: auto;
}

.picker-heading {
  padding-top: 3px;
}

.floating-close-button {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.floating-close-button:hover {
  color: var(--text-primary);
  background: var(--surface-soft);
}

.floating-close-button svg {
  width: 15px;
  height: 15px;
}

.picker-asset-grid {
  padding: 10px 2px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.picker-asset-grid.widget-picker-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.picker-asset-card {
  min-width: 0;
  padding: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 7px;
}

.picker-asset-card:hover {
  color: var(--text-primary);
  border-color: var(--border);
  background: var(--surface-soft);
}

.picker-asset-card.active {
  border-color: rgba(34, 135, 255, 0.34);
  background: var(--primary-soft);
}

.picker-asset-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  background: var(--surface-soft);
}

.picker-asset-card span {
  width: 100%;
  overflow: hidden;
  font-size: 9px;
  line-height: 1.3;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-upload-button {
  width: 100%;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px dashed rgba(34, 135, 255, 0.4);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
}

.picker-upload-button:hover {
  border-color: var(--primary);
  background: #E5F1FF;
}

.picker-upload-button svg {
  width: 15px;
  height: 15px;
}

.toast-container {
  position: fixed;
  top: 82px;
  right: 20px;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 220px;
  max-width: 360px;
  padding: 11px 13px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.14);
  pointer-events: auto;
  animation: toast-in 180ms ease-out both;
}

.toast svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin-top: 1px;
}

.toast.success svg {
  color: var(--success);
}

.toast.error svg {
  color: var(--danger);
}

.toast.info svg {
  color: var(--primary);
}

.toast-message {
  flex: 1;
  font-size: 12px;
  line-height: 1.45;
}

.toast-close {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 4px;
  color: var(--text-muted);
  background: transparent;
}

.toast-close:hover {
  color: var(--text-primary);
  background: var(--surface-soft);
}

.toast-close svg {
  width: 12px;
  height: 12px;
  margin: 0;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  background: rgba(246, 247, 249, 0.84);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.drop-overlay[hidden] {
  display: none;
}

.drop-overlay-content {
  width: 340px;
  height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px dashed var(--primary);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.drop-overlay-content svg {
  width: 32px;
  height: 32px;
  color: var(--primary);
  stroke-width: 1.5;
}

.drop-overlay-content strong {
  color: var(--text-primary);
  font-size: 14px;
}

.drop-overlay-content span {
  font-size: 11px;
}

.phone-screen.system-ui-hidden .status-bar,
.phone-screen.system-ui-hidden .dynamic-island {
  visibility: hidden;
}

.phone-screen.exporting {
  border-radius: 0 !important;
  background: #101112;
}

.phone-screen.exporting .status-bar,
.phone-screen.exporting .dynamic-island,
.phone-screen.exporting .home-slot,
.phone-screen.exporting .dock-slot,
.phone-screen.exporting .item-delete,
.phone-screen.exporting .screen-label-input {
  visibility: hidden !important;
}

.phone-screen.exporting .screen-item {
  outline: none !important;
  opacity: 1 !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 7000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(4px);
}

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

.theme-panel-dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 40px));
  padding: 22px;
  overflow-y: auto;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
}

.theme-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.theme-panel-heading h2 {
  margin-top: 4px;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 680;
}

.the-panel-new-button {
  width: 100%;
  height: 46px;
  margin: 18px 0 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px dashed rgba(34, 135, 255, 0.45);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 650;
}

.the-panel-new-button:hover {
  border-color: var(--primary);
  background: #E5F1FF;
}

.the-panel-new-button svg {
  width: 17px;
  height: 17px;
}

.theme-project-section + .theme-project-section {
  margin-top: 24px;
}

.theme-section-heading {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.theme-section-heading h3 {
  font-size: 13px;
  font-weight: 650;
}

.theme-section-heading > span {
  color: var(--text-muted);
  font-size: 10px;
}

.theme-project-list {
  display: flex;
  flex-direction: column;
}

.theme-project-row {
  min-height: 62px;
  padding: 10px 0;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.theme-project-row.current {
  background: linear-gradient(90deg, var(--primary-soft), transparent 75%);
}

.theme-project-marker {
  width: 34px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid rgba(34, 135, 255, 0.18);
  border-radius: 6px;
}

.theme-project-marker svg {
  width: 16px;
  height: 16px;
}

.theme-project-copy {
  min-width: 0;
}

.theme-project-copy strong,
.theme-project-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-project-copy strong {
  font-size: 12px;
  font-weight: 650;
}

.theme-project-copy span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10px;
}

.theme-project-action {
  height: 30px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 10px;
}

.theme-project-action:hover {
  color: var(--primary);
  border-color: rgba(34, 135, 255, 0.35);
  background: var(--primary-soft);
}

.theme-project-action.danger {
  width: 30px;
  padding: 0;
  color: var(--text-muted);
}

.theme-project-action.danger:hover {
  color: var(--danger);
  border-color: rgba(255, 59, 48, 0.3);
  background: #FFF5F4;
}

.theme-project-action svg {
  width: 13px;
  height: 13px;
}

.theme-project-empty {
  padding: 22px 8px;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}

.external-tool-active .topbar-actions {
  display: none;
}

.is-dragging,
.is-dragging * {
  cursor: grabbing !important;
}

@media (max-width: 1280px) {
  .topbar {
    padding-right: 12px;
    gap: 12px;
  }

  .topbar-eyebrow {
    display: none;
  }

  .theme-name-input {
    width: 150px;
  }

  .icon-text-button {
    padding: 0 9px;
  }

  .server-picker select {
    width: 105px;
  }

  .inspector {
    width: 304px;
    flex-basis: 304px;
  }
}

@media (max-width: 1120px) {
  .tool-rail {
    width: 68px;
    flex-basis: 68px;
  }

  .tool-button {
    width: 54px;
  }

  .theme-name-input {
    width: 132px;
  }

  .icon-text-button span {
    display: none;
  }

  .icon-text-button {
    width: 34px;
    padding: 0;
  }

  .server-picker select {
    width: 94px;
  }

  .primary-button {
    padding: 0 10px;
  }
}
