/* 外壳样式。目标站点的 CSS 全部活在 #mirror 这个 iframe 里，
   和这里天然隔离 —— 这也是用 iframe 而不是直接挂在本文档上的原因：
   站点的 body{...} / *{...} 规则会把我们自己的 UI 一起改掉。 */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #14161a;
  color: #e6e8ec;
  font: 14px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------- 可选工具栏 */

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #1b1e24;
  border-bottom: 1px solid #262a32;
  flex: 0 0 auto;
}

.bar[hidden] { display: none; }

.nav { display: flex; gap: 2px; }

.icon {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #c8ccd4;
  font-size: 15px;
  cursor: pointer;
}

.icon:hover { background: #272b33; }
.icon:disabled { opacity: .35; cursor: default; }

.url {
  flex: 1;
  height: 30px;
  padding: 0 10px;
  border: 1px solid #2d323b;
  border-radius: 6px;
  background: #14161a;
  color: #e6e8ec;
  font-size: 13px;
  outline: none;
}

.url:focus { border-color: #4f9cf9; }

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

.stats { color: #6d7480; font-size: 11px; font-variant-numeric: tabular-nums; }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d9534f;
}

.dot.on { background: #4cae4c; }

/* ---------------------------------------------------------- 镜像 */

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: #fff;
}

#mirror, #mirror-previous {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

/* 还没揭幕时先藏起来：重建过程中会有半成品的一两帧 */
#mirror.hidden { visibility: hidden; }
#mirror.staging { position: absolute; inset: 0; pointer-events: none; }
#mirror-previous { pointer-events: none; }

/* ---------------------------------------------------------- 遮罩 / 提示 */

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #14161a;
  color: #8b929e;
  transition: opacity .25s;
  z-index: 5;
}

.overlay[hidden] { display: none; }
.overlay p { margin: 0; font-size: 14px; }
.overlay.compact {
  inset: auto 12px 12px;
  flex-direction: row;
  padding: 12px;
  border-radius: 8px;
}
.overlay.compact .spinner { display: none; }

#btn-retry {
  padding: 9px 20px;
  border: 1px solid #6d7480;
  border-radius: 6px;
  background: #272b33;
  color: #e6e8ec;
  font: inherit;
  cursor: pointer;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #2d323b;
  border-top-color: #4f9cf9;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
  pointer-events: none;
}

.toast {
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(20, 22, 26, .92);
  color: #e6e8ec;
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
  animation: rise .2s ease-out;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
