/* ---- Two-column settings layout ---- */
.settings-layout {
  display: grid;
  grid-template-columns: 1fr 390px;
  gap: 24px;
  align-items: start;
}
/* preview-col just reserves space; the panel itself is fixed */
.preview-col { pointer-events: none; }

@media (max-width: 1080px) {
  .settings-layout { grid-template-columns: 1fr; }
  .preview-col { display: none; }
  .preview-panel {
    position: static !important;
    width: 100% !important;
    max-height: none !important;
    margin-bottom: 20px;
  }
}

/* flash width stops before the fixed preview panel */
.flash { position: relative; z-index: 60; margin-right: 380px; }
@media (max-width: 1080px) { .flash { margin-right: 0; } }

/* ---- Preview Panel — always fixed to viewport ---- */
.preview-panel {
  position: fixed;
  top: 28px;
  right: clamp(16px, 2.6vw, 44px);
  width: 370px;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  z-index: 40;
  pointer-events: all;
}
.preview-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.preview-title {
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Device buttons */
.dev-btns { display: flex; gap: 4px; }
.dev-btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 7px;
  cursor: pointer;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: all .15s;
  line-height: 0;
}
.dev-btn:hover { color: var(--text); border-color: var(--accent); }
.dev-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Viewport */
.dev-viewport { display: flex; justify-content: center; padding: 6px 0; }

/* ---- Phone 9:16 ---- */
.dev-viewport[data-dev="phone"] .dev-frame {
  width: 248px;
  aspect-ratio: 9/16;
  background: #1a1a2e;
  border: 3px solid #3a3a5c;
  border-radius: 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
}
.dev-viewport[data-dev="phone"] .dev-notch {
  width: 44px; height: 6px;
  background: #3a3a5c;
  border-radius: 0 0 6px 6px;
  margin: 0 auto 4px;
  flex: none;
}
.dev-viewport[data-dev="phone"] .dev-home {
  width: 30px; height: 4px;
  background: #3a3a5c;
  border-radius: 3px;
  margin: 4px auto 6px;
  flex: none;
}
.dev-viewport[data-dev="phone"] .dev-screen { flex: 1; overflow: hidden; }

/* ---- Tablet 4:3 ---- */
.dev-viewport[data-dev="tablet"] .dev-frame {
  width: 340px;
  aspect-ratio: 4/3;
  background: #1a1a2e;
  border: 3px solid #3a3a5c;
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
}
.dev-viewport[data-dev="tablet"] .dev-notch,
.dev-viewport[data-dev="tablet"] .dev-home { display: none !important; }
.dev-viewport[data-dev="tablet"] .dev-screen {
  width: 100%; height: 100%;
  border-radius: 6px;
  overflow: hidden;
}

/* ---- Desktop 16:9 ---- */
.dev-viewport[data-dev="desktop"] .dev-frame {
  width: 360px;
  display: flex;
  flex-direction: column;
}
.dev-viewport[data-dev="desktop"] .dev-notch,
.dev-viewport[data-dev="desktop"] .dev-home { display: none !important; }
.dev-viewport[data-dev="desktop"] .dev-screen {
  width: 360px;
  aspect-ratio: 16/9;
  background: #1a1a2e;
  border: 3px solid #3a3a5c;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
}
.dev-viewport[data-dev="desktop"] .dev-frame::after {
  content: '';
  display: block;
  width: 360px;
  height: 12px;
  background: #3a3a5c;
  border-radius: 0 0 8px 8px;
}

/* Screen content */
.dev-screen { position: relative; }

.prev-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-origin: center center;
  transition: transform .3s ease, filter .3s ease;
}

.prev-bg {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #12111e 0%, #1e1540 45%, #0e1628 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.prev-placeholder-txt {
  color: rgba(255,255,255,.2);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.prev-wm {
  position: absolute;
  padding: 2px 5px;
  background: rgba(255,255,255,.88);
  color: #111;
  font-size: 7px;
  font-weight: 700;
  border-radius: 3px;
  display: none;
  z-index: 2;
}
.prev-sub {
  position: absolute;
  left: 5%;
  right: 5%;
  text-align: center;
  font-weight: 600;
  display: none;
  z-index: 2;
  line-height: 1.3;
  padding: 2px 4px;
  border-radius: 3px;
  background: rgba(0,0,0,.3);
}

/* Badges */
.prev-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 11px;
  min-height: 22px;
}
.prev-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
}
.prev-badge.blue   { background: #dbeafe; color: #1d4ed8; }
.prev-badge.orange { background: #ffedd5; color: #c2410c; }
.prev-badge.purple { background: var(--accent-soft); color: var(--accent); }
.prev-badge.green  { background: #dcfce7; color: #15803d; }

@media (prefers-color-scheme: dark) {
  .prev-badge.blue   { background: #1e3a5f; color: #93c5fd; }
  .prev-badge.orange { background: #431407; color: #fb923c; }
  .prev-badge.green  { background: #14532d; color: #4ade80; }
}

.prev-note {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin: 8px 0 0;
}
