/* =========================================================
   tools/extras.css — 选择转盘 / 抛硬币 / 图片混淆
   ========================================================= */

/* ---------- 选择转盘 ---------- */
.wheel-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#wheel-canvas {
  width: 100%;
  max-width: 440px;
  height: auto;
  border-radius: 50%;
  box-shadow: var(--shadow-glass);
}
.wheel-pointer {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 22px solid var(--ink);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
  z-index: 2;
}
.wheel-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow: auto;
  margin: 12px 0;
}
.wheel-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--r-md);
  background: var(--bg-elev);
  border: 1px solid var(--line);
}
.wheel-option__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.wheel-option__text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.wheel-option__del {
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1;
}
.wheel-add-row {
  display: flex;
  gap: 8px;
}
.wheel-add-row .input {
  flex: 1;
}
.wheel-result__text {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 4px;
}

/* ---------- 抛硬币 ---------- */
.tool-main--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 24px 0;
}
.coin-stage {
  width: 200px;
  height: 200px;
  perspective: 900px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.coin {
  position: relative;
  width: 180px;
  height: 180px;
  transform-style: preserve-3d;
  transition: transform 2.4s cubic-bezier(0.2, 0.6, 0.3, 1);
}
.coin__face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  font-weight: 700;
  border-radius: 50%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 6px solid rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 0.08), 0 10px 24px rgba(0, 0, 0, 0.18);
}
.coin__face--front {
  background: linear-gradient(145deg, #fde68a, #f59e0b);
  color: #92400e;
}
.coin__face--back {
  background: linear-gradient(145deg, #e5e7eb, #9ca3af);
  color: #374151;
  transform: rotateY(180deg);
}
.coin-result {
  font-size: 24px;
  font-weight: 600;
  min-height: 30px;
  color: var(--ink);
}
.coin-stats {
  font-size: 13px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}
.coin-btn-row {
  justify-content: center;
}

/* ---------- 图片加密 / 图片混淆（共用的预览样式） ---------- */
#scramble-preview,
#gilbert-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}
.scramble-canvas,
.gilbert-img {
  max-width: 100%;
  max-height: 480px;
  border-radius: var(--r-md);
  background: var(--bg-sunk);
  box-shadow: var(--shadow-glass);
}
.gilbert-img {
  width: 100%;
  object-fit: contain;
}
.scramble-status__text {
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.6;
}
.scramble-status__text.is-error {
  color: #dc2626;
}
#scramble-drop.is-drag {
  outline: 2px dashed var(--brand-bg);
  outline-offset: 4px;
  background: var(--bg-sunk);
}

/* ---------- AI 抠图（去背景） ---------- */
.bg-checker {
  background-image: repeating-conic-gradient(#d9d6ce 0% 25%, #efece5 0% 50%);
  background-size: 20px 20px;
}
[data-theme="dark"] .bg-checker {
  background-image: repeating-conic-gradient(#26262a 0% 25%, #2e2e33 0% 50%);
}
#removebg-preview {
  display: flex;
  align-items: center;
  justify-content: center;
}
.removebg-img {
  max-width: 100%;
  max-height: 480px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-glass);
}

/* ---------- 图片编辑（去水印 / 修复） ---------- */
.editor-stage {
  position: relative;
  width: 100%;
  background: var(--bg-glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-glass);
  padding: 12px;
  box-sizing: border-box;
}
#editor-display {
  display: block;
  width: 100%;
  height: auto;
  border-radius: calc(var(--r-xl) - 8px);
  background: var(--bg-sunk);
}
#editor-mask {
  position: absolute;
  inset: 12px;
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  touch-action: none;
  cursor: crosshair;
}

/* ---------- 图片格式转换 ---------- */
.convert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
}
.convert-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-elev);
}
.convert-item__thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--r-sm);
  background: var(--bg-sunk);
  flex-shrink: 0;
}
.convert-item__info {
  flex: 1;
  min-width: 0;
}
.convert-item__name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.convert-item__meta {
  font-size: 12px;
  color: var(--ink-3);
}
.convert-item__result {
  font-size: 12px;
  color: var(--brand-ink);
  white-space: nowrap;
}
.convert-item__actions {
  display: flex;
  gap: 6px;
}
.convert-item__rm {
  padding: 0 10px;
  height: 32px;
}

