.mobile-preview {
  --preview-width: 390px;
  --preview-height: 844px;
  --preview-scale: 1;
  min-width: 0;
}

.mobile-preview-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 5px 18px rgba(15, 23, 42, 0.06);
}

.mobile-preview-control-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.mobile-preview-control-group-right {
  justify-content: flex-end;
}

.mobile-preview-toolbar-spacer {
  flex: 1 1 auto;
}

.mobile-preview-divider {
  width: 1px;
  height: 28px;
  margin: 0 2px;
  background: #dbe3ef;
}

.mobile-preview-button {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #ffffff;
  color: #334155;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.mobile-preview-button:hover {
  border-color: #94a3b8;
  background: #f8fafc;
  color: #0f172a;
}

.mobile-preview-button.is-active {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.mobile-preview-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 10px;
  color: #64748b;
  font-size: 12px;
}

.mobile-preview-info > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.mobile-preview-info strong {
  color: #0f172a;
  font-size: 14px;
}

.mobile-preview-scale {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-weight: 800;
}

.mobile-preview-workspace {
  position: relative;
  height: clamp(620px, calc(100vh - 250px), 980px);
  min-height: 620px;
  overflow: auto;
  border: 1px solid #dbe3ef;
  border-radius: 18px;
  background:
    linear-gradient(45deg, rgba(148, 163, 184, 0.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, 0.08) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.08) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.08) 75%),
    #eef2f7;
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.mobile-preview-stage {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-width: 100%;
  min-height: 100%;
  padding: 28px;
  box-sizing: border-box;
}

.mobile-preview-phone-slot {
  position: relative;
  flex: 0 0 auto;
  transition: width 0.2s ease, height 0.2s ease;
}

.mobile-preview-phone {
  position: absolute;
  top: 0;
  left: 50%;
  flex: 0 0 auto;
  width: var(--preview-width);
  height: var(--preview-height);
  padding: 9px;
  border: 2px solid #1e293b;
  border-radius: 34px;
  background: #0f172a;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.28);
  box-sizing: content-box;
  transform: translateX(-50%) scale(var(--preview-scale));
  transform-origin: top center;
  transition: width 0.2s ease, height 0.2s ease, transform 0.2s ease;
}

.mobile-preview-phone-speaker {
  position: absolute;
  z-index: 5;
  top: 14px;
  left: 50%;
  width: 64px;
  height: 5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.75);
  transform: translateX(-50%);
  pointer-events: none;
}

.mobile-preview-viewport {
  position: relative;
  width: var(--preview-width);
  height: var(--preview-height);
  overflow: hidden;
  border-radius: 25px;
  background: #ffffff;
}

.mobile-preview-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.mobile-preview-safe-area {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.mobile-preview-safe-top,
.mobile-preview-safe-bottom {
  position: absolute;
  left: 0;
  right: 0;
  border-color: rgba(239, 68, 68, 0.72);
  background: rgba(239, 68, 68, 0.06);
}

.mobile-preview-safe-top {
  top: 0;
  height: 47px;
  border-bottom: 1px dashed rgba(239, 68, 68, 0.72);
}

.mobile-preview-safe-top span {
  position: absolute;
  right: 8px;
  bottom: 4px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.86);
  color: #b91c1c;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.mobile-preview-safe-bottom {
  bottom: 0;
  height: 34px;
  border-top: 1px dashed rgba(239, 68, 68, 0.72);
}

.mobile-preview-safe-area[hidden] {
  display: none;
}

.mobile-preview-note {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.5;
}

@media (max-width: 1100px) {
  .mobile-preview-toolbar-spacer {
    display: none;
  }

  .mobile-preview-control-group-right {
    margin-left: auto;
  }
}

@media (max-width: 760px) {
  .mobile-preview-workspace {
    min-height: 560px;
    height: 70vh;
  }

  .mobile-preview-divider {
    display: none;
  }

  .mobile-preview-control-group,
  .mobile-preview-control-group-right {
    width: 100%;
    margin-left: 0;
  }

  .mobile-preview-button {
    flex: 1 1 auto;
  }

  .mobile-preview-info,
  .mobile-preview-info > div:first-child,
  .mobile-preview-note {
    align-items: flex-start;
    flex-direction: column;
  }
}
