:root {
  --red: #d80b13;
  --deep-red: #7b0008;
  --paper: #fff8f8;
  --ink: #2a1518;
  --muted: #756166;
  --line: #efd0d3;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 16%, rgba(216, 11, 19, 0.22), transparent 26%),
    radial-gradient(circle at 80% 22%, rgba(255, 125, 134, 0.22), transparent 24%),
    linear-gradient(145deg, #f3d5d8, #fff8f9 46%, #ebc7cb);
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 72% 20%, rgba(255, 96, 106, 0.16), transparent 24%),
    rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
}

.brand,
.pane-title,
.orientation-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img,
.pane-title img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand p,
.brand h1,
.pane-title span,
.pane-title strong {
  display: block;
  margin: 0;
}

.brand p,
.pane-title span {
  color: var(--muted);
  font-size: 12px;
}

.brand h1 {
  color: var(--deep-red);
  font-size: 22px;
  line-height: 1.2;
}

.preview-header a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--red), var(--deep-red));
  text-decoration: none;
  font-weight: 800;
}

.preview-header-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
}

.preview-header-actions a:first-child {
  color: var(--deep-red);
  border: 1px solid rgba(216, 11, 19, 0.22);
  background: rgba(255, 255, 255, 0.9);
}

.preview-grid {
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
  min-height: calc(100vh - 84px);
}

.preview-grid.mobile-landscape {
  grid-template-columns: minmax(780px, 0.95fr) minmax(0, 1fr);
}

.mobile-pane,
.web-pane {
  min-width: 0;
}

.pane-title {
  height: 54px;
  margin-bottom: 12px;
}

.mobile-pane .pane-title {
  justify-content: space-between;
}

.pane-title strong {
  color: var(--deep-red);
  font-size: 16px;
}

.orientation-toggle {
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(239, 208, 211, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
}

.orientation-toggle button {
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  color: var(--deep-red);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.orientation-toggle button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--red), var(--deep-red));
  box-shadow: 0 8px 18px rgba(123, 0, 8, 0.2);
}

.phone-shell {
  position: relative;
  width: var(--phone-width, 390px);
  height: var(--phone-height, calc(100vh - 174px));
  min-height: var(--phone-min-height, 720px);
  margin: 0 auto;
  padding: 18px 10px 12px;
  border: 10px solid #fff8f9;
  border-radius: 36px;
  background: #fff8f9;
  box-shadow:
    0 30px 80px rgba(67, 13, 18, 0.28),
    inset 0 0 0 1px rgba(123, 0, 8, 0.08);
  cursor: grab;
  transition: width 180ms ease, height 180ms ease, min-height 180ms ease;
  user-select: none;
}

.phone-shell.dragging {
  cursor: grabbing;
}

.phone-shell.landscape {
  --phone-width: min(780px, calc(100vw - 48px));
  --phone-height: 390px;
  --phone-min-height: 390px;
}

.speaker {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 86px;
  height: 5px;
  border-radius: 999px;
  background: #edd3d6;
  transform: translateX(-50%);
  z-index: 2;
}

.desktop-shell {
  position: relative;
  height: calc(100vh - 174px);
  min-height: 720px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    radial-gradient(circle at 18% 14%, rgba(216, 11, 19, 0.12), transparent 24%),
    #fff8f9;
  box-shadow: 0 24px 70px rgba(67, 13, 18, 0.14);
  overflow: hidden;
}

iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.phone-shell iframe {
  border-radius: 24px;
  scrollbar-width: none;
}

.phone-shell iframe::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.desktop-shell iframe {
  width: 1280px;
  height: 1020px;
  transform: scale(var(--desktop-scale, 0.72));
  transform-origin: 0 0;
}

@media (max-width: 1100px) {
  .preview-grid {
    grid-template-columns: 1fr;
  }

  .phone-shell {
    width: min(390px, 100%);
  }

  .phone-shell.landscape {
    width: min(780px, 100%);
  }
}

@media (max-width: 760px) {
  .preview-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .brand h1 {
    font-size: 18px;
  }

  .preview-header-actions {
    width: 100%;
  }

  .preview-header-actions a {
    flex: 1;
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
    text-align: center;
  }
}