/* ---------- 视频抽帧 ---------- */
.vframe-stage {
  background: var(--bg-glass);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-glass);
  padding: 12px;
}
#vframe-video {
  width: 100%;
  max-height: 420px;
  border-radius: calc(var(--r-xl) - 8px);
  background: #000;
  display: block;
}
.frame-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}
.frame-item {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-sunk);
}
.frame-item img {
  width: 100%;
  height: 64px;
  object-fit: cover;
  display: block;
}
.frame-item__cap {
  font-size: 11px;
  color: var(--ink-3);
  text-align: center;
  padding: 2px 0;
  font-family: var(--font-mono);
}
.frame-item__rm {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
/* ---------- 视频抽帧：帧操作与灯箱 ---------- */
.frame-item { cursor: pointer; }
.frame-item__actions {
  display: flex;
  gap: 4px;
  padding: 4px 4px 6px;
}
.frame-item__actions .btn {
  height: 26px;
  padding: 0 8px;
  font-size: 12px;
}
.frame-item__cut {
  flex: 1;
}
.frame-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
}
.frame-lightbox[hidden] { display: none; }
.frame-lightbox__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 92vw;
}
.frame-lightbox__img {
  max-width: 88vw;
  max-height: 80vh;
  border-radius: 10px;
  background: #111;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.frame-lightbox__cap {
  color: var(--ink-3);
  font-size: 13px;
  font-family: var(--font-mono);
}
.frame-lightbox__close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.frame-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 72px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 34px;
  cursor: pointer;
}
.frame-lightbox__nav:hover { background: rgba(255, 255, 255, 0.22); }
.frame-lightbox__prev { left: 16px; }
.frame-lightbox__next { right: 16px; }

/* ---------- 图片画质提升：处理前后对比 ---------- */
.compare {
  position: relative;
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-glass);
  padding: 12px;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.compare__stage {
  --pct: 50%;
  position: relative;
  width: 100%;
  line-height: 0;
  border-radius: calc(var(--r-xl) - 8px);
  overflow: hidden;
  cursor: ew-resize;
  touch-action: none;
}

/* 还没处理出结果时（只有一张预览图）分割线拖不动，光标也别提示可以拖 */
.compare__stage:not(.is-ready) {
  cursor: default;
}
.compare__img {
  width: 100%;
  display: block;
  pointer-events: none;
  user-select: none;
}
.compare__after {
  position: absolute;
  inset: 0;
  clip-path: inset(0 calc(100% - var(--pct, 50%)) 0 0);
}
.compare__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: 2;
}
.compare__handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
/* 对比标签与分割线：默认隐藏，只有处理完成后（.is-visible）才显示。
   这样即使 JS / 缓存版本不同步也不会在刚导入时露出来。 */
.compare__hud {
  display: none;
}
.compare__hud.is-visible {
  display: block;
}
.compare__hud[hidden] {
  display: none !important;
}
.compare__tag {
  position: absolute;
  top: 10px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
  line-height: 1.6;
  z-index: 3;
}
.compare__tag--before { right: 10px; }
.compare__tag--after { left: 10px; }
/* ---------- 视频抽帧：播放预览 / 抠图面板 ---------- */
.frame-item__img--cut {
  background-image: repeating-conic-gradient(#d9d6ce 0% 25%, #efece5 0% 50%);
  background-size: 12px 12px;
}
[data-theme="dark"] .frame-item__img--cut {
  background-image: repeating-conic-gradient(#26262a 0% 25%, #2e2e33 0% 50%);
}
.frame-play-btn {
  float: right;
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}
.frame-lightbox__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.frame-lightbox__controls .btn-group .btn {
  height: 30px;
  font-size: 12px;
  padding: 0 10px;
}
